{ "description": "An example PlanDefinition", "_filename": "example/PlanDefinition-us-ph-plandefinition-alt-expression-example.json", "package_name": "hl7.fhir.us.ph-library", "date": "2022-07-31T12:32:29.858-05:00", "meta": { "source": "#7fgE3zdPadJWZv8T", "versionId": "2", "lastUpdated": "2022-07-25T03:24:15.383+00:00" }, "publisher": "HL7 Public Health Work Group (http://www.hl7.org/Special/committees/pher/index.cfm)", "jurisdiction": [ { "text": "United States of America", "coding": [ { "code": "US", "system": "urn:iso:std:iso:3166", "display": "United States of America" } ] } ], "name": "USPublicHealthPlanDefinitionAlternativeExpressionExample", "type": "{:coding [{:system \\\"http://terminology.hl7.org/CodeSystem/plan-definition-type\\\", :code \\\"workflow-definition\\\", :display \\\"Workflow Definition\\\"}]}", "experimental": "true", "resourceType": "PlanDefinition", "title": "US Public Health PlanDefinition Alternative Expression Example", "package_version": "1.0.0-ballot", "status": "active", "id": "1de8f06e-36b8-474a-b84a-e9f443570ae8", "kind": null, "url": "http://example.org/fhir/PlanDefinition/us-ph-plandefinition-alt-expression-example", "action": [ { "id": "start-workflow", "code": [ { "coding": [ { "code": "initiate-reporting-workflow", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions", "display": "Initiate a reporting workflow" } ] } ], "input": [ { "id": "patient", "type": "Patient", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Patient/{{context.patientId}}" } ] }, { "id": "encounter", "type": "Encounter", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Encounter/{{context.encounterId}}" } ] } ], "trigger": [ { "id": "encounter-start", "name": "encounter-start", "type": "named-event", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-named-eventtype-extension", "valueCodeableConcept": { "coding": [ { "code": "encounter-start", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-triggerdefinition-namedevents", "display": "Indicates the start of an encounter" } ] } } ] } ], "description": "This action represents the start of the reporting workflow in response to the encounter-start event.", "relatedAction": [ { "actionId": "check-suspected-disorder", "relationship": "before-start", "offsetDuration": { "code": "h", "value": 1, "system": "http://unitsofmeasure.org" } } ], "textEquivalent": "Start the reporting workflow in response to an encounter-start event" }, { "id": "check-suspected-disorder", "code": [ { "coding": [ { "code": "execute-reporting-workflow", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "action": [ { "id": "is-encounter-suspected-disorder", "code": [ { "coding": [ { "code": "check-trigger-codes", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "modifiedConditions", "type": "Condition", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Condition?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-sdtc-example" } ] }, { "id": "modifiedLabResults", "type": "Observation", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Observation?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "value", "valueSet": "http://example.org/fhir/ValueSet/valueset-sdtc-example" } ] }, { "id": "modifiedMedicationOrders", "type": "MedicationRequest", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "MedicationRequest?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "medication", "valueSet": "http://example.org/fhir/ValueSet/valueset-sdtc-example" } ] } ], "condition": [ { "kind": "applicability", "expression": { "language": "text/fhirpath", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension", "valueExpression": { "language": "text/cql-identifier", "reference": "http://example.org/fhir/Library/RuleFilters|1.0.0", "expression": "Is Suspected Disorder?" } } ], "expression": "%modifiedConditions.exists() or %modifiedLabResults.exists() or %modifiedMedicationOrders.exists()" } } ], "description": "This action represents the check for suspected disorder reportability to create the patients eICR.", "relatedAction": [ { "actionId": "create-eicr", "relationship": "before-start" } ], "textEquivalent": "Check Trigger Codes based on Suspected Reportable Value set." }, { "id": "continue-check-reportable", "code": [ { "coding": [ { "code": "evaluate-condition", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "condition": [ { "kind": "applicability", "expression": { "language": "text/fhirpath", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension", "valueExpression": { "language": "text/cql-identifier", "reference": "http://example.org/fhir/Library/RuleFilters|1.0.0", "expression": "Is Encounter In Progress and Within Normal Reporting Duration or 72h or less after end of encounter?" } } ], "expression": "%encounter.where((status = 'in-progress' and period.start + 1 day * %normalReportingDuration >= now()) or (status = 'finished' and period.end + 72 hours >= now())).select(true)" } } ], "relatedAction": [ { "actionId": "check-reportable", "relationship": "before-start", "offsetDuration": { "code": "h", "value": 6, "system": "http://unitsofmeasure.org" } } ] } ], "description": "This action represents the start of the check suspected disorder reporting workflow in response to the encounter-start event.", "textEquivalent": "Check suspected disorders for immediate reportability and setup jobs for future reportability checks." }, { "id": "check-reportable", "code": [ { "coding": [ { "code": "execute-reporting-workflow", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "action": [ { "id": "is-encounter-reportable", "code": [ { "coding": [ { "code": "check-trigger-codes", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "conditions", "type": "Condition", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Condition?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-dxtc-example" } ] }, { "id": "encounters", "type": "Encounter", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "encounter" } ], "codeFilter": [ { "path": "reasonCode", "valueSet": "http://example.org/fhir/ValueSet/valueset-dxtc-example" } ] }, { "id": "immunizations", "type": "Immunization", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Immunization?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "vaccineCode", "valueSet": "http://example.org/fhir/ValueSet/valueset-mrtc-example" } ] }, { "id": "labOrders", "type": "ServiceRequest", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "ServiceRequest?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-lotc-example" } ] }, { "id": "labTests", "type": "Observation", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Observation?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-lotc-example" } ] }, { "id": "diagnosticOrders", "type": "DiagnosticReport", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "DiagnosticReport?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-lotc-example" } ] }, { "id": "procedureOrders", "type": "ServiceRequest", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "ServiceRequest?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-pctc-example" } ] }, { "id": "procedures", "type": "Procedure", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "Procedure?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-pctc-example" } ] }, { "id": "medicationOrders", "type": "MedicationRequest", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "MedicationRequest?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "medication", "valueSet": "http://example.org/fhir/ValueSet/valueset-mrtc-example" } ] }, { "id": "medicationDispenses", "type": "MedicationDispense", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "MedicationDispense?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "medication", "valueSet": "http://example.org/fhir/ValueSet/valueset-mrtc-example" } ] }, { "id": "medicationAdministrations", "type": "MedicationAdministration", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension", "valueString": "MedicationAdministration?patient=Patient/{{context.patientId}}" } ], "codeFilter": [ { "path": "medication", "valueSet": "http://example.org/fhir/ValueSet/valueset-mrtc-example" } ] }, { "id": "labResults", "type": "Observation", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "labTests" } ], "codeFilter": [ { "path": "value", "valueSet": "http://example.org/fhir/ValueSet/valueset-ostc-example" } ] }, { "id": "diagnosticResults", "type": "DiagnosticReport", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "diagnosticOrders" } ], "codeFilter": [ { "path": "code", "valueSet": "http://example.org/fhir/ValueSet/valueset-ostc-example" } ] } ], "condition": [ { "kind": "applicability", "expression": { "language": "text/fhirpath", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension", "valueExpression": { "language": "text/cql-identifier", "reference": "http://example.org/fhir/Library/RuleFilters|1.0.0", "expression": "Is Encounter Reportable and Within Normal Reporting Duration?" } } ], "expression": "%encounter.where(period.start + 1 day * %normalReportingDuration >= now()).select(true) and (%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists())" } } ], "description": "This action represents the check for reportability to create the patients eICR.", "relatedAction": [ { "actionId": "create-eicr", "relationship": "before-start" } ], "textEquivalent": "Check Trigger Codes based on RCTC Value sets." }, { "id": "check-update-eicr", "code": [ { "coding": [ { "code": "evaluate-condition", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "lasteicr", "type": "Bundle", "profile": [ "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "eicrreport" } ] } ], "condition": [ { "kind": "applicability", "expression": { "language": "text/fhirpath", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension", "valueExpression": { "language": "text/cql-identifier", "reference": "http://example.org/fhir/Library/RuleFilters|1.0.0", "expression": "Most recent eICR sent over 72 hours ago?" } } ], "expression": "((%lasteicr.last().entry[2].resource as Bundle).entry.first().resource as Composition).date < now() - 72 hours" } } ], "relatedAction": [ { "actionId": "create-eicr", "relationship": "before-start" } ] }, { "id": "is-encounter-in-progress", "code": [ { "coding": [ { "code": "evaluate-condition", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "inprogressencounter", "type": "Encounter", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "encounter" } ] } ], "condition": [ { "kind": "applicability", "expression": { "language": "text/fhirpath", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension", "valueExpression": { "language": "text/cql-identifier", "reference": "http://example.org/fhir/Library/RuleFilters|1.0.0", "expression": "Is Encounter In Progress and Within Normal Reporting Duration or 72h or less after end of encounter?" } } ], "expression": "%inprogressencounter.where(status = 'in-progress' and period.start + 1 day * %normalReportingDuration >= now() or (status = 'finished' and period.end + 72 hours >= now())).exists()" } } ], "relatedAction": [ { "actionId": "check-reportable", "relationship": "before-start", "offsetDuration": { "code": "h", "value": 6, "system": "http://unitsofmeasure.org" } } ] } ], "description": "This action represents the check for suspected reportability of the eICR.", "textEquivalent": "Check Reportability and setup jobs for future reportability checks." }, { "id": "create-eicr", "code": [ { "coding": [ { "code": "create-report", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "patientdata", "type": "Patient", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "patient" } ] }, { "id": "conditiondata", "type": "Condition", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "conditions" } ] }, { "id": "encounterdata", "type": "Encounter", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "encounter" } ] }, { "id": "mrdata", "type": "MedicationRequest", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "medicationOrders" } ] }, { "id": "immzdata", "type": "Immunization", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "immunizations" } ] }, { "id": "procdata", "type": "Procedure", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "procedures" } ] }, { "id": "labResultdata", "type": "Observation", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "labResults" } ] }, { "id": "labOrderdata", "type": "ServiceRequest", "profile": [ "http://hl7.org/fhir/StructureDefinition/ServiceRequest" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "labOrders" } ] }, { "id": "diagnosticResultdata", "type": "DiagnosticReport", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "diagnosticResults" } ] }, { "id": "diagnosticOrderdata", "type": "DiagnosticReport", "profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "diagnosticOrders" } ] } ], "output": [ { "id": "eicrreport", "type": "Bundle", "profile": [ "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle" ] } ], "description": "This action represents the creation of the eICR. It subsequently calls validate.", "relatedAction": [ { "actionId": "validate-eicr", "relationship": "before-start" } ], "textEquivalent": "Create eICR" }, { "id": "validate-eicr", "code": [ { "coding": [ { "code": "validate-report", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "generatedeicrreport", "type": "Bundle", "profile": [ "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "eicrreport" } ] } ], "output": [ { "id": "valideicrreport", "type": "Bundle", "profile": [ "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle" ] } ], "description": "This action represents the validation of the eICR. It subsequently calls route-and-send.", "relatedAction": [ { "actionId": "route-and-send-eicr", "relationship": "before-start" } ], "textEquivalent": "Validate eICR" }, { "id": "route-and-send-eicr", "code": [ { "coding": [ { "code": "submit-report", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions" } ] } ], "input": [ { "id": "validatedeicrreport", "type": "Bundle", "profile": [ "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle" ], "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension", "valueString": "valideicrreport" } ] } ], "output": [ { "id": "submittedeicrreport", "type": "Bundle", "profile": [ "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle" ] } ], "description": "This action represents the routing and sending of the eICR.", "textEquivalent": "Route and send eICR" }, { "id": "encounter-modified", "code": [ { "coding": [ { "code": "initiate-reporting-workflow", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-plandefinition-actions", "display": "Initiate a reporting workflow" } ] } ], "trigger": [ { "id": "encounter-modified-trigger", "name": "encounter-modified", "type": "named-event", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-named-eventtype-extension", "valueCodeableConcept": { "coding": [ { "code": "encounter-modified", "system": "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-triggerdefinition-namedevents", "display": "Indicates modifications to data elements of an encounter" } ] } } ] } ], "condition": [ { "kind": "applicability", "expression": { "language": "text/fhirpath", "extension": [ { "url": "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension", "valueExpression": { "language": "text/cql-identifier", "reference": "http://example.org/fhir/Library/RuleFilters|1.0.0", "expression": "Is Encounter Longer Than Normal Reporting Duration?" } } ], "expression": "%encounter.where(period.start + 1 day * %normalReportingDuration < now()).select(true)" } } ], "description": "This action represents the start of the reporting workflow in response to the encounter-modified event", "relatedAction": [ { "actionId": "create-eicr", "relationship": "before-start" } ], "textEquivalent": "Start the reporting workflow in response to an encounter-modified event" } ], "version": "1.0.0-ballot", "relatedArtifact": [ { "type": "depends-on", "label": "RCTC Value Set Library of Trigger Codes", "resource": "http://example.org/fhir/Library/library-rctc-example" } ], "contact": [ { "name": "HL7 International - Public Health", "telecom": [ { "value": "http://www.hl7.org/Special/committees/pher", "system": "url" } ] } ], "effectivePeriod": { "start": "2020-12-01" } }