Skip to content

Fix column indices when building MoveChange from move_changelog.csv - #1669

Merged
Naramsim merged 1 commit into
PokeAPI:masterfrom
santichausis:fix/move-changelog-column-indices
Sep 8, 2026
Merged

Fix column indices when building MoveChange from move_changelog.csv#1669
Naramsim merged 1 commit into
PokeAPI:masterfrom
santichausis:fix/move-changelog-column-indices

Conversation

@santichausis

Copy link
Copy Markdown
Contributor

Fixes #1663.

Problem

move_changelog.csv columns are:

move_id,changed_in_version_group_id,type_id,power,pp,accuracy,priority,target_id,effect_id,effect_chance

The build script's csv_record_to_objects for MoveChange read info[6]/info[7] (priority/target_id — neither of which MoveChange even has a field for) as effect_id/effect_chance, instead of the actual info[8]/info[9] columns.

This both dropped real effect changes and fabricated bogus ones from unrelated numeric values, e.g.:

  • Double-Edge (move 38): CSV row is 38,3,,100,,,,,49, — real effect_id is 49 (recoil), but the old code read info[6] (empty priority) → the recoil effect at gold-silver was silently dropped.
  • Follow Me (move 266): CSV row is 266,15,,,,,3,,,effect_id is actually empty, but the old code read info[6] (priority = 3) → it fabricated move_effect_id=3, which happens to be "Has a chance to poison the target," giving Follow Me a completely fictitious effect change.

Fix

Read info[8]/info[9] instead of info[6]/info[7].

Test plan

There's no existing test coverage for data/v2/build.py's CSV-import logic, so I verified against the real production CSV data:

  • Rebuilt the local sqlite DB from the CSVs with the fix applied.
  • MoveChange.objects.get(move_id=38, version_group_id=3).move_effect_id49 (recoil), previously None.
  • MoveChange.objects.get(move_id=266, version_group_id=15).move_effect_idNone, previously 3 (poison).
  • Confirmed via the live endpoints: GET /api/v2/move/double-edge/ now shows the recoil effect in past_values for gold-silver; GET /api/v2/move/follow-me/ no longer shows the fabricated poison effect.
  • manage.py test pokemon_v2 passes (60 tests).
  • pre-commit run --files data/v2/build.py passes (ruff check, ruff format, ty).

move_changelog.csv columns are:
move_id,changed_in_version_group_id,type_id,power,pp,accuracy,priority,
target_id,effect_id,effect_chance

The build script read info[6]/info[7] (priority/target_id, neither of
which MoveChange models) as effect_id/effect_chance instead of the
actual info[8]/info[9] columns. This dropped real effect changes (e.g.
Double-Edge's recoil effect at gold-silver) and fabricated bogus ones
from unrelated numeric values (e.g. Follow Me picked up a false
"chance to poison" effect from its priority value of 3, which
happens to be move_effect id 3).

Fixes PokeAPI#1663
@Naramsim
Naramsim merged commit d731964 into PokeAPI:master Sep 8, 2026
21 of 22 checks passed
@Naramsim

Naramsim commented Sep 8, 2026

Copy link
Copy Markdown
Member

Thanks a lot for coming back to this. There was an issue linked, am I right?

@pokeapi-machine-user

Copy link
Copy Markdown

A PokeAPI/api-data refresh has started. In ~45 minutes the staging branch of PokeAPI/api-data will be pushed with the new generated data.

The staging branch will be deployed in our staging environment and the entire API will be ready to review.

A Pull Request (master<-staging) will be also created at PokeAPI/api-data and assigned to the PokeAPI Core team to be reviewed. If approved and merged new data will soon be available worldwide at pokeapi.co.

@pokeapi-machine-user

Copy link
Copy Markdown

The updater script has finished its job and has now opened a Pull Request towards PokeAPI/api-data with the updated data.

The Pull Request can be seen deployed in our staging environment when CircleCI deploy will be finished (check the start time of the last build).

FallenDeity pushed a commit to PokeAPI/api-data that referenced this pull request Sep 8, 2026
@santichausis

Copy link
Copy Markdown
Contributor Author

Yep, fixes #1663 — linked in the PR description. Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move effect build order is incorrect

3 participants