FHIR CI-Build

This is the Continuous Integration Build of FHIR (will be incorrect/inconsistent at times).
See the Directory of published versions icon

Clinical Decision Support icon Work Group Maturity Level: 3Trial Use Compartments: N/A

The apply operation applies a PlanDefinition to a given subject.

The canonical URL for this operation definition is

 http://hl7.org/fhir/OperationDefinition/PlanDefinition-apply

Formal Definition (as a OperationDefinition).

URL: [base]/PlanDefinition/$apply

URL: [base]/PlanDefinition/[id]/$apply

This is an idempotent operation

In Parameters:
NameScopeCardinalityTypeBindingProfileDocumentation
planDefinitiontype0..1PlanDefinition

The plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter is required, or a url (and optionally version) must be supplied

urltype0..1canonical(PlanDefinition)

The url of the plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter (and optionally the version), or the planDefinition parameter must be supplied

versiontype0..1string

The version of the plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter may only be used if the url parameter is supplied.

subject1..*string
(reference)

The subject(s) that is/are the target of the plan to be applied. The subject may be a Patient, Practitioner, Organization, Location, Device, or Group. Subjects provided in this parameter will be resolved as the subject of the PlanDefinition based on the type of the subject. If multiple subjects of the same type are provided, the behavior is implementation-defined

encounter0..1string
(reference)

The encounter in context, if any

practitioner0..1string
(reference)

The practitioner applying the plan definition

organization0..1string
(reference)

The organization applying the plan definition

userType0..1CodeableConcept

The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.)

userLanguage0..1CodeableConcept

Preferred language of the person using the system

userTaskContext0..1CodeableConcept

The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources

setting0..1CodeableConcept

The current setting of the request (inpatient, outpatient, etc.)

settingContext0..1CodeableConcept

Additional detail about the setting of the request, if any

Out Parameters:
NameScopeCardinalityTypeBindingProfileDocumentation
return0..*Bundle

A Bundle for each input subject that is the result of applying the plan definition to that subject

Note: as this is the only out parameter, it is a resource, and it has the name 'return', the result of this operation is returned directly as a resource

The result of this operation is a Bundle for each subject, where the Bundle contains as its first entry a RequestOrchestration that is the direct result of applying the PlanDefinition to that subject, and any subsequent entries in the Bundle are resources that were created or updated as part of that process. The RequestOrchestration will have actions for each of the applicable actions in the plan based on evaluating the applicability condition in context. For each applicable action, the definition is applied as described in the $apply operation of the ActivityDefinition resource, and the resulting resource is added as an entry to the Bundle. If the ActivityDefinition includes library references, those libraries will be available to the evaluated expressions. If those libraries have parameters, those parameters will be bound by name to the parameters given to the operation. In addition, parameters to the $apply operation are available within dynamicValue expressions as context variables, accessible by the name of the parameter, prefixed with a percent (%) symbol. For a more detailed description, refer to the PlanDefinition and ActivityDefinition resource documentation. Note that result of this operation is transient (i.e. none of the resources created by the operation are persisted in the server, they are all returned as entries in the result Bundle(s)). The result effectively represents a proposed set of activities, and it is up to the caller to determine whether and how those activities are actually carried out and/or persisted.

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"?>
<Parameters xmlns="http://hl7.org/fhir">
<Bundle>
  <type value="collection"/>
  <entry>
    <fullUrl value="http://example.org/fhir/RequestOrchestration/apply-operation-response"/>
    <resource>
      <RequestOrchestration>
        <!-- This example demonstrates the result of an $apply operation for the citalopramPrescription activity definition. -->
        <id value="apply-operation-response"/>
        <instantiatesCanonical value="http://example.org/fhir/PlanDefinition/example"/>
        <status value="draft"/>
        <intent value="proposal"/>
        <subject>
      	  <reference value="Patient/124"/>
        </subject>
        <activity>
      	<reference>
      		<reference value="ServiceRequest/referralrequest"/>
      	</reference>
        </activity>
        <activity>
          <reference>
            <reference value="MedicationRequest/citalopramPrescription"/>
          </reference>
        </activity>
      </RequestOrchestration>
    </resource>
  </entry>
  <entry>
    <fullUrl value="http://example.org/fhir/ServiceRequest/referralrequest"/>
    <resource>
      <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>
    </resource>
  </entry>
  <entry>
    <fullUrl value="http://example.org/fhir/Medication/citalopramMedication"/>
    <resource>
      <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 (basic dose form)"/>
            </coding>
            <text value="Tablet dose form"/>
          </form>
          <ingredient>
            <itemReference>
              <reference value="Substance/citalopramSubstance"/>
            </itemReference>
            <amount>
              <numerator>
                <value value="20"/>
                <unit value="mg"/>
              </numerator>
              <denominator>
                <value value="1"/>
                <unit value="{tbl}"/>
              </denominator>
            </amount>
          </ingredient>
      </Medication>
    </resource>
  </entry>
  <entry>
    <fullUrl value="http://example.org/fhir/Substance/citalopramSubstance"/>
    <resource>
      <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>
    </resource>
  </entry>
  <entry>
    <fullUrl value="http://example.org/fhir/MedicationRequest/citalopramPrescription"/>
    <resource>
      <MedicationRequest>
    	  <id value="citalopramPrescription"/>
    	  <status value="draft"/>
    	  <intent value="proposal"/>
    	  <medicationReference>
    		  <reference value="Medication/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="http://example.org/fhir/ActivityDefinition/citalopramPrescription"/>
    	  </definition-->
    	  <instantiates value="http://example.org/fhir/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>
    </resource>
  </entry>
</Bundle>
</Parameters>

 

For more information about operations, including how they are invoked, see Operations.