Using OID URNs with the FhirValidator in HAPI

Hello Implementers,

My organization uses internal OIDs to identify code systems and we use FHIR to communicate between different projects in the organization. While I know that OIDs are not preferred in FHIR, it seems that they are not illegal to be used for code system URNs, so we use them because it is only internally that we use them. It says in the FHIR documentation for the Coding datatype that:

Resolvable URLs are generally preferred by implementers over non-resolvable URNs, particularly opaque URNs such as OIDs (urn:oid:) or UUIDs (urn:uuid:).

But it does not say that they must be resolvable URLs.

However, when I tried to validate the FHIR compliance with HAPI, I got this error:

SingleValidationMessage[
    col=3776,
    row=1,
    locationString=Bundle.entry[3].resource.extension[0].value.ofType(CodeableConcept).coding[0],
    message=Coding.system must be an absolute reference, not a local reference,
    severity=error
]

for a JSON string such as this:

            "code": {
              "coding": [
                {
                  "code": "10567",
                  "system": "urn:oid:2.12.242.1.463981.3.41",
                  "display": "Findings"
                }
              ]
            }

Why do I get this error when it seems that OIDs are allowed, though discouraged? How do I check validation without reworking the entire way my organization identifies code systems?

Please note that this wasn’t an issue before when I was using HAPI version 3.2.0, but I’ve updated to a newer version, and now it is marking this as an error when it wasn’t before…

Thank you!

what newer version? The current version should not flag that as an error

I updated HAPI from version 3.2.0 to version 4.2.0 (there are other reasons why I prefer not to update to version 5 yet). I’m still using FHIR DSTU3.

I guess you’l have to update the code manually isAbsolute currently looks like this:

  private boolean isAbsolute(String uri) {
    return Utilities.noString(uri) || uri.startsWith("http:") || uri.startsWith("https:") || uri.startsWith("urn:uuid:") || uri.startsWith("urn:oid:") || uri.startsWith("urn:ietf:")
      || uri.startsWith("urn:iso:") || uri.startsWith("urn:iso-astm:") || uri.startsWith("mailto:")|| isValidFHIRUrn(uri);
  }

Thank you! This helped me debug the issue because I was able to add a break point at that line in InstanceValidator. Turns out there actually was a Coding that I had missed which had serialized the URN as “2.12.242.1.463981.3.41” instead of “urn:oid:2.12.242.1.463981.3.41”.