hqmf2js 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +17 -0
  3. data/Gemfile +41 -0
  4. data/Gemfile.lock +202 -0
  5. data/README.md +7 -0
  6. data/Rakefile +22 -0
  7. data/VERSION +1 -0
  8. data/app/assets/javascripts/hqmf_util.js.coffee +776 -0
  9. data/app/assets/javascripts/logging_utils.js.coffee +150 -0
  10. data/app/assets/javascripts/patient_api_extension.js.coffee +36 -0
  11. data/app/assets/javascripts/specifics.js.coffee +462 -0
  12. data/bin/hqmf2js.rb +25 -0
  13. data/config/warble.rb +144 -0
  14. data/hqmf2js.gemspec +20 -0
  15. data/lib/config/codes.xml +1935 -0
  16. data/lib/generator/characteristic.js.erb +19 -0
  17. data/lib/generator/codes_to_json.rb +81 -0
  18. data/lib/generator/converter.rb +60 -0
  19. data/lib/generator/data_criteria.js.erb +47 -0
  20. data/lib/generator/derived_data.js.erb +5 -0
  21. data/lib/generator/js.rb +263 -0
  22. data/lib/generator/measure_period.js.erb +18 -0
  23. data/lib/generator/patient_data.js.erb +22 -0
  24. data/lib/generator/population_criteria.js.erb +4 -0
  25. data/lib/generator/precondition.js.erb +14 -0
  26. data/lib/hqmf2js.rb +20 -0
  27. data/lib/hquery/engine.rb +4 -0
  28. data/lib/tasks/codes.rake +12 -0
  29. data/lib/tasks/coffee.rake +15 -0
  30. data/lib/tasks/convert.rake +47 -0
  31. data/lib/tasks/cover_me.rake +8 -0
  32. data/test/fixtures/NQF59New.xml +1047 -0
  33. data/test/fixtures/codes/codes.xls +0 -0
  34. data/test/fixtures/codes/codes.xml +1941 -0
  35. data/test/fixtures/i2b2.xml +305 -0
  36. data/test/fixtures/invalid/missing_id.xml +18 -0
  37. data/test/fixtures/invalid/unknown_criteria_type.xml +16 -0
  38. data/test/fixtures/invalid/unknown_demographic_entry.xml +16 -0
  39. data/test/fixtures/invalid/unknown_population_type.xml +9 -0
  40. data/test/fixtures/invalid/unknown_value_type.xml +18 -0
  41. data/test/fixtures/js/59New.js +366 -0
  42. data/test/fixtures/js/test1.js +356 -0
  43. data/test/fixtures/js/test2.js +366 -0
  44. data/test/fixtures/json/0043.json +6 -0
  45. data/test/fixtures/json/0043_hqmf1.json +1 -0
  46. data/test/fixtures/json/0043_hqmf2.json +172 -0
  47. data/test/fixtures/json/59New.json +1352 -0
  48. data/test/fixtures/patient_api.js +2823 -0
  49. data/test/fixtures/patients/francis_drake.json +1180 -0
  50. data/test/fixtures/patients/larry_vanderman.json +645 -0
  51. data/test/test_helper.rb +58 -0
  52. data/test/unit/codes_to_json_test.rb +38 -0
  53. data/test/unit/effective_date_test.rb +48 -0
  54. data/test/unit/hqmf_from_json_javascript_test.rb +108 -0
  55. data/test/unit/hqmf_javascript_test.rb +175 -0
  56. data/test/unit/library_function_test.rb +553 -0
  57. data/test/unit/specifics_test.rb +757 -0
  58. metadata +183 -0
@@ -0,0 +1,305 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <QualityMeasureDocument xmlns="urn:hl7-org:v3"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" classCode="DOC">
4
+ <typeId extension="POQM_HD00001" root="2.16.840.1.113883.1.3"/>
5
+ <id root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395.1"/>
6
+ <code codeSystem="2.16.840.1.113883.6.1" code="57024-2"/>
7
+ <title>Sample Quality Measure Document</title>
8
+ <statusCode code="completed"/>
9
+ <setId root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
10
+ <versionNumber value="1"/>
11
+ <author contextControlCode="OP" typeCode="AUT">
12
+ <assignedPerson classCode="ASSIGNED"/>
13
+ </author>
14
+ <custodian typeCode="CST">
15
+ <assignedPerson classCode="ASSIGNED"/>
16
+ </custodian>
17
+ <controlVariable>
18
+ <localVariableName>MeasurePeriod</localVariableName>
19
+ <measurePeriod>
20
+ <id extension="StartDate" root="0"/>
21
+ <value>
22
+ <width value="1" unit="a"/>
23
+ </value>
24
+ </measurePeriod>
25
+ </controlVariable>
26
+ <component>
27
+ <measureDescriptionSection>
28
+ <title>Measure Description Section</title>
29
+ <text>This is a description of the measure.</text>
30
+ </measureDescriptionSection>
31
+ </component>
32
+ <component>
33
+ <dataCriteriaSection>
34
+ <code codeSystem="2.16.840.1.113883.6.1" code="57025-9"/>
35
+ <title>Data Criteria Section</title>
36
+ <text>This section describes the data criteria.</text>
37
+ <definition>
38
+ <observationDefinition>
39
+ <id extension="Demographics"
40
+ root="2.16.840.1.113883.3.1619.5148.1"/>
41
+ </observationDefinition>
42
+ </definition>
43
+ <definition>
44
+ <encounterDefinition>
45
+ <id extension="Encounters"
46
+ root="2.16.840.1.113883.3.1619.5148.1"/>
47
+ </encounterDefinition>
48
+ </definition>
49
+ <definition>
50
+ <observationDefinition>
51
+ <id extension="Problems"
52
+ root="2.16.840.1.113883.3.1619.5148.1"/>
53
+ </observationDefinition>
54
+ </definition>
55
+ <definition>
56
+ <observationDefinition>
57
+ <id extension="Allergies"
58
+ root="2.16.840.1.113883.3.1619.5148.1"/>
59
+ </observationDefinition>
60
+ </definition>
61
+ <definition>
62
+ <procedureDefinition>
63
+ <id extension="Procedures"
64
+ root="2.16.840.1.113883.3.1619.5148.1"/>
65
+ </procedureDefinition>
66
+ </definition>
67
+ <definition>
68
+ <observationDefinition>
69
+ <id extension="Results" root="2.16.840.1.113883.3.1619.5148.1"
70
+ />
71
+ </observationDefinition>
72
+ </definition>
73
+ <definition>
74
+ <observationDefinition>
75
+ <id extension="Vitals" root="2.16.840.1.113883.3.1619.5148.1"
76
+ />
77
+ </observationDefinition>
78
+ </definition>
79
+ <definition>
80
+ <substanceAdministrationDefinition>
81
+ <id extension="Medications"
82
+ root="2.16.840.1.113883.3.1619.5148.1"/>
83
+ </substanceAdministrationDefinition>
84
+ </definition>
85
+ <definition>
86
+ <supplyDefinition>
87
+ <id extension="RX" root="2.16.840.1.113883.3.1619.5148.1"/>
88
+ </supplyDefinition>
89
+ </definition>
90
+ <entry>
91
+ <localVariableName>StartDate</localVariableName>
92
+ <observationCriteria>
93
+ <id extension="StartDate" root="0"/>
94
+ <code codeSystem="2.16.840.1.113883.6.1" code="52832-3"/>
95
+ <value value="20110101" xsi:type="TS"/>
96
+ </observationCriteria>
97
+ </entry>
98
+ <entry>
99
+ <localVariableName>EndDate</localVariableName>
100
+ <observationCriteria>
101
+ <id extension="EndDate" root="0"/>
102
+ <code codeSystem="2.16.840.1.113883.6.1" code="52833-1"/>
103
+ <value value="20111231" xsi:type="TS"/>
104
+ </observationCriteria>
105
+ </entry>
106
+ <entry>
107
+ <localVariableName>_18-34_years_old_N100A3</localVariableName>
108
+ <observationCriteria>
109
+ <id extension="_18-34_years_old_N100A3"
110
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
111
+ <code displayName="Current Chronological Age"
112
+ codeSystem="2.16.840.1.113883.6.96" code="424144002"/>
113
+ <effectiveTime>
114
+ <low value="20110101"/>
115
+ <high value="20111231"/>
116
+ </effectiveTime>
117
+ <value xsi:type="IVL_PQ">
118
+ <low unit="a" inclusive="true" value="18"/>
119
+ <high unit="a" inclusive="false" value="35"/>
120
+ </value>
121
+ <definition>
122
+ <observationReference moodCode="DEF">
123
+ <id extension="Demographics"
124
+ root="2.16.840.1.113883.3.1619.5148.1"/>
125
+ </observationReference>
126
+ </definition>
127
+ </observationCriteria>
128
+ </entry>
129
+ <entry>
130
+ <localVariableName>_35-44_years_old_N100BB</localVariableName>
131
+ <observationCriteria>
132
+ <id extension="_35-44_years_old_N100BB"
133
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
134
+ <code displayName="Current Chronological Age"
135
+ codeSystem="2.16.840.1.113883.6.96" code="424144002"/>
136
+ <effectiveTime>
137
+ <low value="20110101"/>
138
+ <high value="20111231"/>
139
+ </effectiveTime>
140
+ <value xsi:type="IVL_PQ">
141
+ <low unit="a" inclusive="true" value="35"/>
142
+ <high unit="a" inclusive="false" value="45"/>
143
+ </value>
144
+ <definition>
145
+ <observationReference moodCode="DEF">
146
+ <id extension="Demographics"
147
+ root="2.16.840.1.113883.3.1619.5148.1"/>
148
+ </observationReference>
149
+ </definition>
150
+ </observationCriteria>
151
+ </entry>
152
+ <entry>
153
+ <localVariableName>_45-54_years_old_N100D3</localVariableName>
154
+ <observationCriteria>
155
+ <id extension="_45-54_years_old_N100D3"
156
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
157
+ <code displayName="Current Chronological Age"
158
+ codeSystem="2.16.840.1.113883.6.96" code="424144002"/>
159
+ <effectiveTime>
160
+ <low value="20110101"/>
161
+ <high value="20111231"/>
162
+ </effectiveTime>
163
+ <value xsi:type="IVL_PQ">
164
+ <low unit="a" inclusive="true" value="45"/>
165
+ <high unit="a" inclusive="false" value="55"/>
166
+ </value>
167
+ <definition>
168
+ <observationReference moodCode="DEF">
169
+ <id extension="Demographics"
170
+ root="2.16.840.1.113883.3.1619.5148.1"/>
171
+ </observationReference>
172
+ </definition>
173
+ </observationCriteria>
174
+ </entry>
175
+ <entry>
176
+ <localVariableName>_55-64_years_old_N100EB</localVariableName>
177
+ <observationCriteria>
178
+ <id extension="_55-64_years_old_N100EB"
179
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
180
+ <code displayName="Current Chronological Age"
181
+ codeSystem="2.16.840.1.113883.6.96" code="424144002"/>
182
+ <effectiveTime>
183
+ <low value="20110101"/>
184
+ <high value="20111231"/>
185
+ </effectiveTime>
186
+ <value xsi:type="IVL_PQ">
187
+ <low unit="a" inclusive="true" value="55"/>
188
+ <high unit="a" inclusive="false" value="65"/>
189
+ </value>
190
+ <definition>
191
+ <observationReference moodCode="DEF">
192
+ <id extension="Demographics"
193
+ root="2.16.840.1.113883.3.1619.5148.1"/>
194
+ </observationReference>
195
+ </definition>
196
+ </observationCriteria>
197
+ </entry>
198
+ <entry>
199
+ <localVariableName>Diabetes_mellitus_N1011B</localVariableName>
200
+ <observationCriteria>
201
+ <id extension="Diabetes_mellitus_N1011B"
202
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
203
+ <effectiveTime>
204
+ <low value="20100101"/>
205
+ <high value="20111231"/>
206
+ </effectiveTime>
207
+ <value valueSet="2.16.840.1.113883.3.1619.5148.19.2.103.250"
208
+ codeSystemName="SNOMED-CT"
209
+ codeSystem="2.16.840.1.113883.6.103"
210
+ displayName="Diabetes mellitus" code="190416008" xsi:type="CD"/>
211
+ <definition>
212
+ <observationReference moodCode="DEF">
213
+ <id extension="Problems"
214
+ root="2.16.840.1.113883.3.1619.5148.1"/>
215
+ </observationReference>
216
+ </definition>
217
+ </observationCriteria>
218
+ </entry>
219
+ <entry>
220
+ <localVariableName>HGB_A1C_LOINC4548-4_GE_9_%_N1014B</localVariableName>
221
+ <observationCriteria>
222
+ <id extension="HGB_A1C_LOINC4548-4_GE_9_%_N1014B"
223
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
224
+ <code valueSet="2.16.840.1.113883.3.1619.5148.19.2.1.4548.4"
225
+ codeSystemName="LOINC" codeSystem="2.16.840.1.113883.6.1"
226
+ displayName="HGB A1C " code="4548-4"/>
227
+ <effectiveTime>
228
+ <low value="20110101"/>
229
+ <high value="20111231"/>
230
+ </effectiveTime>
231
+ <value xsi:type="IVL_PQ">
232
+ <low inclusive="true" unit="%" value="9"/>
233
+ </value>
234
+ <definition>
235
+ <observationReference moodCode="DEF">
236
+ <id extension="Results"
237
+ root="2.16.840.1.113883.3.1619.5148.1"/>
238
+ </observationReference>
239
+ </definition>
240
+ </observationCriteria>
241
+ </entry>
242
+ </dataCriteriaSection>
243
+ </component>
244
+ <component>
245
+ <populationCriteriaSection>
246
+ <code codeSystem="2.16.840.1.113883.6.1" code="57026-7"/>
247
+ <title>Population Criteria Section</title>
248
+ <text>This section describes the Initial Patient Population,
249
+ Numerator, Denominator, Denominator Exceptions, and Measure
250
+ Populations</text>
251
+ <entry>
252
+ <patientPopulationCriteria>
253
+ <id extension="IPP"
254
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"/>
255
+ <precondition>
256
+ <atLeastOneTrue>
257
+ <precondition>
258
+ <observationReference>
259
+ <id extension="_18-34_years_old_N100A3"
260
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"
261
+ />
262
+ </observationReference>
263
+ </precondition>
264
+ <precondition>
265
+ <observationReference>
266
+ <id extension="_35-44_years_old_N100BB"
267
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"
268
+ />
269
+ </observationReference>
270
+ </precondition>
271
+ <precondition>
272
+ <observationReference>
273
+ <id extension="_45-54_years_old_N100D3"
274
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"
275
+ />
276
+ </observationReference>
277
+ </precondition>
278
+ <precondition>
279
+ <observationReference>
280
+ <id extension="_55-64_years_old_N100EB"
281
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"
282
+ />
283
+ </observationReference>
284
+ </precondition>
285
+ </atLeastOneTrue>
286
+ </precondition>
287
+ <precondition>
288
+ <observationReference>
289
+ <id extension="Diabetes_mellitus_N1011B"
290
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"
291
+ />
292
+ </observationReference>
293
+ </precondition>
294
+ <!-- <precondition>
295
+ <observationReference>
296
+ <id extension="HGB_A1C_LOINC4548-4_GE_9_%_N1014B"
297
+ root="2.16.840.1.113883.3.1619.5148.3.20120214.191303395"
298
+ />
299
+ </observationReference>
300
+ </precondition>-->
301
+ </patientPopulationCriteria>
302
+ </entry>
303
+ </populationCriteriaSection>
304
+ </component>
305
+ </QualityMeasureDocument>
@@ -0,0 +1,18 @@
1
+ <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xmlns="urn:hl7-org:v3">
3
+ <localVariableName>HbA1C</localVariableName>
4
+ <subsetCode code="RECENT"/>
5
+ <observationCriteria>
6
+ <id root="0"/>
7
+ <code valueSet="2.16.840.1.113883.3.464.1.72"/>
8
+ <statusCode code="completed"/>
9
+ <value xsi:type="IVL_PQ">
10
+ <low value="9" unit="%"/>
11
+ </value>
12
+ <definition>
13
+ <observationReference moodCode="DEF">
14
+ <id root="0" extension="LabResults"/>
15
+ </observationReference>
16
+ </definition>
17
+ </observationCriteria>
18
+ </entry>
@@ -0,0 +1,16 @@
1
+ <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xmlns="urn:hl7-org:v3">
3
+ <localVariableName>blueEyes</localVariableName>
4
+ <observationCriteria>
5
+ <id root="0" extension="blueEyes"/>
6
+ <code code="1234567" codeSystem="1.2.3.4"
7
+ displayName="Eyes"/>
8
+ <value xsi:type="CD" codeSystem="1.2.3.4"
9
+ code="B"/>
10
+ <definition>
11
+ <observationReference moodCode="DEF">
12
+ <id root="0" extension="Foo"/>
13
+ </observationReference>
14
+ </definition>
15
+ </observationCriteria>
16
+ </entry>
@@ -0,0 +1,16 @@
1
+ <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xmlns="urn:hl7-org:v3">
3
+ <localVariableName>blueEyes</localVariableName>
4
+ <observationCriteria>
5
+ <id root="0" extension="blueEyes"/>
6
+ <code code="1234567" codeSystem="1.2.3.4"
7
+ displayName="Eyes"/>
8
+ <value xsi:type="CD" codeSystem="1.2.3.4"
9
+ code="B"/>
10
+ <definition>
11
+ <observationReference moodCode="DEF">
12
+ <id root="0" extension="Demographics"/>
13
+ </observationReference>
14
+ </definition>
15
+ </observationCriteria>
16
+ </entry>
@@ -0,0 +1,9 @@
1
+ <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xmlns="urn:hl7-org:v3">
3
+ <patientPopulationCriteria>
4
+ <id root="c75181d0-73eb-11de-8a39-0800200c9a66"
5
+ extension="Foo"/>
6
+ <precondition>
7
+ </precondition>
8
+ </patientPopulationCriteria>
9
+ </entry>
@@ -0,0 +1,18 @@
1
+ <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xmlns="urn:hl7-org:v3">
3
+ <localVariableName>HbA1C</localVariableName>
4
+ <subsetCode code="RECENT"/>
5
+ <observationCriteria>
6
+ <id root="0" extension="HbA1C"/>
7
+ <code valueSet="2.16.840.1.113883.3.464.1.72"/>
8
+ <statusCode code="completed"/>
9
+ <value xsi:type="Foo">
10
+ <low value="9" unit="%"/>
11
+ </value>
12
+ <definition>
13
+ <observationReference moodCode="DEF">
14
+ <id root="0" extension="LabResults"/>
15
+ </observationReference>
16
+ </definition>
17
+ </observationCriteria>
18
+ </entry>