FHIR Chat · Custom ValueSet missing from validation · hapi

Stream: hapi

Topic: Custom ValueSet missing from validation


view this post on Zulip Morten Ernebjerg (Feb 13 2020 at 20:26):

I am trying to implement validation of STU3 resources with custom profiles and values sets using HAPI 4.1, following the description in section 8.2.5 of the HAPI documentation of profile validation. I register my profile and the custom ValueSet it uses as described there, but when I run it against a valid example, it claims that the code is not in the valueset.

Debugging through, I see that valueset does get loaded and the custom validation support added to the support chain. But it seems the valueset is never fetched in ValidationSupportChain.validateCode(). For the PrePopulatedValidationSupport, isCodeSystemSupported() always returns false. Hence, the PrePopulation validation support is not applied for the code check and the result is that the validator gives an error stating that the the passed code is not in the required value-set (which it does identify correctly). Is there are issue here or am I missing something?

For reference, the value set in question is a restricted subset of the MIME-types, defining the codes via ValueSet.compose. It works fine when checked by the command-line Java validator.

view this post on Zulip Michael Lawley (Feb 13 2020 at 23:04):

Have you also added the underlying CodeSystem(s) the ValueSet uses?

view this post on Zulip Michael Lawley (Feb 13 2020 at 23:06):

MIME is one of those "special" code systems that are infinite and defined by a grammar. These usually have some kind of special-case support inside terminology servers, but this may not be correctly exposed in all code-paths. A common work-around is to added an explicit CodeSystem resource that includes as many as possible of the known-to-be-used codes

view this post on Zulip Morten Ernebjerg (Feb 14 2020 at 09:33):

Hi @Michael Lawley , good point! I tried it out, but although that also works fine with the command-line validator, I still get the same error from HAPI.

view this post on Zulip Morten Ernebjerg (Feb 14 2020 at 09:48):

It's not quite clear to me how validation against a valueset registered in a PrePopulatedValidationSupport instance works, given that that the latter always denies supporting the system, causing ValidationSupportChain.validateCode() to skip it. It also tried registering the PrePopulated validation support with the validation chain before the default one, but that caused an additional error of the same type for a code field with a required binding in the base resource definition (i.e. on the default validation support).

view this post on Zulip Morten Ernebjerg (Feb 14 2020 at 09:54):

Further context: The custom value-set is for a required binding on the code field DocumentReference.content.attachment.contentType. With the validation supports swapped in the chain, I also get an error on DocumentReference.status: The value provided ('current') is not in the value set http://hl7.org/fhir/ValueSet/document-reference-status (http://hl7.org/fhir/ValueSet/document-reference-status, and a code is required from this value set) (error message = Unknown code[current] in system[(none)]).

view this post on Zulip Morten Ernebjerg (Feb 18 2020 at 10:54):

Hi @James Agnew, might you have any pointers on this? (sorry to put this right on your desk...) I see the same problems with HAPI 4.2 (including the error for the standard docref status code) although I am doing essentially exactly what is done in the example in section 8.2.5 of the HAPI docs (cf. the above). It is independent of whether I use a custom CodeSystem or just use the standard (urn:ietf:bcp:13) for the MIME-type CodeSystem.


Last updated: Apr 12 2022 at 19:14 UTC