| 1 | <!--  HL7 QRDA BMI (Section 6) -->
 | 
|---|
| 2 | 
 | 
|---|
| 3 | <!-- errors -->
 | 
|---|
| 4 |   <pattern id="p-qrda_bmi-errors">
 | 
|---|
| 5 |     <title>HL7 QRDA BMI (Section 6) - errors validation phase</title>
 | 
|---|
| 6 |     <rule context='/'>
 | 
|---|
| 7 | 
 | 
|---|
| 8 |     <assert test='count(/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:birthTime) = 1'>
 | 
|---|
| 9 |        Error: CONF-QRDA_BMI-1: Category I BMI QRDA report SHALL contain exactly one
 | 
|---|
| 10 |        ClinicalDocument/recordTarget/patientRole/patient/birthTime.
 | 
|---|
| 11 |     </assert>
 | 
|---|
| 12 | 
 | 
|---|
| 13 |     <assert test='string-length(/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:birthTime/@value) >= 8'>
 | 
|---|
| 14 |        Error: CONF-QRDA_BMI-2: The birthTime SHALL be precise to the day and MAY be precise to
 | 
|---|
| 15 |        the second.
 | 
|---|
| 16 |     </assert>
 | 
|---|
| 17 | 
 | 
|---|
| 18 |     <assert test='.//cda:section/cda:templateId[@root="2.16.840.1.113883.10.20.12.2"]'>
 | 
|---|
| 19 |        Error: CONF-QRDA_BMI-3: A Body Mass Index QRDA SHALL contain a non-nested top-level
 | 
|---|
| 20 |        Measure section containing information about the Body Mass Index
 | 
|---|
| 21 |        measure.
 | 
|---|
| 22 |     </assert>
 | 
|---|
| 23 |     </rule>
 | 
|---|
| 24 | 
 | 
|---|
| 25 |     <rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.12.2"]'>
 | 
|---|
| 26 |     <assert test="contains(translate(cda:title,'QWERTYUIOPASDFGHJKLZXCVBNM','qwertyuiopasdfghjklzxcvbnm'),'measure: body mass index percentile')">
 | 
|---|
| 27 |        Error: CONF-QRDA_BMI-5: The Body Mass Index Measure section SHALL contain exactly one
 | 
|---|
| 28 |        section/title valued with a case-insensitive, text string containing,
 | 
|---|
| 29 |        "Measure: Body Mass Index Percentile".
 | 
|---|
| 30 |     </assert>
 | 
|---|
| 31 | 
 | 
|---|
| 32 |     <assert test='cda:entry/cda:act/cda:code[@code="BMIV1-X" and @codeSystem="2.16.840.1.113883.6.1"]'>
 | 
|---|
| 33 |        Error: CONF-QRDA_BMI-6: The value for act/code SHALL be BMIV1-X Body Mass Index,
 | 
|---|
| 34 |         V1 2.16.840.1.113883.6.1 LOINC STATIC.
 | 
|---|
| 35 |     </assert>
 | 
|---|
| 36 |     </rule>
 | 
|---|
| 37 | 
 | 
|---|
| 38 | <!-- This context comes from the definition of Reporting Parameters Section
 | 
|---|
| 39 | 
 | 
|---|
| 40 | CONF-QRDA-II-24: The value for section/code SHALL be 55187-9 Reporting
 | 
|---|
| 41 |         Parameters 2.16.840.1.113883.6.1 LOINC STATIC.
 | 
|---|
| 42 | 
 | 
|---|
| 43 |  -->
 | 
|---|
| 44 | 
 | 
|---|
| 45 |     <rule context='*[cda:code/@code="55187-9" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]'>
 | 
|---|
| 46 |     <assert test='string-length(cda:entry/cda:act[cda:code[@code="252116004" and @codeSystem="2.16.840.1.113883.6.96"]]/cda:effectiveTime/cda:low/@value) >= 8 and
 | 
|---|
| 47 |                   string-length(cda:entry/cda:act[cda:code[@code="252116004" and @codeSystem="2.16.840.1.113883.6.96"]]/cda:effectiveTime/cda:high/@value) >= 8'>
 | 
|---|
| 48 |        Error: CONF-QRDA_BMI-8: The reporting time period in a Reporting Period Observation SHALL
 | 
|---|
| 49 |        be represented with an effectiveTime/low element with a value of the first
 | 
|---|
| 50 |        day of the month combined with a high element with a value of the last day
 | 
|---|
| 51 |        of the month OR the reporting time period in a Reporting Period Observation
 | 
|---|
| 52 |        SHALL be represented with an effectiveTime/low element with a value of
 | 
|---|
| 53 |        the first day of the quarter combined with a high element with a value of
 | 
|---|
| 54 |        the last day of the quarter representing respectively the first and last days of
 | 
|---|
| 55 |        the period reported.
 | 
|---|
| 56 |     </assert>
 | 
|---|
| 57 |     </rule>
 | 
|---|
| 58 | 
 | 
|---|
| 59 | <!-- This context comes from the definition of Patient Data Section
 | 
|---|
| 60 | 
 | 
|---|
| 61 | CONF-QRDA-I-56: The value for section/code SHALL be 55188-7 Patient Data
 | 
|---|
| 62 |         2.16.840.1.113883.6.1 LOINC STATIC.
 | 
|---|
| 63 | 
 | 
|---|
| 64 | -->
 | 
|---|
| 65 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]'>
 | 
|---|
| 66 |     <assert test='cda:entry/cda:encounter'>
 | 
|---|
| 67 |        Error: CONF-QRDA_BMI-9: The Body Mass Index QRDA Patient Data Section encounter
 | 
|---|
| 68 |        information SHALL be represented with encounter.
 | 
|---|
| 69 |     </assert>
 | 
|---|
| 70 |     <assert test='cda:entry/cda:encounter/@classCode="ENC"'>
 | 
|---|
| 71 |        Error: CONF-QRDA_BMI-11: The value for encounter/@classCode in an Encounter activity
 | 
|---|
| 72 |         SHALL be ENC 2.16.840.1.113883.5.6 ActClass STATIC.
 | 
|---|
| 73 |     </assert>
 | 
|---|
| 74 |     <assert test='cda:entry/cda:encounter/@moodCode="EVN"'>
 | 
|---|
| 75 |        Error: CONF-QRDA_BMI-12: The value for encounter/@moodCode in an Encounter activity
 | 
|---|
| 76 |         SHALL be EVN 2.16.840.1.113883.5.1001 ActMood STATIC.
 | 
|---|
| 77 |     </assert>
 | 
|---|
| 78 |     <assert test='count(cda:entry/cda:encounter/cda:code) = 1'>
 | 
|---|
| 79 |        Error: CONF-QRDA_BMI-14: An Encounter activity SHALL contain exactly one encounter/code.
 | 
|---|
| 80 |     </assert>
 | 
|---|
| 81 |     <assert test='cda:entry/cda:encounter/cda:code/@codeSystem="2.16.840.1.113883.5.4" and (
 | 
|---|
| 82 |                   cda:entry/cda:encounter/cda:code/@code="AMB" or
 | 
|---|
| 83 |                   cda:entry/cda:encounter/cda:code/@code="EMER" or
 | 
|---|
| 84 |                   cda:entry/cda:encounter/cda:code/@code="HH" or
 | 
|---|
| 85 |                   cda:entry/cda:encounter/cda:code/@code="IMP" or
 | 
|---|
| 86 |                   cda:entry/cda:encounter/cda:code/@code="SS")'>
 | 
|---|
| 87 |        Error: CONF-QRDA_BMI-15: The value for encounter/code in the Encounter activity SHALL be 
 | 
|---|
| 88 |        selected from Value Set BMIPhysicalEncounter 2.16.840.1.113883.11.20.2.1 STATIC 20090215.
 | 
|---|
| 89 |     </assert>
 | 
|---|
| 90 |     <assert test='count(cda:entry/cda:encounter/cda:effectiveTime) = 1'>
 | 
|---|
| 91 |        Error: CONF-QRDA_BMI-16: An Encounter activity SHALL contain exactly one
 | 
|---|
| 92 |        encounter/effectiveTime to indicate date and time of the encounter.
 | 
|---|
| 93 |     </assert>
 | 
|---|
| 94 |     <assert test='string-length(cda:entry/cda:encounter/cda:effectiveTime/@value) >= 8'>
 | 
|---|
| 95 |        Error: CONF-QRDA_BMI-17: The encounter/effectiveTime SHALL be accurate to the day.
 | 
|---|
| 96 |     </assert>
 | 
|---|
| 97 |     <assert test='cda:entry/cda:encounter/cda:entryRelationship[@typeCode="COMP"]/cda:organizer'>
 | 
|---|
| 98 |        Error: CONF-QRDA_BMI-18: The Encounter activity SHALL contain exactly one
 | 
|---|
| 99 |        entryRelationship where the value of @typeCode SHALL be COMP, whose
 | 
|---|
| 100 |        target act is a principal diagnosis organizer (as described in Section 6.6.3.2
 | 
|---|
| 101 |        Clinical Statement Conformance Principle Diagnosis).
 | 
|---|
| 102 |     </assert>
 | 
|---|
| 103 |     </rule>
 | 
|---|
| 104 | 
 | 
|---|
| 105 | <!-- Body Mass Index Percentile -->
 | 
|---|
| 106 | 
 | 
|---|
| 107 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]/cda:entry/cda:observation'>
 | 
|---|
| 108 | 
 | 
|---|
| 109 |     <assert test='cda:statusCode'>
 | 
|---|
| 110 |        Error: CONF-QRDA_BMI-36: A Body Mass Index Percentile Observation SHALL contain exactly
 | 
|---|
| 111 |        one observation/statusCode.
 | 
|---|
| 112 |     </assert>
 | 
|---|
| 113 |     <assert test='cda:statusCode[@code="completed"]'>
 | 
|---|
| 114 |        Error: CONF-QRDA_BMI-37: The value of observation/statusCode SHALL be completed.
 | 
|---|
| 115 |     </assert>
 | 
|---|
| 116 |     <assert test='cda:effectiveTime'>
 | 
|---|
| 117 |        Error: CONF-QRDA_BMI-38: A Body Mass Index Percentile Observation SHALL contain exactly
 | 
|---|
| 118 |        one observation/effectiveTime, which represents the time the percentile
 | 
|---|
| 119 |        was measured.
 | 
|---|
| 120 |     </assert>
 | 
|---|
| 121 |     <assert test='string-length(cda:effectiveTime/@value) >= 8'>
 | 
|---|
| 122 |        Error: CONF-QRDA_BMI-39: The observation/effective Time SHALL be accurate to the day
 | 
|---|
| 123 |        and MAY be accurate to the second.
 | 
|---|
| 124 |     </assert>
 | 
|---|
| 125 |     <assert test='cda:code[@code="1111111" and @codeSystem="2.16.840.1.113883.6.96"]'>
 | 
|---|
| 126 |        Error: CONF-QRDA_BMI-40: A Body Mass Percentile Observation SHALL contain exactly one
 | 
|---|
| 127 |        observation/code where the value is TempSNOMEDcode 1111111 Body Mass
 | 
|---|
| 128 |        Percentile 2.16.840.1.113883.6.96 SNOMED-CT STATIC.
 | 
|---|
| 129 |     </assert>
 | 
|---|
| 130 |     <assert test='cda:value[@xsi:type="PQ"]'>
 | 
|---|
| 131 |        Error: CONF-QRDA_BMI-41: The value for value/xsi:type SHALL be PQ.
 | 
|---|
| 132 |     </assert>
 | 
|---|
| 133 |     <assert test='cda:value[@unit = "%"]'>
 | 
|---|
| 134 |        Error: CONF-QRDA_BMI-42: The observation/value SHALL be expressed using a valid UCUM
 | 
|---|
| 135 |        Physical Quantity Unit = "%" (percent).
 | 
|---|
| 136 |     </assert>
 | 
|---|
| 137 |     </rule>
 | 
|---|
| 138 | 
 | 
|---|
| 139 | <!-- Rule context comes from above Patient Data context plus XPath to bring us down to Principle Diagnosis Organizer -->
 | 
|---|
| 140 | 
 | 
|---|
| 141 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]/cda:entry/cda:encounter/cda:entryRelationship[@typeCode="COMP"]/cda:organizer'>
 | 
|---|
| 142 |     <assert test='@classCode="CLUSTER"'>
 | 
|---|
| 143 |        Error: CONF-QRDA_BMI-20: The value for organizer/@classCode in a Principle Diagnosis
 | 
|---|
| 144 |        Organizer SHALL be CLUSTER 2.16.840.1.113883.5.6 ActClass STATIC.
 | 
|---|
| 145 |     </assert>
 | 
|---|
| 146 |     <assert test='@moodCode="EVN"'>
 | 
|---|
| 147 |        Error: CONF-QRDA_BMI-21: The value for organizer/@moodCode in a Principle Diagnosis
 | 
|---|
| 148 |        Organizer SHALL be EVN 2.16.840.1.113883.5.1001 ActMood STATIC.
 | 
|---|
| 149 |     </assert>
 | 
|---|
| 150 |     <assert test='cda:code[@code = "8319008" and @codeSystem="2.16.840.1.113883.6.96"]'>
 | 
|---|
| 151 |        Error: CONF-QRDA_BMI-22: The value for organizer/code SHALL be 8319008 Principle
 | 
|---|
| 152 |        diagnosis 2.16.840.1.113883.6.96 SNOMED-CT STATIC.
 | 
|---|
| 153 |     </assert>
 | 
|---|
| 154 |     <assert test='count(cda:statusCode) = 1'>
 | 
|---|
| 155 |        Error: CONF-QRDA_BMI-23: A Principle Diagnosis Organizer SHALL contain exactly one
 | 
|---|
| 156 |        organizer/statusCode.
 | 
|---|
| 157 |     </assert>
 | 
|---|
| 158 |     <assert test='cda:statusCode[@code = "completed"]'>
 | 
|---|
| 159 |        Error: CONF-QRDA_BMI-24: The value for organizer/statusCode in a Principle Diagnosis
 | 
|---|
| 160 |        Organizer SHALL be completed 2.16.840.1.113883.5.14 ActStatus STATIC.
 | 
|---|
| 161 |     </assert>
 | 
|---|
| 162 |     <assert test='cda:component'>
 | 
|---|
| 163 |        Error: CONF-QRDA_BMI-25: A Principle Diagnosis Organizer SHALL contain one or more 
 | 
|---|
| 164 |        organizer/component.
 | 
|---|
| 165 |     </assert>
 | 
|---|
| 166 |     <assert test='cda:component/cda:observation[@classCode = "OBS" and @moodCode="EVN"]/cda:code[@code = "ASSERTION" and @codeSystem = "2.16.840.1.113883.5.4"]'>
 | 
|---|
| 167 |        Error: CONF-QRDA_BMI-26: The target of the Principle Diagnosis Organizer
 | 
|---|
| 168 |        organizer/component relationship SHALL be a Principle Diagnosis
 | 
|---|
| 169 |        Observation.
 | 
|---|
| 170 |        CONF-QRDA_BMI-27: The Principle Diagnosis Observation SHALL be represented with an
 | 
|---|
| 171 |        observation element where the value of @classCode is OBS and the value
 | 
|---|
| 172 |        of @moodCode is EVN.
 | 
|---|
| 173 |        CONF-QRDA_BMI-28: The value for code/@code SHALL be ASSERTION and
 | 
|---|
| 174 |        code/@codeSystem SHALL be 2.16.840.1.113883.5.4 HL7 ActCode
 | 
|---|
| 175 |        Complete STATIC.
 | 
|---|
| 176 |     </assert>
 | 
|---|
| 177 |     </rule>
 | 
|---|
| 178 | <!-- Rule context comes from above context plus XPath to bring us down to Principle Diagnosis Observation -->
 | 
|---|
| 179 | 
 | 
|---|
| 180 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]/cda:entry/cda:encounter/cda:entryRelationship[@typeCode="COMP"]/cda:organizer/cda:component/cda:observation[@classCode = "OBS" and @moodCode="EVN"][cda:code[@code = "ASSERTION" and @codeSystem = "2.16.840.1.113883.5.4"]]'>
 | 
|---|
| 181 |     <assert test='cda:statusCode[@code="completed"]'>
 | 
|---|
| 182 |        Error: CONF-QRDA_BMI-29: A statusCode element SHALL be present where the value of @code
 | 
|---|
| 183 |        is completed.
 | 
|---|
| 184 |     </assert>
 | 
|---|
| 185 |     <assert test='cda:value[@xsi:type = "CD"]'>
 | 
|---|
| 186 |        Error: CONF-QRDA_BMI-30: The value for value/@xsi:type SHALL be CD.
 | 
|---|
| 187 |     </assert>
 | 
|---|
| 188 | <!--
 | 
|---|
| 189 | 
 | 
|---|
| 190 | This rule was from the April 2009 version...  Removed?
 | 
|---|
| 191 | 
 | 
|---|
| 192 |     <assert test='cda:value[@codeSystem="2.16.840.1.113883.6.2" or @codeSystem="2.16.840.1.113883.6.96"]'>
 | 
|---|
| 193 |        Error: CONF-QRDA_BMI-30: The value for value/@code SHALL be selected from
 | 
|---|
| 194 |        2.16.840.1.113883.6.2 ICD9 CM Diagnoses or
 | 
|---|
| 195 |        2.16.840.1.113883.6.96 SNOMED-CT.
 | 
|---|
| 196 |     </assert>
 | 
|---|
| 197 | -->
 | 
|---|
| 198 | 
 | 
|---|
| 199 |     <assert test='cda:value[@code="102506008" or @codeSystem="2.16.840.1.113883.6.96"]'>
 | 
|---|
| 200 |        Error: CONF-QRDA_BMI-31: The value for value/@code shall be "102506008" (Well Child), from 
 | 
|---|
| 201 |        codeSystem 2.16.840.1.113883.6.96 (SNOMED-CT).
 | 
|---|
| 202 |     </assert>
 | 
|---|
| 203 | 
 | 
|---|
| 204 |     </rule>
 | 
|---|
| 205 | 
 | 
|---|
| 206 |   </pattern>
 | 
|---|
| 207 | 
 | 
|---|
| 208 |   <pattern id="p-qrda_bmi-warnings">
 | 
|---|
| 209 |     <title>HL7 QRDA BMI (Section 6) - warning validation phase</title>
 | 
|---|
| 210 | <!--
 | 
|---|
| 211 |     <rule context='*[cda:templateId/@root="1.3.6.1.4.1.19376.1.5.3.1.1.1"]'>
 | 
|---|
| 212 | 
 | 
|---|
| 213 |     </rule>
 | 
|---|
| 214 | -->
 | 
|---|
| 215 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]'>
 | 
|---|
| 216 |     <assert test='count(cda:entry/cda:encounter/cda:id) >= 1'>
 | 
|---|
| 217 |        Warning: CONF-QRDA_BMI-13: An Encounter activity SHOULD contain at least one encounter/id.
 | 
|---|
| 218 |     </assert>
 | 
|---|
| 219 |     <assert test='cda:entry/cda:observation/cda:id'>
 | 
|---|
| 220 |        Warning: CONF-QRDA_BMI-35: A Body Mass Index Percentile Observation SHOULD contain at
 | 
|---|
| 221 |        least one observation/id.
 | 
|---|
| 222 |     </assert>
 | 
|---|
| 223 | 
 | 
|---|
| 224 |     </rule>
 | 
|---|
| 225 | 
 | 
|---|
| 226 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]'>
 | 
|---|
| 227 |     <assert test='cda:entry/cda:observation'>
 | 
|---|
| 228 |        Warning: CONF-QRDA_BMI-32: The Body Mass Index Percentile QRDA Patient Data section SHOULD
 | 
|---|
| 229 |        contain exactly one Body Mass Index Percentile Observation.
 | 
|---|
| 230 |     </assert>
 | 
|---|
| 231 |     </rule>
 | 
|---|
| 232 | 
 | 
|---|
| 233 |   </pattern>
 | 
|---|
| 234 | 
 | 
|---|
| 235 |   <pattern id="p-qrda_bmi-notes">
 | 
|---|
| 236 |     <title>HL7 QRDA BMI (Section 6) - note validation phase</title>
 | 
|---|
| 237 |     <rule context='/'>
 | 
|---|
| 238 | 
 | 
|---|
| 239 |     <assert test='string-length(/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:patient/cda:birthTime/@value) >= 14'>
 | 
|---|
| 240 |        Note: CONF-QRDA_BMI-2: The birthTime [...] MAY be precise to the second.
 | 
|---|
| 241 |     </assert>
 | 
|---|
| 242 |     </rule>
 | 
|---|
| 243 |     <rule context='*[cda:templateId/@root="2.16.840.1.113883.10.20.12.2"]'>
 | 
|---|
| 244 | 
 | 
|---|
| 245 |     <assert test="contains(translate(cda:entry/cda:act/cda:text,'QWERTYUIOPASDFGHJKLZXCVBNM','qwertyuiopasdfghjklzxcvbnm'),'Children ages 2-18 who had an encounter in the measurement period AND whose weight was classified based on CDC BMI percentile for age and gender.')">
 | 
|---|
| 246 |        Note: CONF-QRDA_BMI-7: The value for act/text element MAY contain a case-insensitive,
 | 
|---|
| 247 |        text string containing the description of the measure, "Children ages 2-18
 | 
|---|
| 248 |        who had an encounter in the measurement period AND whose
 | 
|---|
| 249 |        weight was classified based on CDC BMI percentile for age and
 | 
|---|
| 250 |        gender."
 | 
|---|
| 251 |     </assert>
 | 
|---|
| 252 |     </rule>
 | 
|---|
| 253 | 
 | 
|---|
| 254 |     <rule context='*[cda:code/@code="55188-7" and cda:code/@codeSystem="2.16.840.1.113883.6.1"]'>
 | 
|---|
| 255 |     <assert test='string-length(cda:entry/cda:encounter/cda:effectiveTime/@value) >= 14'>
 | 
|---|
| 256 |        Note: CONF-QRDA_BMI-17: The encounter/effectiveTime ... MAY be accurate to the second.
 | 
|---|
| 257 |     </assert>
 | 
|---|
| 258 |     <assert test='string-length(cda:entry/cda:observation/cda:effectiveTime/@value) >= 14'>
 | 
|---|
| 259 |        Note: CONF-QRDA_BMI-39: The observation/effective Time ... MAY be accurate to the second.
 | 
|---|
| 260 |     </assert>
 | 
|---|
| 261 | 
 | 
|---|
| 262 |     </rule>
 | 
|---|
| 263 |   </pattern>
 | 
|---|
| 264 |   
 | 
|---|