Feat/hts ig text patterns#103
Merged
Merged
Conversation
…o value
Add HtsError::VsInvalid distinct from InvalidRequest so the FHIR issue code
stays `invalid` (HTTP 400) but the tx-issue-type coding becomes `vs-invalid`,
matching the HL7 tx-ecosystem `errors/broken-filter-{expand,validate}`
fixtures (3 IG tests).
The validation runs at the top of `apply_compose_filters`: every
ValueSet.compose.include.filter[] entry must carry a non-empty `value`.
When missing, return a VsInvalid error with the IG-spec text
"The system <url> filter with property = <p>, op = <o> has no value".
Triggered identically by both `$expand` and `$validate-code` on the
broken-filter ValueSet, since both go through `apply_compose_filters`
during expansion.
The HL7 IG `deprecated/expand-*` fixtures (8 IG tests) require:
1. One `used-codesystem` parameter per distinct contributing CodeSystem,
formatted as `<url>|<version>` — restored after the perf revert that
removed it.
2. A parallel `warning-<status>` entry whenever the source ValueSet or a
contributing CodeSystem carries one of:
* `extension[].url == structuredefinition-standards-status` with
`valueCode` of `deprecated`, `withdrawn`, `draft`, etc.
* `experimental: true` → `warning-experimental`
* `status: "draft"` → `warning-draft`
A new `standards_statuses()` helper centralises the rule application and
deduplicates when multiple markers point at the same status code.
Performance impact: one CodeSystem search per distinct contributing system
on the cache-miss path. Hot-path requests are still served from
`state.expand_cache` (pre-serialised bytes), so repeated identical
$expand calls pay the cost only once.
…yLanguage swap
The HL7 IG `language/expand-xform-*` fixtures (8 IG tests) plus a
follow-on set of `display/validation-*` fixtures expect a richer
displayLanguage swap shape:
* The matching-language designation value is promoted to top-level
`display` (existing behavior).
* The original CodeSystem-language display becomes a designation
`{language: <cs-lang>, use: {system, code: preferredForLanguage}, value: <orig>}`.
* The duplicate matched designation is removed from the designation list.
Also handle the Accept-Language style "hard fallback" form
`displayLanguage=de,*; q=0`: when no matching designation exists and the
caller forbids fallback (q=0 on the wildcard), drop top-level `display`
entirely — but still surface the original CS-default display as a
preferredForLanguage designation so consumers can recover it.
Implementation:
* `parse_display_language()` parses the request value into a
`DisplayLangSpec { preferred, hard_fallback }`.
* Designation lookup uses BCP 47 / RFC 4647 prefix matching, so a
request for `de` matches stored `de-CH` designations.
* A single per-system CodeSystem search now drives THREE downstream
blocks (displayLanguage swap, used-codesystem emission, and
warning-<status> emission) via a shared `cs_by_url` map — net zero
extra SQL on the cache-miss path.
smunini
added a commit
that referenced
this pull request
May 5, 2026
Resolved conflicts in crates/hts/src/operations/expand.rs: - Combined HEAD's displayLanguage/parse_display_language code with the supplements branch's apply_supplement_designations and apply_supplement_properties helpers. - Re-added populate_concept_flags helper (referenced by the supplements branch but missing from the merged base after #102 + #103 reordering — restored from supplements branch source). - Kept HEAD's source-VS warning-* expansion.parameter loop AND appended supplements branch's used-supplement entries (both emit distinct parameter names, no overlap). - Closed parse_display_language_only_wildcard_returns_none test fn that the conflict cut mid-body, then preserved both test groups (parse_display_language + useSupplement).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.