Skip to content

fix: compare territory FIPS codes instead of abbreviations in dep_get_index#73

Merged
chris-prener merged 1 commit into
mainfrom
72-fix-territory-fips-validation
May 31, 2026
Merged

fix: compare territory FIPS codes instead of abbreviations in dep_get_index#73
chris-prener merged 1 commit into
mainfrom
72-fix-territory-fips-validation

Conversation

@chris-prener

Copy link
Copy Markdown
Collaborator

Summary

Fixes the territory validation bug in dep_get_index() where the guard clause compared FIPS codes (output of validate_state()) against abbreviation strings, causing the check to never match.

Implementation

  • Changed the territory comparison on line 181 from abbreviation strings ("AS", "GU", "MP", "PR", "VI") to FIPS codes ("60", "66", "69", "72", "78")
  • This aligns with the existing dep_territory_fips() helper convention in dep_get_data.R

Testing

  • Un-skipped the previously-disabled territory validation test
  • Expanded test coverage to all 5 territories × 2 input formats (abbreviation + FIPS) = 10 assertions
  • All 31 tests in test_dep_get_index.R pass

Closes

Closes #72

Notes

Single-line logic fix; no API or behavioral changes beyond correcting the broken validation path.

…_index

validate_state() converts abbreviations to FIPS before the territory
check runs. The check now compares against FIPS codes (60, 66, 69, 72,
78) so it catches both abbreviation and raw FIPS input.

Un-skips and expands the territory validation test to cover all five
territories by both input formats.

Closes #72

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chris-prener chris-prener merged commit bb51d10 into main May 31, 2026
7 checks passed
@chris-prener chris-prener deleted the 72-fix-territory-fips-validation branch June 2, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Territory validation in dep_get_index compares FIPS codes against abbreviations

1 participant