Skip to content

fix(terminology): $validate-code pins one code system version before it checks the display #437

Description

@rubentalstra

When a value set includes two versions of the same code system, $validate-code
pins one of them before it checks the display, so a coding that is valid under
the other version fails.

http://hl7.org/fhir/test/ValueSet/overload-all of the terminology ecosystem
suite includes overload|1.0.0 and overload|2.0.0. In 1.0.0 code2 displays
"Display 2"; in 2.0.0 it displays "Display #2". A Coding of code2 with
"Display 2" and no version is a member of that value set through the 1.0.0
include, with the display that include's version states, so the answer is
result = true with version = 1.0.0. The server answers result = false with
version = 2.0.0 and an invalid-display issue.

R5 states the input as "A coding to validate. The system must match the
specified code system"
(tools/fhir-codegen/vendor/hl7.fhir.r5.core/package/OperationDefinition-ValueSet-validate-code.json),
and the version output as "The version of the system of the code that was
validated": the version reported is the one the code actually validated in, so
the choice among the versions a value set includes belongs to the validation,
not before it. crates/fhir-terminology/src/operations/value_set_validate_code.rs
already has containing_version, which picks the first version holding the
code; it needs to prefer a version that also accepts the asserted display, and
the same choice governs which version an exclude at another version removes.

Five general cases turn on this: overload/validate-good2a,
overload/validate-good-code2-v1display, overload/validate-bad-exclude-code1,
overload/validate-bad-v1code4, and overload/validate-bad-v2code3.

Acceptance criteria

  • When several versions a value set includes hold the code, the validation
    picks the one under which the coding is valid, and reports that version.
  • A test pins the choice, over a synthetic code system in two versions whose
    displays differ.
  • The five overload cases pass on /r4b, /r4, and /r5 and join the
    committed pass lists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal.bugA defect. Maps to a fix/ branch and a fix: commit.spec:FHIRFHIR terminology wire (operations, versioning, OperationOutcome).

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions