"Unable to resolve reference to profile" during validation against package

654 views
Skip to first unread message

Kush Chakraborty

unread,
Mar 18, 2021, 7:10:41 PM3/18/21
to FHIR DOTNET
Hello FHIR.net folks,
I'm unable to get the FHIR Validator to work in validating against eh US Core profile. I'm just starting to use the SDK for validation so I'm likely doing something stupid.

I Downloaded the US CORE Package and have it both in zipped and unzipped form present in folder "fhir-profiles". However while trying to resolve I get the following errors from OerationOutcome:
1. Unable to resolve reference to profile 'http://hl7.org/fhir/StructureDefinition/Patient'
2. Unable to resolve reference to profile 'http://hl7.org/fhir/us/core/StructureDefinition-us-core-patient'

Any pointers would be appreciated.

Code Snippet

// Tried these combinations for source
*/ var source = new CachedResolver(new MultiResolver(
    new DirectorySource(@"../fhir-profiles", 
        new DirectorySourceSettings() { IncludeSubDirectories = true }),
        ZipSource.CreateValidationSource()));*/
        
var source = new CachedResolver(
        new DirectorySource(@"../fhir-profiles",
        new DirectorySourceSettings() { IncludeSubDirectories = true }));
            
var ctx = new ValidationSettings
    {
        ResourceResolver = source,
        GenerateSnapshot = true,
        Trace = false,
        // EnableXsdValidation = true, // Tried both combinations
        // ResolveExternalReferences = false // Tried both combinations
    };

var poco = GetPatientPoco(...);
var validator = new Validator(ctx);

var result = validator.Validate(poco, @"http://hl7.org/fhir/us/core/StructureDefinition-us-core-patient");
return result;

Mirjam Baltus

unread,
Mar 23, 2021, 8:29:55 AM3/23/21
to FHIR DOTNET
You are on the right track, but the main thing that trips up the validation is the URL you have used for the US-core patient profile. It should have a '/' instead of a '-' between the type and the name: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient".
You will also need the regular FHIR specification files, so always do use the MultiResolver with the ValidationSource which you have commented out at this time.

When you change those two things, you should see a better result from the validator.

Op vrijdag 19 maart 2021 om 00:10:41 UTC+1 schreef ks2...@gmail.com:
Reply all
Reply to author
Forward
0 new messages