Hello,
I would like to validate a FHIR resource using .NET API and the resource has to confirm to US Core structure definition (profile). I looked at Furore.Fhir.Validation.Demo code, but I am not sure how to modify the code in order for the validation to be successful. I want be be able to input a resource such as https://www.hl7.org/fhir/us/core/AllergyIntolerance-example.json.html and have the validator return success.
var ctx = new ValidationSettings()
{
…
};
var validator = new Validator(ctx);
var result = validator.Validate(data);
Thank you! I did see that the code is setting local resolver to specification.zip on the local machine. I don’t quite know how to download all US Core profiles or Argonaut profiles to my local machine such that I can set the path in the resolver. Thanks.
I see that the path to the profiles can be set in “Change Settings” dialog. The label says - “The validator will look for your profiles and other conformance resources in this directory”. However I don’t know how to download the profiles to my local folder. I downloaded this package https://www.hl7.org/fhir/us/core/package.tgz and extracted it to a local folder - C:\Users\xxx\Downloads\package\package\xml
The validate method does not seem to work as expected. Settings.ResourceResolver has 2 sources - one is the path above and the other to specification.zip. This doesn’t work as expected because my input json has an error in it, however the Validate method is returning a success.
For the .Net validator to know which profile to validate against, you will either have to provide the Validate method with the profile url, or add the meta.profile field containing that url to the resource json.