Use the FHIR $apply operation on a PlanDefinition to generate a CarePlan and RequestGroup for a patient enrolled in a chronic disease management protocol

domain: hl7.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

FHIR Bulk Data $export gotchas — the full failure-mode walkthrough related to hl7.org, checked against official docs, with linked verified routes.

Steps

  1. POST a Parameters resource to the PlanDefinition's $apply endpoint carrying the required subject parameter referencing the Patient, the encounter parameter if applying within an active encounter context, and the practitioner parameter identifying the applying clinician
  2. Confirm that the PlanDefinition has action elements with condition elements specifying applicability conditions in CQL or FHIRPath; the $apply operation evaluates these conditions against the patient context to determine which actions generate Request resources and which are skipped
  3. Parse the returned CarePlan resource to identify which actions were instantiated into activity elements; each activity will reference a RequestOrchestration (formerly RequestGroup in R4) containing the generated ServiceRequest, MedicationRequest, or Task resources
  4. For actions that require a questionnaire to be completed before the activity is applicable, follow the relationship between the CarePlan activity and the linked Questionnaire and use $populate to pre-fill the Questionnaire from existing patient data before presenting it for completion
  5. POST the returned CarePlan to the FHIR server to persist it; then POST any generated Request resources that were returned as contained resources or as separate resource references in the CarePlan activity elements
  6. If the PlanDefinition version changes after initial application, call $apply again with the same patient context and compare the resulting RequestOrchestration to the existing one to identify new actions that must be added to the patient's active care plan

Known gotchas

Related routes

Write US Core CarePlan and CareTeam resources for a patient with chronic conditions and link them to the relevant Conditions and Practitioners managing the patient
hl7.org/fhir/us/core · 5 steps · unrated
Implement FHIR Group resource management to define a patient cohort for population health queries and use the Group as the subject of a Bulk Data $export
hl7.org/fhir/R4 · 5 steps · unrated
Implement a FHIR-based care coordination workflow using Task resources to assign, track, and complete referral tasks between a referring provider and a specialist, with ServiceRequest linking the clinical order to the task
hl7.org/fhir · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans