How to apply PlanDefinition inorder to generate a carePlan

580 views Asked by At

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.

3

There are 3 answers

2
BlessedHIT On

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>
0
Lakshman Battula On

I am actively looking for the Plandefinition$apply operation usage or implementation. as @code tutorial meny

0
Bryn Rhodes On

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.