FHIR Chat · Validation error on simple example · dotnet

Stream: dotnet

Topic: Validation error on simple example


view this post on Zulip Kirt Noel (Oct 15 2019 at 19:22):

I am having difficulty validating a resource with the C# API against profile I created with Forge.

Here's the error I'm encountering:

[ERROR] Unable to resolve reference to profile 'http://hl7.org/fhir/StructureDefinition/Patient' (at Patient)

Any guidance would be appreciated.

Here's the relevant excerpt from my code:

var myProfiles = new CachedResolver(new MultiResolver(
new DirectorySource(@"\\mySharedDrive\StructureDefinitions")));

var patientProfile = myProfiles.FindStructureDefinition(@"http://example.org/fhir/StructureDefinition/CustomPatientProfile");

Patient patientResource = ...

var validator = new Validator();
var outcome = validator.Validate(patientResource, patientProfile);

view this post on Zulip Vadim Peretokin (Oct 15 2019 at 19:22):

It can possibly mean that the directory where the zip gets extracted to is corrupted - find and delete it

view this post on Zulip Vadim Peretokin (Oct 15 2019 at 19:23):

I don't have the name of the folder offhand, but I've seen this error before, and that was the fix.

view this post on Zulip Kirt Noel (Oct 15 2019 at 19:27):

I simply saved the profile into a directory without zipping it. As such, I didn't invoke: ZipSource.CreateValidationSource()
In iterating with the debugger it seems the profile was loaded from the directory and it subsequently populated the patientProfile variable cited above.

view this post on Zulip Marco Visser (Oct 16 2019 at 06:48):

Hi Kirt,

It cannot find the basic Fhir resource Patient. In your resolver structure I miss the zip file with all the standard Fhir resources. When you use the following resolver structure , the validator should be able to find the standard Patient resource:

var myProfiles = new CachedResolver(new MultiResolver(new DirectorySource(@"\\mySharedDrive\StructureDefinitions"), ZipSource.CreateValidationSource()));

view this post on Zulip Kirt Noel (Oct 16 2019 at 12:00):

Hello Marco.

You correctly identified the problem. Indeed, the folder did not have a copy of the specification.zip in it. Upon placing it there, the error was corrected and the validator was able to resolve both the specification and my Patient profile.

Thank-you!


Last updated: Apr 12 2022 at 19:14 UTC