Stream: dotnet
Topic: FHIR Resource Validation
Sunil Lanke (Dec 11 2019 at 10:55):
I am new to FHIR, I want to validate FHIR resource against custom profile, how should I go ahead?
Ward Weistra (Dec 11 2019 at 13:09):
Hi Sunil, there are multiple options for that. I'll assume you're specifically looking to use the #dotnet validator, given the stream you've posted in.
- One way would be to upload the custom profile to a Simplifier.net project and next validate against that project via https://simplifier.net/validate (select the right project as scope, paste your FHIR instance in the box and validate). See http://docs.simplifier.net/create-my-first-resource/create-my-first-resource.html#how-to-validate-resources
- Another is to use Torinox, the command line implementation: https://simplifier.net/docs/torinox/home
- Or set up your own Vonk FHIR server, load the FHIR profile and use Vonk's validation options: http://docs.simplifier.net/vonk/features/validation.html
They're all based on the same .NET validator. Does that answer your question?
Mirjam Baltus (Dec 11 2019 at 17:28):
To add to that, if you need to incorporate the .Net validator into your own code, you can take a look at this example project: https://github.com/FirelyTeam/Furore.Fhir.ValidationDemo. It is a bit older, but the code works for newer versions of the library and FHIR R4 as well.
Sunil Lanke (Dec 13 2019 at 06:06):
To add to that, if you need to incorporate the .Net validator into your own code, you can take a look at this example project: https://github.com/FirelyTeam/Furore.Fhir.ValidationDemo. It is a bit older, but the code works for newer versions of the library and FHIR R4 as well.
Hi, Thanks for your reply.
I have looked into this demo project, and I am inclined towards using this Hl7.Fhir.Specification component to use for Validation. But unfortunately, this uses default FHIR profiles, I am looking for validating custom profiles. This component uses XDS schema files of the profiles for validation, and I don't have XSD for custom profiles.
How can I create the XSD files of these custom profiles? Is there any tool?
Grahame Grieve (Dec 13 2019 at 06:07):
you can't create xsd files for the profiles. The make rules on top of the existing syntax which is what xsd can express.
Sunil Lanke (Dec 13 2019 at 06:07):
Hi Sunil, there are multiple options for that. I'll assume you're specifically looking to use the #dotnet validator, given the stream you've posted in.
- One way would be to upload the custom profile to a Simplifier.net project and next validate against that project via https://simplifier.net/validate (select the right project as scope, paste your FHIR instance in the box and validate). See http://docs.simplifier.net/create-my-first-resource/create-my-first-resource.html#how-to-validate-resources
- Another is to use Torinox, the command line implementation: https://simplifier.net/docs/torinox/home
- Or set up your own Vonk FHIR server, load the FHIR profile and use Vonk's validation options: http://docs.simplifier.net/vonk/features/validation.html
They're all based on the same .NET validator. Does that answer your question?
Thanks for your reply.
I am looking for Custom Profile validation on Client system.
Grahame Grieve (Dec 13 2019 at 06:07):
the validator takes the structure definitions from the packages, and uses those to check the instances against the profiles
Mirjam Baltus (Dec 13 2019 at 08:12):
@Sunil Lanke : When you say 'custom profiles', do you mean that you have created custom structures, i.e. non-FHIR ones? Or do you mean you have profiled standard FHIR resource/data types? If the latter, you can just point the validator to the folder containing your profiles, set the meta.profile field in the resource instance, and validate against your own profiles. The validator can take a look at the xsd files for the standard structures - there's a setting for it - but this is in addition to using the StructureDefinitions.
Sunil Lanke (Dec 13 2019 at 11:45):
Sunil Lanke : When you say 'custom profiles', do you mean that you have created custom structures, i.e. non-FHIR ones? Or do you mean you have profiled standard FHIR resource/data types? If the latter, you can just point the validator to the folder containing your profiles, set the meta.profile field in the resource instance, and validate against your own profiles. The validator can take a look at the xsd files for the standard structures - there's a setting for it - but this is in addition to using the StructureDefinitions.
Hi, Thanks, this worked for me.
But what I observed that Validator does not validate as per the Schematron defined for the profile, so trying to solve that issue.
Mirjam Baltus (Dec 13 2019 at 12:25):
As Grahame mentioned, StructureDefinitions define the rules much more precise, so that is what the validator uses. You do not need the schematron if you have your profile.
Last updated: Apr 12 2022 at 19:14 UTC