Add core encounter processing pipeline
Filter by game version, parse levels and rate variants across all generations, aggregate encounters by pokemon+method, and build parent/child route hierarchy. Also completes encounter method coverage (73/73) and pokemon form mapping (1180/1181) with manual overrides. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ from pathlib import Path
|
||||
|
||||
from .loader import load_pokedb_data, load_seed_config
|
||||
from .mappings import PokemonMapper, LocationMapper, build_version_map, map_encounter_method
|
||||
from .processing import filter_encounters_for_game, process_encounters, build_routes
|
||||
|
||||
SEEDS_DIR_CANDIDATES = [
|
||||
Path("backend/src/app/seeds"), # from repo root
|
||||
@@ -141,8 +142,47 @@ def main(argv: list[str] | None = None) -> None:
|
||||
|
||||
pokemon_mapper.report_unmapped()
|
||||
|
||||
# TODO: Processing pipeline (subtasks rfg0, gkcy)
|
||||
print("\nMappings built. Processing pipeline not yet implemented.")
|
||||
# Process encounters per game
|
||||
print("\nProcessing encounters...")
|
||||
|
||||
games_to_process: list[tuple[str, str, int]] = [] # (vg_key, game_slug, generation)
|
||||
for vg_key, vg_info in config.version_groups.items():
|
||||
generation = vg_info.get("generation", 0)
|
||||
for slug in vg_info.get("versions", []):
|
||||
if target_game and slug != target_game:
|
||||
continue
|
||||
games_to_process.append((vg_key, slug, generation))
|
||||
|
||||
for vg_key, game_slug, generation in games_to_process:
|
||||
print(f"\n--- {game_slug} ---")
|
||||
|
||||
# Filter encounters for this game
|
||||
game_encounters = filter_encounters_for_game(pokedb.encounters, game_slug)
|
||||
if not game_encounters:
|
||||
print(f" No encounters found in PokeDB data")
|
||||
continue
|
||||
|
||||
print(f" Raw encounters: {len(game_encounters)}")
|
||||
|
||||
# Process into grouped encounters
|
||||
encounters_by_area = process_encounters(
|
||||
game_encounters, generation, pokemon_mapper, location_mapper,
|
||||
)
|
||||
print(f" Location areas with encounters: {len(encounters_by_area)}")
|
||||
|
||||
# Build route hierarchy
|
||||
routes = build_routes(encounters_by_area, location_mapper)
|
||||
|
||||
# Stats
|
||||
total_routes = sum(1 + len(r.children) for r in routes)
|
||||
total_enc = sum(
|
||||
len(r.encounters) + sum(len(c.encounters) for c in r.children)
|
||||
for r in routes
|
||||
)
|
||||
print(f" Routes: {total_routes}")
|
||||
print(f" Encounter entries: {total_enc}")
|
||||
|
||||
print("\nProcessing complete. Output not yet written (subtask gkcy).")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user