2.9 KiB
2.9 KiB
title, status, type, priority, created_at, updated_at, parent
| title | status | type | priority | created_at | updated_at | parent |
|---|---|---|---|---|---|---|
| Add condition data to seed files via PokeDB merge | todo | task | normal | 2026-02-14T21:48:03Z | 2026-02-14T21:48:03Z | oqfo |
Problem
The PokeDB data already contains per-condition encounter rates (rate_morning, rate_day, rate_night, rate_spring, rate_summer, etc.), but the current importer in tools/import-pokedb flattens them to max() in extract_encounter_rate(). We need to preserve these as conditions dicts in the seed JSON files.
Re-running the full import would overwrite route names (normalized in bean r48e) and route ordering (refined in bean qvww), so we need a targeted merge approach.
Approach
Update the import tool to emit condition data, then merge it into existing seed files without touching route names or order.
Checklist
- Update
Encountermodel intools/import-pokedb/import_pokedb/models.pyto carry an optionalconditions: dict[str, int] | Nonefield - Update
extract_encounter_rateinprocessing.pyto return conditions alongside the flat rate (Gen 2/4 time-of-day, Gen 5 seasons, Gen 8 weather) - Update
aggregate_encountersinprocessing.pyto handle condition dicts (merge/sum per condition key) - Update
output.pyto emitconditionsdict in seed JSON when present, withencounter_rateset tonull - Write a merge script/mode that:
- Runs the PokeDB processing for a game to get condition-aware encounters
- Reads the existing seed JSON file (preserving route names, order, and structure)
- For each encounter in the existing file, looks up the condition data from PokeDB
- Adds the
conditionsdict where applicable, without changing anything else - Writes back to the same file
- Run the merge for Gen 2/4 games: gold, silver, crystal, heartgold, soulsilver, diamond, pearl, platinum, brilliant-diamond, shining-pearl
- Run the merge for Gen 5 games: black, white, black-2, white-2
- Run the merge for Gen 8 Sw/Sh: sword, shield
- Verify seed loader handles all new condition data correctly (re-seed and spot check)
- Remove the proof-of-concept manual conditions from heartgold.json Route 29 (replaced by real data)
Affected games by condition type
- morning/day/night: Gold, Silver, Crystal, HeartGold, SoulSilver, Diamond, Pearl, Platinum, Brilliant Diamond, Shining Pearl
- spring/summer/autumn/winter: Black, White, Black 2, White 2
- weather (clear, rain, thunderstorm, etc.): Sword, Shield
- No conditions (flat rates): Gen 1, Gen 3, Gen 6, Gen 7, Gen 9 — no changes needed
Key files
tools/import-pokedb/import_pokedb/processing.py—extract_encounter_rate()currently flattens withmax()tools/import-pokedb/import_pokedb/models.py—Encounterdataclasstools/import-pokedb/import_pokedb/output.py— seed JSON writerbackend/src/app/seeds/loader.py— already supportsconditionsdict expansion