Skip to content

Add associated states (Marshall Islands, FSM, Palau) as ASSOCIATED_STATES#101

Open
jcarbaugh wants to merge 3 commits into
mainfrom
APR-34-add-associated-states
Open

Add associated states (Marshall Islands, FSM, Palau) as ASSOCIATED_STATES#101
jcarbaugh wants to merge 3 commits into
mainfrom
APR-34-add-associated-states

Conversation

@jcarbaugh
Copy link
Copy Markdown
Member

@jcarbaugh jcarbaugh commented May 21, 2026

Add entries for the three Compact of Free Association associated states — Federated States of Micronesia, Marshall Islands, and Palau — to a new top-level ASSOCIATED_STATES constant.

These are sovereign nations in free association with the United States, distinct from US states and territories. They get their own list rather than living in STATES_AND_TERRITORIES, and lookup() does not return them. A new is_associated boolean on State distinguishes them programmatically, matching the existing is_territory / is_obsolete pattern.

Closes #61 and #80

What's in the change

  • New State instances FM, MH, PW defined alphabetically by name in us/states.py, with USPS abbreviations and the historical Census FIPS 5-2 codes (64, 68, 70).
  • New ASSOCIATED_STATES: List[State] = [FM, MH, PW] next to OBSOLETE and TERRITORIES.
  • New is_associated: bool attribute on State, set explicitly on every state (True for the three new entries, False for everything else).
  • Re-exported ASSOCIATED_STATES from the us package.
  • Tests:
    • Extended test_attribute, test_valid_timezones, and test_jellyfish_metaphone to cover the associated states.
    • New test_associated_states_count, test_associated_states_not_in_states_and_territories, test_associated_states_lookup_returns_none, and test_associated_states_have_is_associated_flag.
  • CHANGELOG.md and README.md updated.

Why this shape

  • Not in STATES_AND_TERRITORIES: these jurisdictions are independent countries, so including them would silently change the meaning of every consumer that iterates that list (county totals, FIPS lookups, AP-style helpers).
  • lookup() deliberately ignores them: lookup only scans STATES_AND_TERRITORIES, so associated states are unreachable through it by design. The new test_associated_states_lookup_returns_none documents this so it can't regress silently.
  • is_associated flag instead of relying on list membership: consistent with is_territory and is_obsolete, which are also set explicitly on every State rather than derived from list membership.

Backwards compatibility

STATES, TERRITORIES, STATES_AND_TERRITORIES, and lookup() semantics are unchanged. Adding is_associated is additive.

Add entries for the three Compact of Free Association associated states
to a new top-level ASSOCIATED_STATES list. These are sovereign nations,
not US states or territories, so they are kept out of
STATES_AND_TERRITORIES and are not returned by lookup().

A new is_associated boolean on State distinguishes them programmatically,
matching the existing is_territory / is_obsolete pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jcarbaugh
Copy link
Copy Markdown
Member Author

Concise summary: adds Federated States of Micronesia, Marshall Islands, and Palau to a new ASSOCIATED_STATES list with a corresponding is_associated flag on State. Kept out of STATES_AND_TERRITORIES and lookup().

Things worth scrutinizing:

  1. FIPS codes 64/68/70 are historical. Census Bureau withdrew them after these jurisdictions gained sovereignty (1986/1994). They are still the canonical numeric identifiers in older US datasets. Alternative would be fips=None (mirroring OBSOLETE's pattern). Happy to switch if you prefer the stricter reading.
  2. The is_associated field is mechanically added to all 59 existing State definitions. Worth a glance at the bulk diff to confirm nothing was skipped. test_associated_states_have_is_associated_flag asserts every entry in STATES_AND_TERRITORIES + OBSOLETE has is_associated is False, so a miss would have failed CI.
  3. lookup() deliberately does not find associated states. test_associated_states_lookup_returns_none locks in this behavior. If we ever want them findable, that would be an opt-in similar to DC_STATEHOOD.
  4. Time zones for FSM. Three are used (Pacific/Chuuk, Pacific/Pohnpei, Pacific/Kosrae). Confirmed valid by the extended test_valid_timezones.
  5. enumeration() / mapping() are unchanged. They already accept arbitrary states iterables, so callers can pass us.ASSOCIATED_STATES explicitly. No code change needed.

@jcarbaugh jcarbaugh self-assigned this May 21, 2026
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.

Add Associated states

1 participant