Stream: hapi
Topic: FHIR Validation with custom implementation guide
Nicolai Mainiero (Sep 21 2021 at 11:04):
Hi, I'm struggling with validating a FHIR document in my service. I found ca.uhn.fhir.validation.FhirValidator
which seems to do the job, but I found no way to provide my custom implementation guides. On the other hand there is the ValidationEngine, where it is easy to provide additional implementation guides, but because of the many System.out
usage seems unsuited for a server application.
I'd like to do the validation without reaching out to another service, and ideally load the implementation guides from the classpath. Any advice how to implement the validation.
Patrick Werner (Sep 21 2021 at 17:46):
https://hapifhir.io/hapi-fhir/docs/validation/introduction.html and the following chapters are covering how to use the hapi validation stack. You can provide the resources of your IG through the PrePopulatedValidationSupport class.
Oliver Egger (Sep 21 2021 at 20:09):
@Nicolai Mainiero we preload ig's to a forked hapi-fhir-jpaserver instance and use then the $validate operation to access it, see https://github.com/ahdis/matchbox if you are interested
Nicolai Mainiero (Sep 22 2021 at 05:45):
Thanks for the replies. I looked into the PrePopulatedValidationSupport but unfortunately it does not support my use case (german eRezept validation) because, the profiles are used with an version tag.
<Bundle xmlns="http://hl7.org/fhir">
<id value="1131c63a-f238-48ef-a1cc-818393356575"></id>
<meta>
<profile value="http://fhir.abda.de/eRezeptAbgabedaten/StructureDefinition/DAV-PR-ERP-AbgabedatenBundle|1.0.3"></profile>
</meta>
And I don't want to do additional HTTP-Request during validation if it's possible to do it in process.
I went with the ValidationEngine and implemented my own IgLoader to read the implementation guides from the classpath. Thanks for all your suggestions.
Peter Robinson (Dec 13 2021 at 21:24):
I am also struggling with loading a custom IG together with examples that conform to it. Can anyone recommend an example code to demonstrate how to do this? The online HAPI documentation does not seem to cover this at all
Lin Zhang (Dec 14 2021 at 01:47):
I'm also interested.
Last updated: Apr 12 2022 at 19:14 UTC