Clinical Practice Guidelines
3.0.0-ballot - STU 3 Ballot International flag

Clinical Practice Guidelines, published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 3.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/cqf-recommendations/ and changes regularly. See the Directory of published versions

OperationDefinition: CPG PlanDefinition Apply

Official URL: http://hl7.org/fhir/uv/cpg/OperationDefinition/cpg-plandefinition-apply Version: 3.0.0-ballot
Standards status: Trial-use Maturity Level: 4 Computable Name: CPGPlanDefinitionApply
Other Identifiers: OID:2.16.840.1.113883.4.642.40.48.33.4

The apply operation applies a PlanDefinition to a given context

Use this operation to evaluate a guideline definition in a subject's context and obtain proposed activities. It connects reusable recommendation, strategy, and pathway definitions to patient-specific requests.

This CPG operation returns subject-specific Bundles. Its result differs from the CarePlan return of base FHIR R4 PlanDefinition $apply; agree which operation contract the client and service implement. The returned proposals are transient, and the receiving application decides how to present, authorize, and persist selected activities.

Language: en

URL: [base]/PlanDefinition/$apply

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

Parameters

UseNameScopeCardinalityTypeBindingDocumentation
INurl0..1uri

Canonical URL of the PlanDefinition when invoked at the resource type level. This is exclusive with the planDefinition parameter.

INversion0..1string

Version of the PlanDefinition when invoked at the resource type level. This is exclusive with the planDefinition parameter.

INplanDefinition0..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, either this parameter or url (and optionally version) must be supplied.

INsubject1..*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

INencounter0..1string
(reference)

The encounter in context, if any

INpractitioner0..1string
(reference)

The practitioner applying the plan definition

INorganization0..1string
(reference)

The organization applying the plan definition

INuserType0..1CodeableConcept

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

INuserLanguage0..1CodeableConcept

Preferred language of the person using the system

INuserTaskContext0..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

INsetting0..1CodeableConcept

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

INsettingContext0..1CodeableConcept

Additional detail about the setting of the request, if any

INparameters0..1Parameters

Any input parameters defined in libraries referenced by the PlanDefinition. Parameter types are mapped to CQL as specified in the Using CQL With FHIR implementation guide. If a parameter appears more than once in the input Parameters resource, it is represented with a List in the input CQL. If a parameter has parts, it is represented as a Tuple in the input CQL.

INuseServerData0..1boolean

Whether to use data from the server performing the evaluation. If this parameter is true (the default), then the operation will use data first from any bundles provided as parameters (through the data and prefetch parameters), second data from the server performing the operation, and third, data from the dataEndpoint parameter (if provided). If this parameter is false, the operation will use data first from the bundles provided in the data or prefetch parameters, and second from the dataEndpoint parameter (if provided).

INdata0..1Bundle

Data to be made available to the PlanDefinition evaluation. This parameter is exclusive with the prefetchData parameter (i.e. either provide all data as a single bundle, or provide data using multiple bundles with prefetch descriptions).

INprefetchData0..*

Data to be made available to the PlanDefinition evaluation, organized as prefetch response bundles. Each prefetchData parameter specifies either the name of the prefetchKey it is satisfying, a DataRequirement describing the prefetch, or both.

INprefetchData.key0..1string

The key of the prefetch item. This typically corresponds to the name of a parameter in a library, or the name of a prefetch item in a CDS Hooks discovery response

INprefetchData.descriptor0..1DataRequirement

A DataRequirement describing the content of the prefetch item.

INprefetchData.data0..1Bundle

The prefetch data as a Bundle. If the prefetchData has no prefetchResult part, it indicates there is no data associated with this prefetch item.

INdataEndpoint0..1Endpoint

An endpoint to use to access data referenced by retrieve operations in libraries referenced by the PlanDefinition. If provided, this endpoint is used after the data or prefetchData bundles, and the server, if the useServerData parameter is true.

INartifactEndpointConfiguration0..*

Configuration information to resolve canonical artifacts

Processing Semantics:

Create a canonical-like reference (e.g. {canonical.url}|{canonical.version} or similar extensions for non-canonical artifacts).

  • Given a single artifactEndpointConfiguration
    • When artifactRoute is present
      • And the canonical or artifact reference starts with the artifactRoute (up to and including the entire uri)
      • Then attempt to resolve with endpointUri or endpoint
    • When artifactRoute is not present
      • Then attempt to resolve with endpointUri or endpoint
  • Given multiple artifactEndpointConfigurations
    • Then rank order each configuration (see below)
    • And attempt to resolve with endpointUri or endpoint in order until resolved

Rank each artifactEndpointConfiguration such that:

  • if artifactRoute is present and artifactRoute starts with canonical or artifact reference: rank based on number of matching characters
  • if artifactRoute is not present: include but rank lower

NOTE: For evenly ranked artifactEndpointConfigurations, order as defined in the OperationDefinition.

INartifactEndpointConfiguration.artifactRoute0..1uri

An optional route used to determine whether this endpoint is expected to be able to resolve artifacts that match the route (i.e. start with the route, up to and including the entire url)

INartifactEndpointConfiguration.endpointUri0..1uri

The URI of the endpoint, exclusive with the endpoint parameter

INartifactEndpointConfiguration.endpoint0..1Endpoint

An Endpoint resource describing the endpoint, exclusive with the endpointUri parameter

OUTreturn0..*Bundle

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

The result of this operation is a Bundle for each subject, where the Bundle contains Request resources that are the direct result of applying the PlanDefinition to that subject. The Bundle will have entries for each of the applicable actions in the PlanDefinition based on evaluating the applicability condition in context, and producing Request resources based on the definition element for each applicable action.

When an action has child actions, the cqf-applicabilityBehavior extension on that action determines how the applicability conditions of the child actions are evaluated:

  • all: each child action is evaluated independently, and every applicable child action is included in the result.
  • any: the child actions are evaluated in order, and only the first applicable child action is included in the result. The remaining child actions are not evaluated.

If the extension is not present, child actions are evaluated as all. Applicability behavior determines which child actions are included in the result. The selectionBehavior of the action then describes how the user may select among the included actions. When the result is returned as a RequestGroup, the corresponding RequestGroup action carries the same cqf-applicabilityBehavior value.

An action may also carry the cpg-preferenceBehavior extension, which conveys how the guideline regards the action once it is included (preferred, recommended, neutral, or not recommended). Preference does not affect which actions are included: applicability is determined only by the action conditions of kind applicability. When the result is returned as a RequestGroup, the operation SHOULD copy the cpg-preferenceBehavior value from each PlanDefinition action to the corresponding RequestGroup action. A dynamicValue may compute or override the value at runtime.

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 in the Bundle. The resulting Bundle may be any combination of Request resources, including CarePlan, RequestGroup, and individual Request resources such as ServiceRequest and MedicationRequest.

Note that to preserve the structure of the PlanDefinition, systems may choose to return the requests in a RequestGroup. In this case, the individual request resources will have an intent of option, meaning that their intent is governed by the RequestGroup.

Warning and information messages generated by the logic engine while evaluating the PlanDefinition SHOULD be communicated using the cqf-messages extension, which references an OperationOutcome containing the messages. All messages for the operation are reported on the topmost resulting resource: the RequestGroup or CarePlan that contains the other resulting resources or, when the result is a single request resource, that resource. To ensure there is a single topmost resource, systems that return more than one request resource SHOULD return them within a RequestGroup. The OperationOutcome is included as a contained resource of the topmost resulting 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 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.

Notes:

  • Identify a stored definition through an instance invocation, or use the type-level planDefinition input or url with an optional version. Supply the subject references using the declared string parameter and provide the relevant encounter and user context.
  • Choose data or prefetchData for supplied evaluation data. Evaluation looks first at supplied data, then at server data if useServerData is true (the default), then at dataEndpoint when supplied. The parameters input supplies named Library parameters, and artifactEndpointConfiguration can configure canonical artifact resolution.
  • In STU3, this operation drops the mergeNestedCarePlans and terminologyEndpoint parameters. See the STU3 change log.
  • The declared return cardinality is 0..* Bundles, with a Bundle described for each evaluated subject. A result can contain individual requests, CarePlans, or RequestGroups. When a RequestGroup preserves the action structure, its child requests use option intent.
  • For grouped actions, evaluate child applicability according to cqf-applicabilityBehavior and inspect the applicable children and copied behavior on any returned RequestGroup action. See the processing rules.
  • Preference behavior does not affect applicability. When the result preserves the action structure in a RequestGroup, copy each action's cpg-preferenceBehavior value to the corresponding RequestGroup action, applying any dynamicValue that computes it. See Express preference among options.
  • Evaluation messages are described through cqf-messages on the topmost result, referencing a contained OperationOutcome; check it for warnings and informational messages when interpreting the proposals. A RequestGroup can provide a single topmost resource when the response contains multiple requests.
  • Inspect the proposed resources and evaluation messages before committing actions. Invoking $apply does not persist its results or establish that care occurred.

Continue with execution methods, interactive CDS, and activity flow.