Current Build
Clinical Decision Support Work Group Maturity Level: 2Trial Use Compartments: N/A

The apply operation applies a definition in a specific context

The official URL for this operation definition is

Formal Definition (as a OperationDefinition).

URL: [base]/ActivityDefinition/$apply

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

This is not an idempotent operation

In Parameters:

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


The patient that is the target of the activity to be applied


The encounter in context, if any


The practitioner in context


The organization in context


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


Preferred language of the person using the system


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


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


Additional detail about the setting of the request, if any

Out Parameters:

The resource that is the result of applying the definition

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. For a more detailed description, refer to the ActivityDefinition resource

Apply a citalopram prescription activity definition to a patient (Request):

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

Returned on successful application (Response):

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8"?>
<MedicationRequest xmlns="">
  <!-- This example demonstrates the result of an $apply operation for the citalopramPrescription activity definition. -->
  <id value="apply-operation-response"/>
	<status value="generated"/>
    <div xmlns="">
      <id value="citalopramMedication"/>
          <system value=""/>
          <code value="200371"/>
        <text value="citalopram"/>
            <system value=""/>
            <code value="385055001"/>
            <display value="Tablet dose form"/>
          <text value="Tablet dose form"/>
            <reference value="#citalopramSubstance"/>
              <value value="20"/>
              <unit value="mg"/>
              <value value="1"/>
              <unit value="{tbl}"/>
      <id value="citalopramSubstance"/>
          <system value=""/>
          <code value="2556"/>
        <text value="citalopram"/>
  <status value="draft"/>
  <intent value="proposal"/>
	  <reference value="#citalopramMedication"/>
	  <reference value="Patient/124"/>
    <reference value="ActivityDefinition/citalopramPrescription"/>
  <instantiates value="ActivityDefinition/citalopramPrescription"/>
	<text value="1 tablet oral 1 time daily"/>
			<frequency value="1"/>
			<period value="1"/>
			<periodUnit value="d"/>
			<code value="26643006"/>
			<display value="Oral route (qualifier value)"/>
		<text value="Oral route (qualifier value)"/>
	      <text value="ordered"/>
			<value value="1"/>
			<unit value="{tbl}"/>
	  <numberOfRepeatsAllowed value="3"/>
		  <value value="30"/>
		  <unit value="{tbl}"/>


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