How to apply PlanDefinition inorder to generate a carePlan - hl7-fhir

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

Related

Unable to toggle editor style after manually editing xcdatamodel/content file

After manually editing the xcdatamodel/content due to a merge conflict I'm able to open and run the project just fine, but I'm unable to toggle the toggle the editor style to show the "object relations diagram"
I'm using Xcode 13.4.1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21279" systemVersion="21G115" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Foo" representedClassName=".foo" syncable="YES">
...
</entity>
<entity name="Bar" representedClassName=".bar" syncable="YES">
...
</entity>
<entity name="FooBar" representedClassName=".fooBar" syncable="YES">
...
<fetchIndex name="fooie">
<fetchIndexElement property="fooeee" type="Binary" order="ascending"/>
</fetchIndex>
</entity>
<entity name="BarFoo" representedClassName=".barFoo" syncable="YES">
<fetchIndex name="byPropertyIndex">
<fetchIndexElement property="bla bla bla" type="Binary" order="descending"/>
</fetchIndex>
</entity>
<elements>
<element name="Foo" positionX="0" positionY="0" width="0" height="0"/>
<element name="Bar" positionX="0" positionY="0" width="0" height="0"/>
<element name="FooBar" positionX="0" positionY="0" width="0" height="0"/>
<element name="BarFoo" positionX="0" positionY="0" width="0" height="0"/>
</elements>
</model>
Any Idea what is going on here? How can I get xcode to open the object Diagram for this model version?

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.

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.

FHIR contained practionner in generalPractitioner

In the (last) FHIR specification (v1.8.0), it's mentioned that a contained resource can be embedded in a Reference (documentation), when no reference exists.
But, by looking at the XSD, I can't figure out how to validate the XML against the patient.xsd with such a mechanism.
Here is my attempt
<?xml version="1.0" encoding="UTF-8"?>
<Patient xmlns="http://hl7.org/fhir">
<identifier>
<system value="urn:oid:1.2.250.1.311.1.1"/>
<value value="2000100439"/>
<assigner>
<display value="ap-hm"/>
</assigner>
</identifier>
<name>
<use value="official"/>
<family value="COPTER"/>
<given value="ELI"/>
</name>
<gender value="male"/>
<birthDate value="1954-08-14"/>
<deceasedBoolean value="false"/>
<address>
<use value="home"/>
<line value="45 boulevard des cigales"/>
<city value="MARSEILLE 10"/>
<postalCode value="13010"/>
</address>
<maritalStatus>
<coding>
<system value="http://hl7.org/fhir/v3/MaritalStatus"/>
<code value="U"/>
</coding>
</maritalStatus>
<generalPractitioner>
<contained>
<Practitioner>
<id value="p1"/>
<name>
<family value="PASTEUR"/>
<given value="LOUIS"/>
</name>
<address>
<city>MARSEILLE</city>
<postalCode>13005</postalCode>
</address>
<gender value="male"/>
</Practitioner>
</contained>
</generalPractitioner>
</Patient>
What is the correct way to have a contained reference ?
All contained resources are sent near the top using the "contained" element. They are then referenced as a local reference. So your example would look as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Patient xmlns="http://hl7.org/fhir">
<contained>
<Practitioner>
<id value="p1"/>
<name>
<family value="PASTEUR"/>
<given value="LOUIS"/>
</name>
<address>
<city>MARSEILLE</city>
<postalCode>13005</postalCode>
</address>
<gender value="male"/>
</Practitioner>
</contained>
<identifier>
<system value="urn:oid:1.2.250.1.311.1.1"/>
<value value="2000100439"/>
<assigner>
<display value="ap-hm"/>
</assigner>
</identifier>
<name>
<use value="official"/>
<family value="COPTER"/>
<given value="ELI"/>
</name>
<gender value="male"/>
<birthDate value="1954-08-14"/>
<deceasedBoolean value="false"/>
<address>
<use value="home"/>
<line value="45 boulevard des cigales"/>
<city value="MARSEILLE 10"/>
<postalCode value="13010"/>
</address>
<maritalStatus>
<coding>
<system value="http://hl7.org/fhir/v3/MaritalStatus"/>
<code value="U"/>
</coding>
</maritalStatus>
<generalPractitioner>
<reference value="#p1"/>
</generalPractitioner>
</Patient>

How do i display an image instead of text for a ? on an xml form for ODK collect?

Since odk collect uses utf-8, the language that i would like the questions of the form to be in would be displayed one character at a time vs. conjoined. instead of displaying text for the question, i want the question to display an image which will be on the question text formatted properly. Is there anyway this can be done, are there any good tutorials or information out there that can help me accomplish this?
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>firstform</h:title>
<model>
<instance>
<data id="build_firstform_1375472795">
<meta>
<instanceID/>
</meta>
<field_name/>
<field_age/>
<field_location/>
</data>
</instance>
<itext>
<translation lang="eng">
<text id="/data/field_name:label">
<value>**<img src="Q1.png" >**</value>
</text>
<text id="/data/field_name:hint">
<value>What is your name (last, first)?</value>
</text>
the bolded code did not work.
<?xml version="1.0" encoding="UTF-8"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:jr="http://openrosa.org/javarosa" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><h:head xmlns="">
<h:title>images</h:title><model>
<instance>
<data id="1">
<some_text/>
<image_test/>
</data>
</instance>
<itext>
<translation lang="eng">
<text id="/data/image_test:label">
<value>picture test</value>
</text>
<text id="/data/image_test:a">
<value form="image">jr://images/p1.jpg</value>
</text>
<text id="/data/image_test:b">
<value form="image">jr://images/p2.jpg</value>
</text>
</translation>
</itext>
<bind nodeset="/data/image_test" type="select1"/>
</model>
</h:head>
<h:body xmlns="">
<select1 ref="/data/image_test">
<label ref="jr:itext('/data/image_test:label')"/>
<item>
<label ref="jr:itext('/data/image_test:a')"/>
<value>a</value>
</item>
<item>
<label ref="jr:itext('/data/image_test:b')"/>
<value>b</value>
</item>
<item>
<label ref="jr:itext('/data/image_test:c')"/>
<value>c</value>
</item>
</select1>
</h:body>
</h:html>

Resources