简体   繁体   中英

HL7 Validator PlanDefinition failed:

I had to upgrade Hl7.Fhir.STU3 and Hl7.Fhir.Specification.STU3 library and now I am getting error message that it can't resolution PlanDefinition profile. I can see within the debugger that the specification.zip is being Extracted Extracted to 'C:\\Users\\dev\\AppData\\Local\\Temp\\FhirArtifactCache-1.2.1-Hl7.Fhir.STU3.Specification\\specification'}

Why will this not finding PlanDefinition?

{"Overall result: FAILURE (1 errors and 0 warnings)\r\n\r\n[ERROR] Resolution of profile at 'http://hl7.org/fhir/StructureDefinition/PlanDefinition' failed: Cannot prepare ZipSource: file 'D:\\Users\\mcdevitt\\Documents\\Visual Studio 2015\\FHIRValidatorFile\\FHIRValidatorFile\\FHIRValidatorFile\\bin\\Debug\\CustomProfiles' was not found (at PlanDefinition)"}

var HL7obj = new FhirXmlParser().Parse<PlanDefinition>(HL7FileData);
var coreSource = ZipSource.CreateValidationSource();
var cachedResolver = new CachedResolver(
            new DirectorySource(CustomProfilesPath, includeSubdirectories: true));

var combinedSource = new MultiResolver(cachedResolver, coreSource);

var ctx = new ValidationSettings()
        {
            ResourceResolver = combinedSource,
            GenerateSnapshot = true,
            Trace = false,
            EnableXsdValidation = true,
            ResolveExteralReferences = false
        };

var HL7validator = new Validator(ctx);
var result = HL7validator.Validate(HL7obj);

This error comes from the ZipSource not being able to find a zipped file at the listed path. Instead of the path to a folder, please indicate the zipfile that you want to use as source.

From the 'coreSource' name, I assume that you want to point to the base FHIR specification. Instead of supplying your own zipfile for that, you can change it to this line:

var coreSource = ZipSource.CreateValidationSource();

The library will locate the specification.zip that comes with it, and will then be able to use it for validation against the core spec.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM