0

I am looking for Fhir Resource validation against Fhir Structure definition using .net core

I found there is a lib org.hl7.fhir.validator.jar and I couldn't find a better way to do validation through c# code, my requirements are simple

  1. Cardinality validation
  2. Values
  3. Bindings
  4. Profiles

I have an idea in my mind, which is passing the FhirResource as a parameter and load the structure definition file and check the properties and return the error messages as Operational Outcome. Can someone advise me a best way to try it in C# specially in .NET core?

Shanjee
  • 491
  • 5
  • 16

1 Answers1

3

You can use the validation functionality of the .NET FHIR API (https://www.nuget.org/packages/Hl7.Fhir.STU3/), see here (https://github.com/FirelyTeam/Furore.Fhir.ValidationDemo) for a demo application that uses this library.

Although the demo is a winforms project, the .NET FHIR API is fully .NET Core compatible.

Ewout Kramer
  • 984
  • 6
  • 9
  • thanks, i have changed the dll to R4 and tried to validate the sample resource from Hl7 website, but i got validation failure messages. Overall result: FAILURE [ERROR] Resolution of profile at 'http://hl7.org/fhir/StructureDefinition/Observation' failed: Type checking the data: Encountered unknown element 'valueSetReference' at location 'StructureDefinition.snapshot[0].element[4].binding[0].valueSetReference[0]' while parsing (at Observation) – Shanjee Sep 17 '19 at 07:29
  • Hi Ewout, thanks for the demo, I also tried with a DTU3, but got for a simple patient following error: [ERROR] Resolution of profile at 'http://hl7.org/fhir/StructureDefinition/Patient' failed: Type checking the data: Encountered unknown element 'requirements' at location 'StructureDefinition.requirements[0]' while parsing (at Patient), any idea? I don't have a requirements element in the JSON – iBoonZ Nov 05 '19 at 09:42
  • Hi, was this ever resolved? I am facing the same errors now. – FatSnake Aug 16 '22 at 15:46