FHIR R4 contained referecnes, schematron validation fails - hl7-fhir

I am validating the below Appointment resource (which includes a contained reference) using FHIR R4 schema and schmeatron, and I always get this error:
dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource.
From my knowledge the contained reference is well included and referenced, and also the Resource validates against STU 3 schema and schematron, but I am not able to validate against R4 schematron.
What I am doing wrong?
Thanks
<?xml version="1.0" encoding="UTF-8"?>
<Appointment xmlns="http://hl7.org/fhir">
<contained>
<Slot>
<id value="slot159260820191620"/>
<schedule>
<identifier>
<system value="urn:oid:2.16.840.1.113883.3.7482.1.6"/>
<value value="159"/>
</identifier>
</schedule>
<status value="free"/>
<start value="2019-08-26T16:20:00+02:00"/>
<end value="2019-08-26T16:40:00+02:00"/>
</Slot>
</contained>
<status value="proposed"/>
<slot>
<reference value="#slot159260820191620"/>
</slot>
<participant>
<actor>
<identifier>
<system value="urn:oid:2.16.840.1.113883.3.7482.3.1"/>
<value value="143052"/>
</identifier>
</actor>
<status value="accepted"/>
</participant>

Nothing. The schematron is broken. It should say
...for $id in f:contained/*/f:id/#value...
I'll check to confirm whether this is in the list of technical corrections we'll be posting soon.

Related

FHIR - Consent Resource - Giving Hl7.Fhir.Serialization.ComplexTypeReader error

I am not a techie but have assumed some responsibilities in someone's absence.
Trying to push below Consent FHIR Resource:
<Consent xmlns="http://hl7.org/fhir">
<id value="123" />
<status value="inactive" />
<scope>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/consentscope" />
<code value="patient-privacy" />
</coding>
</scope>
<category>
<coding>
<system value="http://loinc.org" />
<code value="59284-0" />
</coding>
</category>
<patient>
<reference value="Patient/41" />
<display value="John Stifiles" />
</patient>
<policyRule>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/consentpolicycodes" />
<code value="cric" />
</coding>
</policyRule>
<provision>
<type value="deny" />
<period>
<start value="2021-09-27" />
<end value="2021-09-27" />
</period>
</provision>
</Consent>
This is passed with no errors from inferno.healthit.gov/validator/ but when I run through my integrator (it hits HL7 validator), I get a variety of errors - Encountered unknown member 'Scope' or Encountered unknown member 'Patient', etc.
This is a Consent resource that conforms to FHIR version R4. Inferno runs FHIR R4 as well, so that works.
However, if you try and validate this resource against FHIR STU3, you will get the errors you mentioned, since the Consent resource structure significantly changed from STU3 to R4. Please check your integrator and make sure it runs FHIR R4 as well.

How to apply PlanDefinition inorder to generate a carePlan

I am newbie to FHIR. Trying to create careplan by applying PlanDefinition/$apply. Are there any examples available so that I can take them as reference and generate careplan out of planDefintion.
I am able to post an planDefinition but I don't have any clue on implementing $apply out of it.
There is an implementation of PlanDefinition/$apply here:
https://github.com/DBCG/cqf-ruler/blob/master/r4/src/main/java/org/opencds/cqf/r4/providers/PlanDefinitionApplyProvider.java#L84
Note that there is in-progress work on that provider to make it more modular, but the logic is essentially the same.
Have a look at this example from the FHIR Wiki
Request: Apply the low suicide risk order set to patient 124
GET [base]/PlanDefinition/example/$apply?subject=Patient/124
Response: Returned on successful application of the order set
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<CarePlan xmlns="http://hl7.org/fhir">
<!-- This example demonstrates the result of an $apply operation for the citalopramPrescription activity definition. -->
<id value="apply-operation-response"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
Generated...
</div>
</text>
<contained>
<ServiceRequest>
<id value="referralrequest"/>
<status value="draft"/>
<intent value="proposal"/>
<code>
<coding>
<system value="http://snomed.info/sct"/>
<code value="306206005"/>
</coding>
<text value="Referral to service (procedure)"/>
</code>
<subject>
<reference value="Patient/124"/>
</subject>
<occurrenceDateTime value="2017-02-26T11:47:00.000Z"/>
<requester>
<reference value="Practitioner/123"/>
</requester>
<performerType>
<coding>
<system value="http://nucc.org/provider-taxonomy"/>
<code value="261QM0850X"/>
<display value="Adult Mental Health"/>
</coding>
</performerType>
<reasonCode>
<coding>
<system value="http://example.org/CodeSystem/suicide-risk-assessment-score"/>
<code value="Low"/>
<display value="Low Suicide Risk"/>
</coding>
<text value="Low Suicide Risk"/>
</reasonCode>
<reasonReference>
<reference value="RiskAssessment/suicide-risk-assessment"/>
</reasonReference>
</ServiceRequest>
</contained>
<contained>
<Medication>
<id value="citalopramMedication"/>
<code>
<coding>
<system value="http://www.nlm.nih.gov/research/umls/rxnorm"/>
<code value="200371"/>
</coding>
<text value="citalopram"/>
</code>
<form>
<coding>
<system value="http://snomed.info/sct"/>
<code value="385055001"/>
<display value="Tablet dose form"/>
</coding>
<text value="Tablet dose form"/>
</form>
<ingredient>
<itemReference>
<reference value="#citalopramSubstance"/>
</itemReference>
<amount>
<numerator>
<value value="20"/>
<unit value="mg"/>
</numerator>
<denominator>
<value value="1"/>
<unit value="{tbl}"/>
</denominator>
</amount>
</ingredient>
</Medication>
</contained>
<contained>
<Substance>
<id value="citalopramSubstance"/>
<code>
<coding>
<system value="http://www.nlm.nih.gov/research/umls/rxnorm"/>
<code value="2556"/>
</coding>
<text value="citalopram"/>
</code>
</Substance>
</contained>
<contained>
<MedicationRequest>
<id value="citalopramPrescription"/>
<status value="draft"/>
<intent value="proposal"/>
<medicationReference>
<reference value="#citalopramMedication"/>
</medicationReference>
<subject>
<reference value="Patient/124"/>
</subject>
<requester>
<reference value="Practitioner/123"/>
</requester>
<reasonCode>
<coding>
<system value="http://example.org/CodeSystem/suicide-risk-assessment-score"/>
<code value="Low"/>
<display value="Low Suicide Risk"/>
</coding>
<text value="Low Suicide Risk"/>
</reasonCode>
<reasonReference>
<reference value="RiskAssessment/suicide-risk-assessment"/>
</reasonReference>
<!--definition>
<reference value="ActivityDefinition/citalopramPrescription"/>
</definition-->
<instantiates value="ActivityDefinition/citalopramPrescription"/>
<dosageInstruction>
<text value="1 tablet oral 1 time daily"/>
<timing>
<repeat>
<frequency value="1"/>
<period value="1"/>
<periodUnit value="d"/>
</repeat>
</timing>
<route>
<coding>
<code value="26643006"/>
<display value="Oral route (qualifier value)"/>
</coding>
<text value="Oral route (qualifier value)"/>
</route>
<doseAndRate>
<type><text value="ordered"/></type>
<doseQuantity>
<value value="1"/>
<unit value="{tbl}"/>
</doseQuantity>
</doseAndRate>
</dosageInstruction>
<dispenseRequest>
<numberOfRepeatsAllowed value="3"/>
<quantity>
<value value="30"/>
<unit value="{tbl}"/>
</quantity>
</dispenseRequest>
</MedicationRequest>
</contained>
<instantiatesCanonical value="PlanDefinition/example"/>
<status value="draft"/>
<intent value="proposal"/>
<subject>
<reference value="Patient/124"/>
</subject>
<activity>
<reference>
<reference value="#referralrequest"/>
</reference>
</activity>
<activity>
<reference>
<reference value="#citalopramPrescription"/>
</reference>
</activity>
</CarePlan>
I am actively looking for the Plandefinition$apply operation usage or implementation.
as #code tutorial meny

Multiple referring pratictioners in an FHIR Encounter

I want to express the following use case :
A patient is pregnant. She's seen by two specialists : an endocrinologist and an obstetric gynecologist.
The gynecologist sends her to the hospital, for a care he can't give.
The patient has then :
a family doctor
a referring doctor (obstetric gynecologist)
a specialist (endocrinologist)
The family doctor is referenced in the Patient Resource, by the generalPractitioner element.
But I want to reference the two others practitioners in the Encounter Resource.
I'm ok with the first (the referring), but I don't know where to reference the second.
<?xml version="1.0" encoding="UTF-8"?>
<Encounter xmlns="http://hl7.org/fhir">
<id value="99289910"/>
<contained>
<ReferralRequest>
<id value="p1"/>
<status value="active"/>
<category value="request"/>
<requester>
<reference value="Practitioner/99003499686"/>
<identifier>
<type>
<coding>
<system value="http://hl7.org/fhir/v2/0443"/>
<code value="RP"/>
<display value="Referring Provider"/>
</coding>
<text value="Referring doctor"/>
</type>
<system value='urn:oid:1.2.250.1.71.4.2.1'></system>
<value value='99003499686'/>
<assigner><display value="RPPS"/></assigner>
</identifier>
</requester>
</ReferralRequest>
</contained>
<status value="finished"/>
<class>
<system value="http://hl7.org/fhir/v3/ActCode"/>
<code value="IMP"/>
</class>
<patient>
<reference value="/patient/3803218"/>
</patient>
<incomingReferral>
<reference value="#p1"/>
</incomingReferral>
<period>
<start value="2016-09-07T15:39:00"/>
<end value="2016-09-11T16:35:00"/>
</period>
<location>
<location>
<reference value="/uf/1835"/>
</location>
<status value="completed"/>
<period>
<start value="2016-09-07T15:39:00"/>
<end value="2016-09-08T00:28:00"/>
</period>
</location>
<location>
<location>
<reference value="/uf/3650"/>
</location>
<status value="completed"/>
<period>
<start value="2016-09-08T00:28:00"/>
<end value="2016-09-11T16:35:00"/>
</period>
</location>
<serviceProvider>
<reference value="/uf/2407"/>
</serviceProvider>
</Encounter>
Where can I reference the specialist (endocrinologist) in the Encounter ?
If I understand correctly, the first would be identified as the referring practitioner, but the other is essentially just an "interested party" - someone who should be notified of the admission, the discharge and presumably should receive a copy of the discharge summary.
The concept of "interested party" isn't part of the value set for Encounter.participant.type, but the value set is extensible, so you're free to define your own code for that concept. It seems like a generally useful idea, so I'd encourage you to submit a change request (propose a change link at the bottom of each page in the spec) for us to add that to the specification for everyone.

How to parse SOAP XML in ruby?

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://extranet.mcs.be/DEV_QUALITY_API/modules/quality/services/soap/quality.php"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getQuestionnairesListResponse>
<return SOAP-ENC:arrayType="ns1:QuestionnaireListItem[34]"
xsi:type="ns1:ArrayOfQuestionnaireListItem">
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000022</ID>
<Code xsi:type="xsd:string">Interest PubTransp</Code>
<Reference xsi:type="xsd:string">Check Employees Interest in Public
Transport</Reference>
</item>
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000008</ID>
<Code xsi:type="xsd:string">CS SRE North 2003</Code>
<Reference xsi:type="xsd:string">Customer Satisfaction SRE North 2003</Reference>
</item>
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000006</ID>
<Code xsi:type="xsd:string">CS SRE South 2003</Code>
<Reference xsi:type="xsd:string">Customer Satisfaction SRE South 2003</Reference>
</item>
.
.
.
I want to parse the above soap String (I actually want to get items from the above soap). How could I do this?
There's a gem called Savon that's specifically made for dealing with SOAP in Ruby.
There's good documentation on the web site, once you looked into that and have more specific questions I'm sure we can help you.

How to customize the schema inlined inside an imported WSDL

I have a.wsdl & b.wsdl where a.wsdl imports b.wsdl.
Now I have to customize the schema inside b.wsdl using wsimport and JAXB. but using below customization is giving error that "XPath evaluation of "wsdl:definitions/wsdl:types/xsd:schema[#targetNamespace='b']" results in an empty target node
I am not able to find a way to customize the inlined schema in imported b.wsdl when generating the client code using wsimport.
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema[#targetNamespace='b']"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jaxb:globalBindings>
<jaxb:javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
</jaxb:globalBindings>
</jaxws:bindings>
A.wsdl
<definitions targetNamespace="a"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:interface="b">
<import location="b.wsdl" namespace="b"/>
<service name="Service">
<port binding="interface:Binding" name="Port">
<soap:address location="https://localhost/sdk/vpxdService" />
</port>
</service>
</definitions>
B.wsdl
<definitions targetNamespace="b"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:b="b"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<schema
targetNamespace="b"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:b="b"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<complexType name="XYZ">
<sequence>
<element name="dynamicType" type="xsd:string" minOccurs="0" />
<element name="val" type="xsd:anyType" maxOccurs="unbounded" />
</sequence>
</complexType>
</types>
</schema>
</definitions>
After going through given website I modified the external binding file to use wsdlLocation="b.wsdl" instead of node="wsdl:definitions/wsdl:types/xsd:schema[#targetNamespace='b']" which did the magic.
This will make sure that the inline schema defined in WSDL will customized as required.
<bindings
xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
version="2.0">
<bindings wsdlLocation="b.wsdl">
<globalBindings>
<javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate"
/>
</globalBindings>
</bindings>
</bindings>
http://fusesource.com/docs/framework/2.1/jaxws/JAXWSCustomTypeMappingOverview.html
Have you tried adding the following attributes to the <jaxws:bindings> element?
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
and
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
You're referencing the xsd and wsdl namespaces in your xpath expression, but until you define the URI's for them, they won't match up with the URI's in the target documents.

Resources