Skip to content

Guard against real clinic codes in identifiers; add CODESTYLE.md - #29

Merged
pmayd merged 1 commit into
devfrom
chore/codestyle-and-id-check
Oct 27, 2026
Merged

pmayd merged 1 commit into
devfrom
chore/codestyle-and-id-check

Conversation

@pmayd

@pmayd pmayd commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

What

  • New guard test tests/test_no_real_patient_identifiers.py: fails when any tracked file contains a patient identifier whose country and clinic code together match a clinic in reference_data/clinic_data.xlsx. Matches underscore and hyphen separators and any casing. Reference data itself is exempt.
  • One leftover fixed: the rebuild-findings test fixture still carried an identifier with a real clinic code; replaced with a stand-in (country kept, clinic replaced), the same scheme as the 2026-09-01 history rewrite.
  • CODESTYLE.md (new): review standards. First rule: when several source spellings map to one concept, declare one canonical name with its aliases (as the synonym YAMLs do); never let list order pick the winner, and raise on an ambiguity the config cannot resolve.
  • CLAUDE.md: names dev as the trunk (it still said migration) and points to CODESTYLE.md.

Why

The repository is public. Patient identifiers are pseudonymous, but anyone holding a clinic's patient list can resolve them. The history rewrite removed the real ones; this test keeps them from coming back. It matches on the country and clinic pair, not the clinic code alone, because two real clinic codes start with Q, the letter the stand-ins use.

Limit: identifiers built at runtime from a format string are invisible to the check; review still has to catch those.

Verification

  • The new test fails on the unfixed fixture (reports the one leftover) and passes after the fix.
  • just lint, just format-check, just check: pass.
  • just test: 1401 passed, 1 skipped.

A test now fails when a tracked file holds a patient identifier whose
country and clinic code match the clinic reference file. It found one
leftover in the rebuild-findings fixture, replaced with a stand-in.
CODESTYLE.md records the explicit-canonical-config rule for review, and
CLAUDE.md names dev as the trunk.
@pmayd
pmayd merged commit e6b28e9 into dev Oct 27, 2026
2 checks passed
@pmayd
pmayd deleted the chore/codestyle-and-id-check branch October 27, 2026 10:27
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.

1 participant