cql_qdm_patientapi 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78a519d96f971f10c752b78e5045705cd55a24ed
4
- data.tar.gz: c750783a753736e31ca697992efeea99b611110a
3
+ metadata.gz: 7165133cf3ab4dae98bf3eab64cccc6089511bf6
4
+ data.tar.gz: a7cbfc4c6c410ebb76e5c130dad3a45fe1b8a4b4
5
5
  SHA512:
6
- metadata.gz: 31d54a169065908c624074e4c0a6670e7b92a36f3a6d5965de187b760ae4d81db308531ecbe3b8489f22230bb8d71eb80226cb611a8dc25317af178de6a7feef
7
- data.tar.gz: 45d104049eb25549b7447de2556fe57bdd627172b4f4776cb995554427bf53a2ea42f4916a0cb51ac3a413e2c08f650c25c6fd2d0801d68277b9f7e57c5a383c
6
+ metadata.gz: 976d559eaa8d4826df046fd72a5458b071cfbd8c868c005e6baea02d3b2e07997ad1542b5e9a02a9401ed8c013d8fabd76a5635c682ee6b9414d676a289fab45
7
+ data.tar.gz: 6bb7d9a35ca76bb041d86b8cf7058482b249d2cb2d5ec316e35c2cb502bbe320283d8619585a24ec493ff7062e4790742c4bda29d78e794abc85dadb1725aaae
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cql_qdm_patientapi (1.0.4)
4
+ cql_qdm_patientapi (1.1.0)
5
5
  coffee-rails (~> 4.1)
6
6
  rails (~> 4.2)
7
7
  sprockets-rails (~> 2.3)
@@ -180,7 +180,8 @@ class CQL_QDM.CQLPatient
180
180
  'provider_characteristics',
181
181
  'substances',
182
182
  'system_characteristics',
183
- 'transfers'
183
+ 'transfers',
184
+ 'participations'
184
185
  ]
185
186
  data_types = {}
186
187
  for type in types
@@ -53,7 +53,7 @@ class CQL_QDM.CareGoal extends CQL_QDM.QDMDatatype
53
53
  targetOutcome: ->
54
54
  if @_targetOutcome?
55
55
  if @_targetOutcome?['unit']?
56
- new cql.Quantity({unit: @_targetOutcome['unit'], value: @_targetOutcome['value']})
56
+ new cql.Quantity({unit: @_targetOutcome['unit'], value: @_targetOutcome['scalar']})
57
57
  else
58
58
  new cql.Code(@_targetOutcome.code, @_targetOutcome.code_system)
59
59
  else
@@ -19,7 +19,9 @@ class CQL_QDM.PatientCharacteristicBirthdate extends CQL_QDM.QDMDatatype
19
19
  @returns {Object}
20
20
  ###
21
21
  getCode: ->
22
- '21112-8' # LOINC code for birthdate
22
+ # NOTE: hard coding the code system. this will be removed when we switch
23
+ # to the QDM patient model
24
+ new cql.Code('21112-8', 'LOINC')
23
25
 
24
26
  ###
25
27
  @returns {DateTime}
@@ -34,7 +34,7 @@ class CQL_QDM.ImmunizationAdministered extends CQL_QDM.QDMDatatype
34
34
  ###
35
35
  dosage: ->
36
36
  if @_dosage?
37
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
37
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
38
38
  else
39
39
  null
40
40
 
@@ -70,7 +70,7 @@ class CQL_QDM.ImmunizationAdministered extends CQL_QDM.QDMDatatype
70
70
  ###
71
71
  supply: ->
72
72
  if @_supply?
73
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
73
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
74
74
  else
75
75
  null
76
76
 
@@ -111,7 +111,7 @@ class CQL_QDM.ImmunizationOrder extends CQL_QDM.QDMDatatype
111
111
  ###
112
112
  dosage: ->
113
113
  if @_dosage?
114
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
114
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
115
115
  else
116
116
  null
117
117
 
@@ -147,6 +147,6 @@ class CQL_QDM.ImmunizationOrder extends CQL_QDM.QDMDatatype
147
147
  ###
148
148
  supply: ->
149
149
  if @_supply?
150
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
150
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
151
151
  else
152
152
  null
@@ -19,7 +19,7 @@ class CQL_QDM.MedicationActive extends CQL_QDM.QDMDatatype
19
19
  constructor: (@entry) ->
20
20
  super @entry
21
21
  @_dosage = @entry.dose
22
- @_frequency = @entry.frequency
22
+ @_frequency = @entry.administrationTiming
23
23
  @_route = @entry.route
24
24
  @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
25
25
  if @entry.end_time
@@ -34,7 +34,7 @@ class CQL_QDM.MedicationActive extends CQL_QDM.QDMDatatype
34
34
  ###
35
35
  dosage: ->
36
36
  if @_dosage?
37
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
37
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
38
38
  else
39
39
  null
40
40
 
@@ -42,10 +42,8 @@ class CQL_QDM.MedicationActive extends CQL_QDM.QDMDatatype
42
42
  @returns {Code}
43
43
  ###
44
44
  frequency: ->
45
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
46
- throw new Error('Bonnie does not currently support MedicationActive.frequency')
47
45
  if @_frequency?
48
- new cql.Code(@_frequency.code, @_frequency.code_system)
46
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
49
47
  else
50
48
  null
51
49
 
@@ -74,7 +72,7 @@ class CQL_QDM.MedicationActive extends CQL_QDM.QDMDatatype
74
72
  ###
75
73
  supply: ->
76
74
  if @_supply?
77
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
75
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
78
76
  else
79
77
  null
80
78
 
@@ -92,7 +90,7 @@ class CQL_QDM.MedicationAdministered extends CQL_QDM.QDMDatatype
92
90
  super @entry
93
91
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
94
92
  @_dosage = @entry.dose
95
- @_frequency = @entry.frequency
93
+ @_frequency = @entry.administrationTiming
96
94
  @_negationRationale = @entry.negationReason
97
95
  @_reason = @entry.reason
98
96
  @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
@@ -116,7 +114,7 @@ class CQL_QDM.MedicationAdministered extends CQL_QDM.QDMDatatype
116
114
  ###
117
115
  dosage: ->
118
116
  if @_dosage?
119
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
117
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
120
118
  else
121
119
  null
122
120
 
@@ -124,10 +122,8 @@ class CQL_QDM.MedicationAdministered extends CQL_QDM.QDMDatatype
124
122
  @returns {code}
125
123
  ###
126
124
  frequency: ->
127
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
128
- throw new Error('Bonnie does not currently support MedicationAdministered.frequency')
129
125
  if @_frequency?
130
- new cql.Code(@_frequency.code, @_frequency.code_system)
126
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
131
127
  else
132
128
  null
133
129
 
@@ -174,7 +170,7 @@ class CQL_QDM.MedicationAdministered extends CQL_QDM.QDMDatatype
174
170
  ###
175
171
  supply: ->
176
172
  if @_supply?
177
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
173
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
178
174
  else
179
175
  null
180
176
 
@@ -193,7 +189,7 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
193
189
  super @entry
194
190
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
195
191
  @_dosage = @entry.dose
196
- @_frequency = @entry.frequency
192
+ @_frequency = @entry.administrationTiming
197
193
  @_negationRationale = @entry.negationReason
198
194
  @_refills = @entry.refills
199
195
  @_route = @entry.route
@@ -210,7 +206,7 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
210
206
  ###
211
207
  dosage: ->
212
208
  if @_dosage?
213
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
209
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
214
210
  else
215
211
  null
216
212
 
@@ -218,10 +214,8 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
218
214
  @returns {Code}
219
215
  ###
220
216
  frequency: ->
221
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
222
- throw new Error('Bonnie does not currently support MedicationDischarge.frequency')
223
217
  if @_frequency?
224
- new cql.Code(@_frequency.code, @_frequency.code_system)
218
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
225
219
  else
226
220
  null
227
221
 
@@ -238,8 +232,10 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
238
232
  @returns {Integer}
239
233
  ###
240
234
  refills: ->
241
- # TODO: Refills should represent 'The number of refills allowed by the prescription.'
242
- throw new Error('Bonnie does not currently support MedicationDischarge.refills')
235
+ if @_refills?
236
+ @_refills['scalar']
237
+ else
238
+ null
243
239
 
244
240
  ###
245
241
  @returns {Code}
@@ -255,7 +251,7 @@ class CQL_QDM.MedicationDischarge extends CQL_QDM.QDMDatatype
255
251
  ###
256
252
  supply: ->
257
253
  if @_supply?
258
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
254
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
259
255
  else
260
256
  null
261
257
 
@@ -278,7 +274,7 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
278
274
  super @entry
279
275
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
280
276
  @_dosage = @entry.dose
281
- @_frequency = @entry.frequency
277
+ @_frequency = @entry.administrationTiming
282
278
  @_negationRationale = @entry.negationReason
283
279
  @_refills = @entry.refills
284
280
  @_route = @entry.route
@@ -301,7 +297,7 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
301
297
  ###
302
298
  dosage: ->
303
299
  if @_dosage?
304
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
300
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
305
301
  else
306
302
  null
307
303
 
@@ -309,10 +305,8 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
309
305
  @returns {Code}
310
306
  ###
311
307
  frequency: ->
312
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
313
- throw new Error('Bonnie does not currently support MedicationDispensed.frequency')
314
308
  if @_frequency?
315
- new cql.Code(@_frequency.code, @_frequency.code_system)
309
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
316
310
  else
317
311
  null
318
312
 
@@ -340,8 +334,10 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
340
334
  @returns {Integer}
341
335
  ###
342
336
  refills: ->
343
- # TODO: Refills should represent 'The number of refills allowed by the prescription.'
344
- throw new Error('Bonnie does not currently support MedicationDispensed.refills')
337
+ if @_refills?
338
+ @_refills['scalar']
339
+ else
340
+ null
345
341
 
346
342
  ###
347
343
  @returns {Code}
@@ -357,7 +353,7 @@ class CQL_QDM.MedicationDispensed extends CQL_QDM.QDMDatatype
357
353
  ###
358
354
  supply: ->
359
355
  if @_supply?
360
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
356
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
361
357
  else
362
358
  null
363
359
 
@@ -376,7 +372,7 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
376
372
  @_activeDatetime = CQL_QDM.Helpers.convertDateTime(@entry.active_datetime)
377
373
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
378
374
  @_dosage = @entry.dose
379
- @_frequency = @entry.frequency
375
+ @_frequency = @entry.administrationTiming
380
376
  @_method = @entry.method
381
377
  @_negationRationale = @entry.negationReason
382
378
  @_reason = @entry.reason
@@ -407,7 +403,7 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
407
403
  ###
408
404
  dosage: ->
409
405
  if @_dosage?
410
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
406
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
411
407
  else
412
408
  null
413
409
 
@@ -415,10 +411,8 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
415
411
  @returns {Code}
416
412
  ###
417
413
  frequency: ->
418
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
419
- throw new Error('Bonnie does not currently support MedicationOrder.frequency')
420
414
  if @_frequency?
421
- new cql.Code(@_frequency.code, @_frequency.code_system)
415
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
422
416
  else
423
417
  null
424
418
 
@@ -453,8 +447,10 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
453
447
  @returns {Integer}
454
448
  ###
455
449
  refills: ->
456
- # TODO: Refills should represent 'The number of refills allowed by the prescription.'
457
- throw new Error('Bonnie does not currently support MedicationOrder.refills')
450
+ if @_refills?
451
+ @_refills['scalar']
452
+ else
453
+ null
458
454
 
459
455
  ###
460
456
  @returns {Interval<Date>}
@@ -481,6 +477,6 @@ class CQL_QDM.MedicationOrder extends CQL_QDM.QDMDatatype
481
477
  ###
482
478
  supply: ->
483
479
  if @_supply?
484
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
480
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
485
481
  else
486
482
  null
@@ -0,0 +1,36 @@
1
+ ###
2
+ @namespace scoping into the CQL_QDM namespace (all classes and
3
+ their methods will be accessable through the CQL_QDM namespace)
4
+ ###
5
+ @CQL_QDM ||= {}
6
+
7
+ ###
8
+ Data elements that meet criteria using this datatype should document the type of plan or
9
+ program in which the patient is expected to be enrolled. The program is identified as the Issuer
10
+ (e.g., Aetna, BCBSA, Cigna, etc.). The code attribute indicates the coverage type indicating
11
+ the program in which the subject of record participates (e.g., health insurance plan policy,
12
+ disease specific policy, health maintenance organization policy, etc.)
13
+ ###
14
+ class CQL_QDM.Participation extends CQL_QDM.QDMDatatype
15
+ ###
16
+ @param {Object} entry - the HDS data criteria object to convert
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)
23
+ else
24
+ # No end time; high is set to infinity
25
+ @_participationPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
26
+
27
+ ###
28
+ @returns {Interval<Date>}
29
+ ###
30
+ participationPeriod: ->
31
+ low = @_participationPeriodLow
32
+ high = @_participationPeriodHigh
33
+ if low?
34
+ new cql.Interval(low, high)
35
+ else
36
+ null
@@ -18,6 +18,8 @@ class CQL_QDM.PatientCharacteristicEthnicity extends CQL_QDM.QDMDatatype
18
18
 
19
19
  getCode: ->
20
20
  if @_patient?.has('ethnicity')
21
-     code: @_patient.get('ethnicity')
21
+ # NOTE: hard coding the code system. this will be removed when we switch
22
+ # to the QDM patient model
23
+     new cql.Code(@_patient.get('ethnicity'), 'CDC Race')
22
24
  else
23
25
  null
@@ -20,10 +20,11 @@ class CQL_QDM.PatientCharacteristicExpired extends CQL_QDM.QDMDatatype
20
20
  ###
21
21
  getCode: ->
22
22
  if @_patient.get('deathdate')?
23
- '419099009'
23
+ # NOTE: hard coding the code system. this will be removed when we switch
24
+ # to the QDM patient model
25
+ new cql.Code('419099009', 'SNOMED-CT')
24
26
  else
25
- code:
26
- ''
27
+ null
27
28
 
28
29
  ###
29
30
  @returns {Code}
@@ -18,6 +18,8 @@ class CQL_QDM.PatientCharacteristicRace extends CQL_QDM.QDMDatatype
18
18
 
19
19
  getCode: ->
20
20
  if @_patient?.has('race')
21
-     code: @_patient.get('race')
21
+ # NOTE: hard coding the code system. this will be removed when we switch
22
+ # to the QDM patient model
23
+     new cql.Code(@_patient.get('race'), 'CDC Race')
22
24
  else
23
25
  null
@@ -16,8 +16,6 @@ class CQL_QDM.PatientCharacteristicSex extends CQL_QDM.QDMDatatype
16
16
      @_patient = @patient
17
17
 
18
18
  getCode: ->
19
- # NOTE: Eventually this could be replaced with actual codes. That would
20
- # require modifications to the execution engine in order to handle that
21
- # change.
22
- code:
23
- @_patient.get('gender')
19
+ # NOTE: hard coding the code system. this will be removed when we switch
20
+ # to the QDM patient model
21
+     new cql.Code(@_patient.get('gender'), 'AdministrativeGender')
@@ -18,7 +18,7 @@ class CQL_QDM.SubstanceAdministered extends CQL_QDM.QDMDatatype
18
18
  super @entry
19
19
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
20
20
  @_dosage = @entry.dose
21
- @_frequency = @entry.frequency
21
+ @_frequency = @entry.administrationTiming
22
22
  @_negationRationale = @entry.negationReason
23
23
  @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
24
24
  if @entry.end_time
@@ -41,7 +41,7 @@ class CQL_QDM.SubstanceAdministered extends CQL_QDM.QDMDatatype
41
41
  ###
42
42
  dosage: ->
43
43
  if @_dosage?
44
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
44
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
45
45
  else
46
46
  null
47
47
 
@@ -49,10 +49,8 @@ class CQL_QDM.SubstanceAdministered extends CQL_QDM.QDMDatatype
49
49
  @returns {Code}
50
50
  ###
51
51
  frequency: ->
52
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
53
- throw new Error('Bonnie does not currently support SubstanceAdministered.frequency')
54
52
  if @_frequency?
55
- new cql.Code(@_frequency.code, @_frequency.code_system)
53
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
56
54
  else
57
55
  null
58
56
 
@@ -90,7 +88,7 @@ class CQL_QDM.SubstanceAdministered extends CQL_QDM.QDMDatatype
90
88
  ###
91
89
  supply: ->
92
90
  if @_supply?
93
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
91
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
94
92
  else
95
93
  null
96
94
 
@@ -107,7 +105,7 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
107
105
  super @entry
108
106
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
109
107
  @_dosage = @entry.dose
110
- @_frequency = @entry.frequency
108
+ @_frequency = @entry.administrationTiming
111
109
  @_method = @entry.method
112
110
  @_negationRationale = @entry.negationReason
113
111
  @_reason = @entry.reason
@@ -126,7 +124,7 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
126
124
  ###
127
125
  dosage: ->
128
126
  if @_dosage?
129
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
127
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
130
128
  else
131
129
  null
132
130
 
@@ -134,10 +132,8 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
134
132
  @returns {Code}
135
133
  ###
136
134
  frequency: ->
137
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
138
- throw new Error('Bonnie does not currently support SubstanceOrder.frequency')
139
135
  if @_frequency?
140
- new cql.Code(@_frequency.code, @_frequency.code_system)
136
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
141
137
  else
142
138
  null
143
139
 
@@ -172,8 +168,10 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
172
168
  @returns {Integer}
173
169
  ###
174
170
  refills: ->
175
- # TODO: Refills should represent 'The number of refills allowed by the prescription.'
176
- throw new Error('Bonnie does not currently support SubstanceOrder.refills')
171
+ if @_refills?
172
+ @_refills['scalar']
173
+ else
174
+ null
177
175
 
178
176
  ###
179
177
  @returns {Code}
@@ -189,7 +187,7 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
189
187
  ###
190
188
  supply: ->
191
189
  if @_supply?
192
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
190
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
193
191
  else
194
192
  null
195
193
 
@@ -207,7 +205,7 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
207
205
  super @entry
208
206
  @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
209
207
  @_dosage = @entry.dose
210
- @_frequency = @entry.frequency
208
+ @_frequency = @entry.administrationTiming
211
209
  @_method = @entry.method
212
210
  @_negationRationale = @entry.negationReason
213
211
  @_reason = @entry.reason
@@ -226,7 +224,7 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
226
224
  ###
227
225
  dosage: ->
228
226
  if @_dosage?
229
- new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['value']})
227
+ new cql.Quantity({unit: @_dosage['unit'], value: @_dosage['scalar']})
230
228
  else
231
229
  null
232
230
 
@@ -234,10 +232,8 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
234
232
  @returns {Code}
235
233
  ###
236
234
  frequency: ->
237
- # TODO: Frequency currently not in HDS model. Can probably add by calculating based off of dose & regimen
238
- throw new Error('Bonnie does not currently support SubstanceRecommended.frequency')
239
235
  if @_frequency?
240
- new cql.Code(@_frequency.code, @_frequency.code_system)
236
+ new cql.Code(@_frequency.code, @_frequency.code_system, @_frequency.version, @_frequency.title)
241
237
  else
242
238
  null
243
239
 
@@ -272,8 +268,10 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
272
268
  @returns {Integer}
273
269
  ###
274
270
  refills: ->
275
- # TODO: Refills should represent 'The number of refills allowed by the prescription.'
276
- throw new Error('Bonnie does not currently support SubstanceRecommended.refills')
271
+ if @_refills?
272
+ @_refills['scalar']
273
+ else
274
+ null
277
275
 
278
276
  ###
279
277
  @returns {Code}
@@ -289,6 +287,6 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
289
287
  ###
290
288
  supply: ->
291
289
  if @_supply?
292
- new cql.Quantity({unit: @_supply['unit'], value: @_supply['value']})
290
+ new cql.Quantity({unit: @_supply['unit'], value: @_supply['scalar']})
293
291
  else
294
292
  null