US Public Health Profiles Library
2.0.0-ballot - STU 2 - Ballot United States of America flag

US Public Health Profiles Library, published by HL7 International / Public Health. This guide is not an authorized publication; it is the continuous build for version 2.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-us-ph-library/ and changes regularly. See the Directory of published versions

: US Public Health PlanDefinition - Alternative Expression - JSON Representation

Page standards status: Informative

Raw json | Download

{
  "resourceType" : "PlanDefinition",
  "id" : "us-ph-plandefinition-alt-expression-example",
  "meta" : {
    "profile" : [
      🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-plandefinition"
    ]
  },
  "text" : {
    "status" : "extensions",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n<div>\n    <table class=\"grid dict\">\n        \n        <tr>\n            <th scope=\"row\"><b>Id: </b></th>\n            <td style=\"padding-left: 4px;\">us-ph-plandefinition-alt-expression-example</td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Url: </b></th>\n            <td style=\"padding-left: 4px;\"><a href=\"PlanDefinition-us-ph-plandefinition-alt-expression-example.html\">US Public Health PlanDefinition Alternative Expression Example</a></td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Version: </b></th>\n            <td style=\"padding-left: 4px;\">2.0.0-ballot</td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\">\n                <b>\n                    \n                        \n                    \n                </b>\n            </th>\n            <td style=\"padding-left: 4px;\">\n                \n                <p style=\"margin-bottom: 5px;\">\n                    <span>urn:oid:2.16.840.1.113883.4.642.40.58.34.1</span>\n                </p>\n                \n            </td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Title: </b></th>\n            <td style=\"padding-left: 4px;\">US Public Health PlanDefinition Alternative Expression Example</td>\n        </tr>\n        \n\n        \n\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Experimental: </b></th>\n            <td style=\"padding-left: 4px;\">true</td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Type: </b></th>\n            <td style=\"padding-left: 4px;\">\n                \n                    \n                        \n                        <p style=\"margin-bottom: 5px;\">\n                            <b>system: </b> <span><a href=\"http://terminology.hl7.org/6.5.0/CodeSystem-plan-definition-type.html\">http://terminology.hl7.org/CodeSystem/plan-definition-type</a></span>\n                        </p>\n                        \n                        \n                        <p style=\"margin-bottom: 5px;\">\n                            <b>code: </b> <span>workflow-definition</span>\n                        </p>\n                        \n                        \n                        <p style=\"margin-bottom: 5px;\">\n                            <b>display: </b> <span>Workflow Definition</span>\n                        </p>\n                        \n                    \n                \n                \n            </td>\n        </tr>\n        \n\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Date: </b></th>\n            <td style=\"padding-left: 4px;\">2022-07-31 12:32:29-0500</td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Publisher: </b></th>\n            <td style=\"padding-left: 4px;\">HL7 International / Public Health</td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Description: </b></th>\n            <td style=\"padding-left: 4px;\"><div><p>An example PlanDefinition</p>\n</div></td>\n        </tr>\n        \n\n        \n\n        \n\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Jurisdiction: </b></th>\n            <td style=\"padding-left: 4px;\">US</td>\n        </tr>\n        \n\n        \n\n        \n\n        \n\n        \n\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Effective Period: </b></th>\n            <td style=\"padding-left: 4px;\">2020-12-01..</td>\n        </tr>\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Related Artifacts: </b></th>\n            <td style=\"padding-left: 4px;\">\n                \n                \n                \n                <p><b>Dependencies</b></p>\n                <ul>\n                    \n                    <li><code>http://example.org/fhir/Library/library-rctc-example</code></li>\n                    \n                </ul>\n                \n                \n                \n                \n                \n            </td>\n        </tr>\n        \n\n        \n\n        \n        <tr>\n            <th scope=\"row\"><b>Actions: </b></th>\n            <td style=\"padding-left: 4px;\">\n                <table class=\"grid-dict\">\n                    \n                    <tr>\n                        <td>\n                            \n                            Start the reporting workflow in response to an encounter-start event\n                            \n                            <br/>\n                            \n                            <b>When:</b>\n                            \n                            <i>Named Event:</i> encounter-start\n                            <br/>\n                            \n                            \n                            \n                            \n                            \n                            \n                        </td>\n                    </tr>\n                    \n                    <tr>\n                        <td>\n                            \n                            Check suspected disorders for immediate reportability and setup jobs for future reportability checks.\n                            \n                            <br/>\n                            \n                            \n                            \n                            <b>Then:</b>\n                            <table class=\"grid-dict\">\n                                \n                                <tr>\n                                    <td>\n                                        \n                                        Check Trigger Codes based on Suspected Reportable Value set.\n                                        \n                                        <br/>\n                                        \n                                        \n                                        <b>If:</b>\n                                        \n                                        <i>Applicability:</i>\n                                        \n                                        <i>(%modifiedConditions.exists() or %modifiedLabResults.exists() or %modifiedMedicationOrders.exists())</i>\n                                        <br/>\n                                        \n                                        \n                                        \n                                        \n                                        \n                                    </td>\n                                </tr>\n                                \n                                <tr>\n                                    <td>\n                                        \n                                        <b> :</b>\n                                        \n                                        \n                                        <br/>\n                                        \n                                        \n                                        <b>If:</b>\n                                        \n                                        <i>Applicability:</i>\n                                        \n                                        <i>(%encounter.where((status = 'in-progress' and period.start + 1 day * %normalReportingDuration &gt;= now()) or (status = 'finished' and period.end + 72 hours &gt;= now())).select(true))</i>\n                                        <br/>\n                                        \n                                        \n                                        \n                                        \n                                        \n                                    </td>\n                                </tr>\n                                \n                            </table>\n                            \n                        </td>\n                    </tr>\n                    \n                    <tr>\n                        <td>\n                            \n                            Check Reportability and setup jobs for future reportability checks.\n                            \n                            <br/>\n                            \n                            \n                            \n                            <b>Then:</b>\n                            <table class=\"grid-dict\">\n                                \n                                <tr>\n                                    <td>\n                                        \n                                        Check Trigger Codes based on RCTC Value sets.\n                                        \n                                        <br/>\n                                        \n                                        \n                                        <b>If:</b>\n                                        \n                                        <i>Applicability:</i>\n                                        \n                                        <i>(%encounter.where(period.start + 1 day * %normalReportingDuration &gt;= 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()))</i>\n                                        <br/>\n                                        \n                                        \n                                        \n                                        \n                                        \n                                    </td>\n                                </tr>\n                                \n                                <tr>\n                                    <td>\n                                        \n                                        <b> :</b>\n                                        \n                                        \n                                        <br/>\n                                        \n                                        \n                                        <b>If:</b>\n                                        \n                                        <i>Applicability:</i>\n                                        \n                                        <i>(((%lasteicr.last().entry[2].resource as Bundle).entry.first().resource as Composition).date &lt; now() - 72 hours)</i>\n                                        <br/>\n                                        \n                                        \n                                        \n                                        \n                                        \n                                    </td>\n                                </tr>\n                                \n                                <tr>\n                                    <td>\n                                        \n                                        <b> :</b>\n                                        \n                                        \n                                        <br/>\n                                        \n                                        \n                                        <b>If:</b>\n                                        \n                                        <i>Applicability:</i>\n                                        \n                                        <i>(%inprogressencounter.where(status = 'in-progress' and period.start + 1 day * %normalReportingDuration &gt;= now() or (status = 'finished' and period.end + 72 hours &gt;= now())).exists())</i>\n                                        <br/>\n                                        \n                                        \n                                        \n                                        \n                                        \n                                    </td>\n                                </tr>\n                                \n                            </table>\n                            \n                        </td>\n                    </tr>\n                    \n                    <tr>\n                        <td>\n                            \n                            Create eICR\n                            \n                            <br/>\n                            \n                            \n                            \n                            <b>Then:</b>\n                            <table class=\"grid-dict\">\n                                \n                                <tr>\n                                    <td>\n                                        \n                                        Anonymize the report.\n                                        \n                                        <br/>\n                                        \n                                        \n                                        \n                                        \n                                        \n                                    </td>\n                                </tr>\n                                \n                            </table>\n                            \n                        </td>\n                    </tr>\n                    \n                    <tr>\n                        <td>\n                            \n                            Validate eICR\n                            \n                            <br/>\n                            \n                            \n                            \n                            \n                            \n                        </td>\n                    </tr>\n                    \n                    <tr>\n                        <td>\n                            \n                            Route and send eICR\n                            \n                            <br/>\n                            \n                            \n                            \n                            \n                            \n                        </td>\n                    </tr>\n                    \n                    <tr>\n                        <td>\n                            \n                            Start the reporting workflow in response to an encounter-modified event\n                            \n                            <br/>\n                            \n                            <b>When:</b>\n                            \n                            <i>Named Event:</i> encounter-modified\n                            <br/>\n                            \n                            \n                            \n                            <b>If:</b>\n                            \n                            <i>Applicability:</i>\n                            \n                            <i>(%encounter.where(period.start + 1 day * %normalReportingDuration &lt; now()).select(true))</i>\n                            <br/>\n                            \n                            \n                            \n                            \n                            \n                        </td>\n                    </tr>\n                    \n                </table>\n            </td>\n        </tr>\n        \n    </table>\n</div>\n</div>"
  },
  "url" : "http://example.org/fhir/PlanDefinition/us-ph-plandefinition-alt-expression-example",
  "identifier" : [
    {
      "system" : "urn:ietf:rfc:3986",
      "value" : "urn:oid:2.16.840.1.113883.4.642.40.58.34.1"
    }
  ],
  "version" : "2.0.0-ballot",
  "name" : "USPublicHealthPlanDefinitionAlternativeExpressionExample",
  "title" : "US Public Health PlanDefinition Alternative Expression Example",
  "type" : {
    "coding" : [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/plan-definition-type",
        "code" : "workflow-definition",
        "display" : "Workflow Definition"
      }
    ]
  },
  "status" : "active",
  "experimental" : true,
  "date" : "2022-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"
        },
        {
          "system" : "email",
          "value" : "pher@lists.HL7.org"
        }
      ]
    }
  ],
  "description" : "An example PlanDefinition",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "US"
        }
      ]
    }
  ],
  "effectivePeriod" : {
    "start" : "2020-12-01"
  },
  "relatedArtifact" : [
    {
      "type" : "depends-on",
      "label" : "RCTC Value Set Library of Trigger Codes",
      "resource" : "http://example.org/fhir/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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
              "code" : "initiate-reporting-workflow",
              "display" : "Initiate a reporting workflow"
            }
          ]
        }
      ],
      "trigger" : [
        {
          "id" : "encounter-start",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-named-eventtype-extension",
              "valueCodeableConcept" : {
                "coding" : [
                  {
                    "system" : "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-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/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
              "valueString" : "Patient/{{context.patientId}}"
            }
          ],
          "type" : "Patient"
        },
        {
          "id" : "encounter",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/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/ph-library/CodeSystem/us-ph-codesystem-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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
                  "code" : "check-trigger-codes"
                }
              ]
            }
          ],
          "condition" : [
            {
              "kind" : "applicability",
              "expression" : {
                "extension" : [
                  {
                    "url" : "http://hl7.org/fhir/StructureDefinition/cqf-alternativeExpression",
                    "valueExpression" : {
                      "language" : "text/cql-identifier",
                      "expression" : "Is Suspected Disorder?",
                      "reference" : "http://example.org/fhir/Library/RuleFilters|1.0.0"
                    }
                  }
                ],
                "language" : "text/fhirpath",
                "expression" : "%modifiedConditions.exists() or %modifiedLabResults.exists() or %modifiedMedicationOrders.exists()"
              }
            }
          ],
          "input" : [
            {
              "id" : "modifiedConditions",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "Condition?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "Condition",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-sdtc-example"
                }
              ]
            },
            {
              "id" : "modifiedLabResults",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "Observation?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "Observation",
              "codeFilter" : [
                {
                  "path" : "value",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-sdtc-example"
                }
              ]
            },
            {
              "id" : "modifiedMedicationOrders",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "MedicationRequest?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "MedicationRequest",
              "codeFilter" : [
                {
                  "path" : "medication",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-sdtc-example"
                }
              ]
            }
          ],
          "relatedAction" : [
            {
              "actionId" : "create-eicr",
              "relationship" : "before-start"
            }
          ]
        },
        {
          "id" : "continue-check-reportable",
          "code" : [
            {
              "coding" : [
                {
                  "system" : "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
                  "code" : "evaluate-condition"
                }
              ]
            }
          ],
          "condition" : [
            {
              "kind" : "applicability",
              "expression" : {
                "extension" : [
                  {
                    "url" : "http://hl7.org/fhir/StructureDefinition/cqf-alternativeExpression",
                    "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://example.org/fhir/Library/RuleFilters|1.0.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,
                "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/ph-library/CodeSystem/us-ph-codesystem-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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
                  "code" : "check-trigger-codes"
                }
              ]
            }
          ],
          "condition" : [
            {
              "kind" : "applicability",
              "expression" : {
                "extension" : [
                  {
                    "url" : "http://hl7.org/fhir/StructureDefinition/cqf-alternativeExpression",
                    "valueExpression" : {
                      "language" : "text/cql-identifier",
                      "expression" : "Is Encounter Reportable and Within Normal Reporting Duration?",
                      "reference" : "http://example.org/fhir/Library/RuleFilters|1.0.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/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "Condition?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "Condition",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-dxtc-example"
                }
              ]
            },
            {
              "id" : "encounters",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension",
                  "valueString" : "encounter"
                }
              ],
              "type" : "Encounter",
              "codeFilter" : [
                {
                  "path" : "reasonCode",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-dxtc-example"
                }
              ]
            },
            {
              "id" : "immunizations",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "Immunization?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "Immunization",
              "codeFilter" : [
                {
                  "path" : "vaccineCode",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-mrtc-example"
                }
              ]
            },
            {
              "id" : "labOrders",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "ServiceRequest?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "ServiceRequest",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-lotc-example"
                }
              ]
            },
            {
              "id" : "labTests",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "Observation?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "Observation",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-lotc-example"
                }
              ]
            },
            {
              "id" : "diagnosticOrders",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "DiagnosticReport?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "DiagnosticReport",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-lotc-example"
                }
              ]
            },
            {
              "id" : "procedureOrders",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "ServiceRequest?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "ServiceRequest",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-pctc-example"
                }
              ]
            },
            {
              "id" : "procedures",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "Procedure?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "Procedure",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-pctc-example"
                }
              ]
            },
            {
              "id" : "medicationOrders",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "MedicationRequest?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "MedicationRequest",
              "codeFilter" : [
                {
                  "path" : "medication",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-mrtc-example"
                }
              ]
            },
            {
              "id" : "medicationDispenses",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "MedicationDispense?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "MedicationDispense",
              "codeFilter" : [
                {
                  "path" : "medication",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-mrtc-example"
                }
              ]
            },
            {
              "id" : "medicationAdministrations",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension",
                  "valueString" : "MedicationAdministration?patient=Patient/{{context.patientId}}"
                }
              ],
              "type" : "MedicationAdministration",
              "codeFilter" : [
                {
                  "path" : "medication",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-mrtc-example"
                }
              ]
            },
            {
              "id" : "labResults",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension",
                  "valueString" : "labTests"
                }
              ],
              "type" : "Observation",
              "codeFilter" : [
                {
                  "path" : "value",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-ostc-example"
                }
              ]
            },
            {
              "id" : "diagnosticResults",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension",
                  "valueString" : "diagnosticOrders"
                }
              ],
              "type" : "DiagnosticReport",
              "codeFilter" : [
                {
                  "path" : "code",
                  "valueSet" : "http://example.org/fhir/ValueSet/valueset-ostc-example"
                }
              ]
            }
          ],
          "relatedAction" : [
            {
              "actionId" : "create-eicr",
              "relationship" : "before-start"
            }
          ]
        },
        {
          "id" : "check-update-eicr",
          "code" : [
            {
              "coding" : [
                {
                  "system" : "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
                  "code" : "evaluate-condition"
                }
              ]
            }
          ],
          "condition" : [
            {
              "kind" : "applicability",
              "expression" : {
                "extension" : [
                  {
                    "url" : "http://hl7.org/fhir/StructureDefinition/cqf-alternativeExpression",
                    "valueExpression" : {
                      "language" : "text/cql-identifier",
                      "expression" : "Most recent eICR sent over 72 hours ago?",
                      "reference" : "http://example.org/fhir/Library/RuleFilters|1.0.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/ph-library/StructureDefinition/us-ph-relateddata-extension",
                  "valueString" : "eicrreport"
                }
              ],
              "type" : "Bundle",
              "profile" : [
                🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"
              ]
            }
          ],
          "relatedAction" : [
            {
              "actionId" : "create-eicr",
              "relationship" : "before-start"
            }
          ]
        },
        {
          "id" : "is-encounter-in-progress",
          "code" : [
            {
              "coding" : [
                {
                  "system" : "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
                  "code" : "evaluate-condition"
                }
              ]
            }
          ],
          "condition" : [
            {
              "kind" : "applicability",
              "expression" : {
                "extension" : [
                  {
                    "url" : "http://hl7.org/fhir/StructureDefinition/cqf-alternativeExpression",
                    "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://example.org/fhir/Library/RuleFilters|1.0.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/ph-library/StructureDefinition/us-ph-relateddata-extension",
                  "valueString" : "encounter"
                }
              ],
              "type" : "Encounter"
            }
          ],
          "relatedAction" : [
            {
              "actionId" : "check-reportable",
              "relationship" : "before-start",
              "offsetDuration" : {
                "value" : 6,
                "system" : "http://unitsofmeasure.org",
                "code" : "h"
              }
            }
          ]
        }
      ]
    },
    {
      "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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
              "code" : "create-report"
            }
          ]
        }
      ],
      "input" : [
        {
          "id" : "patientdata",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/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/ph-library/StructureDefinition/us-ph-relateddata-extension",
              "valueString" : "conditions"
            }
          ],
          "type" : "Condition",
          "profile" : [
            🔗 "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-encounter-diagnosis"
          ]
        },
        {
          "id" : "encounterdata",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/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/ph-library/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/ph-library/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/ph-library/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/ph-library/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/ph-library/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/ph-library/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/ph-library/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/ph-library/StructureDefinition/us-ph-document-bundle"
          ]
        }
      ],
      "relatedAction" : [
        {
          "actionId" : "validate-eicr",
          "relationship" : "before-start"
        }
      ],
      "action" : [
        {
          "id" : "anonymize-report",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-trust-service-endpoint-extension",
              "valueReference" : {
                🔗 "reference" : "Endpoint/us-ph-endpoint-pha"
              }
            }
          ],
          "description" : "This action is used to anonymize a identifiable report",
          "textEquivalent" : "Anonymize the report.",
          "code" : [
            {
              "coding" : [
                {
                  "system" : "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
                  "code" : "anonymize-report"
                }
              ]
            }
          ],
          "input" : [
            {
              "id" : "report-to-be-anonymized",
              "extension" : [
                {
                  "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension",
                  "valueString" : "output-report"
                }
              ],
              "type" : "Bundle"
            }
          ],
          "output" : [
            {
              "id" : "anonymized-report",
              "type" : "Bundle",
              "profile" : [
                🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-reporting-bundle"
              ]
            }
          ]
        }
      ]
    },
    {
      "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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
              "code" : "validate-report"
            }
          ]
        }
      ],
      "input" : [
        {
          "id" : "generatedeicrreport",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension",
              "valueString" : "eicrreport"
            }
          ],
          "type" : "Bundle",
          "profile" : [
            🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"
          ]
        }
      ],
      "output" : [
        {
          "id" : "valideicrreport",
          "type" : "Bundle",
          "profile" : [
            🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
              "code" : "submit-report"
            }
          ]
        }
      ],
      "input" : [
        {
          "id" : "validatedeicrreport",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension",
              "valueString" : "valideicrreport"
            }
          ],
          "type" : "Bundle",
          "profile" : [
            🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"
          ]
        }
      ],
      "output" : [
        {
          "id" : "submittedeicrreport",
          "type" : "Bundle",
          "profile" : [
            🔗 "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-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/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions",
              "code" : "initiate-reporting-workflow",
              "display" : "Initiate a reporting workflow"
            }
          ]
        }
      ],
      "trigger" : [
        {
          "id" : "encounter-modified-trigger",
          "extension" : [
            {
              "url" : "http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-named-eventtype-extension",
              "valueCodeableConcept" : {
                "coding" : [
                  {
                    "system" : "http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-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/StructureDefinition/cqf-alternativeExpression",
                "valueExpression" : {
                  "language" : "text/cql-identifier",
                  "expression" : "Is Encounter Longer Than Normal Reporting Duration?",
                  "reference" : "http://example.org/fhir/Library/RuleFilters|1.0.0"
                }
              }
            ],
            "language" : "text/fhirpath",
            "expression" : "%encounter.where(period.start + 1 day * %normalReportingDuration < now()).select(true)"
          }
        }
      ],
      "relatedAction" : [
        {
          "actionId" : "create-eicr",
          "relationship" : "before-start"
        }
      ]
    }
  ]
}