quality-measure-engine 1.1.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. data/.gitignore +12 -0
  2. data/.travis.yml +16 -0
  3. data/Gemfile +5 -21
  4. data/Gemfile.lock +126 -0
  5. data/LICENSE.txt +13 -0
  6. data/README.md +23 -44
  7. data/Rakefile +6 -29
  8. data/lib/qme/bundle/bundle.rb +34 -0
  9. data/lib/qme/bundle/importer.rb +69 -0
  10. data/lib/qme/database_access.rb +7 -11
  11. data/lib/qme/map/map_reduce_builder.rb +4 -1
  12. data/lib/qme/map/map_reduce_executor.rb +55 -43
  13. data/lib/qme/map/measure_calculation_job.rb +24 -23
  14. data/lib/qme/quality_measure.rb +5 -5
  15. data/lib/qme/quality_report.rb +37 -19
  16. data/lib/qme/railtie.rb +7 -0
  17. data/lib/qme/tasks/bundle.rake +14 -0
  18. data/lib/qme/version.rb +3 -0
  19. data/lib/quality-measure-engine.rb +13 -25
  20. data/quality-measure-engine.gemspec +28 -0
  21. data/test/fixtures/bundles/just_measure_0002.zip +0 -0
  22. data/test/fixtures/delayed_backend_mongoid_jobs/queued_job.json +9 -0
  23. data/test/fixtures/measures/measure_metadata.json +52 -0
  24. data/test/fixtures/records/barry_berry.json +471 -0
  25. data/test/fixtures/records/billy_jones_ipp.json +78 -0
  26. data/test/fixtures/records/jane_jones_numerator.json +120 -0
  27. data/test/fixtures/records/jill_jones_denominator.json +78 -0
  28. data/test/simplecov_setup.rb +18 -0
  29. data/test/test_helper.rb +26 -0
  30. data/test/unit/qme/map/map_reduce_builder_test.rb +38 -0
  31. data/test/unit/qme/map/map_reduce_executor_test.rb +56 -0
  32. data/test/unit/qme/map/measure_calculation_job_test.rb +22 -0
  33. data/test/unit/qme/quality_measure_test.rb +14 -0
  34. data/{spec/qme/quality_report_spec.rb → test/unit/qme/quality_report_test.rb} +32 -20
  35. metadata +91 -115
  36. data/VERSION +0 -1
  37. data/js/map_reduce_utils.js +0 -173
  38. data/js/underscore_min.js +0 -25
  39. data/lib/qme/ext/record.rb +0 -43
  40. data/lib/qme/importer/entry.rb +0 -126
  41. data/lib/qme/importer/generic_importer.rb +0 -117
  42. data/lib/qme/importer/measure_properties_generator.rb +0 -39
  43. data/lib/qme/importer/property_matcher.rb +0 -110
  44. data/lib/qme/measure/database_loader.rb +0 -83
  45. data/lib/qme/measure/measure_loader.rb +0 -174
  46. data/lib/qme/measure/properties_builder.rb +0 -184
  47. data/lib/qme/measure/properties_converter.rb +0 -27
  48. data/lib/qme/randomizer/patient_randomization_job.rb +0 -47
  49. data/lib/qme/randomizer/patient_randomizer.rb +0 -250
  50. data/lib/qme/randomizer/random_patient_creator.rb +0 -47
  51. data/lib/qme_test.rb +0 -13
  52. data/lib/tasks/fixtures.rake +0 -91
  53. data/lib/tasks/measure.rake +0 -110
  54. data/lib/tasks/mongo.rake +0 -68
  55. data/lib/tasks/patient_random.rake +0 -45
  56. data/spec/qme/bundle_spec.rb +0 -37
  57. data/spec/qme/importer/generic_importer_spec.rb +0 -73
  58. data/spec/qme/importer/measure_properties_generator_spec.rb +0 -15
  59. data/spec/qme/importer/property_matcher_spec.rb +0 -174
  60. data/spec/qme/map/map_reduce_builder_spec.rb +0 -38
  61. data/spec/qme/map/measures_spec.rb +0 -38
  62. data/spec/qme/map/patient_mapper_spec.rb +0 -11
  63. data/spec/qme/measure_loader_spec.rb +0 -12
  64. data/spec/qme/properties_builder_spec.rb +0 -61
  65. data/spec/spec_helper.rb +0 -120
  66. data/spec/validate_measures_spec.rb +0 -21
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'qme/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "quality-measure-engine"
8
+ gem.version = QME::VERSION
9
+ gem.authors = ["Marc Hadley", "Andy Gregorowicz", "Rob Dingwell", "Adam Goldstein"]
10
+ gem.email = ["talk@projectpophealth.org"]
11
+ gem.description = %q{A library for running clinical quality measures}
12
+ gem.summary = %q{This library can run JavaScript based clinical quality measures on a repository of patients stored in MongoDB}
13
+ gem.homepage = "http://www.projectpophealth.org"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'moped', '~> 1.2.7'
21
+ gem.add_dependency 'mongoid', '~> 3.0.9'
22
+ gem.add_dependency 'rubyzip', '~> 0.9.9'
23
+ gem.add_dependency 'delayed_job_mongoid', '~> 2.0.0'
24
+
25
+ gem.add_development_dependency "minitest", "~> 4.1.0"
26
+ gem.add_development_dependency "simplecov", "~> 0.7.1"
27
+ gem.add_development_dependency "rails", "~> 3.2.8"
28
+ end
@@ -0,0 +1,9 @@
1
+ {
2
+ _id: "508aeff07042f9f88900000d",
3
+ priority: 0,
4
+ attempts: 0,
5
+ handler: "--- !ruby/object:QME::MapReduce::MeasureCalculationJob\ntest_id: \nmeasure_id: test2\nsub_id: b\neffective_date: 1284854400\nfilters: \n",
6
+ run_at: ISODate("2012-10-26T20:17:52+00:00"),
7
+ updated_at: ISODate("2012-10-26T20:17:52+00:00"),
8
+ created_at: ISODate("2012-10-26T20:17:52+00:00")
9
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "id": "0043",
3
+ "name": "Pneumonia Vaccination Status for Older Adults",
4
+ "description": "Patients more than 65 years old who received a pneumococcal vaccine.",
5
+ "category": "Miscellaneous",
6
+ "steward": "NCQA",
7
+ "parameters": {
8
+ "effective_date": {
9
+ "description": "Effective end date for measure",
10
+ "type": "number",
11
+ "format": "utc-sec"
12
+ }
13
+ },
14
+ "patient":
15
+ {
16
+ "birthdate":
17
+ {
18
+ "description": "Date of birth",
19
+ "critical": true,
20
+ "standard_category": "characteristic",
21
+ "type":"number",
22
+ "format": "utc-sec",
23
+ "codes":
24
+ [
25
+ {
26
+ "set": "HL7",
27
+ "version": "3.0",
28
+ "values": ["00110"]
29
+ }
30
+ ]
31
+ }
32
+ },
33
+ "measure":
34
+ {
35
+ },
36
+ "population":
37
+ {
38
+ "category": "Patient Characteristic",
39
+ "title": "Age >= 64"
40
+ },
41
+ "denominator":
42
+ {
43
+ "category": "Outpatient Encounter",
44
+ "title": "Within a year"
45
+ },
46
+ "numerator":
47
+ {
48
+ "category": "Medication Administered",
49
+ "title": "Pneumococcal vaccination"
50
+ },
51
+ "exclusions": {}
52
+ }
@@ -0,0 +1,471 @@
1
+ {
2
+ "_id": "506afdf87042f9e32c000001",
3
+ "first": "Barry",
4
+ "last": "Berry",
5
+ "name": "Barry B. Berry",
6
+ "gender": "M",
7
+ "expired": true,
8
+ "clinicalTrialParticipant": false,
9
+ "birthdate": -223262033,
10
+ "maritalStatus": {
11
+ "code": "M",
12
+ "codeSystem": "HL7"
13
+ },
14
+ "religiousAffiliation": {
15
+ "code": "1013",
16
+ "codeSystem": "HL7"
17
+ },
18
+ "race": {
19
+ "code": "2131-1",
20
+ "codeSystem": "CDC"
21
+ },
22
+ "ethnicity": {
23
+ "code": "2186-5",
24
+ "codeSystem": "CDC"
25
+ },
26
+ "birthPlace": {
27
+ "city": "Washington",
28
+ "state": "DC"
29
+ },
30
+ "confidentiality": {
31
+ "code": "N",
32
+ "codeSystem": "HL7"
33
+ },
34
+ "provider": {
35
+ "providerEntity": {
36
+ "first": "Mary",
37
+ "last": "Care"
38
+ },
39
+ "careProvisionDateRange": {
40
+ "hi": 1124956803,
41
+ "low": 1124956803
42
+ }
43
+ },
44
+ "languages": [
45
+ {
46
+ "codes": {
47
+ "IETF": [
48
+ "en"
49
+ ]
50
+ }
51
+ }
52
+ ],
53
+ "addresses": [
54
+ {
55
+ "street": [
56
+ "15 Credibility Street"
57
+ ],
58
+ "city": "Boston",
59
+ "state": "MA",
60
+ "zip": "01803"
61
+ }
62
+ ],
63
+ "supports": {
64
+ "supportDate": {
65
+ "hi": 1124956803,
66
+ "low": 1124956803
67
+ }
68
+ },
69
+ "custodian": {
70
+ "name": "General Hospital"
71
+ },
72
+ "encounters": [
73
+ {
74
+ "codes": {
75
+ "CPT": [
76
+ "99201"
77
+ ]
78
+ },
79
+ "facility": {
80
+ "name": "General Hospital",
81
+ "start_time": 1124956803,
82
+ "end_time": 1124957003,
83
+ "code": {
84
+ "code": "1155-1",
85
+ "codeSystem": "HL7 Healthcare Service Location"
86
+ },
87
+ "addresses": [
88
+ {
89
+ "street": [
90
+ "100 Bureau Drive"
91
+ ],
92
+ "city": "Gaithersburg",
93
+ "state": "MD",
94
+ "zip": "20899",
95
+ "country": null
96
+ }
97
+ ],
98
+ "telecoms": [
99
+ {
100
+ "value": "tel:1-301-555-5555",
101
+ "use": "HP"
102
+ }
103
+ ]
104
+ },
105
+ "time": 1268042997,
106
+ "description": "Outpatient encounter",
107
+ "_id": "OP12345",
108
+ "dischargeDisp": "Home",
109
+ "admitType": {
110
+ "code": "04",
111
+ "codeSystem": "regular"
112
+ },
113
+ "performer": {
114
+ "organization": {
115
+ "name": "General Hospital"
116
+ }
117
+ },
118
+ "low": 1124956803,
119
+ "hi": 1314259203,
120
+ "reason": {
121
+ "codes": {
122
+ "CPT": [
123
+ "99201"
124
+ ]
125
+ },
126
+ "description": "PCP referred"
127
+ }
128
+ },
129
+ {
130
+ "codes": {
131
+ "CPT": [
132
+ "99201"
133
+ ]
134
+ },
135
+ "time": 1281484083,
136
+ "description": "Outpatient encounter"
137
+ }
138
+ ],
139
+ "conditions": [
140
+ {
141
+ "codes": {
142
+ "SNOMED-CT": [
143
+ "105539002"
144
+ ]
145
+ },
146
+ "time": 1269762692,
147
+ "description": "Tobacco Non-user"
148
+ },
149
+ {
150
+ "codes": {
151
+ "SNOMED-CT": [
152
+ "109838007"
153
+ ]
154
+ },
155
+ "time": 1263167138,
156
+ "description": "Colorectal Cancer",
157
+ "ageAtOnset": 20,
158
+ "priority": 1,
159
+ "ordinality": "principal",
160
+ "ordinality_code": {
161
+ "code": "8319008",
162
+ "codeSystem": "SNOMED-CT"
163
+ },
164
+ "severity": {
165
+ "code": "371924009",
166
+ "codeSystem": "SNOMED-CT"
167
+ },
168
+ "problemStatus": {
169
+ "code": "55561003",
170
+ "codeSystem": "SNOMED-CT"
171
+ }
172
+ }
173
+ ],
174
+ "vital_signs": [
175
+ {
176
+ "codes": {
177
+ "SNOMED-CT": [
178
+ "105539002"
179
+ ]
180
+ },
181
+ "time": 1263168508,
182
+ "description": "Tobacco Non-user",
183
+ "status_code": {
184
+ "HL7 ActStatus": ["completed"]
185
+ }
186
+ },
187
+ {
188
+ "codes": {
189
+ "LOINC": [
190
+ "8480-6"
191
+ ]
192
+ },
193
+ "time": 1263168508,
194
+ "description": "Systolic BP",
195
+ "status_code": {
196
+ "HL7 ActStatus": ["completed"]
197
+ },
198
+ "values": [{
199
+ "scalar": 132,
200
+ "units": "mm[Hg]"
201
+ }],
202
+ "comment": "BP taken sitting"
203
+ }
204
+ ],
205
+ "procedures": [
206
+ {
207
+ "codes": {
208
+ "CPT": [
209
+ "44388"
210
+ ]
211
+ },
212
+ "site": {
213
+ "code": "71854001",
214
+ "codeSystem": "SNOMED-CT"
215
+ },
216
+ "time": 1073238725,
217
+ "performer": {
218
+ "person": {
219
+ "first": "Bobby",
220
+ "last": "Tables"
221
+ }
222
+ },
223
+ "description": "Colonscopy",
224
+ "incisionDateTime": 1073238725
225
+ }
226
+ ],
227
+ "results": [
228
+ {
229
+ "codes": {
230
+ "SNOMED-CT": [
231
+ "104150001"
232
+ ]
233
+ },
234
+ "time": 1263168508,
235
+ "description": "Sucralose hemolysis test",
236
+ "status_code": {
237
+ "HL7 ActStatus": ["completed"]
238
+ },
239
+ "comment": "Negative"
240
+ }
241
+ ],
242
+ "immunizations": [
243
+ {
244
+ "codes": {
245
+ "CVX": [
246
+ "03"
247
+ ]
248
+ },
249
+ "time": 1263168508,
250
+ "description": "MMR",
251
+ "medicationSeriesNumber": {
252
+ "unit": "",
253
+ "value": 2
254
+ },
255
+ "comment": "vaccine"
256
+ },
257
+ {
258
+ "codes": {
259
+ "CVX": [
260
+ "04"
261
+ ]
262
+ },
263
+ "time": 1263168508,
264
+ "description": "Something",
265
+ "negationInd": true,
266
+ "performer": {
267
+ "person": {
268
+ "name": "\n FirstName\n LastName\n ",
269
+ "first": "FirstName",
270
+ "last": "LastName",
271
+ "addresses": [
272
+ {
273
+ "street": [
274
+ "100 Bureau Drive"
275
+ ],
276
+ "city": "Gaithersburg",
277
+ "state": "MD",
278
+ "zip": "20899",
279
+ "country": null
280
+ }
281
+ ],
282
+ "telecoms": [
283
+ {
284
+ "value": "tel:1-301-555-5555",
285
+ "use": "HP"
286
+ }
287
+ ]
288
+ }
289
+ },
290
+ "negationReason": {
291
+ "code": "IMMUNE",
292
+ "codeSystem": "HL7 No Immunization Reason"
293
+ },
294
+ "comment": "patient invincible"
295
+ },
296
+ {
297
+ "codes": {
298
+ "CVX": [
299
+ "04"
300
+ ]
301
+ },
302
+ "time": 1263168508,
303
+ "description": "Something",
304
+ "performer": {
305
+ "person": {
306
+ "name": "\n FirstName\n LastName\n ",
307
+ "first": "FirstName",
308
+ "last": "LastName",
309
+ "addresses": [
310
+ {
311
+ "street": [
312
+ "100 Bureau Drive"
313
+ ],
314
+ "city": "Gaithersburg",
315
+ "state": "MD",
316
+ "zip": "20899",
317
+ "country": null
318
+ }
319
+ ],
320
+ "telecoms": [
321
+ {
322
+ "value": "tel:1-301-555-5555",
323
+ "use": "HP"
324
+ }
325
+ ]
326
+ }
327
+ },
328
+ "comment": "patient invincible"
329
+ }
330
+ ],
331
+ "medications": [
332
+ {
333
+ "administrationTiming": {
334
+ "period": {
335
+ "unit": "h",
336
+ "value": 24
337
+ },
338
+ "institutionSpecified": true
339
+ },
340
+ "oid": "2.16.840.1.113883.3.560.1.8",
341
+ "freeTextSig": "Take your vitamins!",
342
+ "codes": {
343
+ "RxNorm": [
344
+ "89905"
345
+ ]
346
+ },
347
+ "dose": {
348
+ "unit": "tablet",
349
+ "value": 1
350
+ },
351
+ "time": 1286382415,
352
+ "description": "Multivitamin",
353
+ "brandName": "Centrum Silver",
354
+ "route": {
355
+ "code": "C38288",
356
+ "codeSystem": "NCI Thesaurus"
357
+ },
358
+ "typeOfMedication": {
359
+ "code": "329505003",
360
+ "codeSystem": "SNOMED-CT"
361
+ },
362
+ "statusOfMedication": {
363
+ "code": "55561003",
364
+ "codeSystem": "SNOMED-CT"
365
+ },
366
+ "fulfillmentHistory": [
367
+ {
368
+ "dispenseDate": 1073238725,
369
+ "fillNumber": 5,
370
+ "quantityDispensed": {
371
+ "unit": "tablet",
372
+ "value": 30
373
+ },
374
+ "provider": {
375
+ "person": {
376
+ "first": "Bobby",
377
+ "last": "Tables"
378
+ }
379
+ }
380
+ }
381
+ ],
382
+ "cumulativeMedicationDuration": {
383
+ "scalar": 3,
384
+ "unit": "d"
385
+ },
386
+ "orderInformation": [
387
+ {
388
+ "orderDateTime": 1073238725,
389
+ "fills": 20,
390
+ "quantityOrdered": {
391
+ "unit": "tablet",
392
+ "value": 30
393
+ }
394
+ }
395
+ ]
396
+ }
397
+ ],
398
+ "allergies": [
399
+ {
400
+ "codes": {
401
+ "SNOMED-CT": [
402
+ "39579001"
403
+ ]
404
+ },
405
+ "time": 1269762692,
406
+ "start_time": 1269762691,
407
+ "end_time": 1269762693,
408
+ "description": "Anaphalactic reaction to peanuts",
409
+ "comment": "Carries Epipen",
410
+ "reaction": {
411
+ "code": "414285001",
412
+ "codeSystem": "SNOMED-CT"
413
+ },
414
+ "severity": {
415
+ "code": "371924009",
416
+ "codeSystem": "SNOMED-CT"
417
+ }
418
+ }
419
+ ],
420
+ "pregnancies": [
421
+ {
422
+ "codes": {
423
+ "SNOMED-CT": [
424
+ "77386006"
425
+ ]
426
+ },
427
+ "time": 1269762692,
428
+ "description": "patient currently pregnant"
429
+ }
430
+ ],
431
+ "socialhistories": [
432
+ {
433
+ "codes": {
434
+ "SNOMED-CT": [
435
+ "229819007"
436
+ ]
437
+ },
438
+ "time": 1269762692,
439
+ "description": "Tobacco use and exposure",
440
+ "value": "1 pack per day"
441
+ }
442
+ ],
443
+ "functional_statuses": [
444
+ {
445
+ "codes": {
446
+ "SNOMED-CT": [
447
+ "273447005"
448
+ ]
449
+ },
450
+ "start_time": 1269762691,
451
+ "end_time": 1269762693,
452
+ "type": "result",
453
+ "source": {
454
+ "code": "patient reported",
455
+ "codeSystem": "SNOMED-CT"
456
+ }
457
+ }
458
+ ],
459
+ "medical_equipment" : [
460
+ {
461
+ "codes": {
462
+ "SNOMED-CT": [
463
+ "273447005"
464
+ ]
465
+ },
466
+ "start_time": 1269762691,
467
+ "end_time": 1269762693,
468
+ "anatomicalStructure" : {"code": "13648007", "codeSystem": "SNOMED-CT"}
469
+ }
470
+ ]
471
+ }