R6 Ballot (2nd Draft)

Publish-box (todo)

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

The apply operation applies a definition in a specific context.

The canonical URL for this operation definition is

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

Formal Definition (as a OperationDefinition).

URL: [base]/ActivityDefinition/$apply

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

This is an idempotent operation

In Parameters:
Name Scope Cardinality Type Binding Profile Documentation
activityDefinition type 0..1 ActivityDefinition

The activity definition to apply. If the operation is invoked on an instance, this parameter is not allowed. If the operation is invoked at the type level, this parameter is required

subject 1..* string
(reference)

The subject(s) that is/are the target of the activity definition 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

encounter 0..1 string
(reference)

The encounter in context, if any

practitioner 0..1 string
(reference)

The practitioner in context

organization 0..1 string
(reference)

The organization in context

userType 0..1 CodeableConcept

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

userLanguage 0..1 CodeableConcept

Preferred language of the person using the system

userTaskContext 0..1 CodeableConcept

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

setting 0..1 CodeableConcept

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

settingContext 0..1 CodeableConcept

Additional detail about the setting of the request, if any

Out Parameters:
Name Scope Cardinality Type Binding Profile Documentation
return 1..1 Resource

The resource that is the result of applying the definition

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 invoking this operation is a resource of the type specified by the activity definition, with all the definitions resolved as appropriate for the type of resource. Any dynamicValue elements will be evaluated (in the order in which they appear in the resource) and the results applied to the returned resource. 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 ActivityDefinition resource. 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 contained resources in the result). 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.

Request: Apply a citalopram prescription activity definition to a patient

GET [base]/ActivityDefinition/citalopramPrescription/$apply?subject=Patient/124

Response: Returned on successful application

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<MedicationRequest 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>
    <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="#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>
  <status value="draft"/>
  <intent value="proposal"/>
  <medicationReference>
	  <reference value="#citalopramMedication"/>
  </medicationReference>
  <subject>
	  <reference value="Patient/124"/>
  </subject>
  <!--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>

 

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