### PlanDefinition Turtle Template Example
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
An example of how to represent a PlanDefinition resource using the Turtle RDF syntax. It includes common properties like url, identifier, and specifies the resource type as PlanDefinition.
```turtle
@prefix fhir: .
[ a fhir:[**PlanDefinition**](plandefinition-definitions.html#PlanDefinition "This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical artifacts such as clinical decision support rules, order sets and protocols.");
fhir:nodeRole fhir:treeRoot; # if this is the parser root
# from [Resource](resource.html): [.id](resource.html#id), [.meta](resource.html#meta), [.implicitRules](resource.html#implicitRules), and [.language](resource.html#language)
# from [DomainResource](domainresource.html): [.text](narrative.html#Narrative), [.contained](references.html#contained), [.extension](extensibility.html), and [.modifierExtension](extensibility.html#modifierExtension)
fhir:[PlanDefinition.url](plandefinition-definitions.html#PlanDefinition.url "An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.") [ uri](datatypes.html#uri) ;
fhir:[PlanDefinition.identifier](plandefinition-definitions.html#PlanDefinition.identifier "A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.") [ Identifier](datatypes.html#Identifier)
```
--------------------------------
### FHIR Search for PlanDefinitions (Bash)
Source: https://context7.com/trifork/thp-context7/llms.txt
Provides bash examples for searching PlanDefinition resources using the FHIR API. It demonstrates searching by type, status, title, description, and jurisdiction.
```bash
# Search for PlanDefinitions by type
curl -X GET "https://fhir.example.org/PlanDefinition?type=order-set&status=active" \
-H "Accept: application/fhir+json" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
# Search by title or description
curl -X GET "https://fhir.example.org/PlanDefinition?title:contains=diabetes" \
-H "Accept: application/fhir+json"
# Search by jurisdiction
curl -X GET "https://fhir.example.org/PlanDefinition?jurisdiction=urn:iso:std:iso:3166|US" \
-H "Accept: application/fhir+json"
```
--------------------------------
### FHIR $apply Operation Example (Bash)
Source: https://context7.com/trifork/thp-context7/llms.txt
Demonstrates how to use the FHIR $apply operation via curl to instantiate a PlanDefinition for a specific patient. It includes various parameters to define the context of the application, such as subject, encounter, and user role.
```bash
# Apply a PlanDefinition to a specific patient
curl -X POST "https://fhir.example.org/PlanDefinition/low-suicide-risk-order-set/$apply" \
-H "Content-Type: application/fhir+json" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-d '{
"resourceType": "Parameters",
"parameter": [{
"name": "subject",
"valueString": "Patient/12345"
}, {
"name": "encounter",
"valueString": "Encounter/67890"
}, {
"name": "practitioner",
"valueString": "Practitioner/99999"
}, {
"name": "organization",
"valueString": "Organization/11111"
}, {
"name": "userType",
"valueCodeableConcept": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/practitioner-role",
"code": "doctor"
}]
}
}, {
"name": "userLanguage",
"valueCodeableConcept": {
"coding": [{
"system": "urn:ietf:bcp:47",
"code": "en-US"
}]
}
}, {
"name": "userTaskContext",
"valueCodeableConcept": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/task-code",
"code": "fulfill"
}]
}
}, {
"name": "setting",
"valueCodeableConcept": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP",
"display": "inpatient encounter"
}]
}
}]
}'
# Expected Response: CarePlan or RequestGroup with instantiated actions
{
"resourceType": "CarePlan",
"status": "draft",
"intent": "order",
"subject": {
"reference": "Patient/12345"
},
"encounter": {
"reference": "Encounter/67890"
},
"activity": [{
"reference": {
"reference": "ServiceRequest/med-order-1"
}
}, {
"reference": {
"reference": "ServiceRequest/lab-order-1"
}
}]
}
```
--------------------------------
### PlanDefinition Actions with Conditions and Triggers
Source: https://context7.com/trifork/thp-context7/llms.txt
Demonstrates how to define actions within a PlanDefinition with conditional logic, event triggers, and participant roles. This diabetes screening protocol example includes CQL-based applicability conditions, named event triggers, and references to ActivityDefinition resources for executable clinical activities.
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/diabetes-screening",
"name": "DiabetesScreening",
"title": "Diabetes Screening Protocol",
"status": "active",
"action": [{
"prefix": "1",
"title": "Order HbA1c Test",
"description": "Order glycated hemoglobin test for diabetes screening",
"priority": "routine",
"code": [{
"coding": [{
"system": "http://snomed.info/sct",
"code": "165395008",
"display": "HbA1c measurement"
}]
}],
"trigger": [{
"type": "named-event",
"name": "annual-physical-exam"
}],
"condition": [{
"kind": "applicability",
"expression": {
"language": "text/cql",
"expression": "Patient.age >= 45 or Patient.bmi >= 25"
}
}],
"participant": [{
"type": "practitioner",
"role": {
"coding": [{
"system": "http://snomed.info/sct",
"code": "309343006",
"display": "Physician"
}]
}
}],
"definitionCanonical": "http://example.org/ActivityDefinition/hba1c-test"
}]
}
```
--------------------------------
### PlanDefinition with Goals and Target Measures
Source: https://context7.com/trifork/thp-context7/llms.txt
Shows how to define goals within a PlanDefinition resource, including goal categories, priorities, and measurable targets. This weight loss management protocol example demonstrates setting specific health outcomes with LOINC coding for body weight measurement and timeframes for achievement.
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/weight-loss-protocol",
"name": "WeightLossProtocol",
"title": "Weight Loss Management Protocol",
"status": "active",
"goal": [{
"category": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/goal-category",
"code": "dietary"
}]
},
"description": {
"text": "Achieve target weight reduction"
},
"priority": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/goal-priority",
"code": "high-priority"
}]
},
"start": {
"text": "At enrollment"
},
"addresses": [{
"coding": [{
"system": "http://snomed.info/sct",
"code": "414916001",
"display": "Obesity"
}]
}],
"target": [{
"measure": {
"coding": [{
"system": "http://loinc.org",
"code": "29463-7",
"display": "Body weight"
}]
},
"detailQuantity": {
"value": 150,
"unit": "lbs",
"system": "http://unitsofmeasure.org",
"code": "[lb_av]"
},
"due": {
"value": 6,
"unit": "months",
"system": "http://unitsofmeasure.org",
"code": "mo"
}
}]
}]
}
```
--------------------------------
### PlanDefinition XML Structure Example
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
This XML snippet illustrates the basic structure of a PlanDefinition resource within the HL7 FHIR standard. It includes common elements like url, identifier, version, name, title, and subtitle, which are used for identifying and describing the plan definition.
```xml
```
--------------------------------
### Basic PlanDefinition Resource Structure with Metadata
Source: https://context7.com/trifork/thp-context7/llms.txt
Demonstrates the fundamental structure of a FHIR PlanDefinition resource including resource type, identifiers, versioning, status, and descriptive metadata. This example shows a low suicide risk order set with standard FHIR elements like URL, identifier system/value pairs, and publication details.
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/example-protocol",
"identifier": [{
"system": "http://hospital.org/protocols",
"value": "PROTO-001"
}],
"version": "1.0.0",
"name": "LowSuicideRiskOrderSet",
"title": "Low Suicide Risk Order Set",
"subtitle": "Standardized care protocol for low-risk patients",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/plan-definition-type",
"code": "order-set",
"display": "Order Set"
}]
},
"status": "active",
"experimental": false,
"date": "2023-01-15T00:00:00Z",
"publisher": "Example Healthcare Organization",
"description": "A comprehensive order set for managing patients identified as low suicide risk",
"purpose": "To standardize care delivery and ensure consistent treatment approaches",
"copyright": "© 2023 Example Healthcare Organization"
}
```
--------------------------------
### POST /PlanDefinition/{id}/goal
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Creates a new goal definition within a PlanDefinition resource. Allows specification of goal start events, addressed conditions, supporting documentation, and measurable targets.
```APIDOC
## POST /PlanDefinition/{id}/goal
### Description
Creates a new goal definition within a PlanDefinition resource with start events, addressed conditions, and target outcomes.
### Method
POST
### Endpoint
/PlanDefinition/{id}/goal
### Parameters
#### Path Parameters
- **id** (string) - Required - The PlanDefinition resource identifier
#### Request Body
- **start** (CodeableConcept) - Optional - When goal pursuit begins
- **addresses** (CodeableConcept[]) - Optional - Conditions or problems the goal addresses
- **documentation** (RelatedArtifact[]) - Optional - Supporting resources for the goal
- **target** (BackboneElement[]) - Optional - Target outcomes with measures and due dates
### Request Example
{
"start": {
"coding": [{
"system": "http://loinc.org",
"code": "LA123-4",
"display": "At start of plan"
}]
},
"addresses": [{
"coding": [{
"system": "http://snomed.info/sct",
"code": "38341003",
"display": "Hypertension"
}]
}],
"target": [{
"measure": {
"coding": [{
"system": "http://loinc.org",
"code": "3141-9",
"display": "Body weight"
}]
},
"detailQuantity": {
"value": 150,
"unit": "pounds",
"system": "http://unitsofmeasure.org",
"code": "[lb_av]"
}
}]
}
### Response
#### Success Response (201)
- **resourceType** (string) - "PlanDefinition"
- **id** (string) - Newly created PlanDefinition identifier
- **goal** (BackboneElement[]) - The created goal definition
#### Response Example
{
"resourceType": "PlanDefinition",
"id": "plan-123",
"goal": [{
"id": "goal-456",
"start": {...},
"addresses": [...],
"target": [...]
}]
}
```
--------------------------------
### Define Action Relationships and Timing in FHIR PlanDefinition
Source: https://context7.com/trifork/thp-context7/llms.txt
Configure sequential clinical actions with temporal relationships and offset durations. This example demonstrates a surgical preparation workflow where actions are ordered with specific time intervals (e.g., antibiotic administration 30 minutes after pre-operative assessment). Uses relatedAction properties to establish dependencies and timing constraints between actions.
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/surgical-prep",
"name": "SurgicalPreparation",
"title": "Surgical Preparation Protocol",
"status": "active",
"action": [{
"id": "preop-assessment",
"prefix": "1",
"title": "Pre-operative Assessment",
"description": "Complete pre-operative medical assessment",
"timingDateTime": "2024-01-15T09:00:00Z",
"definitionCanonical": "http://example.org/ActivityDefinition/preop-assessment"
}, {
"id": "antibiotic-admin",
"prefix": "2",
"title": "Administer Prophylactic Antibiotic",
"description": "Administer pre-surgical antibiotic dose",
"relatedAction": [{
"actionId": "preop-assessment",
"relationship": "after",
"offsetDuration": {
"value": 30,
"unit": "minutes",
"system": "http://unitsofmeasure.org",
"code": "min"
}
}],
"definitionCanonical": "http://example.org/ActivityDefinition/antibiotic-administration"
}, {
"id": "surgical-procedure",
"prefix": "3",
"title": "Perform Surgical Procedure",
"description": "Execute planned surgical intervention",
"relatedAction": [{
"actionId": "antibiotic-admin",
"relationship": "after-end",
"offsetDuration": {
"value": 60,
"unit": "minutes",
"system": "http://unitsofmeasure.org",
"code": "min"
}
}],
"definitionCanonical": "http://example.org/ActivityDefinition/surgical-procedure"
}]
}
```
--------------------------------
### PlanDefinition Action Conditions
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Defines criteria for the applicability, start, or stop of an action. These are expressed using boolean logic.
```APIDOC
## PlanDefinition Action Conditions
### Description
Establishes the criteria that must be met for an action to be considered applicable, or to start or stop its execution.
### Method
N/A (Represents a resource element)
### Endpoint
N/A (Represents a resource element)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```json
{
"condition": [
{
"kind": "applicability",
"expression": {
"description": "Patient has a known diagnosis of X.",
"language": "text/fhirpath",
"expression": "Patient.diagnosis.where(code = 'X').exists()"
}
}
]
}
```
### Response
#### Success Response (200)
N/A (Represents a resource element)
#### Response Example
```json
{
"condition": [
{
"kind": "applicability",
"expression": {
"language": "text/fhirpath",
"expression": "Patient.diagnosis.where(code = 'X').exists()"
}
}
]
}
```
```
--------------------------------
### GET /PlanDefinition/{id}/goal
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Retrieves goal definitions from a PlanDefinition resource. Goals define what should be accomplished, when they should begin, and what conditions they address. Each goal can have multiple targets with specific measurable outcomes.
```APIDOC
## GET /PlanDefinition/{id}/goal
### Description
Retrieves goal definitions from a PlanDefinition resource, including goal start events, addressed conditions, and target outcomes.
### Method
GET
### Endpoint
/PlanDefinition/{id}/goal
### Parameters
#### Path Parameters
- **id** (string) - Required - The PlanDefinition resource identifier
### Response
#### Success Response (200)
- **start** (CodeableConcept) - Optional - When goal pursuit begins (Goal start event value set)
- **addresses** (CodeableConcept[]) - Optional - Problems, conditions, issues, or concerns the goal addresses (Condition/Problem/Diagnosis Codes value set)
- **documentation** (RelatedArtifact[]) - Optional - Didactic or informational resources associated with the goal
- **target** (BackboneElement[]) - Optional - Target outcomes for the goal
#### Response Example
{
"start": {
"coding": [{
"system": "http://loinc.org",
"code": "LA123-4",
"display": "At start of plan"
}]
},
"addresses": [{
"coding": [{
"system": "http://snomed.info/sct",
"code": "38341003",
"display": "Hypertension"
}]
}],
"documentation": [],
"target": []
}
```
--------------------------------
### PlanDefinition Core Elements (FHIR)
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Demonstrates the fundamental properties of a PlanDefinition resource, including its identifier, status, publisher, name, title, and version.
```json
{
"resourceType": "PlanDefinition",
"identifier": [
{
"system": "http://example.org/identifiers",
"value": "plan-123"
}
],
"status": "draft",
"publisher": "Example Publisher",
"name": "ExamplePlan",
"title": "Example Plan Definition",
"version": "1.0.0"
}
```
--------------------------------
### GET /PlanDefinition/{id}/goal/{goalId}/target
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Retrieves target outcome specifications for a goal. Targets define what measurable parameters should be tracked and what values represent goal achievement, including specific quantities, ranges, or coded concepts.
```APIDOC
## GET /PlanDefinition/{id}/goal/{goalId}/target
### Description
Retrieves target outcome specifications for a specific goal, including measurable parameters and achievement criteria.
### Method
GET
### Endpoint
/PlanDefinition/{id}/goal/{goalId}/target
### Parameters
#### Path Parameters
- **id** (string) - Required - The PlanDefinition resource identifier
- **goalId** (string) - Required - The goal identifier
### Response
#### Success Response (200)
- **measure** (CodeableConcept) - Optional - The parameter whose value is to be tracked (LOINC Codes value set)
- **detailQuantity** (Quantity) - Optional - Target value as a quantity (e.g., 150 pounds)
- **detailRange** (Range) - Optional - Target value as a range with low and high values
- **detailCodeableConcept** (CodeableConcept) - Optional - Target value as a coded concept
- **due** (Duration) - Optional - Timeframe after goal start in which the goal should be met
#### Response Example
{
"measure": {
"coding": [{
"system": "http://loinc.org",
"code": "3141-9",
"display": "Body weight"
}]
},
"detailQuantity": {
"value": 150,
"unit": "pounds",
"system": "http://unitsofmeasure.org",
"code": "[lb_av]"
},
"due": {
"value": 3,
"unit": "months",
"system": "http://unitsofmeasure.org",
"code": "mo"
}
}
```
--------------------------------
### Search PlanDefinitions
Source: https://context7.com/trifork/thp-context7/llms.txt
Retrieve PlanDefinition resources based on various search criteria.
```APIDOC
## GET /PlanDefinition
### Description
Searches for PlanDefinition resources based on specified criteria.
### Method
GET
### Endpoint
`/PlanDefinition`
### Parameters
#### Query Parameters
- **type** (string) - Optional - Filters PlanDefinitions by their type (e.g., "order-set").
- **status** (string) - Optional - Filters PlanDefinitions by their status (e.g., "active").
- **title:contains** (string) - Optional - Filters PlanDefinitions where the title contains the specified string.
- **jurisdiction** (uri) - Optional - Filters PlanDefinitions by their jurisdiction (e.g., "urn:iso:std:iso:3166|US").
### Request Example
```bash
# Search for active PlanDefinitions of type 'order-set'
curl -X GET "https://fhir.example.org/PlanDefinition?type=order-set&status=active" \
-H "Accept: application/fhir+json" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
# Search for PlanDefinitions with 'diabetes' in the title
curl -X GET "https://fhir.example.org/PlanDefinition?title:contains=diabetes" \
-H "Accept: application/fhir+json"
# Search for PlanDefinitions applicable in the US
curl -X GET "https://fhir.example.org/PlanDefinition?jurisdiction=urn:iso:std:iso:3166|US" \
-H "Accept: application/fhir+json"
```
### Response
#### Success Response (200)
- Returns a FHIR Bundle resource containing matching PlanDefinition resources.
#### Response Example
```json
{
"resourceType": "Bundle",
"type": "searchset",
"entry": [
{
"resource": {
"resourceType": "PlanDefinition",
"id": "low-suicide-risk-order-set",
"url": "http://example.org/PlanDefinition/low-suicide-risk-order-set",
"name": "LowSuicideRiskOrderSet",
"title": "Low Suicide Risk Order Set",
"status": "active",
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "US"
}
]
}
]
}
}
]
}
```
```
--------------------------------
### Create a Complete Clinical Protocol (JSON FHIR PlanDefinition)
Source: https://context7.com/trifork/thp-context7/llms.txt
This JSON object represents a FHIR PlanDefinition resource, specifically defining a clinical protocol for managing severe sepsis and septic shock. It includes metadata, goals, and a series of actions with conditions and dynamic values, intended for implementation in a healthcare setting. This definition relies on external libraries and activity definitions for detailed execution.
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/sepsis-protocol",
"identifier": [{
"system": "http://hospital.org/protocols",
"value": "SEPSIS-2024-V1"
}],
"version": "1.0.0",
"name": "SepsisManagementProtocol",
"title": "Severe Sepsis and Septic Shock Management Protocol",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/plan-definition-type",
"code": "clinical-protocol"
}]
},
"status": "active",
"experimental": false,
"date": "2024-01-01T00:00:00Z",
"publisher": "Critical Care Department",
"description": "Evidence-based protocol for early identification and treatment of severe sepsis and septic shock",
"purpose": "To reduce mortality and morbidity through standardized rapid intervention",
"useContext": [{
"code": {
"system": "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code": "focus"
},
"valueCodeableConcept": {
"coding": [{
"system": "http://snomed.info/sct",
"code": "76571007",
"display": "Septic shock"
}]
}
}],
"jurisdiction": [{
"coding": [{
"system": "urn:iso:std:iso:3166",
"code": "US"
}]
}],
"approvalDate": "2024-01-01",
"lastReviewDate": "2024-01-01",
"effectivePeriod": {
"start": "2024-01-01",
"end": "2025-12-31"
},
"topic": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/definition-topic",
"code": "treatment"
}]
}],
"author": [{
"name": "Dr. Jane Smith, Critical Care Specialist"
}],
"relatedArtifact": [{
"type": "citation",
"display": "Surviving Sepsis Campaign Guidelines 2021",
"url": "https://www.sccm.org/SurvivingSepsisCampaign"
}],
"library": ["http://example.org/Library/sepsis-calculations"],
"goal": [{
"category": {
"text": "Treatment"
},
"description": {
"text": "Achieve hemodynamic stability"
},
"priority": {
"coding": [{
"code": "high-priority"
}]
}
}],
"action": [{
"prefix": "1",
"title": "Initial Resuscitation (Hour 0-1)",
"groupingBehavior": "logical-group",
"selectionBehavior": "all",
"requiredBehavior": "must",
"action": [{
"prefix": "1.1",
"title": "Obtain Blood Cultures",
"priority": "stat",
"requiredBehavior": "must",
"definitionCanonical": "http://example.org/ActivityDefinition/blood-culture"
}, {
"prefix": "1.2",
"title": "Administer Broad-Spectrum Antibiotics",
"priority": "stat",
"requiredBehavior": "must",
"relatedAction": [{
"actionId": "1.1",
"relationship": "concurrent"
}],
"definitionCanonical": "http://example.org/ActivityDefinition/antibiotic-sepsis"
}, {
"prefix": "1.3",
"title": "Fluid Resuscitation",
"priority": "stat",
"requiredBehavior": "must",
"dynamicValue": [{
"path": "dosageInstruction.doseAndRate.rateQuantity.value",
"expression": {
"language": "text/cql",
"expression": "30 * Patient.weight"
}
}],
"definitionCanonical": "http://example.org/ActivityDefinition/crystalloid-bolus"
}]
}, {
"prefix": "2",
"title": "Vasopressor Support (if hypotension persists)",
"condition": [{
"kind": "applicability",
"expression": {
"language": "text/cql",
"expression": "MeanArterialPressure < 65"
}
}],
"requiredBehavior": "must",
"definitionCanonical": "http://example.org/ActivityDefinition/norepinephrine"
}]
}
```
--------------------------------
### Create a Complete Clinical Protocol
Source: https://context7.com/trifork/thp-context7/llms.txt
This endpoint allows the creation of a new PlanDefinition resource, representing a clinical protocol. The request body must be a valid FHIR PlanDefinition JSON object.
```APIDOC
## POST /PlanDefinition
### Description
Creates a new PlanDefinition resource representing a clinical protocol.
### Method
POST
### Endpoint
/PlanDefinition
### Request Body
- **PlanDefinition** (object) - Required - The FHIR PlanDefinition resource to create.
### Request Example
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/sepsis-protocol",
"identifier": [
{
"system": "http://hospital.org/protocols",
"value": "SEPSIS-2024-V1"
}
],
"version": "1.0.0",
"name": "SepsisManagementProtocol",
"title": "Severe Sepsis and Septic Shock Management Protocol",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/plan-definition-type",
"code": "clinical-protocol"
}
]
},
"status": "active",
"experimental": false,
"date": "2024-01-01T00:00:00Z",
"publisher": "Critical Care Department",
"description": "Evidence-based protocol for early identification and treatment of severe sepsis and septic shock",
"purpose": "To reduce mortality and morbidity through standardized rapid intervention",
"useContext": [
{
"code": {
"system": "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code": "focus"
},
"valueCodeableConcept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "76571007",
"display": "Septic shock"
}
]
}
}
],
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "US"
}
]
}
],
"approvalDate": "2024-01-01",
"lastReviewDate": "2024-01-01",
"effectivePeriod": {
"start": "2024-01-01",
"end": "2025-12-31"
},
"topic": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/definition-topic",
"code": "treatment"
}
]
}
],
"author": [
{
"name": "Dr. Jane Smith, Critical Care Specialist"
}
],
"relatedArtifact": [
{
"type": "citation",
"display": "Surviving Sepsis Campaign Guidelines 2021",
"url": "https://www.sccm.org/SurvivingSepsisCampaign"
}
],
"library": ["http://example.org/Library/sepsis-calculations"],
"goal": [
{
"category": {
"text": "Treatment"
},
"description": {
"text": "Achieve hemodynamic stability"
},
"priority": {
"coding": [
{
"code": "high-priority"
}
]
}
}
],
"action": [
{
"prefix": "1",
"title": "Initial Resuscitation (Hour 0-1)",
"groupingBehavior": "logical-group",
"selectionBehavior": "all",
"requiredBehavior": "must",
"action": [
{
"prefix": "1.1",
"title": "Obtain Blood Cultures",
"priority": "stat",
"requiredBehavior": "must",
"definitionCanonical": "http://example.org/ActivityDefinition/blood-culture"
},
{
"prefix": "1.2",
"title": "Administer Broad-Spectrum Antibiotics",
"priority": "stat",
"requiredBehavior": "must",
"relatedAction": [
{
"actionId": "1.1",
"relationship": "concurrent"
}
],
"definitionCanonical": "http://example.org/ActivityDefinition/antibiotic-sepsis"
},
{
"prefix": "1.3",
"title": "Fluid Resuscitation",
"priority": "stat",
"requiredBehavior": "must",
"dynamicValue": [
{
"path": "dosageInstruction.doseAndRate.rateQuantity.value",
"expression": {
"language": "text/cql",
"expression": "30 * Patient.weight"
}
}
],
"definitionCanonical": "http://example.org/ActivityDefinition/crystalloid-bolus"
}
]
},
{
"prefix": "2",
"title": "Vasopressor Support (if hypotension persists)",
"condition": [
{
"kind": "applicability",
"expression": {
"language": "text/cql",
"expression": "MeanArterialPressure < 65"
}
}
],
"requiredBehavior": "must",
"definitionCanonical": "http://example.org/ActivityDefinition/norepinephrine"
}
]
}
```
### Response
#### Success Response (201)
- **PlanDefinition** (object) - The created PlanDefinition resource, including its assigned ID.
#### Response Example
```json
{
"resourceType": "PlanDefinition",
"id": "xyz789", // Newly assigned ID
"url": "http://example.org/PlanDefinition/sepsis-protocol",
// ... rest of the PlanDefinition resource ...
}
```
```
--------------------------------
### PlanDefinition Resource Structure
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
This snippet illustrates the basic structure of the PlanDefinition FHIR resource, including common elements like url, identifier, version, name, title, subtitle, and type. It also points to other FHIR resources and datatypes for detailed definitions.
```json
{
"resourceType" : "PlanDefinition",
"url": "",
"identifier": [
{ [Identifier] }
],
"version": "",
"name": "",
"title": "",
"subtitle": "",
"type": {
[CodeableConcept]
}
}
```
--------------------------------
### PlanDefinition Relationships (FHIR)
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Illustrates how PlanDefinitions can depend on, be derived from, or have predecessors/successors. These relationships are crucial for versioning and dependency management.
```json
{
"resourceType": "PlanDefinition",
"relatedArtifact": [
{
"type": "depends-on",
"resource": {
"reference": "Library/example"
}
},
{
"type": "derived-from",
"resource": {
"reference": "ActivityDefinition/example"
}
},
{
"type": "predecessor",
"resource": {
"reference": "PlanDefinition/previous-example"
}
},
{
"type": "successor",
"resource": {
"reference": "PlanDefinition/next-example"
}
}
]
}
```
--------------------------------
### PlanDefinition Fields
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
This section details the various fields available for a PlanDefinition resource, including their types, descriptions, and usage context.
```APIDOC
## PlanDefinition Resource Fields
### Description
This document outlines the fields associated with the PlanDefinition resource, providing details on their purpose, data types, and constraints.
### Fields Overview
- **useContext**: (UsageContext) - Represents the contexts that the content was developed with a focus and intent of supporting. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances.
- **jurisdiction**: (CodeableConcept) - A legal or geographic region in which the plan definition is intended to be used. This field is extensible and may reference the 'Countries and regions within which this artifact is targeted for use' value set.
- **purpose**: (markdown) - An explanation of why this plan definition is needed and why it has been designed as it has.
- **usage**: (string) - Describes the clinical usage of the plan from a clinical perspective.
- **copyright**: (markdown) - A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
- **approvalDate**: (date) - The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
- **lastReviewDate**: (date) - The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
- **effectivePeriod**: (Period) - The period during which the plan definition content was or is planned to be in active use.
- **topic**: (CodeableConcept) - Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching. Examples include 'Education', 'Treatment', 'Assessment'.
```
--------------------------------
### Configure Dynamic Values and Parametric Calculations in FHIR PlanDefinition
Source: https://context7.com/trifork/thp-context7/llms.txt
Use dynamicValue elements with CQL expressions to compute medication dosages based on patient parameters. This weight-based dosing protocol references external CQL libraries and calculates dose quantities dynamically. The expression references patient weight and converts it using a dosing formula (5 mg/kg), with results populated into the medication activity definition path.
```json
{
"resourceType": "PlanDefinition",
"url": "http://example.org/PlanDefinition/weight-based-dosing",
"name": "WeightBasedMedicationProtocol",
"title": "Weight-Based Medication Dosing Protocol",
"status": "active",
"library": ["http://example.org/Library/dosing-calculations"],
"action": [{
"prefix": "1",
"title": "Administer Weight-Based Medication",
"description": "Calculate and administer medication dose based on patient weight",
"definitionCanonical": "http://example.org/ActivityDefinition/medication-administration",
"dynamicValue": [{
"path": "dosage.doseAndRate.doseQuantity.value",
"expression": {
"language": "text/cql",
"expression": "CalculateDosage(Patient.weight, 5, 'mg', 'kg')",
"reference": "http://example.org/Library/dosing-calculations#CalculateDosage"
}
}, {
"path": "dosage.doseAndRate.doseQuantity.unit",
"expression": {
"language": "text/cql",
"expression": "'mg'"
}
}]
}]
}
```
--------------------------------
### Search PlanDefinition by Effective Date (cURL)
Source: https://context7.com/trifork/thp-context7/llms.txt
This cURL command demonstrates how to search for PlanDefinition resources within a specific effective date range. It uses the `effective=ge` and `effective=le` parameters to filter by greater than or equal to and less than or equal to dates, respectively. The `Accept` header specifies the desired FHIR resource format.
```shell
curl -X GET "https://fhir.example.org/PlanDefinition?effective=ge2023-01-01&effective=le2023-12-31" \
-H "Accept: application/fhir+json"
```
--------------------------------
### PlanDefinition Search Parameters
Source: https://github.com/trifork/thp-context7/blob/main/PlanDefinition - FHIR v4.0.1.html
Lists the available search parameters for the PlanDefinition resource, including common parameters and resource-specific ones.
```APIDOC
## Search Parameters for PlanDefinition
### Description
This section lists the search parameters available for the PlanDefinition resource. Common search parameters also apply. Refer to the [Searching](search.html) documentation for more details.
### Available Search Parameters:
* **composed-of** (reference) - What resource is being referenced. Expression: `PlanDefinition.relatedArtifact.where(type='composed-of').resource`.
* **context** (token) - A use context assigned to the plan definition. Expression: `(PlanDefinition.useContext.value as CodeableConcept)`.
* **context-quantity** (quantity) - A quantity- or range-valued use context assigned to the plan definition. Expression: `(PlanDefinition.useContext.value as Quantity) | (PlanDefinition.useContext.value as Range)`.
* **context-type** (token) - A type of use context assigned to the plan definition. Expression: `PlanDefinition.useContext.code`.
* **context-type-quantity** (composite) - A use context type and quantity- or range-based value assigned to the plan definition. On `PlanDefinition.useContext`: `context-type: code`, `context-quantity: value.as(Quantity) | value.as(Range)`.
* **context-type-value** (composite) - A use context type and value assigned to the plan definition. On `PlanDefinition.useContext`: `context-type: code`, `context: value.as(CodeableConcept)`.
* **date** (date) - The plan definition publication date. Expression: `PlanDefinition.date`.
* **definition** (reference) - Description of the plan definition.
```
--------------------------------
### PlanDefinition Apply Operation
Source: https://context7.com/trifork/thp-context7/llms.txt
The $apply operation on a PlanDefinition resource instantiates a plan for a patient, potentially creating CarePlans or RequestGroups. It accepts various parameters to customize the application context.
```APIDOC
## POST /PlanDefinition/{id}/$apply
### Description
Applies a PlanDefinition to a specific context, generating actionable plans or requests.
### Method
POST
### Endpoint
`/PlanDefinition/{id}/$apply`
### Parameters
#### Query Parameters
None
#### Request Body
**resourceType** (string) - Required - Must be "Parameters".
**parameter** (array) - Required - An array of parameters to customize the application of the PlanDefinition.
- **name** (string) - Required - The name of the parameter (e.g., "subject", "encounter", "practitioner").
- **valueString** (string) - Optional - The string value for the parameter.
- **valueCodeableConcept** (object) - Optional - The CodeableConcept value for the parameter.
- **coding** (array) - Required - An array of coding objects.
- **system** (string) - Required - The system URI for the code.
- **code** (string) - Required - The code value.
- **display** (string) - Optional - The display text for the code.
### Request Example
```json
{
"resourceType": "Parameters",
"parameter": [
{
"name": "subject",
"valueString": "Patient/12345"
},
{
"name": "encounter",
"valueString": "Encounter/67890"
},
{
"name": "practitioner",
"valueString": "Practitioner/99999"
},
{
"name": "organization",
"valueString": "Organization/11111"
},
{
"name": "userType",
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/practitioner-role",
"code": "doctor"
}
]
}
},
{
"name": "userLanguage",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:ietf:bcp:47",
"code": "en-US"
}
]
}
},
{
"name": "userTaskContext",
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/task-code",
"code": "fulfill"
}
]
}
},
{
"name": "setting",
"valueCodeableConcept": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
"code": "IMP",
"display": "inpatient encounter"
}
]
}
}
]
}
```
### Response
#### Success Response (200)
- **resourceType** (string) - The type of resource returned, typically "CarePlan" or "RequestGroup".
- **status** (string) - The status of the generated plan (e.g., "draft").
- **intent** (string) - The intent of the plan (e.g., "order").
- **subject** (object) - Reference to the patient the plan is for.
- **encounter** (object) - Reference to the encounter the plan is associated with.
- **activity** (array) - A list of activities included in the plan.
- **reference** (object) - A reference to a specific activity or service request.
#### Response Example
```json
{
"resourceType": "CarePlan",
"status": "draft",
"intent": "order",
"subject": {
"reference": "Patient/12345"
},
"encounter": {
"reference": "Encounter/67890"
},
"activity": [
{
"reference": {
"reference": "ServiceRequest/med-order-1"
}
},
{
"reference": {
"reference": "ServiceRequest/lab-order-1"
}
}
]
}
```
```