Skip to content

fix(hts): IG conformance — multilingual display wording, designation order, hierarchical $expand#154

Merged
smunini merged 2 commits into
mainfrom
fix/hts-conformance-multilingual-hierarchical
Jun 13, 2026
Merged

fix(hts): IG conformance — multilingual display wording, designation order, hierarchical $expand#154
smunini merged 2 commits into
mainfrom
fix/hts-conformance-multilingual-hierarchical

Conversation

@smunini

@smunini smunini commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Why

The nightly HTS Terminology IG Conformance job (run 27456608477) went red with no new commits to main. That workflow checks out HL7/fhir-tx-ecosystem-ig unpinned and downloads validator_cli.jar latest on every run, so the upstream commit 741e6e7 "add additional tests for language and secondary displays" (2026-06-12 05:43 UTC, between the green 06-12 and red 06-13 runs) is what turned it red.

It added 7 tests — 6 exercise PR #149's new multilingual code, 1 is a brand-new feature. Failures were identical across all 4 matrices (sqlite/postgres × R4/R5).

What

Multilingual display validation (validate_code.rs) — when a display is valid in the CodeSystem's default language but the requested displayLanguage has no designation, quote the supplied display and use "…which is a valid display for the default language".
Fixes validation-right-de-en, validation-right-de-ende-N, validation/simple-{code,coding,codeableconcept}-good-language-none.

Designation ordering (expand.rs apply_display_language) — front-insert the synthesised preferredForLanguage designation (the rotated primary display) instead of pushing it last. The HL7 validator sorts designations by language (stable), so a same-language explicit designation was beating it to designation[0].
Fixes language-xform-en-multi-de-hard.

Hierarchical-by-default \$expand (new feature) — when a request omits both excludeNested and hierarchical and the inline ValueSet wholly includes is-a CodeSystem(s) with real parent/child edges, return a nested expansion (tx.fhir.org behaviour). Adds the code_system_is_hierarchical trait method (sqlite + postgres). I audited the whole IG suite: this gate flips exactly vs-expand-versionless — the ~100 other excludeNested-omitting expand tests stay flat.
Fixes vs-expand-versionless.

Note: default-nesting is wired for inline valueSet composes (what the validator sends). URL-resolved ValueSets keep the flat default — correct for every current fixture, and documented inline as a scope boundary.

Testing

  • Reproduced each failure locally against the actual upstream fixtures, then confirmed each fix.
  • Full HTS sqlite suite green (607 lib + integration); postgres compiles; cargo fmt + clippy (sqlite & postgres, CI flags) clean.
  • Adds regression tests expand_is_a_codesystem_nests_by_default and expand_is_a_codesystem_flat_with_exclude_nested.

…order, hierarchical $expand

The nightly "HTS Terminology IG Conformance" job checks out
HL7/fhir-tx-ecosystem-ig unpinned and uses validator_cli.jar latest, so the
upstream commit 741e6e7 ("add additional tests for language and secondary
displays") turned main red with no local changes. It added 7 tests that
exercise PR #149's multilingual code plus one new feature.

Fixes (all 4 matrices: sqlite/postgres × R4/R5):

- validate_code: when a display is valid in the CodeSystem's default language
  but the requested displayLanguage has no designation, quote the *supplied*
  display and use "…which is a valid display for the default language"
  (NO_VALID_DISPLAY_FOUND_NONE_FOR_LANG_OK). Fixes validation-right-de-en,
  validation-right-de-ende-N, and validation/simple-{code,coding,
  codeableconcept}-good-language-none.

- expand/apply_display_language: front-insert the synthesised
  preferredForLanguage designation (rotated primary display) instead of
  pushing it last. The validator sorts designations by language (stable), so a
  same-language explicit designation otherwise beats it to designation[0].
  Fixes language-xform-en-multi-de-hard.

- expand: default to a hierarchical (nested) expansion when neither
  excludeNested nor hierarchical is specified and the inline ValueSet wholly
  includes is-a CodeSystem(s) with real parent/child edges. Adds the
  code_system_is_hierarchical trait method (sqlite + postgres). Gated so it
  flips only vs-expand-versionless across the whole IG suite — the ~100 other
  excludeNested-omitting expand tests stay flat.

Adds regression tests for nested-by-default vs excludeNested=true.
@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@smunini smunini merged commit 298c7d6 into main Jun 13, 2026
18 checks passed
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