HL7验证程序PlanDefinition失败:

时间:2019-06-10 12:17:32

标签: c# hl7-fhir

我必须升级Hl7.Fhir.STU3和Hl7.Fhir.Specification.STU3库,现在我收到错误消息,它无法解析PlanDefinition配置文件。 我可以在调试器中看到正在提取specification.zip 提取到'C:\ Users \ dev \ AppData \ Local \ Temp \ FhirArtifactCache-1.2.1-Hl7.Fhir.STU3.Specification \ specification'}

  

为什么会找不到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);

1 个答案:

答案 0 :(得分:0)

此错误来自ZipSource,无法在列出的路径中找到压缩文件。代替您要使用的文件夹路径,请指出要用作源的压缩文件。

从“ coreSource”名称开始,我假设您要指向基本的FHIR规范。您可以将其更改为以下行,而不是为此提供自己的zipfile:

var coreSource = ZipSource.CreateValidationSource();

该库将找到其随附的Specification.zip,然后将其用于根据核心规范进行验证。