hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

Valid OMB Race Code "2028-9" Flagged as Invalid by HAPI FHIR Validator 7.4.0 #6348

Open Shreeja-dev opened 1 month ago

Shreeja-dev commented 1 month ago

While validating a Bundle payload using the HAPI FHIR 7.4.0 validator, we encountered an error when providing a valid value for race. Specifically, the value "Asian" with code "2028-9" was reported as invalid, despite being part of the OMB Race Categories value set.

We are using Java 21 and HAPI FHIR validator 7.4.0. We are validating using packages as outlined in the documentation (HAPI FHIR Instance Validator Documentation - Section 14.2.5).

To Reproduce Steps to reproduce the behavior:

  1. Create a FHIR patient profile with race:

    {
        "extension": [
            {
                "url": "ombCategory",
                "valueCoding": {
                    "system": "urn:oid:2.16.840.1.113883.6.238",
                    "code": "2028-9",
                    "display": "Asian"
                }
            },
            {
                "url": "text",
                "valueString": "Asian"
            }
        ],
        "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
    }
  2. Validate the Bundle using the HAPI FHIR validator with the below package above,(using NpmPackageValidationSupport)

    We have added the following packages to our classpath :

  3. Observe the following error message:

    {
        "extension": [
            {
                "url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line",
                "valueInteger": 1
            },
            {
                "url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col",
                "valueInteger": 5201
            },
            {
                "url": "http://hl7.org/fhir/StructureDefinition/operationoutcome-message-id",
                "valueString": "Terminology_TX_NoValid_12"
            }
        ],
        "severity": "error",
        "code": "processing",
        "details": {
            "coding": [
                {
                    "system": "http://hl7.org/fhir/java-core-messageId",
                    "code": "Terminology_TX_NoValid_12"
                }
            ]
        },
        "diagnostics": "The Coding provided (urn:oid:2.16.840.1.113883.6.238#2028-9) was not found in the value set 'OMB Race Categories' ([http://hl7.org/fhir/us/core/ValueSet/omb-race-category|7.0.0](http://hl7.org/fhir/us/core/ValueSet/omb-race-category%7C7.0.0)), and a code is required from this value set.  (error message = Unknown code 'urn:oid:2.16.840.1.113883.6.238#2028-9' for in-memory expansion of ValueSet 'http://hl7.org/fhir/us/core/ValueSet/omb-race-category')",
        "location": [
            "Bundle.entry[0].resource/*Patient/PatientExample*/.extension[0].extension[0].value.ofType(Coding)",
            "Line[1] Col[5201]"
        ]
    }

Expected behavior The code "2028-9" with the display "Asian" should be recognized as valid according to the OMB Race Categories value set, and the validator should not return an error for this valid entry.

Additional context We have also tried validating through the Instance Validator approach as mentioned in the HAPI FHIR Documentation (Validation Support Modules - Section 14.3.14). It gives the same error.

Could you please investigate and provide suggestion for why the code "2028-9" is being flagged as invalid despite being a recognized value.