This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.
12.22.1 Scope and Usage
This resource is a definition resource from a FHIR workflow perspective - see Workflow, specifically Definition.
An ActivityDefinition is a shareable, consumable description of some activity to be performed. It may be used to specify actions to be taken as part of a workflow, order set, or protocol, or it may be used independently as part of a catalog of activities such as orderables.
For more information on how activity definitions can be used to construct request resources, see the Applying an ActivityDefinition topic below.
12.22.2 Boundaries and Relationships
In general, an activity definition is simply a conceptual description of some specific action that should be taken. An instance of an ActivityDefinition does not indicate that any action has been performed (as an event resource does), nor does it indicate the actual intent to carry out any particular action (as a request resource does). Instead, an activity definition provides a reusable template that can be used to construct specific request resources such as ServiceRequest and MedicationRequest.
Note that this is conceptually similar to the Task resource as well, with the distinction being that ActivityDefinition represents the description of a task in the abstract, while the Task resource is used to track a specific instance of a task as it moves through the steps of a workflow.
The definition of a specific activity to be taken, independent of any particular patient or context + Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation
Canonical identifier for this activity definition, represented as a URI (globally unique) + Warning: URL should not contain | or # - these characters make processing canonical references problematic
The definition of a specific activity to be taken, independent of any particular patient or context + Warning: Name should be usable as an identifier for the module by machine processing applications such as code generation
Canonical identifier for this activity definition, represented as a URI (globally unique) + Warning: URL should not contain | or # - these characters make processing canonical references problematic
Either a practitioner role or a relationship type. Note from UTG import - may have been a temporary entry that subsequently disappeared from the FHIR source; unable to locate. Version set to 0.1.0
This value set includes all drug or medicament substance codes and all pharmaceutical/biologic products from SNOMED CT - provided as an exemplar value set.
URL should not contain | or # - these characters make processing canonical references problematic
exists() implies matches('^[^|# ]+$')
12.22.4.3 Applying an ActivityDefinition
An ActivityDefinition resource provides a description, or template, of an action to performed. These actions can be purely text-based descriptions of the action to be performed, only interpretable by a human user, or they can be structured definitions with enough information to construct a resource to represent the request or activity directly. This process of converting the ActivityDefinition into a specific resource in a particular context is performed with the $apply operation.
In the simplest case, the process maps the elements specified in the ActivityDefinition to the corresponding elements on a resource of the appropriate type, using the kind element of the definition to determine the type of resource to be created.
More dynamic scenarios can be achieved in one of two ways, either by providing dynamicValue expressions, or by specifying a StructureMap that transforms the definition into the appropriate request resource.
Note that systems will likely vary widely in the degree of support they provide for the $apply operation. In particular, the fact that a system supports applying definitions of one category, does not imply that it supports applying definitions for all categories. For example, a service focused on medication order sets may have sophisticated support for MedicationRequest activities, but no support at all for the ServiceRequest activities.
The following diagram illustrates the relationship between the PlanDefinition and ActivityDefinition resources, as well as a typical application to CarePlan, RequestOrchestration, and Request resources:
To accommodate the variability in systems and use cases, this specification is not prescriptive about exactly how an ActivityDefinition is applied to produce target request resources. However, the approach depicted above provides a general framework for the process, and the following steps provide more detail on the potential approach:
Create the target resource of the type specified by the kind element and focused on the Patient in context
Set the status of the target resource to draft
Set the intent of the target resource to option
Apply the structural elements of the ActivityDefinition to the target resource such as code, timing, doNotPerform, product, quantity, dosage, and so on
Resolve the participant element based on the user in context
Resolve the location element based on the location in context
If the transform element is specified, apply the transform to the resource. Note that the referenced StructureMap may actually construct the resource, rather than taking an instance. See the StructureMap for more information
Apply any dynamicValue elements (in the order in which they appear in the ActivityDefinition resource) by evaluating the expression and setting the value of the appropriate element of the target resource (as specified by the dynamicValue.path element)
Note that the parameters to the $apply operation are available within dynamicValue CQL and FHIRPath expressions as context variables, accessible by the name of the parameter prefixed with a percent (%) symbol. For example, to access the subject given to the apply, use the expression %subject.
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.
12.22.4.4 Event Resources
The kind element may only specify Request resource types to facilitate considering user input as part of processing the result of any automated clinical reasoning processes. To support creation of event resources, such as Observations, RiskAssessments, and DetectedIssues, use a Task resource with the focus of the task set to the event resource to be created.
12.22.4.5 Profiling ActivityDefinition
Because the ActivityDefinition resource can be used to describe many different types of request resources, profiles of the resource will be useful in communicating additional constraints and expectations about how the resource should be used in a particular context. For example, a profile of ActivityDefinition may specify that it is intended to describe medication orders within an order set. Such a profile would indicate that the quantity element should not be used, but the dosage element must be.
12.22.4.6 ActivityDefinition Structure Mapping
The following sections provide FHIR Mapping Language snippets for mapping ActivityDefinition instances to each kind of Request resource that can be created.
12.22.4.6.1 Appointment
map "http://research.philips.com/fhir/r4/mapping/AdToAppointment" =
"R3 Parameters of Activitydefinition.$apply to Appointment"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/Appointment" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.participant as participant then {
doActor: for sbj as sbj make participant.actor=sbj
doStatus: for sbj as sbj make participant.status ="needs-action"
}
}
// "practitioner" : for src.parameter as p where name='practitioner' then{
// do: for p.value as prac make tgt.requester = prac
// }
"organization" : for src as src where
parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
then{
do: for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.requester = org
}
}
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.encounter = enc
// }
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ServiceRequest as target
// "refAd" : for src.url as vvv make tgt.basedOn = vvv
// "ad.code" : for src.code as vvv make tgt.code = vvv // could be serviceCategory or specialty --> unclear
// "intent" : for src make tgt.intent = "proposal"
"ad.priority" : for src where priority='routine' then {
prio: for src make tgt.priority = 9
}
"ad.priority" : for src.priority as priority where priority='urgent' then {
prio: for priority make tgt.priority = 7
}
"ad.priority" : for src.priority as priority where priority='asap' then {
prio: for priority make tgt.priority = 4
}
"ad.priority" : for src.priority as priority where priority='stat' then {
prio: for priority make tgt.priority = 1
}
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.timingP1" : for src.timing :Period as period make tgt.start = period.start
"ad.timingP2" : for src.timing :Period as period make tgt.end = period.end
"ad.timingD" : for src.timing :Duration as duration make tgt.minutesDuration = duration
"ad.timingDT" : for src.timing :dateTime as dt make tgt.start = dt
"ad.location" : for src.location as location make tgt.participant as participant then {
doActor: for location make participant.actor = location
doStatus: for location make participant.status = "needs-action"
}
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as vvv check quantity.empty()
// "ad.bodysite" : for src.bodySite as vvv make tgt.bodySite = vvv
// "ad.dosage" : for src as vvv check dosage.empty()
// "intent" : for src make tgt.intent = "proposal"
"status" : for src make tgt.status = "proposed"
"created" : for src make tgt.created = evaluate( src, now() )
endgroup
12.22.4.6.2 AppointmentResponse
map "http://research.philips.com/fhir/r4/mapping/AdToAppointmentResponse" =
"R3 Parameters of Activitydefinition.$apply to AppointmentResponse"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/AppointmentResponse" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
// "subject" : for src.parameter as p where name='subject' then {
// do: for p.value as sbj make tgt.subject = sbj
// }
//
// "practitioner" : for src.parameter as p where name='practitioner' then{
// do: for p.value as prac make tgt.requester = prac
// }
//
// "organization" : for src as src where
// parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
// then{
// do: for src.parameter as p where name='organization' then{
// do: for p.value as org make tgt.requester = org
// }
// }
//
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.encounter = enc
// }
// unsure who the actor is. No default makes sense - leave empty.
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ServiceRequest as target
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"status" : for src make tgt.participantStatus = "needs-action"
// "intent" : for src make tgt.intent = "proposal"
// "ad.code" : for src.code as vvv make tgt.code = vvv
// "ad.timing" : for src.timing as timing make tgt.start = timing // unsure how to map on start/end
// "ad.location" : for src.location as vvv make tgt.locationReference = vvv
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as vvv check quantity.empty()
// "ad.bodysite" : for src.bodySite as vvv make tgt.bodySite = vvv
// "ad.dosage" : for src as vvv check dosage.empty()
endgroup
12.22.4.6.3 CarePlan
map "http://research.philips.com/fhir/r4/mapping/AdToCarePlan" =
"R3 Parameters of Activitydefinition.$apply to CarePlan"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/CarePlan" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.subject = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.author = prac
}
"organization" : for src as src where
parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
then{
do: for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.author = org
}
}
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ServiceRequest as target
"ad.code" : for src.code as vvv make tgt.category = vvv
// "ad.priority" : for src.priority as prio make tgt.priority = vvv
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.timing" : for src.timing as timing make tgt.period = timing
// "ad.location" : for src.location as location make tgt.location=location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as vvv check quantity.empty()
// "ad.bodysite" : for src.bodySite as vvv make tgt.bodySite = vvv
// "ad.dosage" : for src as vvv check dosage.empty()
"refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"status" : for src make tgt.status = "draft"
"intent" : for src make tgt.intent = "proposal"
"created" : for src make tgt.created = evaluate( src, now() )
endgroup
12.22.4.6.4 Claim
map "http://research.philips.com/fhir/r4/mapping/AdToClaim" =
"R3 Parameters of Activitydefinition.$apply to Claim"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/Claim" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.patient = sbj
}
"practitioner1" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.enterer = prac
}
"organization" : for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.provider = org
}
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.encounter = enc
// }
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: Claim as target
"ad.code" : for src.code as vvv make tgt.type = vvv
"ad.priority1" : for src where priority.exists() then {
do: for src.priority as priority make tgt.priority as tgtprioCc then {
doCoding: for priority make tgtprioCc.coding as tgtCoding then {
system: for priority make tgtCoding.system = "http://hl7.org/fhir/ValueSet/request-priority"
code: for priority make tgtCoding.code = priority
}
}
}
"ad.priority2" : for src where priority.exists().not() then {
do: for src make tgt.priority as tgtprioCc then {
doCoding: for src make tgtprioCc.coding as tgtCoding then {
system: for src make tgtCoding.system = "http://hl7.org/fhir/ValueSet/request-priority"
code: for src make tgtCoding.code = "normal"
}
}
}
// "ad.timing" : for src.timing as timing make tgt.period = timing
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.location" : for src.location as location make tgt.facility = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"status" : for src make tgt.status = "draft"
"use" : for src make tgt.use = "claim"
"created" : for src make tgt.created = evaluate( src, now() )
endgroup
12.22.4.6.5 CommunicationRequest
map "http://research.philips.com/fhir/r4/mapping/AdToCommunicationRequest" =
"R3 Parameters of Activitydefinition.$apply to CommunicationRequest"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/CommunicationRequest" as target
group main
input src: Parameters as source
input tgt: ProcedureRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.subject = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.requester = prac
}
"organization" : for src.parameter as p where
parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
then {
do: for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.requester = org
}
}
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ProcedureRequest as target
"basedOn" : for src make tgt.basedOn = reference( src )
"status" : for src make tgt.status = "draft"
"authoredOn" : for src make tgt.authoredOn = evaluate( src, now() )
"ad.code" : for src.code as vvv make tgt.reasonCode = vvv
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.timing" : for src.timing as vvv make tgt.occurrence = vvv
// "ad.location" : for src as vvv check location.empty()
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as vvv check quantity.empty()
// "ad.bodysite" : for src as vvv check bodysite.empty()
// "ad.dosage" : for src as vvv check dosage.empty()
endgroup
12.22.4.6.6 Contract
map "http://research.philips.com/fhir/r4/mapping/AdToContract" =
"R3 Parameters of Activitydefinition.$apply to Contract"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/Contract" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.subject = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.author = prac
}
"organization" : for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.authority = org
}
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.context = enc
// }
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: Contract as target
"ad.code" : for src.code as code make tgt.scope = code
// "ad.priority" : for src as priority make tgt.priority as tgtprioCc
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.timing" : for src.timing as timing make tgt.applies = timing
"ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
// "status" : for src make tgt.status = "draft"
// "use" : for src make tgt.use = "claim"
// "created" : for src make tgt.created = evaluate( src, now() )
endgroup
12.22.4.6.7 DeviceRequest
map "http://research.philips.com/fhir/r4/mapping/AdToDeviceRequest" =
"R3 Parameters of Activitydefinition.$apply to DeviceRequest"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/DeviceRequest" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.subject = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.requester = prac
}
"organization" : for src as src where
parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
then{
do: for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.requester = org
}
}
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: DeviceRequest as target
"ad.code" : for src.code as code make tgt.code = code
"ad.priority" : for src.priority as vvv make tgt.priority = vvv
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
"refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"intent" : for src make tgt.intent = "proposal"
// "use" : for src make tgt.use = "claim"
// "created" : for src make tgt.created = evaluate( src, now() )
endgroup
12.22.4.6.8 EnrollmentRequest
map "http://research.philips.com/fhir/r4/mapping/AdToEnrollmentRequest" =
"R3 Parameters of Activitydefinition.$apply to EnrollmentRequest"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/EnrollmentRequest" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.candidate = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.provider = prac
}
// "organization" : for src as src where
// parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
// then{
// do: for src.parameter as p where name='organization' then{
// do: for p.value as org make tgt.requester = org
// }
// }
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.encounter = enc
// }
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: EnrollmentRequest as target
// "ad.code" : for src.code as code make tgt.code = code
// "ad.priority" : for src.priority as priority make tgt.priority as priority
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
// "ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
// "intent" : for src make tgt.intent = "proposal"
// "use" : for src make tgt.use = "claim"
"created" : for src make tgt.created = evaluate( src, now() )
endgroup
12.22.4.6.9 ImmunizationRecommendation
map "http://research.philips.com/fhir/r4/mapping/AdToImmunizationRecommendation" =
"R3 Parameters of Activitydefinition.$apply to ImmunizationRecommendation"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.patient = sbj
}
// "practitioner" : for src.parameter as p where name='practitioner' then{
// do: for p.value as prac make tgt.provider = prac
// }
"organization" : for src as src where name='organization' then{
do: for p.value as organization make tgt.authority = organization
}
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.encounter = enc
// }
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ImmunizationRecommendation as target
// "ad.code" : for src.code as code make tgt.code = code
// "ad.priority" : for src.priority as priority make tgt.priority as priority
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
// "ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
// "intent" : for src make tgt.intent = "proposal"
// "use" : for src make tgt.use = "claim"
"created" : for src make tgt.date = evaluate( src, now() )
endgroup
12.22.4.6.10 MedicationRequest
map "http://research.philips.com/fhir/r4/mapping/AdToMedicationRequest" =
"R3 Parameters of Activitydefinition.$apply to MedicationRequest"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/MedicationRequest" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.subject = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
doReq: for p.value as prac make tgt.requester = prac
doRec: for p.value as prac make tgt.recorder = prac
}
"organization" : for src as src where
parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
then{
do: for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.requester = org
}
}
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: MedicationRequest as target
"ad.code" : for src.code as code make tgt.reasonCode = code
"ad.priority" : for src.priority as priority make tgt.priority = priority
"ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.doNotPerform as doNotPerform
// "ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
"ad.product" : for src.product as product make tgt.medication = product
// "ad.quantity" : for src.quantity as quantity make tgt.quantity as tgt
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
"ad.dosage" : for src.dosage as dosage make tgt.dosageInstruction = dosage
dispenseRequest: for src make tgt.dispenseRequest as dispenseRequest then {
dr.q: for src.quantity as quantity make dispenseRequest.quantity = quantity
dr.di: for src.timing : Duration as timing make dispenseRequest.dispenseInterval = timing
dr.di: for src.timing : Period as timing make dispenseRequest.validityPeriod = timing
}
"refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"intent" : for src make tgt.intent = "proposal"
"status" : for src make tgt.status = "active"
"created" : for src make tgt.authoredOn = evaluate( src, now() )
endgroup
12.22.4.6.11 NutritionOrder
map "http://research.philips.com/fhir/r4/mapping/AdToNutritionOrder" =
"R3 Parameters of Activitydefinition.$apply to NutritionOrder"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/NutritionOrder" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.patient = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.orderer = prac
}
// "organization" : for src as src where
// parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
// then{
// do: for src.parameter as p where name='organization' then{
// do: for p.value as org make tgt.requester = org
// }
// }
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: NutritionOrder as target
"ad.code1" : for src where doNotPerform then {
prMod: for src.code as code make tgt.foodPreferenceModifier = code
}
"ad.code2" : for src where doNotPerform.not() then {
prMod: for src.code as code make tgt.excludeFoodModifier = code
}
// "ad.priority" : for src.priority as priority make tgt.priority as priority
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
// "ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
"refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"intent" : for src make tgt.intent = "proposal"
"status" : for src make tgt.status = "active"
"created" : for src make tgt.dateTime = evaluate( src, now() )
endgroup
12.22.4.6.12 ServiceRequest
map "http://research.philips.com/fhir/r4/mapping/AdToServiceRequest" =
"R3 Parameters of Activitydefinition.$apply to ServiceRequest"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" as target
group main
input src: Parameters as source
input tgt: ReferralRequest as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.subject = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.requester = prac
}
"organization" : for src as src where
parameter.where( name='practitioner').exists().not() and parameter.where( name='organization').exists()
then{
do: for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.requester = org
}
}
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ServiceRequest as target
"refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"status" : for src make tgt.status = "draft"
"intent" : for src make tgt.intent = "proposal"
"ad.code" : for src.code as vvv make tgt.code = vvv
"ad.timing" : for src.timing as vvv make tgt.occurrence = vvv
"ad.location" : for src.location as vvv make tgt.locationReference = vvv
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as vvv check quantity.empty()
"ad.bodysite" : for src.bodySite as vvv make tgt.bodySite = vvv
// "ad.dosage" : for src as vvv check dosage.empty()
endgroup
12.22.4.6.13 SupplyRequest
map "http://research.philips.com/fhir/r4/mapping/AdToSupplyRequest" =
"R3 Parameters of Activitydefinition.$apply to SupplyRequest"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/SupplyRequest" as target
group main
input src: Parameters as source
input tgt: SupplyRequest as target
// "subject" : for src.parameter as p where name='subject' then {
// do: for p.value as sbj make tgt.subject = sbj
// }
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.requester = prac
}
"organization" : for src.parameter as p where name='organization' then{
do: for p.value as org make tgt.requester =org
}
// "encounter" : for src.parameter as p where name='encounter' then {
// do: for p.value as enc make tgt.context = enc
// }
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: SupplyRequest as target
"ad.code" : for src.code as code make tgt.item = code
"ad.priority" : for src.priority as priority make tgt.priority = priority
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
"ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
"ad.quantity" : for src.quantity as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"status" : for src make tgt.status = "draft"
"authoredOn" : for src make tgt.authoredOn = evaluate( src, now() )
endgroup
12.22.4.6.14 Task
map "http://research.philips.com/fhir/r4/mapping/Task" =
"R3 Parameters of Activitydefinition.$apply to Task"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/Task" as target
group main
input src: Parameters as source
input tgt: Task as target
"for" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.for = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.requester as requester then{
do: for prac make requester.agent = prac
}
}
"organization" : for src.parameter as p where name='organization' then {
do: for p.value as org make tgt.requester as requester then {
do: for org make requester.onBehalfOf = org
}
}
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: ProcedureRequest as target
// "basedOn" : for src make tgt.basedOn = reference( src )
refAd : for src.url as can make tgt.instantiatesCanonical = can
"status" : for src make tgt.status = "draft"
"ad.code" : for src.code as vvv make tgt.code = vvv
// "ad.timing" : for src as vvv check timing.empty() ==>restriction.period
// "ad.location" : for src as vvv check location.empty()
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src as vvv check quantity.empty()
// "ad.bodysite" : for src as vvv check bodysite.empty()
// "ad.dosage" : for src as vvv check dosage.empty()
// "ad.relatedart": for src.relatedArtifact as relatedArtifact make tgt.payload as payload then {
// do: for relatedArtifact as relatedArtifact make payload.content as content then {
// "content": for relatedArtifact as vvv make content = vvv
// "display" : for relatedArtifact.display as vvv make content
// "citation": for relatedArtifact as vvv make content = vvv
// "url" : for relatedArtifact as vvv make content = vvv
// "document": for relatedArtifact as vvv make content = vvv
// "resource": for relatedArtifact as vvv make content = vvv
// }
// }
endgroup
12.22.4.6.15 VisionPrescription
map "http://research.philips.com/fhir/r4/mapping/AdToVisionPrescription" =
"R3 Parameters of Activitydefinition.$apply to VisionPrescription"
uses "http://hl7.org/fhir/StructureDefinition/Parameters" as source
uses "http://hl7.org/fhir/StructureDefinition/VisionPrescription" as target
group main
input src: Parameters as source
input tgt: VisionPrescription as target
"subject" : for src.parameter as p where name='subject' then {
do: for p.value as sbj make tgt.patient = sbj
}
"practitioner" : for src.parameter as p where name='practitioner' then{
do: for p.value as prac make tgt.prescriber = prac
}
// "organization" : for src.parameter as p where name='organization' then{
// do: for p.value as org make tgt.requester =org
// }
"encounter" : for src.parameter as p where name='encounter' then {
do: for p.value as enc make tgt.encounter = enc
}
actded: for src.parameter as p where name='source' then {
do: for p.resource as ad then createActDef( ad, tgt )
}
endgroup
group createActDef
input src: ActivityDefinition as source
input tgt: VisionPrescription as target
// "ad.code" : for src.code as code make tgt.item = code
// "ad.priority" : for src.priority as priority make tgt.priority = priority
// "ad.doNotPerform" : for src.doNotPerform as doNotPerform make tgt.priority as priority
// "ad.timing" : for src.timing as timing make tgt.occurrence = timing
// "ad.location" : for src.location as location make tgt.site = location
// "ad.product" : for src as vvv check product.empty()
// "ad.quantity" : for src.quantity as quantity make tgt.quantity = quantity
// "ad.bodysite" : for src.bodySite as bodysite make tgt.bodySite = bodysite
// "ad.dosage" : for src as vvv check dosage.empty()
// "refAd" : for src.url as vvv make tgt.instantiatesCanonical = vvv
"status" : for src make tgt.status = "draft"
"created" : for src make tgt.created = evaluate( src, now() )
endgroup