Stream: hapi
Topic: Schematron Validation fails on R4
Mukesh Sharma (Aug 20 2019 at 15:50):
Hi,
I am using HAPI 3.7.0 implementation for FHIR. When I apply schematron validation on a 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 that I provide:
<Patient xmlns="http://hl7.org/fhir">
<identifier>
<period>
<start value="2003-05-06"/>
<end value="2000-05-07"/>
</period>
</identifier>
</Patient>
I have validated that a schematron is present in the validation resources jar 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>
This issue is faced only on R4. For STU3 and DSTU2, this scenario passes with below outcome :
<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>
I suspect there is a bug with the SchematronValidator for R4.
Please check.
Regards,
Mukesh
James Agnew (Aug 20 2019 at 19:19):
That looks like a valid error to me- your start date comes after your end date, so that's not a valid period.
Jean Duteau (Aug 20 2019 at 20:40):
@James Agnew I think the point is that the Schematron rule validly fires in DSTU2 and STU3 but not in R4.
Last updated: Apr 12 2022 at 19:14 UTC