FHIR Chat · Schematron validation fails for R4 resource · implementers

Stream: implementers

Topic: Schematron validation fails for R4 resource


view this post on Zulip Mukesh Sharma (Aug 19 2019 at 11:12):

I am using HAPI implementation for FHIR. When I apply Schematron validation on an R4 Patient resource, I get the following failure:
Failed to apply Schematron bundleresource://367.fwk360062456:7/org/hl7/fhir/r4/model/schema/patient.sch onto XML source

Resource input:
<Patient xmlns="http://hl7.org/fhir">
<identifier>
<period>
<start value="2003-05-06"/>
<end value="2000-05-07"/>
</period>
</identifier>
</Patient>
Schematron is present and has a rule :
<sch:rule context=“f:Patient/f:identifier/f:period”>
<sch:assert test=“not(exists(f:start/@value)) or not(exists(f:end/@value)) or (xs:dateTime(f:start/@value) <= xs:dateTime(f:end/@value))”>per-1: If present, start SHALL have a lower value than end</sch:assert>
</sch:rule>

I am using a 3.7.0 version of HAPI libraries.
This issue is faced only on R4.
STU3 and DSTU2 version pass with a proper OperationOutcome object. See below:
<OperationOutcome>
<issue>
<severity value="error"/>
<code value="processing"/>
<diagnostics value="[error] in /*:Patient[namespace-uri()='http://hl7.org/fhir'][1]/*:identifier[namespace-uri()='http://hl7.org/fhir'][1]/*:period[namespace-uri()='http://hl7.org/fhir'][1] @ Patient per-1: If present, start SHALL have a lower value than end Test=not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)"/>
<location value="Patient"/>
</issue>
</OperationOutcome>

Please help on this issue.

view this post on Zulip Lloyd McKenzie (Aug 20 2019 at 16:58):

@James Agnew


Last updated: Apr 12 2022 at 19:14 UTC