Skip to content

Conversation

@JesperDramsch
Copy link
Owner

Fixes the recurring bug where "US" gets incorrectly expanded to "United States of America".

Problem

The codebase had 3 separate, conflicting country mapping definitions:

  • titles.py: CUSTOM_COUNTRY_MAPPINGS
  • import_python_organizers.py: COUNTRY_NAME_ALIASES
  • interactive_merge.py: replacements dict

Solution

Created utils/tidy_conf/countries.py as the single source of truth. All other modules now import from there.

Behavior

Input Conference Name Place Field CSV Country
US/USA PyCon US US USA
UK/GB PyCon UK UK GBR
DE PyCon Germany Germany DEU

Changes

  • New: utils/tidy_conf/countries.py - centralized mappings
  • New: tests/test_country_mappings.py - 28 regression tests
  • Modified: titles.py, interactive_merge.py, import_python_organizers.py - now import from central module

…merica bug

The codebase had three separate country mapping definitions that were
inconsistent and causing "US" to be incorrectly expanded to "United States
of America" instead of "United States".

Changes:
- Create utils/tidy_conf/countries.py as the single source of truth for all
  country-related mappings
- Update titles.py to import from centralized module
- Update interactive_merge.py to use COUNTRY_NORMALIZATION from centralized module
- Update import_python_organizers.py to import get_country_alpha3 from centralized module
- Add comprehensive tests in test_country_mappings.py

Key mappings now consistent:
- "US", "USA" -> "United States" (display name for conference titles)
- "United States of America", "USA" -> "US" (normalization for places)
- "US", "USA" -> "USA" (alpha-3 code for CSV output)
@github-actions github-actions bot added the Tests label Jan 23, 2026
Per user preference:
- "PyCon US" stays as "PyCon US" (not expanded)
- "PyCon UK" stays as "PyCon UK" (not expanded)
- "PyCon DE" becomes "PyCon Germany" (expanded)
- "PyCon PL" becomes "PyCon Poland" (expanded)

Updated COUNTRY_DISPLAY_NAMES to map US->US and UK->UK instead of
expanding to full country names.
@JesperDramsch JesperDramsch force-pushed the claude/fix-country-mapping-cO2Mq branch from 9f4a879 to b3c4700 Compare January 23, 2026 21:40
@JesperDramsch JesperDramsch merged commit 69e4b29 into main Jan 23, 2026
11 checks passed
@JesperDramsch JesperDramsch deleted the claude/fix-country-mapping-cO2Mq branch January 23, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants