Skip to content

feat(profile): insurance number by country - #1660

Merged
MBombeck merged 1 commit into
release/v1.50.0from
feat/150-insurance-number-at
Nov 28, 2026
Merged

MBombeck merged 1 commit into
release/v1.50.0from
feat/150-insurance-number-at

Conversation

@MBombeck

Copy link
Copy Markdown
Owner

The insurance number on the profile follows a country now, not only the German KVNR.

  • insuranceNumberCountry (ISO 3166-1 alpha-2, nullable; a number stored without one stays DE) and insuranceGroupNumber (US only) on the profile read and write, /api/auth/me and the backup. Migration 0577 adds both columns, nullable, no backfill.
  • One rule module, src/lib/validations/insurance-number.ts: DE KVNR, AT SVNR, CH AHV number, NL BSN and FR NIR by check digit; every other country 3 to 30 letters, digits, spaces, hyphens or dots, as entered. Tests cover valid and invalid numbers for each.
  • applyProfileUpdate checks the number under the country sent with it, else the stored one, and refuses a country change the stored number would fail. Refusals carry invalid_kvnr, invalid_svnr, invalid_ahv, invalid_bsn, invalid_nir or invalid_member_id, worded per rule in all ten locales.
  • FHIR: Patient identifier under the national system (gematik KVNR, Austrian svnr-eHealth OID 1.2.40.0.10.1.4.3.1, CH AHVN13 urn:oid:2.16.756.5.32, Nictiz BSN, INS-NIR urn:oid:1.2.250.1.213.1.4.8), otherwise type MB with no system; the group number goes on Coverage.class (group).
  • The doctor's report and the form show the number in its country's form. The form puts the country select next to the number and shows the group number only for the US.
  • Feature key profile.insurance-number-country; OpenAPI regenerated.

Refs #1658

The insurance number followed one rule, the German KVNR, so an Austrian
social insurance number or a US member ID was refused. The number now
follows a country, any ISO 3166-1 alpha-2 code, stored beside it
(insuranceNumberCountry; a number stored without one stays German).

One module, src/lib/validations/insurance-number.ts, holds the rule:
DE KVNR, AT SVNR, CH AHV number, NL BSN and FR NIR are checked by their
check digit; every other country takes 3 to 30 letters, digits, spaces,
hyphens or dots as entered. A US plan carries its group number
(insuranceGroupNumber), cleared for every other country.

The profile update checks the number under the country sent with it, or
the stored one, and refuses a country change the stored number would
fail; each refusal carries a per-rule code the form words in every
language. The doctor's report prints the number in its country's form.
The FHIR Patient identifier uses the national system where one is
published (gematik KVNR, Austrian svnr-eHealth OID, CH AHVN13, Nictiz
BSN, French INS-NIR), otherwise type MB with no system, and the group
number rides Coverage.class.

Additive on the profile read and write, feature key
profile.insurance-number-country. Migration 0577 adds the two nullable
columns; backup, wipe and the account seed carry them.

Refs #1658
@MBombeck
MBombeck merged commit cd06947 into release/v1.50.0 Nov 28, 2026
40 checks passed
@MBombeck
MBombeck deleted the feat/150-insurance-number-at branch December 1, 2026 09:12
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