FHIR Chat · HAPI Warning for unresolvable URIs and identifier type codes · hapi

Stream: hapi

Topic: HAPI Warning for unresolvable URIs and identifier type codes


view this post on Zulip frank cao (Aug 13 2019 at 15:33):

Hi, I'm using the validator to validate my resource instance (https://simplifier.net/provincialclientregistry-ontario-stu3/patient-example) against the STU3 patient profile at https://simplifier.net/ProvincialClientRegistry-Ontario-STU3/pcr-patient-response. I'm getting some warnings and error regarding some of the fields, I wonder if someone can help me troubleshoot.

1. In my example, I have meta.profile that points to the canonical URL of the profile. The URI is not resolvable at this point and validator throws a warning "StructureDefinition reference could not be resolved". Can we safely ignore this warning?
<meta>
<profile value="http://ehealthontario.ca/fhir/StructureDefinition/pcr-patient-response|2.0.0" />
2. In Patient.identifier, we use a customized valueset for identier.type.code which includes codes from such as "JHN" for Ontario health card number. Validator throws a warning as follows. I'm not sure if this is a bug as it's permissable to use other codes since the binding is extensible. Can we ignore this warning or is this a bug?
None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type, and a code should come from this value set unless it has no suitable code) (codes = http://hl7.org/fhir/v2/0203#JHN

3. For patient.language, validator throws an error if we use three letter code from ISO639-3 as opposed to two letter codes. My understanding is that BCP47 allows both code systems and three letter codes should be allowed. What should we do in this case?
Thank you!!

Fang Cao

view this post on Zulip David Hay (Aug 13 2019 at 17:55):

#1 - if the validator can't find the profile, then the instance won't be validated - sure you can ignore it, provided you accept that. I've been using the hapi server to validate (using $validate) , and making sure the profile SD is on the server, which seems to work for me...
#2 - that does sound like an informational message - what's the severity?
#3 - not sure of this one...

view this post on Zulip Grahame Grieve (Aug 13 2019 at 21:38):

#1 - given that http://ehealthontario.ca/fhir/StructureDefinition/pcr-patient-response is not resolvable, it's not a surprise that the validator can't resolve it. You have to download it yourself however that should be done, and include it in the parameters using an -ig parameter

#2 - the validator can't determine whether your custom codes are valid or not. So it notes that fact for human review - but it's not an error

#3 - The validator should be accepting 3 letter language codes registered with IANA. What is the code that you are using?

view this post on Zulip frank cao (Aug 14 2019 at 16:05):

To clarify, I'm not using the $validate operation, instead we use the HAPI validator jar file to provide structure defintions locally. We run the command "java -jar fhirvalidator.jar <fhir-structure-defintion-package.zip> <resource-example.json>" and we get message like this:

Location = Patient.meta.profile[0], Message = StructureDefinition reference "http://ehealthontario.ca/fhir/StructureDefinition/pcr-patient-response|2.0.0" could not be resolved, Severity = WARNING

Question: Is this an acceptable approach to validate locally, or will HAPI validator always try to resolve the profile URI?

Regarding the language code error, HAPI fails if we use "fra" for French, but it will accept "fr". In our profile, we constrained it to only use three letter codes. If bcp47 requires two letters only for the applicable languages, do we have to manually fix those languages? The challenge is that we have over 8000 codes in our language valueset, and would be difficult to fix manually.

view this post on Zulip Grahame Grieve (Aug 14 2019 at 20:33):

looks like you're missing a -ig:

java -jar fhirvalidator.jar -ig <fhir-structure-defintion-package.zip> <resource-example.json>

view this post on Zulip Grahame Grieve (Aug 14 2019 at 20:33):

I do not see fra listed in the IANA language registry

view this post on Zulip Patrick Werner (Aug 15 2019 at 11:19):

I do not see fra listed in the IANA language registry

isn't IANA two letter only?

view this post on Zulip Grahame Grieve (Aug 15 2019 at 11:20):

no it has 3 letter codes too. But not fra

view this post on Zulip frank cao (Aug 15 2019 at 14:20):

looks like you're missing a -ig:

java -jar fhirvalidator.jar -ig <fhir-structure-defintion-package.zip> <resource-example.json>

I'm using the HAPI validator, and it doesn't seem to accept the -ig flag. Are you referring to the native FHIR validator?

view this post on Zulip frank cao (Aug 15 2019 at 14:24):

no it has 3 letter codes too. But not fra

Interesting, so does that mean FHIR requires the use of these values only? If so, is there a FHIR valueset of this somewhere? We would like to provide the valueset on Simplifier.

view this post on Zulip James Agnew (Aug 15 2019 at 14:29):

Sorry- what are you doing exactly? If you're using HAPI's FhirInstanceValidator module I'm surprised it is accepting any BCP47 codes at all- we haven't implemented BCP47 yet in HAPI's term svcs.

view this post on Zulip frank cao (Aug 15 2019 at 14:43):

I'm actually helping a developer to resolve FHIR errors so I may not have the proper info. The developer wrote a wrapper that can validate a resource example against custom profiles. It has a lib folder that i have provided the screenshots below. I assume the HAPI validator jar file is being used for the validation.

pasted image

view this post on Zulip frank cao (Aug 15 2019 at 16:49):

James, we are using the FhirInstanceValidator class. Below is the code that creates the class according to the developer:

private static FhirInstanceValidator createFhirInstanceValidator(String fileName) throws ResourceException {
        RegistryValidationSupport registryValidationSupport = RegistryValidationSupport.fromFile(fileName);
        ValidationSupportChain validationSupportChain = new ValidationSupportChain(new DefaultProfileValidationSupport(), registryValidationSupport);

        FhirInstanceValidator fhirInstanceValidator = new FhirInstanceValidator();
        fhirInstanceValidator.setValidationSupport(validationSupportChain);

        return fhirInstanceValidator;
    }

This is the validator error message for patient language

Location = Patient.communication.language, Message = None of the codes provided are in the maximum value set http://hl7.org/fhir/ValueSet/all-languages (http://hl7.org/fhir/ValueSet/all-languages, and a code from this value set is required) (codes = urn:ietf:bcp:47#aaa), Severity = ERROR

view this post on Zulip Grahame Grieve (Aug 15 2019 at 18:52):

I assumed tx.fhir.org was being used for the language validation, but apparently not.... it's very hard for for me to help when people use the validator through HAPI because I don't know how it's configured

view this post on Zulip frank cao (Aug 15 2019 at 19:37):

I assumed tx.fhir.org was being used for the language validation, but apparently not.... it's very hard for for me to help when people use the validator through HAPI because I don't know how it's configured

Thanks for the help Grahame. Regarding the patient communication language valueset, is FHIR required to follow the "must use 2 letter code when you can, only use 3 letter code when two letter does not exist" rule? I think the lack of explanation of that rule may be confusing for implementers if they have to read the bcp47 documentation.

view this post on Zulip James Agnew (Aug 15 2019 at 19:39):

RegistryValidatorSupport isn't a HAPI FHIR class either- is that something you guys wrote?

I would kind of echo Grahame's point here. It's hard to troubleshoot problems without any knowledge of what you're actually using. My recommendation would be to switch to the validator CLI tool and see if you can replicate this with that. If you have the same issues with that tool, the troubleshooting steps would be very different from if you only see this through HAPI's infrastructure.

view this post on Zulip Grahame Grieve (Aug 15 2019 at 19:41):

is FHIR required to follow the "must use 2 letter code when you can, only use 3 letter code when two letter does not exist"

The FHIR binding for Maximum Value set - the absolute limit on allowable codes is toBCP-47. My read of BCP-47 is that it is clear: you SHALL only use language codes found in the IANA registry. Accordingly, the validator is validating on the IANA registry.

view this post on Zulip frank cao (Aug 15 2019 at 20:15):

is FHIR required to follow the "must use 2 letter code when you can, only use 3 letter code when two letter does not exist"

The FHIR binding for Maximum Value set - the absolute limit on allowable codes is toBCP-47. My read of BCP-47 is that it is clear: you SHALL only use language codes found in the IANA registry. Accordingly, the validator is validating on the IANA registry.

Thank you.

view this post on Zulip frank cao (Aug 16 2019 at 18:05):

RegistryValidatorSupport isn't a HAPI FHIR class either- is that something you guys wrote?

I would kind of echo Grahame's point here. It's hard to troubleshoot problems without any knowledge of what you're actually using. My recommendation would be to switch to the validator CLI tool and see if you can replicate this with that. If you have the same issues with that tool, the troubleshooting steps would be very different from if you only see this through HAPI's infrastructure.

Hi James, I followed your recommendation and the CLI reports the error in the profile regarding SliceName. Not sure why as we have proper strings with dash. Any ideas?

Issue 1: ERROR - StructureDefinition
         [error] in
         /*:StructureDefinition[namespace-uri()='http://hl7.org/fhir'][1]/*:snap
         shot[namespace-uri()='http://hl7.org/fhir'][1]/*:element[namespace-uri(
         )='http://hl7.org/fhir'][34] @ StructureDefinition eld-16: sliceName
         must be a proper token Test=not(exists(f:sliceName/@value)) or
         matches(f:sliceName/@value, '^[a-zA-Z0-9\\-\\_]+$')

view this post on Zulip Grahame Grieve (Aug 16 2019 at 20:10):

That's a weird error message. I maintain the vlaidator, but I don't see where this bit comes from: [namespace-uri()='http://hl7.org/fhir']

view this post on Zulip Grahame Grieve (Aug 16 2019 at 20:10):

what does the slicename it indicates hold?

view this post on Zulip frank cao (Aug 26 2019 at 19:08):

Sorry for the late reply. It turns out the error is actually "unable to resolve discriminator" on patient.name.given where we used ISO21090 extension for middle name. Below is our slicing definition, could you point me where it's wrong?

"id": "Patient.name.given",
        "path": "Patient.name.given",
        "slicing": {
          "discriminator": [
            {
              "type": "exists",
              "path": "extension('http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier')"
            }
          ],
          "description": "by extension('http://hl7.org/fhir/StructureDefinition/iso21090-EN-qualifier')",
          "rules": "open"
        },

view this post on Zulip frank cao (Sep 05 2019 at 15:57):

I figured out the cause of "unable to resolve discriminator" error. Because the discriminator is exists(extension), I need to specify the extension on the slice that doesn't use the extension (i.e. making it 0..0).


Last updated: Apr 12 2022 at 19:14 UTC