Stream: implementers
Topic: Validate a ressource with a custom profile
Thomas (Sep 13 2019 at 08:51):
Hi,
I'm using a custom profile of a patient and I want to validate it against an HAPI server.
I'm currently using this library (https://github.com/FirelyTeam/fhir-net-api) to communicate with this HAPI server.
FirelyTeam provide this library (https://www.nuget.org/packages/Hl7.Fhir.Specification.R4/) to validate ressource, but it seems that this validation is done on the client side.
Do you have any advices for validating ressource with a custom profile against HAPI server ?
Thanks !
Stefan Lang (Sep 13 2019 at 09:01):
To validate server side the server needs to know the profile. So:
- Create the profile and all Extensions and Vocabulary it uses on the server. On a public server, this is done by just POSTing to [base]/StructureDefinition
- Declare conformity of your resource instance (Patient) to the profile by adding a meta.profile element containing the profile's canonical url
- POST your resource instance to [base]/[resourcetype]/$validate, e.g. [base]/Patient/$validate
Stefan Lang (Sep 13 2019 at 09:03):
Of course you need to create the profile and all other conformance and terminology only once
Thomas (Sep 13 2019 at 09:45):
Hi Stefan and thanks for your answer !
I've already done all your steps but I'm wondering :
- if FirelyTeam library((https://github.com/FirelyTeam/fhir-net-api) propose an API to directly call this [base]/[resourcetype]/$validate endpoint ?
- Do I need to create custom POST with the serialized resource ?
- Any other best practices ?
Thanks again !
Michel Rutten (Sep 13 2019 at 10:51):
Hi @Thomas, the .NET FHIR library contains a validator component. So you can perform validation locally, without having to call out to a FHIR server.
Stefan Lang (Sep 13 2019 at 11:17):
If I understand it correct, @Thomas ' question is: How to implement a server side validation with a client that's built upon the Dotnet library.
When it comes to Dotnet, I'm out ;)
Thomas (Sep 13 2019 at 11:44):
Thanks for your answers @Michel Rutten @Stefan Lang !
I'll try to have a look to this validator component, I guess we can specify custom profiles.
Thanks again
Michel Rutten (Sep 13 2019 at 11:57):
Indeed, you can implement the Validator component in a client and/or in a server. There is a Validator desktop application in our GitHub repo that demonstrates the implementation:
https://github.com/FirelyTeam/Furore.Fhir.ValidationDemo
Last updated: Apr 12 2022 at 19:14 UTC