FHIR © HL7.org  |  FHIRsmith 4.0.1  |  Server Home  |  XIG Home  |  XIG Stats  | 

FHIR IG analytics

Packagehl7.fhir.us.ecr.r4b
Resource TypePlanDefinition
IdPlanDefinition-plandefinition-ersd-instance-example.json
FHIR VersionR4B

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Generated Narrative: PlanDefinition plandefinition-ersd-instance-example

Variable: 14(normalReportingDuration)

url: PlanDefinition eRSD PlanDefinition Instance Example

identifier: Uniform Resource Identifier (URI)/urn:oid:2.16.840.1.113883.4.642.40.46.34.3

version: 2.1.2

name: PlanDefinition_eRSD_Instance_Example

title: eRSD PlanDefinition Instance Example

type: Workflow Definition

status: Active

experimental: true

date: 2020-07-31 12:32:29-0500

publisher: HL7 International / Public Health

contact: HL7 International / Public Health: http://www.hl7.org/Special/committees/pher

description:

An example ersd PlanDefinition

jurisdiction: United States of America

effectivePeriod: 2020-12-01 --> (ongoing)

RelatedArtifacts

-TypeLabelResource
*Depends OnRCTC Value Set Library of Trigger CodesReportable Condition Trigger Codes (RCTC) Example Library

action

id

start-workflow

description: This action represents the start of the reporting workflow in response to the encounter-start event.

textEquivalent: Start the reporting workflow in response to an encounter-start event

code: Initiate a reporting workflow

trigger

id

encounter-start

US Public Health Named Event Type Extension: Indicates the start of an encounter

type: Named Event

name: encounter-start

input

id

patient

US Public Health FHIR Query Pattern Extension: Patient/{{context.patientId}}

type: Patient

input

id

encounter

US Public Health FHIR Query Pattern Extension: Encounter/{{context.encounterId}}

type: Encounter

RelatedActions

-ActionIdRelationshipOffset[x]
*check-suspected-disorderBefore StartNo display for Duration (value: 1; system: http://unitsofmeasure.org; code: h)

action

id

check-suspected-disorder

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.

code: Execute a series of actions to accomplish reporting

action

id

is-encounter-suspected-disorder

description: This action represents the check for suspected disorder reportability to create the patients eICR.

textEquivalent: Check Trigger Codes based on Suspected Reportable Value set.

code: Evaluate candidate patient's data against trigger codes to determine reportability

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath%modifiedConditions.exists() or %modifiedLabResults.exists() or %modifiedMedicationOrders.exists()

input

id

modifiedConditions

US Public Health FHIR Query Pattern Extension: Condition?patient=Patient/{{context.patientId}}

type: Condition

CodeFilters

-PathValueSet
*codeExample Suspected Disorder Triggers for Public Health Reporting

input

id

modifiedLabResults

US Public Health FHIR Query Pattern Extension: Observation?patient=Patient/{{context.patientId}}

type: Observation

CodeFilters

-PathValueSet
*valueExample Lab Order Test Triggers for Public Health Reporting

input

id

modifiedMedicationOrders

US Public Health FHIR Query Pattern Extension: MedicationRequest?patient=Patient/{{context.patientId}}

type: MedicationRequest

CodeFilters

-PathValueSet
*medicationExample Medications Triggers for Public Health Reporting

RelatedActions

-ActionIdRelationship
*create-eicrBefore Start

action

id

continue-check-reportable

code: Evaluate condition to determine reportability

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath%encounter.where((status = 'in-progress' and period.start + 1 day * %normalReportingDuration >= now()) or (status = 'finished' and period.end + 72 hours >= now())).select(true)

RelatedActions

-ActionIdRelationshipOffset[x]
*check-reportableBefore StartNo display for Duration (value: 6; comparator: <=; system: http://unitsofmeasure.org; code: h)

action

id

check-reportable

description: This action represents the check for suspected reportability of the eICR.

textEquivalent: Check Reportability and setup jobs for future reportability checks.

code: Execute a series of actions to accomplish reporting

action

id

is-encounter-reportable

description: This action represents the check for reportability to create the patients eICR.

textEquivalent: Check Trigger Codes based on RCTC Value sets.

code: Evaluate candidate patient's data against trigger codes to determine reportability

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath%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())

input

id

conditions

US Public Health FHIR Query Pattern Extension: Condition?patient=Patient/{{context.patientId}}

type: Condition

CodeFilters

-PathValueSet
*codeExample Diagnosis Problem Triggers for Public Health Reporting

input

id

encounters

US Public Health Related Data Extension: encounter

type: Encounter

CodeFilters

-PathValueSet
*reasonCodeExample Diagnosis Problem Triggers for Public Health Reporting

input

id

immunizations

US Public Health FHIR Query Pattern Extension: Immunization?patient=Patient/{{context.patientId}}

type: Immunization

CodeFilters

-PathValueSet
*vaccineCodeExample Medications Triggers for Public Health Reporting

input

id

labOrders

US Public Health FHIR Query Pattern Extension: ServiceRequest?patient=Patient/{{context.patientId}}

type: ServiceRequest

CodeFilters

-PathValueSet
*codeExample Lab Order Test Triggers for Public Health Reporting

input

id

labTests

US Public Health FHIR Query Pattern Extension: Observation?patient=Patient/{{context.patientId}}

type: Observation

CodeFilters

-PathValueSet
*codeExample Lab Order Test Triggers for Public Health Reporting

input

id

diagnosticOrders

US Public Health FHIR Query Pattern Extension: DiagnosticReport?patient=Patient/{{context.patientId}}

type: DiagnosticReport

CodeFilters

-PathValueSet
*codeExample Lab Order Test Triggers for Public Health Reporting

input

id

procedureOrders

US Public Health FHIR Query Pattern Extension: ServiceRequest?patient=Patient/{{context.patientId}}

type: ServiceRequest

CodeFilters

-PathValueSet
*codeExample Procedure Triggers for Public Health Reporting

input

id

procedures

US Public Health FHIR Query Pattern Extension: Procedure?patient=Patient/{{context.patientId}}

type: Procedure

CodeFilters

-PathValueSet
*codeExample Procedure Triggers for Public Health Reporting

input

id

medicationOrders

US Public Health FHIR Query Pattern Extension: MedicationRequest?patient=Patient/{{context.patientId}}

type: MedicationRequest

CodeFilters

-PathValueSet
*medicationExample Medications Triggers for Public Health Reporting

input

id

medicationDispenses

US Public Health FHIR Query Pattern Extension: MedicationDispense?patient=Patient/{{context.patientId}}

type: MedicationDispense

CodeFilters

-PathValueSet
*medicationExample Medications Triggers for Public Health Reporting

input

id

medicationAdministrations

US Public Health FHIR Query Pattern Extension: MedicationAdministration?patient=Patient/{{context.patientId}}

type: MedicationAdministration

CodeFilters

-PathValueSet
*medicationExample Medications Triggers for Public Health Reporting

input

id

labResults

US Public Health Related Data Extension: labTests

type: Observation

CodeFilters

-PathValueSet
*valueExample Organism Substance Triggers for Public Health Reporting

input

id

diagnosticResults

US Public Health Related Data Extension: diagnosticOrders

type: DiagnosticReport

CodeFilters

-PathValueSet
*codeExample Organism Substance Triggers for Public Health Reporting

RelatedActions

-ActionIdRelationship
*create-eicrBefore Start

action

id

check-update-eicr

code: Evaluate condition to determine reportability

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath((%lasteicr.last().entry[2].resource as Bundle).entry.first().resource as Composition).date < now() - 72 hours

input

id

lasteicr

US Public Health Related Data Extension: eicrreport

type: Bundle

profile: eICR Document Bundle

RelatedActions

-ActionIdRelationship
*create-eicrBefore Start

action

id

is-encounter-in-progress

code: Evaluate condition to determine reportability

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath%inprogressencounter.where(status = 'in-progress' and period.start + 1 day * %normalReportingDuration >= now() or (status = 'finished' and period.end + 72 hours >= now())).exists()

input

id

inprogressencounter

US Public Health Related Data Extension: encounter

type: Encounter

RelatedActions

-ActionIdRelationshipOffset[x]
*check-reportableBefore StartNo display for Duration (value: 6; comparator: <=; system: http://unitsofmeasure.org; code: h)

action

id

is-encounter-completed

code: Complete reporting for the patient

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath%completedEncounter.exists(status = 'finished')

input

id

completedEncounter

US Public Health Related Data Extension: encounter

type: Encounter

action

id

create-eicr

description: This action represents the creation of the eICR. It subsequently calls validate.

textEquivalent: Create eICR

code: Create a Report containing Patient's data for patients who passed the check-reportability test

input

id

patientdata

US Public Health Related Data Extension: patient

type: Patient

profile: US Core Patient Profile

input

id

conditiondata

US Public Health Related Data Extension: conditions

type: Condition

profile: US Core Condition Profile

input

id

encounterdata

US Public Health Related Data Extension: encounter

type: Encounter

profile: US Core Encounter Profile

input

id

mrdata

US Public Health Related Data Extension: medicationOrders

type: MedicationRequest

profile: US Core MedicationRequest Profile

input

id

immzdata

US Public Health Related Data Extension: immunizations

type: Immunization

profile: US Core Immunization Profile

input

id

procdata

US Public Health Related Data Extension: procedures

type: Procedure

profile: US Core Procedure Profile

input

id

labResultdata

US Public Health Related Data Extension: labResults

type: Observation

profile: US Core Laboratory Result Observation Profile

input

id

labOrderdata

US Public Health Related Data Extension: labOrders

type: ServiceRequest

profile: ServiceRequest

input

id

diagnosticResultdata

US Public Health Related Data Extension: diagnosticResults

type: DiagnosticReport

profile: US Core DiagnosticReport Profile for Laboratory Results Reporting

input

id

diagnosticOrderdata

US Public Health Related Data Extension: diagnosticOrders

type: DiagnosticReport

profile: US Core DiagnosticReport Profile for Laboratory Results Reporting

output

id

eicrreport

type: Bundle

profile: eICR Document Bundle

RelatedActions

-ActionIdRelationship
*validate-eicrBefore Start

action

id

validate-eicr

description: This action represents the validation of the eICR. It subsequently calls route-and-send.

textEquivalent: Validate eICR

code: Validate Report against specified profiles and terminologies.

input

id

generatedeicrreport

US Public Health Related Data Extension: eicrreport

type: Bundle

profile: eICR Document Bundle

output

id

valideicrreport

type: Bundle

profile: eICR Document Bundle

RelatedActions

-ActionIdRelationship
*route-and-send-eicrBefore Start

action

id

route-and-send-eicr

description: This action represents the routing and sending of the eICR.

textEquivalent: Route and send eICR

code: Submit the report to specified endpoint

input

id

validatedeicrreport

US Public Health Related Data Extension: valideicrreport

type: Bundle

profile: eICR Document Bundle

output

id

submittedeicrreport

type: Bundle

profile: eICR Document Bundle

action

id

encounter-modified

description: This action represents the start of the reporting workflow in response to the encounter-modified event

textEquivalent: Start the reporting workflow in response to an encounter-modified event

code: Initiate a reporting workflow

trigger

id

encounter-modified-trigger

US Public Health Named Event Type Extension: Indicates modifications to data elements of an encounter

type: Named Event

name: encounter-modified

condition

kind: Applicability

Expressions

-ExtensionLanguageExpression
*FHIRPath%encounter.where(period.start + 1 day * %normalReportingDuration < now()).select(true)

RelatedActions

-ActionIdRelationship
*create-eicrBefore Start

Source1

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