cql_qdm_patientapi 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +4 -4
  3. data/app/assets/javascripts/datatypes/adverseevent.js.coffee +9 -9
  4. data/app/assets/javascripts/datatypes/allergyintolerance.js.coffee +8 -8
  5. data/app/assets/javascripts/datatypes/assessment.js.coffee +67 -38
  6. data/app/assets/javascripts/datatypes/careexperience.js.coffee +7 -7
  7. data/app/assets/javascripts/datatypes/caregoal.js.coffee +8 -8
  8. data/app/assets/javascripts/datatypes/communication.js.coffee +51 -65
  9. data/app/assets/javascripts/datatypes/datatype.js.coffee +14 -9
  10. data/app/assets/javascripts/datatypes/device.js.coffee +21 -31
  11. data/app/assets/javascripts/datatypes/diagnosis.js.coffee +8 -8
  12. data/app/assets/javascripts/datatypes/diagnosticstudy.js.coffee +26 -46
  13. data/app/assets/javascripts/datatypes/encounter.js.coffee +26 -26
  14. data/app/assets/javascripts/datatypes/familyhistory.js.coffee +5 -5
  15. data/app/assets/javascripts/datatypes/immunization.js.coffee +19 -28
  16. data/app/assets/javascripts/datatypes/intervention.js.coffee +23 -23
  17. data/app/assets/javascripts/datatypes/laboratorytest.js.coffee +28 -48
  18. data/app/assets/javascripts/datatypes/medication.js.coffee +141 -81
  19. data/app/assets/javascripts/datatypes/participation.js.coffee +5 -5
  20. data/app/assets/javascripts/datatypes/patient_characteristic.js.coffee +4 -4
  21. data/app/assets/javascripts/datatypes/patient_characteristic_payer.js.coffee +6 -6
  22. data/app/assets/javascripts/datatypes/physicalexam.js.coffee +27 -47
  23. data/app/assets/javascripts/datatypes/procedure.js.coffee +32 -82
  24. data/app/assets/javascripts/datatypes/substance.js.coffee +31 -70
  25. data/app/assets/javascripts/datatypes/symptom.js.coffee +6 -6
  26. data/app/assets/javascripts/utils/helpers.js.coffee +8 -2
  27. data/lib/cql_qdm_patientapi/version.rb +1 -1
  28. data/vendor/assets/javascripts/cql4browsers.js +1520 -556
  29. metadata +3 -3
@@ -16,18 +16,17 @@ class CQL_QDM.MedicationActive extends CQL_QDM.QDMDatatype
16
16
  ###
17
17
  @param {Object} entry - the HDS data criteria object to convert
18
18
  ###
19
- constructor: (@entry) ->
20
- super @entry
21
- @_dosage = @entry.dose
22
- @_frequency = @entry.administrationTiming
23
- @_route = @entry.route
24
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
25
- if @entry.end_time
26
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
19
+ constructor: (entry) ->
20
+ super entry
21
+ @_dosage = entry.dose
22
+ @_frequency = entry.administrationTiming
23
+ @_route = entry.route
24
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
25
+ if entry.end_time
26
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
27
27
  else
28
28
  # No end time; high is set to infinity
29
29
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
30
- @_supply = @entry.supply
31
30
 
32
31
  ###
33
32
  @returns {Quantity}
@@ -70,15 +69,6 @@ class CQL_QDM.MedicationActive extends CQL_QDM.QDMDatatype
70
69
  else
71
70
  null
72
71
 
73
- ###
74
- @returns {Quantity}
75
- ###
76
- supply: ->
77
- if @_supply?
78
- new cql.Quantity({unit: @_supply['units'], value: @_supply['scalar']})
79
- else
80
- null
81
-
82
72
 
83
73
  ###
84
74
  Data elements that meet criteria using this datatype should document that the
@@ -89,21 +79,20 @@ class CQL_QDM.MedicationAdministered extends CQL_QDM.QDMDatatype
89
79
  ###
90
80
  @param {Object} entry - the HDS data criteria object to convert
91
81
  ###
92
- constructor: (@entry) ->
93
- super @entry
94
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
95
- @_dosage = @entry.dose
96
- @_frequency = @entry.administrationTiming
97
- @_negationRationale = @entry.negationReason
98
- @_reason = @entry.reason
99
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
100
- if @entry.end_time
101
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
82
+ constructor: (entry) ->
83
+ super entry
84
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
85
+ @_dosage = entry.dose
86
+ @_frequency = entry.administrationTiming
87
+ @_negationRationale = entry.negationReason
88
+ @_reason = entry.reason
89
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
90
+ if entry.end_time
91
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
102
92
  else
103
93
  # No end time; high is set to infinity
104
94
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
105
- @_route = @entry.route
106
- @_supply = @entry.supply
95
+ @_route = entry.route
107
96
 
108
97
  ###
109
98
  Author date time is only present when this data type has been negated.
@@ -171,15 +160,6 @@ class CQL_QDM.MedicationAdministered extends CQL_QDM.QDMDatatype
171
160
  else
172
161
  null
173
162
 
174
- ###
175
- @returns {Quantity}
176
- ###
177
- supply: ->
178
- if @_supply?
179
- new cql.Quantity({unit: @_supply['units'], value: @_supply['scalar']})
180
- else
181
- null
182
-
183
163
 
184
164
  ###
185
165
  Data elements that meet criteria using this datatype should document that the
@@ -191,16 +171,18 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
191
171
  ###
192
172
  @param {Object} entry - the HDS data criteria object to convert
193
173
  ###
194
- constructor: (@entry) ->
195
- super @entry
196
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
197
- @_dosage = @entry.dose
198
- @_frequency = @entry.administrationTiming
199
- @_negationRationale = @entry.negationReason
200
- @_refills = @entry.refills
201
- @_route = @entry.route
202
- @_supply = @entry.supply
203
- delete @entry.end_time
174
+ constructor: (entry) ->
175
+ super entry
176
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
177
+ @_daysSupplied = entry.daysSupplied
178
+ @_dosage = entry.dose
179
+ @_frequency = entry.administrationTiming
180
+ @_negationRationale = entry.negationReason
181
+ @_prescriberIdentifier = entry.prescriberIdentifier
182
+ @_refills = entry.refills
183
+ @_route = entry.route
184
+ @_supply = entry.supply
185
+ delete entry.end_time
204
186
 
205
187
  ###
206
188
  @returns {Date}
@@ -208,6 +190,15 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
208
190
  authorDatetime: ->
209
191
  @_authorDatetime
210
192
 
193
+ ###
194
+ @returns {Integer}
195
+ ###
196
+ daysSupplied: ->
197
+ if @_daysSupplied? and @_daysSupplied['scalar']?
198
+ parseInt(@_daysSupplied['scalar'], 10)
199
+ else
200
+ null
201
+
211
202
  ###
212
203
  @returns {Quantity}
213
204
  ###
@@ -238,12 +229,21 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
238
229
  else
239
230
  null
240
231
 
232
+ ###
233
+ @returns {Id}
234
+ ###
235
+ prescriberId: ->
236
+ if @_prescriberIdentifier?
237
+ new CQL_QDM.Id(@_prescriberIdentifier.value, @_prescriberIdentifier.namingSystem)
238
+ else
239
+ null
240
+
241
241
  ###
242
242
  @returns {Integer}
243
243
  ###
244
244
  refills: ->
245
- if @_refills?
246
- @_refills['scalar']
245
+ if @_refills? and @_refills['scalar']?
246
+ parseInt(@_refills['scalar'], 10)
247
247
  else
248
248
  null
249
249
 
@@ -280,18 +280,21 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
280
280
  ###
281
281
  @param {Object} entry - the HDS data criteria object to convert
282
282
  ###
283
- constructor: (@entry) ->
284
- super @entry
285
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
286
- @_dosage = @entry.dose
287
- @_frequency = @entry.administrationTiming
288
- @_negationRationale = @entry.negationReason
289
- @_refills = @entry.refills
290
- @_route = @entry.route
291
- @_supply = @entry.supply
292
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
293
- if @entry.end_time
294
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
283
+ constructor: (entry) ->
284
+ super entry
285
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
286
+ @_dispenserIdentifier = entry.dispenserIdentifier
287
+ @_daysSupplied = entry.daysSupplied
288
+ @_dosage = entry.dose
289
+ @_frequency = entry.administrationTiming
290
+ @_negationRationale = entry.negationReason
291
+ @_prescriberIdentifier = entry.prescriberIdentifier
292
+ @_refills = entry.refills
293
+ @_route = entry.route
294
+ @_supply = entry.supply
295
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
296
+ if entry.end_time
297
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
295
298
  else
296
299
  # No end time; high is set to infinity
297
300
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
@@ -302,6 +305,24 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
302
305
  authorDatetime: ->
303
306
  @_authorDatetime
304
307
 
308
+ ###
309
+ @returns {Id}
310
+ ###
311
+ dispenserId: ->
312
+ if @_dispenserIdentifier?
313
+ new CQL_QDM.Id(@_dispenserIdentifier.value, @_dispenserIdentifier.namingSystem)
314
+ else
315
+ null
316
+
317
+ ###
318
+ @returns {Integer}
319
+ ###
320
+ daysSupplied: ->
321
+ if @_daysSupplied? and @_daysSupplied['scalar']?
322
+ parseInt(@_daysSupplied['scalar'], 10)
323
+ else
324
+ null
325
+
305
326
  ###
306
327
  @returns {Quantity}
307
328
  ###
@@ -332,6 +353,15 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
332
353
  else
333
354
  null
334
355
 
356
+ ###
357
+ @returns {Id}
358
+ ###
359
+ prescriberId: ->
360
+ if @_prescriberIdentifier?
361
+ new CQL_QDM.Id(@_prescriberIdentifier.value, @_prescriberIdentifier.namingSystem)
362
+ else
363
+ null
364
+
335
365
  ###
336
366
  @returns {Interval<Date>}
337
367
  ###
@@ -347,8 +377,8 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
347
377
  @returns {Integer}
348
378
  ###
349
379
  refills: ->
350
- if @_refills?
351
- @_refills['scalar']
380
+ if @_refills? and @_refills['scalar']?
381
+ parseInt(@_refills['scalar'], 10)
352
382
  else
353
383
  null
354
384
 
@@ -380,20 +410,23 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
380
410
  ###
381
411
  @param {Object} entry - the HDS data criteria object to convert
382
412
  ###
383
- constructor: (@entry) ->
384
- super @entry
385
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
386
- @_dosage = @entry.dose
387
- @_frequency = @entry.administrationTiming
388
- @_method = @entry.method
389
- @_negationRationale = @entry.negationReason
390
- @_reason = @entry.reason
391
- @_refills = @entry.refills
392
- @_route = @entry.route
393
- @_supply = @entry.supply
394
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
395
- if @entry.end_time
396
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
413
+ constructor: (entry) ->
414
+ super entry
415
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
416
+ @_daysSupplied = entry.daysSupplied
417
+ @_dosage = entry.dose
418
+ @_frequency = entry.administrationTiming
419
+ @_method = entry.method
420
+ @_negationRationale = entry.negationReason
421
+ @_prescriberIdentifier = entry.prescriberIdentifier
422
+ @_reason = entry.reason
423
+ @_refills = entry.refills
424
+ @_route = entry.route
425
+ @_setting = entry.setting
426
+ @_supply = entry.supply
427
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
428
+ if entry.end_time
429
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
397
430
  else
398
431
  # No end time; high is set to infinity
399
432
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
@@ -404,6 +437,15 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
404
437
  authorDatetime: ->
405
438
  @_authorDatetime
406
439
 
440
+ ###
441
+ @returns {Integer}
442
+ ###
443
+ daysSupplied: ->
444
+ if @_daysSupplied? and @_daysSupplied['scalar']?
445
+ parseInt(@_daysSupplied['scalar'], 10)
446
+ else
447
+ null
448
+
407
449
  ###
408
450
  @returns {Quantity}
409
451
  ###
@@ -443,6 +485,15 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
443
485
  else
444
486
  null
445
487
 
488
+ ###
489
+ @returns {Id}
490
+ ###
491
+ prescriberId: ->
492
+ if @_prescriberIdentifier?
493
+ new CQL_QDM.Id(@_prescriberIdentifier.value, @_prescriberIdentifier.namingSystem)
494
+ else
495
+ null
496
+
446
497
  ###
447
498
  @returns {Code}
448
499
  ###
@@ -456,8 +507,8 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
456
507
  @returns {Integer}
457
508
  ###
458
509
  refills: ->
459
- if @_refills?
460
- @_refills['scalar']
510
+ if @_refills? and @_refills['scalar']?
511
+ parseInt(@_refills['scalar'], 10)
461
512
  else
462
513
  null
463
514
 
@@ -481,6 +532,15 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
481
532
  else
482
533
  null
483
534
 
535
+ ###
536
+ @returns {Code}
537
+ ###
538
+ setting: ->
539
+ if @_setting?
540
+ new cql.Code(@_setting.code, @_setting.code_system, null, @_setting.title || null)
541
+ else
542
+ null
543
+
484
544
  ###
485
545
  @returns {Quantity}
486
546
  ###
@@ -15,11 +15,11 @@ class CQL_QDM.Participation extends CQL_QDM.QDMDatatype
15
15
  ###
16
16
  @param {Object} entry - the HDS data criteria object to convert
17
17
  ###
18
- constructor: (@entry) ->
19
- super @entry
20
- @_participationPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
21
- if @entry.end_time
22
- @_participationPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
18
+ constructor: (entry) ->
19
+ super entry
20
+ @_participationPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
21
+ if entry.end_time
22
+ @_participationPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
23
23
  else
24
24
  # No end time; high is set to infinity
25
25
  @_participationPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
@@ -11,10 +11,10 @@ class CQL_QDM.PatientCharacteristic extends CQL_QDM.QDMDatatype
11
11
  ###
12
12
  @param {Object} patient - the HDS patient object to use
13
13
  ###
14
- constructor: (@entry) ->
15
- super @entry
16
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
17
- @_codes = @entry.codes
14
+ constructor: (entry) ->
15
+ super entry
16
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
17
+ @_codes = entry.codes
18
18
 
19
19
  ###
20
20
  @returns {Date}
@@ -11,15 +11,15 @@ class CQL_QDM.PatientCharacteristicPayer extends CQL_QDM.QDMDatatype
11
11
  ###
12
12
  @param {Object} patient - the HDS patient object to use
13
13
  ###
14
- constructor: (@entry) ->
15
- super @entry
16
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
17
- if @entry.end_time
18
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
14
+ constructor: (entry) ->
15
+ super entry
16
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
17
+ if entry.end_time
18
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
19
19
  else
20
20
  # No end time; high is set to infinity
21
21
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
22
- @_codes = @entry.codes
22
+ @_codes = entry.codes
23
23
 
24
24
  ###
25
25
  @returns {Interval<Date>}
@@ -16,14 +16,13 @@ class CQL_QDM.PhysicalExamOrder extends CQL_QDM.QDMDatatype
16
16
  ###
17
17
  @param {Object} entry - the HDS data criteria object to convert
18
18
  ###
19
- constructor: (@entry) ->
20
- super @entry
21
- @_anatomicalLocationSite = @entry.anatomicalLocation
22
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
23
- @_method = @entry.method
24
- @_negationRationale = @entry.negationReason
25
- @_reason = @entry.reason
26
- delete @entry.end_time
19
+ constructor: (entry) ->
20
+ super entry
21
+ @_anatomicalLocationSite = entry.anatomicalLocation
22
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
23
+ @_negationRationale = entry.negationReason
24
+ @_reason = entry.reason
25
+ delete entry.end_time
27
26
 
28
27
  ###
29
28
  @returns {Code}
@@ -40,15 +39,6 @@ class CQL_QDM.PhysicalExamOrder extends CQL_QDM.QDMDatatype
40
39
  authorDatetime: ->
41
40
  @_authorDatetime
42
41
 
43
- ###
44
- @returns {Code}
45
- ###
46
- method: ->
47
- if @_method?
48
- new cql.Code(@_method.code, @_method.code_system, null, @_method.title || null)
49
- else
50
- null
51
-
52
42
  ###
53
43
  @returns {Code}
54
44
  ###
@@ -77,22 +67,22 @@ class CQL_QDM.PhysicalExamPerformed extends CQL_QDM.QDMDatatype
77
67
  ###
78
68
  @param {Object} entry - the HDS data criteria object to convert
79
69
  ###
80
- constructor: (@entry) ->
81
- super @entry
82
- @_anatomicalLocationSite = @entry.anatomicalLocation
83
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
84
- @_method = @entry.method
85
- @_negationRationale = @entry.negationReason
86
- @_reason = @entry.reason
87
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
88
- if @entry.end_time
89
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
70
+ constructor: (entry) ->
71
+ super entry
72
+ @_anatomicalLocationSite = entry.anatomicalLocation
73
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
74
+ @_method = entry.method
75
+ @_negationRationale = entry.negationReason
76
+ @_reason = entry.reason
77
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
78
+ if entry.end_time
79
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
90
80
  else
91
81
  # No end time; high is set to infinity
92
82
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
93
- if @entry.values? && @entry.values.length > 0
94
- @_result = @entry.values?[0]
95
- @_components = @entry.components
83
+ if entry.values? && entry.values.length > 0
84
+ @_result = entry.values?[0]
85
+ @_components = entry.components
96
86
 
97
87
  ###
98
88
  @returns {Code}
@@ -173,14 +163,13 @@ class CQL_QDM.PhysicalExamRecommended extends CQL_QDM.QDMDatatype
173
163
  ###
174
164
  @param {Object} entry - the HDS data criteria object to convert
175
165
  ###
176
- constructor: (@entry) ->
177
- super @entry
178
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
179
- @_anatomicalLocationSite = @entry.anatomicalLocation
180
- @_method = @entry.method
181
- @_negationRationale = @entry.negationReason
182
- @_reason = @entry.reason
183
- delete @entry.end_time
166
+ constructor: (entry) ->
167
+ super entry
168
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
169
+ @_anatomicalLocationSite = entry.anatomicalLocation
170
+ @_negationRationale = entry.negationReason
171
+ @_reason = entry.reason
172
+ delete entry.end_time
184
173
 
185
174
  ###
186
175
  @returns {Code}
@@ -197,15 +186,6 @@ class CQL_QDM.PhysicalExamRecommended extends CQL_QDM.QDMDatatype
197
186
  authorDatetime: ->
198
187
  @_authorDatetime
199
188
 
200
- ###
201
- @returns {Code}
202
- ###
203
- method: ->
204
- if @_method?
205
- new cql.Code(@_method.code, @_method.code_system, null, @_method.title || null)
206
- else
207
- null
208
-
209
189
  ###
210
190
  @returns {Code}
211
191
  ###