Skip to content

[APP-770] Filter inactive counties from county options dropdown#3366

Open
nullflux wants to merge 2 commits into
mainfrom
aw/APP-770-inactive-counties
Open

[APP-770] Filter inactive counties from county options dropdown#3366
nullflux wants to merge 2 commits into
mainfrom
aw/APP-770-inactive-counties

Conversation

@nullflux

@nullflux nullflux commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

The NBS 7 patient address County dropdown (Add Patient → Address, plus its autocomplete) listed outdated and duplicate counties. Reported by Alaska via NBS Central SEER #18441; expected behavior is active counties only.

Root cause

The county option queries read NBS_SRTE..state_county_code_value with no active-status predicate:

  • CountiesListFinder (GET /nbs/api/options/counties/{state}, the dropdown)
  • CountyOptionResolver (county autocomplete)

Every other SRTE-backed option finder in options-api (jurisdiction, condition, primary language, occupation, program area) filters status_cd = 'A'. These two county finders were the only exceptions, so retired/renamed county codes and their old-vs-new duplicates rendered

Change

Add status_cd = 'A' to both county finders, matching the sibling finders.

Test plan

Red-fix-green on the options-api @EmbeddedNbsDatabase Cucumber harness (real SQL Server Testcontainer):

  • Two new CountiesOptions.feature scenarios assert an inactive county is excluded from the list and from autocomplete.
  • CountyMother now stamps status_cd and can seed inactive counties.
  • RED (before the finder change): 2 failures. GREEN (after): 76/76 pass.

Follow-up

Not yet confirmed against live AK SRTE data whether the outdated counties are flagged via status_cd or via effective_to_time (with status_cd still A). If the latter, both finders also need (effective_to_time is null or effective_to_time > getdate()). Repro SQL is on SEER #18441 for the state to confirm.

The NBS 7 patient address County dropdown (Add Patient -> Address, and
its autocomplete) listed outdated and duplicate counties because the two
county option queries selected from NBS_SRTE..state_county_code_value
without an active-status predicate. Every other SRTE-backed option finder
in options-api (jurisdiction, condition, language, occupation, program
area) filters status_cd = 'A'; the county list finder and the county
autocomplete resolver were the lone exceptions.

Add status_cd = 'A' to CountiesListFinder and CountyOptionResolver so
retired county codes are excluded, matching the sibling finders.

Adds CountiesOptions scenarios covering an inactive county for both the
list and autocomplete paths; CountyMother now stamps status_cd and can
seed inactive counties.

SEER #18441
@nullflux nullflux requested a review from a team as a code owner June 24, 2026 20:28
@nullflux nullflux requested review from JordanGuinn and brick-green and removed request for a team June 24, 2026 20:28

@brick-green brick-green left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no notes 🥇

@JordanGuinn JordanGuinn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much appreciated 👏 🚀

@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants