<?xml version="1.0" encoding="UTF-8"?>

<Library xmlns="http://hl7.org/fhir">
  <id value="QICoreCommonTests"/>
  <text>
    <status value="extensions"/><div xmlns="http://www.w3.org/1999/xhtml">
    <table class="grid dict">
        
        <tr>
            <th scope="row"><b>Id: </b></th>
            <td style="padding-left: 4px;">QICoreCommonTests</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Url: </b></th>
            <td style="padding-left: 4px;">http://hl7.org/fhir/us/qicore/Library/QICoreCommonTests</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Version: </b></th>
            <td style="padding-left: 4px;">4.1.0</td>
        </tr>
        
        
        
        <tr>
            <th scope="row"><b>Name: </b></th>
            <td style="padding-left: 4px;">QICoreCommonTests</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Title: </b></th>
            <td style="padding-left: 4px;">QICore Common Tests</td>
        </tr>
        
        
        
        <tr>
            <th scope="row"><b>Status: </b></th>
            <td style="padding-left: 4px;">active</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Experimental: </b></th>
            <td style="padding-left: 4px;">false</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Type: </b></th>
            <td style="padding-left: 4px;">
                
                    
                        
                        <p style="margin-bottom: 5px;">
                            <b>system: </b> <span>http://terminology.hl7.org/CodeSystem/library-type</span>
                        </p>
                        
                        
                        <p style="margin-bottom: 5px;">
                            <b>code: </b> <span>logic-library</span>
                        </p>
                        
                        
                    
                
                
            </td>
        </tr>
        
        
        
        <tr>
            <th scope="row"><b>Date: </b></th>
            <td style="padding-left: 4px;">2020-11-29T15:54:22-07:00</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Publisher: </b></th>
            <td style="padding-left: 4px;">http://www.hl7.org/Special/committees/cqi/index.cfm</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Description: </b></th>
            <td style="padding-left: 4px;">This library defines tests for the QICoreCommon library.</td>
        </tr>
        
        
        
        
        
        <tr>
            <th scope="row"><b>Jurisdiction: </b></th>
            <td style="padding-left: 4px;">US</td>
        </tr>
        
        
        
        
        
        <tr>
            <th scope="row"><b>Approval Date: </b></th>
            <td style="padding-left: 4px;">2021-11-06</td>
        </tr>
        
        
        <tr>
            <th scope="row"><b>Last Review Date: </b></th>
            <td style="padding-left: 4px;">2021-11-06</td>
        </tr>
        
        
        
        <tr>
          <th scope="row"><b>Related Artifacts: </b></th>
          <td style="padding-left: 4px;">
            
            
            
            <p><b>Dependencies</b></p>
            <ul>
              
                <li>http://hl7.org/fhir/us/qicore/Library/QICoreCommon</li>
              
                <li>http://terminology.hl7.org/CodeSystem/v3-MaritalStatus</li>
              
                <li>urn:oid:2.16.840.1.113883.6.238</li>
              
                <li>http://loinc.org</li>
              
                <li>http://hl7.org/fhir/ValueSet/marital-status</li>
              
            </ul>
            
            
            
            
            
          </td>
        </tr>
        
        
        <tr>
          <th scope="row"><b>Parameters: </b></th>
          <td style="padding-left: 4px;">
            <table class="grid-dict">
              <tr><th><b>Name</b></th><th><b>Type</b></th><th><b>Min</b></th><th><b>Max</b></th><th><b>In/Out</b></th></tr>
              
                <tr><th>Patient</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>AdverseEvent</th><th>AdverseEvent</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>AllergyIntolerance</th><th>AllergyIntolerance</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>BodyStructure</th><th>BodyStructure</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>CarePlan</th><th>CarePlan</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>CareTeam</th><th>CareTeam</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Claim</th><th>Claim</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Communication</th><th>Communication</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>CommunicationNotDone</th><th>Communication</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>CommunicationRequest</th><th>CommunicationRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Condition</th><th>Condition</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Coverage</th><th>Coverage</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Device</th><th>Device</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>DeviceNotRequested</th><th>DeviceRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>DeviceRequest</th><th>DeviceRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>DiagnosticReportLab</th><th>DiagnosticReport</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>DiagnosticReportNote</th><th>DiagnosticReport</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Encounter</th><th>Encounter</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>EncounterPerformed</th><th>Encounter</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>FamilyMemberHistory</th><th>FamilyMemberHistory</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Flag</th><th>Flag</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Goal</th><th>Goal</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ImagingStudy</th><th>ImagingStudy</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Immunization</th><th>Immunization</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ImmunizationEvaluation</th><th>ImmunizationEvaluation</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ImmunizationNotDone</th><th>Immunization</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ImmunizationRecommendation</th><th>ImmunizationRecommendation</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ImplantableDevice</th><th>Device</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Location</th><th>Location</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Medication</th><th>Medication</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>MedicationAdministration</th><th>MedicationAdministration</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>MedicationAdministrationNotDone</th><th>MedicationAdministration</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>MedicationDispense</th><th>MedicationDispense</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>MedicationDispenseNotDone</th><th>MedicationDispense</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>MedicationNotRequested</th><th>MedicationRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>MedicationRequest</th><th>MedicationRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>NutritionOrder</th><th>NutritionOrder</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Observation</th><th>Observation</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ObservationNotDone</th><th>Observation</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Organization</th><th>Organization</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Practitioner</th><th>Practitioner</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>PractitionerRole</th><th>PractitionerRole</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Procedure</th><th>Procedure</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ProcedurePerformed</th><th>Procedure</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ProcedureNotDone</th><th>Procedure</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>RelatedPerson</th><th>RelatedPerson</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ServiceNotRequested</th><th>ServiceRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>ServiceRequest</th><th>ServiceRequest</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Specimen</th><th>Specimen</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Substance</th><th>Substance</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>Task</th><th>Task</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>TaskNotDone</th><th>Task</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>TestPatientGender</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestPatientActive</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestPatientBirthDate</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestPatientMaritalStatusMembership</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestPatientMartialStatusComparison</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestPatientDeceasedAsBoolean</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestPatientDeceasedAsDateTime</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestSlices</th><th>Observation</th><th>0</th><th>*</th><th>out</th></tr>
              
                <tr><th>TestSimpleExtensions</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
                <tr><th>TestComplexExtensions</th><th>Patient</th><th>0</th><th>1</th><th>out</th></tr>
              
            </table>
          </td>
        </tr>
        
        
        <tr>
          <th scope="row"><b>Data Requirements:</b></th>
          <td style="padding-left: 4px;">
            <table class="grid-dict">
              <tr><th><b>Type</b></th><th><b>Profile</b></th><th><b>MS</b></th><th><b>Code Filter</b></th></tr>
              
                <tr>
                  <th>Patient</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Patient</th>
                  <th>;;;;;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>AdverseEvent</th>
                  <th>http://hl7.org/fhir/StructureDefinition/AdverseEvent</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>AllergyIntolerance</th>
                  <th>http://hl7.org/fhir/StructureDefinition/AllergyIntolerance</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>BodyStructure</th>
                  <th>http://hl7.org/fhir/StructureDefinition/BodyStructure</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>CarePlan</th>
                  <th>http://hl7.org/fhir/StructureDefinition/CarePlan</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>CareTeam</th>
                  <th>http://hl7.org/fhir/StructureDefinition/CareTeam</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Claim</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Claim</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Communication</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Communication</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>CommunicationRequest</th>
                  <th>http://hl7.org/fhir/StructureDefinition/CommunicationRequest</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Condition</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Condition</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Coverage</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Coverage</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Device</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Device</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>DeviceRequest</th>
                  <th>http://hl7.org/fhir/StructureDefinition/DeviceRequest</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>DiagnosticReport</th>
                  <th>http://hl7.org/fhir/StructureDefinition/DiagnosticReport</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Encounter</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>FamilyMemberHistory</th>
                  <th>http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Flag</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Flag</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Goal</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Goal</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>ImagingStudy</th>
                  <th>http://hl7.org/fhir/StructureDefinition/ImagingStudy</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Immunization</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Immunization</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>ImmunizationEvaluation</th>
                  <th>http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>ImmunizationRecommendation</th>
                  <th>http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Location</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Location</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Medication</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Medication</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>MedicationAdministration</th>
                  <th>http://hl7.org/fhir/StructureDefinition/MedicationAdministration</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>MedicationDispense</th>
                  <th>http://hl7.org/fhir/StructureDefinition/MedicationDispense</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>MedicationRequest</th>
                  <th>http://hl7.org/fhir/StructureDefinition/MedicationRequest</th>
                  <th>;;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>NutritionOrder</th>
                  <th>http://hl7.org/fhir/StructureDefinition/NutritionOrder</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Observation</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Observation</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Observation</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Observation</th>
                  <th>;;;</th>
                  <th>
                    
                      <b>code filter: </b>
                      
                      <br/>
                      
                      
                      <span style="padding-left: 4px;">
                          <b>path: </b><span>code</span>
                      </span>
                      
                      <br/>
                      
                      
                      
                      
                          
                          <p style="margin-bottom: 5px;">
                              <b>system: </b> <span>http://loinc.org</span>
                          </p>
                          
                          
                          <p style="margin-bottom: 5px;">
                              <b>code: </b> <span>85354-9</span>
                          </p>
                          
                          
                          <p style="margin-bottom: 5px;">
                              <b>display: </b> <span>Blood pressure panel with all children optional</span>
                          </p>
                          
                      
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Organization</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Organization</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Practitioner</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Practitioner</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>PractitionerRole</th>
                  <th>http://hl7.org/fhir/StructureDefinition/PractitionerRole</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Procedure</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Procedure</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>RelatedPerson</th>
                  <th>http://hl7.org/fhir/StructureDefinition/RelatedPerson</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>ServiceRequest</th>
                  <th>http://hl7.org/fhir/StructureDefinition/ServiceRequest</th>
                  <th>;;</th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Specimen</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Specimen</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Substance</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Substance</th>
                  <th></th>
                  <th>
                    
                  </th>
                </tr>
              
                <tr>
                  <th>Task</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Task</th>
                  <th>;</th>
                  <th>
                    
                  </th>
                </tr>
              
            </table>
          </td>
        </tr>
        
        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><a id="cql-content"><b>Content: </b></a> text/cql</th></tr>
              <tr><td><pre><code class="language-cql">library QICoreCommonTests

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'

include QICoreCommon called Common

codesystem "Marital Status Codes": 'http://terminology.hl7.org/CodeSystem/v3-MaritalStatus'
codesystem "CDC Race and Ethnicity Codes": 'urn:oid:2.16.840.1.113883.6.238'

valueset "Marital Status": 'http://hl7.org/fhir/ValueSet/marital-status'

code "Marital Status - Married": 'M' from "Marital Status Codes"
code "American Indian or Alaska Native": '1002-5' from "CDC Race and Ethnicity Codes"
code "Alaska Native": '1735-0' from "CDC Race and Ethnicity Codes"
code "Blood pressure": '85354-9' from Common."LOINC" display 'Blood pressure panel with all children optional'
code "Diastolic blood pressure": '8462-4' from Common."LOINC" display 'Diastolic blood pressure'
code "Systolic blood pressure": '8480-6' from Common."LOINC" display 'Systolic blood pressure'

context Patient

// QICoreAdverseEvent
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-adverseevent
define AdverseEvent:
  [AdverseEvent]

// QICoreAllergyIntolerance
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-allergyintolerance
define AllergyIntolerance:
  [AllergyIntolerance]

// QICoreBodyStructure
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-bodystructure
define BodyStructure:
  [BodyStructure]

// QICoreCarePlan
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-careplan
define CarePlan:
  [CarePlan]

// QICoreCareTeam
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-careteam
define CareTeam:
  [CareTeam]

// QICoreClaim
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-claim
define Claim:
  [Claim]

// QICoreCommunication
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-communication
define Communication:
  [Communication] C
    where C.status in { 'preparation', 'in-progress', 'on-hold', 'completed' }

// QICoreCommunicationNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-communicationnotdone
define CommunicationNotDone:
  [Communication] C
    where C.status = 'not-done'

// QICoreCommunicationRequest
// @profile: 	http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-communicationrequest
define CommunicationRequest:
  [CommunicationRequest]

// QICoreCondition
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition
define Condition:
  [Condition]

// QICoreCoverage
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage
define Coverage:
  [Coverage]

// QICoreDevice
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-device
define Device:
  [Device]

// QICoreDeviceNotRequested
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-devicenotrequested
define DeviceNotRequested:
  [DeviceRequest] D
    where D.status = 'completed'
      and D.doNotPerform() is true

// QICoreDeviceRequest
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-devicerequest
define DeviceRequest:
  [DeviceRequest] D
    where D.status in { 'draft', 'active', 'on-hold', 'revoked', 'completed' }
      and D.doNotPerform() is not true

// QICoreDeviceUseStatement
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-deviceusestatement
define DeviceUseStatement:
  [DeviceUseStatement]

// QICoreDiagnosticReportLab
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-diagnosticreport-lab
define DiagnosticReportLab:
  [DiagnosticReport] D
    //where D.category ~ "http://terminology.hl7.org/CodeSystem/v2-0074#LAB"

// QICoreDiagnosticReportNote
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-diagnosticreport-note
define DiagnosticReportNote:
  [DiagnosticReport] D

// QICoreEncounter
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
define Encounter:
  [Encounter]

define EncounterPerformed:
  Encounter E
    where E.status = 'finished'

// QICoreFamilyMemberHistory
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-familymemberhistory
define FamilyMemberHistory:
  [FamilyMemberHistory]

// QICoreFlag
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-flag
define Flag:
  [Flag]

// QICoreGoal
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-goal
define Goal:
  [Goal]

// QICoreImagingStudy
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-imagingstudy
define ImagingStudy:
  [ImagingStudy]

// QICoreImmunization
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-immunization
define Immunization:
  [Immunization] I
    where I.status = 'completed'

// QICoreImmunizationEvaluation
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-immunizationevaluation
define ImmunizationEvaluation:
  [ImmunizationEvaluation]

// QICoreImmunizationNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-immunizationnotdone
define ImmunizationNotDone:
  [Immunization] I
    where I.status = 'not-done'

// QICoreImmunizationRecommendation
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-immunizationrec
define ImmunizationRecommendation:
  [ImmunizationRecommendation]

// USCoreImplantableDevice
// @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device
define ImplantableDevice:
  [Device]

// QICoreLocation
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-location
define Location:
  [Location]

// QICoreMedication
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication
define Medication:
  [Medication]

// QICoreMedicationAdministration
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration
define MedicationAdministration:
  [MedicationAdministration] M
    where M.status in { 'in-progress', 'on-hold', 'completed' }

// QICoreMedicationAdministrationNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotadministered
define MedicationAdministrationNotDone:
  [MedicationAdministration] M
    where M.status = 'not-done'

// QICoreMedicationDispense
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationdispense
define MedicationDispense:
  [MedicationDispense] D
    where D.status in { 'preparation', 'in-progress', 'on-hold', 'completed' }

// QICoreMedicationDispenseNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotdispensed
define MedicationDispenseNotDone:
  [MedicationDispense] D
    where D.status in { 'cancelled', 'declined' }

// QICoreMedicationNotRequested
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested
define MedicationNotRequested:
  [MedicationRequest] R
    where R.status = 'completed'
      and R.doNotPerform is true

/*
define "Antithrombotic Not Given at Discharge":
  ["MedicationRequest": medication in "Antithrombotic Therapy"] NoAntithromboticDischarge
    where NoAntithromboticDischarge.doNotPerform is true
			and (NoAntithromboticDischarge.reasonCode in "Medical Reason"
				or NoAntithromboticDischarge.reasonCode in "Patient Refusal")
      and exists (NoAntithromboticDischarge.category C where FHIRHelpers.ToConcept(C) ~ FC."Community" or FHIRHelpers.ToConcept(C) ~ FC."Discharge")
      and NoAntithromboticDischarge.status = 'completed'
      and NoAntithromboticDischarge.intent = 'order'

define "Antithrombotic Not Given at Discharge":
  QICore.MedicationNotRequested NoAntithromboticDischarge
    where NoAntithromboticDischarge.medication in "Antithrombotic Therapy"
      and (NoAntithromboticDischarge.reasonCode in "Medical Reason"
        or NoAntithromboticDischarge.reasonCode in "Patient Refusal")
      and (NoAntithromboticDischarge.isCommunity() or NoAntithromboticDischarge.isDischarge())
      and NoAntithromboticDischarge.intent = 'order'

define "Antithrombotic Not Given at Discharge":
  ["MedicationNotRequested": medication in "Antithrombotic Therapy"] NoAntithromboticDischarge
    where (NoAntithromboticDischarge.reasonCode in "Medical Reason"
        or NoAntithromboticDischarge.reasonCode in "Patient Refusal")
      and (NoAntithromboticDischarge.isCommunity() or NoAntithromboticDischarge.isDischarge())
      and NoAntithromboticDischarge.intent = 'order'
*/

// QICoreMedicationRequest
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest
define MedicationRequest:
  [MedicationRequest] R
    where R.status in { 'active', 'on-hold', 'completed', 'draft' }
      and R.doNotPerform is not true

/*
define "Antithrombotic Therapy at Discharge":
  ["MedicationRequest": medication in "Antithrombotic Therapy"] Antithrombotic
    where exists (Antithrombotic.category C where FHIRHelpers.ToConcept(C) in { Global."Community", Global."Discharge" })
      and Antithrombotic.status in { 'active', 'completed' }
      and Antithrombotic.intent.value = 'order'

define "Antithrombotic Therapy at Discharge":
  QICore.MedicationRequest Antithrombotic
    where Antithrombotic.medication in "Antithrombotic Therapy"
      and (Antithrombotic.isCommunity() or Antithrombotic.isDischarge())
      and Antithrombotic.status in { 'active', 'completed' }
      and Antithrombotic.intent = 'order'

define "Antithrombotic Therapy at Discharge":
  [MedicationRequest: medication in "Antithrombotic Therapy"] Antithrombotic
    where (Antithrombotic.isCommunity() or Antithrombotic.isDischarge())
      and Antithrombotic.status in { 'active', 'completed' }
      and Antithrombotic.intent = 'order'
*/

// QICoreMedicationStatement
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationstatement
define MedicationStatement:
  [MedicationStatement]

// QICoreNutritionOrder
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-nutritionorder
define NutritionOrder:
  [NutritionOrder]

// QICoreObservation
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation
define Observation:
  [Observation] O
    where O.status in { 'registered', 'preliminary', 'final', 'amended', 'corrected' }

// QICoreObservationNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observationnotdone
define ObservationNotDone:
  [Observation] O
    where O.status = 'cancelled'

// FHIR Vital Signs

// USCore Smoking Status

// USCore Laboratory Result

// USCore Pediatric BMI for Age

// USCore Pediatric Weight for Height

// USCore Pulse Oximetry

// QICoreOrganization
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-organization
define Organization:
  [Organization]

// QICorePatient
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
//define Patient:
//  [Patient]

// QICorePractitioner
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-practitioner
define Practitioner:
  [Practitioner]

// QICorePractitionerRole
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-practitionerrole
define PractitionerRole:
  [PractitionerRole]

// QICoreProcedure
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
define Procedure:
  [Procedure] P
    where P.status in { 'preparation', 'in-progress', 'on-hold', 'completed' }

define ProcedurePerformed:
  Procedure P
    where P.status = 'completed'

/*
define "Flexible Sigmoidoscopy Performed":
 [Procedure: "Flexible Sigmoidoscopy"] FlexibleSigmoidoscopy
	 where FlexibleSigmoidoscopy.status = 'completed'
		 and Global."Normalize Interval"(FlexibleSigmoidoscopy.performed) ends 5 years or less on or before end of "Measurement Period"

define "Flexible Sigmoidoscopy Performed":
  QICore.ProcedurePerformed FlexibleSigmoidoscopy
    where FlexibleSigmoidoscopy.code in "Flexible Sigmoidoscopy"
      and FlexibleSigmoidoscopy.performed.toInterval() ends 5 years or less on or before end of "Measurement Period"
*/

// QICoreProcedureNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone
define ProcedureNotDone:
  [Procedure] P
    where P.status = 'not-done'

/*
define "No VTE Prophylaxis Device Applied":
  ["Procedure": "Device Application"] DeviceApplied
    let DeviceNotDoneTiming: Global.GetExtension(DeviceApplied, 'qicore-recorded').value
    where (DeviceApplied.usedCode in "Intermittent pneumatic compression devices (IPC)"
      or DeviceApplied.usedCode in "Venous foot pumps (VFP)"
      or DeviceApplied.usedCode in "Graduated compression stockings (GCS)"
    )
      and  DeviceApplied.status = 'not-done'
    return {id: DeviceApplied.id, requestStatusReason: DeviceApplied.statusReason, authoredOn: DeviceNotDoneTiming}

define "No VTE Prophylaxis Device Applied":
  QICore.ProcedureNotDone DeviceApplied
    where DeviceApplied.code in "Device Application"
      and (DeviceApplied.usedCode in "Intermittent pneumatic compression devices (IPC)"
        or DeviceApplied.usedCode in "Venous foot pumps (VFP)"
        or DeviceApplied.usedCode in "Graduated compression stockings (GCS)")
    return {
      id: DeviceApplied.id,
      requestStatusReason: DeviceApplied.statusReason,
      authoredOn: DeviceApplied.recorded()
    }

*/

// QICoreRelatedPerson
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-relatedperson
define RelatedPerson:
  [RelatedPerson]

// QICoreServiceNotRequested
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicenotrequested
define ServiceNotRequested:
  [ServiceRequest] SR
    where SR.status = 'completed'
      and SR.doNotPerform is true

/*
define "No VTE Prophylaxis Device Order":
  (["ServiceRequest": "Venous foot pumps (VFP)"]
    union ["ServiceRequest": "Intermittent pneumatic compression devices (IPC)"]
    union ["ServiceRequest": "Graduated compression stockings (GCS)"]
  ) DeviceOrder
    where DeviceOrder.status = 'completed'
      and DeviceOrder.doNotPerform is true

define "No VTE Prophylaxis Device Order":
  QICore.ServiceNotRequested DeviceOrder
    where DeviceOrder.code in "Venous foot pumps (VFP)"
      or DeviceOrder.code in "Intermittent pneumatic compression devices (IPC)"
      or DeviceOrder.code in "Graduated compression stockings (GCS)"
*/

// QICoreServiceRequest
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
define ServiceRequest:
  [ServiceRequest] SR
    where SR.status in { 'draft', 'active', 'on-hold', 'completed' }
      and SR.doNotPerform is not true

/*
define "Intervention Comfort Measures":
  (["ServiceRequest": "Comfort Measures"] P
    where P.intent = 'order'
  )
    union (["Procedure": "Comfort Measures"] InterventionPerformed
      where InterventionPerformed.status in {'completed', 'in-progress'}
    )

define "Intervention Comfort Measures":
  (QICore.ServiceRequest SR
    where SR.code in "Comfort Measures"
      and SR.intent = 'order'
  )
    union (
      QICore.Procedure InterventionPerformed
        where InterventionPerformed.code in "Comfort Measures"
          and InterventionPerformed.status in { 'completed', 'in-progress' }
    )
*/

// QICoreSpecimen
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-specimen
define Specimen:
  [Specimen]

// QICoreSubstance
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-substance
define Substance:
  [Substance]

// QICoreTask
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-task
define Task:
  [Task] T
    where T.status in { 'draft', 'requested', 'received', 'accepted', 'ready', 'in-progress', 'on-hold', 'completed' }

// QICoreTaskNotDone
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-tasknotdone
// TODO: What about cancelled and failed?
define TaskNotDone:
  [Task] T
    where T.status = 'rejected'

define TestPatientGender:
  Patient P
    where P.gender = 'male'

define TestPatientActive:
  Patient P
    where P.active is true

define TestPatientBirthDate:
  Patient P
    where P.birthDate before Today()

define TestPatientMaritalStatusMembership:
  Patient P
    where P.maritalStatus in "Marital Status"

define TestPatientMartialStatusComparison:
  Patient P
    where P.maritalStatus ~ "Marital Status - Married"

define TestPatientDeceasedAsBoolean:
  Patient P
    where P.deceased is false

define TestPatientDeceasedAsDateTime:
  Patient P
    where P.deceased before Today()

define TestSlices:
  [Observation: "Blood pressure"] O
    let
      systolicBP: singleton from (O.component SBP where SBP.code ~ "Systolic blood pressure"),
      diastolicBP: singleton from (O.component DBP where DBP.code ~ "Diastolic blood pressure")
    where O.status in { 'registered', 'preliminary', 'final', 'amended', 'corrected' }
      and systolicBP.value &lt; 140 'mm[Hg]'
      and diastolicBP.value &lt; 90 'mm[Hg]'

define TestSimpleExtensions:
  Patient P
    where P.birthsex() = 'M'

define TestComplexExtensions:
  Patient P
    where exists ((P.race().ombCategory) C where C ~ "American Indian or Alaska Native")
      and exists ((P.race().detailed) C where C ~ "Alaska Native")
</code></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
        
        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><b>Content: </b> application/elm+xml</th></tr>
              <tr><td><pre><code>Encoded data (205164 characters)</code></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
        
        
        <tr>
          <td colspan="2">
            <table>
              <tr><th><b>Content: </b> application/elm+json</th></tr>
              <tr><td><pre><code>Encoded data (360476 characters)</code></pre></td></tr>
            </table>
          </td>
        </tr>
        
        
    </table>
</div>
  </text>
  <url value="http://hl7.org/fhir/us/qicore/Library/QICoreCommonTests"/>
  <version value="4.1.0"/>
  <name value="QICoreCommonTests"/>
  <title value="QICore Common Tests"/>
  <status value="active"/>
  <experimental value="false"/>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
      <code value="logic-library"/>
    </coding>
  </type>
  <date value="2020-11-29T15:54:22-07:00"/>
  <publisher value="http://www.hl7.org/Special/committees/cqi/index.cfm"/>
  <contact>
    <name value="Clinical Quality Information WG"/>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/cqi"/>
    </telecom>
  </contact>
  <description value="This library defines tests for the QICoreCommon library."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="US"/>
    </coding>
  </jurisdiction>
  <approvalDate value="2021-11-06"/>
  <lastReviewDate value="2021-11-06"/>
  <topic>
    <text value="FHIR"/>
  </topic>
  <topic>
    <text value="CQL"/>
  </topic>
  <topic>
    <text value="QICore"/>
  </topic>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library Common"/>
    <resource value="http://hl7.org/fhir/us/qicore/Library/QICoreCommon"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Code system Marital Status Codes"/>
    <resource value="http://terminology.hl7.org/CodeSystem/v3-MaritalStatus"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Code system CDC Race and Ethnicity Codes"/>
    <resource value="urn:oid:2.16.840.1.113883.6.238"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Code system LOINC"/>
    <resource value="http://loinc.org"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Value set Marital Status"/>
    <resource value="http://hl7.org/fhir/ValueSet/marital-status"/>
  </relatedArtifact>
  <parameter>
    <name value="Patient"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="AdverseEvent"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="AdverseEvent"/>
  </parameter>
  <parameter>
    <name value="AllergyIntolerance"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="AllergyIntolerance"/>
  </parameter>
  <parameter>
    <name value="BodyStructure"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="BodyStructure"/>
  </parameter>
  <parameter>
    <name value="CarePlan"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="CarePlan"/>
  </parameter>
  <parameter>
    <name value="CareTeam"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="CareTeam"/>
  </parameter>
  <parameter>
    <name value="Claim"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Claim"/>
  </parameter>
  <parameter>
    <name value="Communication"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Communication"/>
  </parameter>
  <parameter>
    <name value="CommunicationNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Communication"/>
  </parameter>
  <parameter>
    <name value="CommunicationRequest"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="CommunicationRequest"/>
  </parameter>
  <parameter>
    <name value="Condition"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Condition"/>
  </parameter>
  <parameter>
    <name value="Coverage"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Coverage"/>
  </parameter>
  <parameter>
    <name value="Device"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Device"/>
  </parameter>
  <parameter>
    <name value="DeviceNotRequested"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="DeviceRequest"/>
  </parameter>
  <parameter>
    <name value="DeviceRequest"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="DeviceRequest"/>
  </parameter>
  <parameter>
    <name value="DiagnosticReportLab"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="DiagnosticReport"/>
  </parameter>
  <parameter>
    <name value="DiagnosticReportNote"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="DiagnosticReport"/>
  </parameter>
  <parameter>
    <name value="Encounter"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Encounter"/>
  </parameter>
  <parameter>
    <name value="EncounterPerformed"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Encounter"/>
  </parameter>
  <parameter>
    <name value="FamilyMemberHistory"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="FamilyMemberHistory"/>
  </parameter>
  <parameter>
    <name value="Flag"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Flag"/>
  </parameter>
  <parameter>
    <name value="Goal"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Goal"/>
  </parameter>
  <parameter>
    <name value="ImagingStudy"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="ImagingStudy"/>
  </parameter>
  <parameter>
    <name value="Immunization"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Immunization"/>
  </parameter>
  <parameter>
    <name value="ImmunizationEvaluation"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="ImmunizationEvaluation"/>
  </parameter>
  <parameter>
    <name value="ImmunizationNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Immunization"/>
  </parameter>
  <parameter>
    <name value="ImmunizationRecommendation"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="ImmunizationRecommendation"/>
  </parameter>
  <parameter>
    <name value="ImplantableDevice"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Device"/>
  </parameter>
  <parameter>
    <name value="Location"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Location"/>
  </parameter>
  <parameter>
    <name value="Medication"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Medication"/>
  </parameter>
  <parameter>
    <name value="MedicationAdministration"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="MedicationAdministration"/>
  </parameter>
  <parameter>
    <name value="MedicationAdministrationNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="MedicationAdministration"/>
  </parameter>
  <parameter>
    <name value="MedicationDispense"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="MedicationDispense"/>
  </parameter>
  <parameter>
    <name value="MedicationDispenseNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="MedicationDispense"/>
  </parameter>
  <parameter>
    <name value="MedicationNotRequested"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="MedicationRequest"/>
  </parameter>
  <parameter>
    <name value="MedicationRequest"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="MedicationRequest"/>
  </parameter>
  <parameter>
    <name value="NutritionOrder"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="NutritionOrder"/>
  </parameter>
  <parameter>
    <name value="Observation"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Observation"/>
  </parameter>
  <parameter>
    <name value="ObservationNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Observation"/>
  </parameter>
  <parameter>
    <name value="Organization"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Organization"/>
  </parameter>
  <parameter>
    <name value="Practitioner"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Practitioner"/>
  </parameter>
  <parameter>
    <name value="PractitionerRole"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="PractitionerRole"/>
  </parameter>
  <parameter>
    <name value="Procedure"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Procedure"/>
  </parameter>
  <parameter>
    <name value="ProcedurePerformed"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Procedure"/>
  </parameter>
  <parameter>
    <name value="ProcedureNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Procedure"/>
  </parameter>
  <parameter>
    <name value="RelatedPerson"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="RelatedPerson"/>
  </parameter>
  <parameter>
    <name value="ServiceNotRequested"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="ServiceRequest"/>
  </parameter>
  <parameter>
    <name value="ServiceRequest"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="ServiceRequest"/>
  </parameter>
  <parameter>
    <name value="Specimen"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Specimen"/>
  </parameter>
  <parameter>
    <name value="Substance"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Substance"/>
  </parameter>
  <parameter>
    <name value="Task"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Task"/>
  </parameter>
  <parameter>
    <name value="TaskNotDone"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Task"/>
  </parameter>
  <parameter>
    <name value="TestPatientGender"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestPatientActive"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestPatientBirthDate"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestPatientMaritalStatusMembership"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestPatientMartialStatusComparison"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestPatientDeceasedAsBoolean"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestPatientDeceasedAsDateTime"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestSlices"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Observation"/>
  </parameter>
  <parameter>
    <name value="TestSimpleExtensions"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="TestComplexExtensions"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <dataRequirement>
    <type value="Patient"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mustSupport value="deceased"/>
    <mustSupport value="gender"/>
    <mustSupport value="active"/>
    <mustSupport value="birthDate"/>
    <mustSupport value="maritalStatus"/>
  </dataRequirement>
  <dataRequirement>
    <type value="AdverseEvent"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/AdverseEvent"/>
  </dataRequirement>
  <dataRequirement>
    <type value="AllergyIntolerance"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/AllergyIntolerance"/>
  </dataRequirement>
  <dataRequirement>
    <type value="BodyStructure"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/BodyStructure"/>
  </dataRequirement>
  <dataRequirement>
    <type value="CarePlan"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/CarePlan"/>
  </dataRequirement>
  <dataRequirement>
    <type value="CareTeam"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/CareTeam"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Claim"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Claim"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Communication"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Communication"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="CommunicationRequest"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/CommunicationRequest"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Condition"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Condition"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Coverage"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Coverage"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Device"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Device"/>
  </dataRequirement>
  <dataRequirement>
    <type value="DeviceRequest"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/DeviceRequest"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="DiagnosticReport"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/DiagnosticReport"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Encounter"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="FamilyMemberHistory"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Flag"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Flag"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Goal"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Goal"/>
  </dataRequirement>
  <dataRequirement>
    <type value="ImagingStudy"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/ImagingStudy"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Immunization"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Immunization"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="ImmunizationEvaluation"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/ImmunizationEvaluation"/>
  </dataRequirement>
  <dataRequirement>
    <type value="ImmunizationRecommendation"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Location"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Location"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Medication"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Medication"/>
  </dataRequirement>
  <dataRequirement>
    <type value="MedicationAdministration"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/MedicationAdministration"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="MedicationDispense"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/MedicationDispense"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="MedicationRequest"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/MedicationRequest"/>
    <mustSupport value="doNotPerform"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="NutritionOrder"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/NutritionOrder"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Observation"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Observation"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Observation"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Observation"/>
    <mustSupport value="component"/>
    <mustSupport value="code"/>
    <mustSupport value="status"/>
    <codeFilter>
      <path value="code"/>
      <code>
        <system value="http://loinc.org"/>
        <code value="85354-9"/>
        <display value="Blood pressure panel with all children optional"/>
      </code>
    </codeFilter>
  </dataRequirement>
  <dataRequirement>
    <type value="Organization"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Organization"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Practitioner"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
  </dataRequirement>
  <dataRequirement>
    <type value="PractitionerRole"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Procedure"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Procedure"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="RelatedPerson"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson"/>
  </dataRequirement>
  <dataRequirement>
    <type value="ServiceRequest"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/ServiceRequest"/>
    <mustSupport value="doNotPerform"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Specimen"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Specimen"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Substance"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Substance"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Task"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Task"/>
    <mustSupport value="status"/>
  </dataRequirement>
  <content>
    <contentType value="text/cql"/>
    <data value="[encoded data, 23644 characters]"/>
  </content>
  <content>
    <contentType value="application/elm+xml"/>
    <data value="[encoded data, 205164 characters]"/>
  </content>
  <content>
    <contentType value="application/elm+json"/>
    <data value="[encoded data, 360476 characters]"/>
  </content>
</Library>