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
@@ -12,25 +12,14 @@ class CQL_QDM.ProcedureOrder extends CQL_QDM.QDMDatatype
12
12
  ###
13
13
  @param {Object} entry - the HDS data criteria object to convert
14
14
  ###
15
- constructor: (@entry) ->
16
- super @entry
17
- @_anatomicalApproachSite = @entry.anatomical_approach
18
- @_anatomicalLocationSite = @entry.anatomical_location
19
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
20
- @_method = @entry.method
21
- @_negationRationale = @entry.negationReason
22
- @_ordinality = @entry.ordinality
23
- @_reason = @entry.reason
24
- delete @entry.end_time
25
-
26
- ###
27
- @returns {Code}
28
- ###
29
- anatomicalApproachSite: ->
30
- if @_anatomicalApproachSite?
31
- new cql.Code(@_anatomicalApproachSite.code, @_anatomicalApproachSite.code_system, null, @_anatomicalApproachSite.title || null)
32
- else
33
- null
15
+ constructor: (entry) ->
16
+ super entry
17
+ @_anatomicalLocationSite = entry.anatomical_location
18
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
19
+ @_negationRationale = entry.negationReason
20
+ @_ordinality = entry.ordinality
21
+ @_reason = entry.reason
22
+ delete entry.end_time
34
23
 
35
24
  ###
36
25
  @returns {Code}
@@ -47,15 +36,6 @@ class CQL_QDM.ProcedureOrder extends CQL_QDM.QDMDatatype
47
36
  authorDatetime: ->
48
37
  @_authorDatetime
49
38
 
50
- ###
51
- @returns {Code}
52
- ###
53
- method: ->
54
- if @_method?
55
- new cql.Code(@_method.code, @_method.code_system, null, @_method.title || null)
56
- else
57
- null
58
-
59
39
  ###
60
40
  @returns {Code}
61
41
  ###
@@ -93,35 +73,25 @@ class CQL_QDM.ProcedurePerformed extends CQL_QDM.QDMDatatype
93
73
  ###
94
74
  @param {Object} entry - the HDS data criteria object to convert
95
75
  ###
96
- constructor: (@entry) ->
97
- super @entry
98
- @_anatomicalApproachSite = @entry.anatomical_approach
99
- @_anatomicalLocationSite = @entry.anatomical_location
100
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
101
- @_incisionDatetime = CQL_QDM.Helpers.convertDateTime(@entry.incisionTime)
102
- @_method = @entry.method
103
- @_negationRationale = @entry.negationReason
104
- @_ordinality = @entry.ordinality
105
- @_reason = @entry.reason
106
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
107
- if @entry.end_time
108
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
76
+ constructor: (entry) ->
77
+ super entry
78
+ @_anatomicalLocationSite = entry.anatomical_location
79
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
80
+ @_incisionDatetime = CQL_QDM.Helpers.convertDateTime(entry.incisionTime)
81
+ @_method = entry.method
82
+ @_negationRationale = entry.negationReason
83
+ @_ordinality = entry.ordinality
84
+ @_reason = entry.reason
85
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
86
+ if entry.end_time
87
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
109
88
  else
110
89
  # No end time; high is set to infinity
111
90
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
112
- if @entry.values? && @entry.values.length > 0
113
- @_result = @entry.values?[0]
114
- @_status = @entry.qdm_status
115
- @_components = @entry.components
116
-
117
- ###
118
- @returns {Code}
119
- ###
120
- anatomicalApproachSite: ->
121
- if @_anatomicalApproachSite?
122
- new cql.Code(@_anatomicalApproachSite.code, @_anatomicalApproachSite.code_system, null, @_anatomicalApproachSite.title || null)
123
- else
124
- null
91
+ if entry.values? && entry.values.length > 0
92
+ @_result = entry.values?[0]
93
+ @_status = entry.qdm_status
94
+ @_components = entry.components
125
95
 
126
96
  ###
127
97
  @returns {Code}
@@ -226,25 +196,14 @@ class CQL_QDM.ProcedureRecommended extends CQL_QDM.QDMDatatype
226
196
  ###
227
197
  @param {Object} entry - the HDS data criteria object to convert
228
198
  ###
229
- constructor: (@entry) ->
230
- super @entry
231
- @_anatomicalApproachSite = @entry.anatomical_approach
232
- @_anatomicalLocationSite = @entry.anatomical_location
233
- @_method = @entry.method
234
- @_negationRationale = @entry.negationReason
235
- @_ordinality = @entry.ordinality
236
- @_reason = @entry.reason
237
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
238
- delete @entry.end_time
239
-
240
- ###
241
- @returns {Code}
242
- ###
243
- anatomicalApproachSite: ->
244
- if @_anatomicalApproachSite?
245
- new cql.Code(@_anatomicalApproachSite.code, @_anatomicalApproachSite.code_system, null, @_anatomicalApproachSite.title || null)
246
- else
247
- null
199
+ constructor: (entry) ->
200
+ super entry
201
+ @_anatomicalLocationSite = entry.anatomical_location
202
+ @_negationRationale = entry.negationReason
203
+ @_ordinality = entry.ordinality
204
+ @_reason = entry.reason
205
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
206
+ delete entry.end_time
248
207
 
249
208
  ###
250
209
  @returns {Code}
@@ -261,15 +220,6 @@ class CQL_QDM.ProcedureRecommended extends CQL_QDM.QDMDatatype
261
220
  authorDatetime: ->
262
221
  @_authorDatetime
263
222
 
264
- ###
265
- @returns {Code}
266
- ###
267
- method: ->
268
- if @_method?
269
- new cql.Code(@_method.code, @_method.code_system, null, @_method.title || null)
270
- else
271
- null
272
-
273
223
  ###
274
224
  @returns {Code}
275
225
  ###
@@ -14,20 +14,19 @@ class CQL_QDM.SubstanceAdministered extends CQL_QDM.QDMDatatype
14
14
  ###
15
15
  @param {Object} entry - the HDS data criteria object to convert
16
16
  ###
17
- constructor: (@entry) ->
18
- super @entry
19
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
20
- @_dosage = @entry.dose
21
- @_frequency = @entry.administrationTiming
22
- @_negationRationale = @entry.negationReason
23
- @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
24
- if @entry.end_time
25
- @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
17
+ constructor: (entry) ->
18
+ super entry
19
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
20
+ @_dosage = entry.dose
21
+ @_frequency = entry.administrationTiming
22
+ @_negationRationale = entry.negationReason
23
+ @_relevantPeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
24
+ if entry.end_time
25
+ @_relevantPeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
26
26
  else
27
27
  # No end time; high is set to infinity
28
28
  @_relevantPeriodHigh = CQL_QDM.Helpers.infinityDateTime()
29
- @_route = @entry.route
30
- @_supply = @entry.supply
29
+ @_route = entry.route
31
30
 
32
31
  ###
33
32
  Author date time is only present when this data type has been negated.
@@ -86,14 +85,6 @@ class CQL_QDM.SubstanceAdministered extends CQL_QDM.QDMDatatype
86
85
  else
87
86
  null
88
87
 
89
- ###
90
- @returns {Quantity}
91
- ###
92
- supply: ->
93
- if @_supply?
94
- new cql.Quantity({unit: @_supply['units'], value: @_supply['scalar']})
95
- else
96
- null
97
88
 
98
89
 
99
90
  ###
@@ -104,18 +95,17 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
104
95
  ###
105
96
  @param {Object} entry - the HDS data criteria object to convert
106
97
  ###
107
- constructor: (@entry) ->
108
- super @entry
109
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
110
- @_dosage = @entry.dose
111
- @_frequency = @entry.administrationTiming
112
- @_method = @entry.method
113
- @_negationRationale = @entry.negationReason
114
- @_reason = @entry.reason
115
- @_refills = @entry.refills
116
- @_route = @entry.route
117
- @_supply = @entry.supply
118
- delete @entry.end_time
98
+ constructor: (entry) ->
99
+ super entry
100
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
101
+ @_dosage = entry.dose
102
+ @_frequency = entry.administrationTiming
103
+ @_negationRationale = entry.negationReason
104
+ @_reason = entry.reason
105
+ @_refills = entry.refills
106
+ @_route = entry.route
107
+ @_supply = entry.supply
108
+ delete entry.end_time
119
109
 
120
110
  ###
121
111
  @returns {Date}
@@ -144,15 +134,6 @@ class CQL_QDM.SubstanceOrder extends CQL_QDM.QDMDatatype
144
134
  else
145
135
  null
146
136
 
147
- ###
148
- @returns {Code}
149
- ###
150
- method: ->
151
- if @_method?
152
- new cql.Code(@_method.code, @_method.code_system, null, @_method.title || null)
153
- else
154
- null
155
-
156
137
  ###
157
138
  @returns {Code}
158
139
  ###
@@ -208,18 +189,16 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
208
189
  ###
209
190
  @param {Object} entry - the HDS data criteria object to convert
210
191
  ###
211
- constructor: (@entry) ->
212
- super @entry
213
- @_authorDatetime = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
214
- @_dosage = @entry.dose
215
- @_frequency = @entry.administrationTiming
216
- @_method = @entry.method
217
- @_negationRationale = @entry.negationReason
218
- @_reason = @entry.reason
219
- @_refills = @entry.refills
220
- @_route = @entry.route
221
- @_supply = @entry.supply
222
- delete @entry.end_time
192
+ constructor: (entry) ->
193
+ super entry
194
+ @_authorDatetime = CQL_QDM.Helpers.convertDateTime(entry.start_time)
195
+ @_dosage = entry.dose
196
+ @_frequency = entry.administrationTiming
197
+ @_negationRationale = entry.negationReason
198
+ @_reason = entry.reason
199
+ @_refills = entry.refills
200
+ @_route = entry.route
201
+ delete entry.end_time
223
202
 
224
203
  ###
225
204
  @returns {Date}
@@ -248,15 +227,6 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
248
227
  else
249
228
  null
250
229
 
251
- ###
252
- @returns {Code}
253
- ###
254
- method: ->
255
- if @_method?
256
- new cql.Code(@_method.code, @_method.code_system, null, @_method.title || null)
257
- else
258
- null
259
-
260
230
  ###
261
231
  @returns {Code}
262
232
  ###
@@ -292,12 +262,3 @@ class CQL_QDM.SubstanceRecommended extends CQL_QDM.QDMDatatype
292
262
  new cql.Code(@_route.code, @_route.code_system, null, @_route.title || null)
293
263
  else
294
264
  null
295
-
296
- ###
297
- @returns {Quantity}
298
- ###
299
- supply: ->
300
- if @_supply?
301
- new cql.Quantity({unit: @_supply['units'], value: @_supply['scalar']})
302
- else
303
- null
@@ -18,15 +18,15 @@ class CQL_QDM.Symptom extends CQL_QDM.QDMDatatype
18
18
  ###
19
19
  @param {Object} entry - the HDS data criteria object to convert
20
20
  ###
21
- constructor: (@entry) ->
22
- super @entry
23
- @_prevalencePeriodLow = CQL_QDM.Helpers.convertDateTime(@entry.start_time)
24
- if @entry.end_time
25
- @_prevalencePeriodHigh = CQL_QDM.Helpers.convertDateTime(@entry.end_time)
21
+ constructor: (entry) ->
22
+ super entry
23
+ @_prevalencePeriodLow = CQL_QDM.Helpers.convertDateTime(entry.start_time)
24
+ if entry.end_time
25
+ @_prevalencePeriodHigh = CQL_QDM.Helpers.convertDateTime(entry.end_time)
26
26
  else
27
27
  # No end time; high is set to infinity
28
28
  @_prevalencePeriodHigh = CQL_QDM.Helpers.infinityDateTime()
29
- @_severity = @entry.severity
29
+ @_severity = entry.severity
30
30
 
31
31
  ###
32
32
  @returns {Interval<Date>}
@@ -19,9 +19,9 @@ class CQL_QDM.Helpers
19
19
  @convertDateTime: (input) ->
20
20
  if input?
21
21
  if moment.utc(input, 'MM/DD/YYYY hh:mm A', true).isValid() || moment.utc(input, 'MM/DD/YYYY h:mm A', true).isValid()
22
- cql.DateTime.fromDate(moment.utc(input, 'MM/DD/YYYY hh:mm A').toDate(), 0)
22
+ cql.DateTime.fromJSDate(moment.utc(input, 'MM/DD/YYYY hh:mm A').toDate(), 0)
23
23
  else
24
- cql.DateTime.fromDate(moment.utc(input, 'X').toDate(), 0)
24
+ cql.DateTime.fromJSDate(moment.utc(input, 'X').toDate(), 0)
25
25
  else
26
26
  null
27
27
 
@@ -58,6 +58,12 @@ class CQL_QDM.Helpers
58
58
  code = input.code.code
59
59
  display = input.description
60
60
  new cql.Code(code, code_system, null, display || null)
61
+ else if input.numerator_scalar? and input.denominator_scalar?
62
+ input.numerator_units = "1" if !input.numerator_units? or input.numerator_units == ""
63
+ input.denominator_units = "1" if !input.denominator_units? or input.denominator_units == ""
64
+ numerator = new cql.Quantity({value: input.numerator_scalar, unit: input.numerator_units})
65
+ denominator = new cql.Quantity({value: input.denominator_scalar, unit: input.denominator_units})
66
+ new cql.Ratio({numerator: numerator, denominator: denominator})
61
67
  # Check that the scalar portion is a number and the units are a non-zero length string.
62
68
  else if (input.scalar?.match(/^[-+]?[0-9]*\.?[0-9]+$/) != null)
63
69
  if input.units.length > 0
@@ -1,3 +1,3 @@
1
1
  module CqlQdmPatientapi
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  /**
2
- * no_asset_compression
3
- **/
2
+ * no_asset_compression
3
+ **/
4
4
  (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
5
5
  // Generated by CoffeeScript 1.12.7
6
6
  (function() {
@@ -345,15 +345,17 @@
345
345
 
346
346
 
347
347
 
348
- },{"./datatypes/datatypes":6,"./fhir/models":90,"./util/util":135}],4:[function(require,module,exports){
348
+ },{"./datatypes/datatypes":6,"./fhir/models":91,"./util/util":136}],4:[function(require,module,exports){
349
349
  // Generated by CoffeeScript 1.12.7
350
350
  (function() {
351
- var codeservice, context, datatypes, exec, expression, library, patient, quantity, repository, results;
351
+ var codeservice, context, datatypes, exec, expression, library, patient, quantity, ratio, repository, results;
352
352
 
353
353
  library = require('./elm/library');
354
354
 
355
355
  quantity = require('./elm/quantity');
356
356
 
357
+ ratio = require('./elm/ratio');
358
+
357
359
  expression = require('./elm/expression');
358
360
 
359
361
  repository = require('./runtime/repository');
@@ -388,6 +390,8 @@
388
390
 
389
391
  module.exports.Quantity = quantity.Quantity;
390
392
 
393
+ module.exports.Ratio = ratio.Ratio;
394
+
391
395
  module.exports.Expression = expression.Expression;
392
396
 
393
397
  module.exports.ValueSet = datatypes.ValueSet;
@@ -406,7 +410,7 @@
406
410
 
407
411
 
408
412
 
409
- },{"./cql-code-service":1,"./cql-patient":3,"./datatypes/datatypes":6,"./elm/expression":20,"./elm/library":25,"./elm/quantity":32,"./runtime/context":129,"./runtime/executor":130,"./runtime/repository":131,"./runtime/results":132}],5:[function(require,module,exports){
413
+ },{"./cql-code-service":1,"./cql-patient":3,"./datatypes/datatypes":6,"./elm/expression":20,"./elm/library":25,"./elm/quantity":32,"./elm/ratio":34,"./runtime/context":130,"./runtime/executor":131,"./runtime/repository":132,"./runtime/results":133}],5:[function(require,module,exports){
410
414
  // Generated by CoffeeScript 1.12.7
411
415
  (function() {
412
416
  var Code, CodeSystem, Concept, ValueSet, codesInList, codesMatch, toCodeList, typeIsArray;
@@ -462,8 +466,37 @@
462
466
  this.codes = codes != null ? codes : [];
463
467
  }
464
468
 
469
+ Object.defineProperties(ValueSet.prototype, {
470
+ isValueSet: {
471
+ get: function() {
472
+ return true;
473
+ }
474
+ }
475
+ });
476
+
465
477
  ValueSet.prototype.hasMatch = function(code) {
466
- return codesInList(toCodeList(code), this.codes);
478
+ var codeItem, codesList, i, len, matchFound, multipleCodeSystemsExist, ref;
479
+ codesList = toCodeList(code);
480
+ if (codesList.length === 1 && typeof codesList[0] === 'string') {
481
+ matchFound = false;
482
+ multipleCodeSystemsExist = false;
483
+ ref = this.codes;
484
+ for (i = 0, len = ref.length; i < len; i++) {
485
+ codeItem = ref[i];
486
+ if (codeItem.system !== this.codes[0].system) {
487
+ multipleCodeSystemsExist = true;
488
+ }
489
+ if (codeItem.code === codesList[0]) {
490
+ matchFound = true;
491
+ }
492
+ if (multipleCodeSystemsExist && matchFound) {
493
+ throw new Error('In (valueset) is ambiguous -- multiple codes with multiple code systems exist in value set.');
494
+ }
495
+ }
496
+ return matchFound;
497
+ } else {
498
+ return codesInList(codesList, this.codes);
499
+ }
467
500
  };
468
501
 
469
502
  return ValueSet;
@@ -518,7 +551,7 @@
518
551
 
519
552
 
520
553
 
521
- },{"../util/util":135}],6:[function(require,module,exports){
554
+ },{"../util/util":136}],6:[function(require,module,exports){
522
555
  // Generated by CoffeeScript 1.12.7
523
556
  (function() {
524
557
  var clinical, datetime, element, i, interval, j, len, len1, lib, libs, logic, ref, uncertainty;
@@ -551,13 +584,15 @@
551
584
  },{"./clinical":5,"./datetime":7,"./interval":9,"./logic":10,"./uncertainty":11}],7:[function(require,module,exports){
552
585
  // Generated by CoffeeScript 1.12.7
553
586
  (function() {
554
- var DateTime, Uncertainty, cqlFormatStringToMomentFormatString, getTimezoneSeparatorFromString, isValidDateTimeStringFormat, moment, normalizeMillisecondsField, normalizeMillisecondsFieldInString;
587
+ var Date, DateTime, Uncertainty, cqlFormatStringToMomentFormatString, daysInMonth, getTimezoneSeparatorFromString, isValidDateStringFormat, isValidDateTimeStringFormat, jsDate, moment, normalizeMillisecondsField, normalizeMillisecondsFieldInString, ref;
555
588
 
556
589
  Uncertainty = require('./uncertainty').Uncertainty;
557
590
 
591
+ ref = require('../util/util'), jsDate = ref.jsDate, normalizeMillisecondsField = ref.normalizeMillisecondsField, normalizeMillisecondsFieldInString = ref.normalizeMillisecondsFieldInString, getTimezoneSeparatorFromString = ref.getTimezoneSeparatorFromString;
592
+
558
593
  moment = require('moment');
559
594
 
560
- module.exports.DateTime = DateTime = (function() {
595
+ DateTime = (function() {
561
596
  DateTime.Unit = {
562
597
  YEAR: 'year',
563
598
  MONTH: 'month',
@@ -578,7 +613,7 @@
578
613
  }
579
614
  matches = /(\d{4})(-(\d{2}))?(-(\d{2}))?(T((\d{2})(\:(\d{2})(\:(\d{2})(\.(\d+))?)?)?)?(Z|(([+-])(\d{2})(\:?(\d{2}))?))?)?/.exec(string);
580
615
  if (matches == null) {
581
- throw new Error('Invalid DateTime String: ' + string);
616
+ return null;
582
617
  }
583
618
  years = matches[1];
584
619
  months = matches[3];
@@ -591,10 +626,10 @@
591
626
  milliseconds = normalizeMillisecondsField(milliseconds);
592
627
  }
593
628
  if (milliseconds != null) {
594
- string = normalizeMillisecondsFieldInString(string, matches);
629
+ string = normalizeMillisecondsFieldInString(string, matches[14]);
595
630
  }
596
631
  if (!isValidDateTimeStringFormat(string)) {
597
- throw new Error('Invalid DateTime String: ' + string);
632
+ return null;
598
633
  }
599
634
  args = [years, months, days, hours, minutes, seconds, milliseconds];
600
635
  args = (function() {
@@ -619,21 +654,21 @@
619
654
  })(DateTime, args, function(){});
620
655
  };
621
656
 
622
- DateTime.fromDate = function(date, timezoneOffset) {
657
+ DateTime.fromJSDate = function(date, timezoneOffset) {
623
658
  if (date instanceof DateTime) {
624
659
  return date;
625
660
  }
626
661
  if (timezoneOffset != null) {
627
- date = new Date(date.getTime() + (timezoneOffset * 60 * 60 * 1000));
662
+ date = new jsDate(date.getTime() + (timezoneOffset * 60 * 60 * 1000));
628
663
  return new DateTime(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds(), timezoneOffset);
629
664
  } else {
630
665
  return new DateTime(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
631
666
  }
632
667
  };
633
668
 
634
- function DateTime(year, month, day, hour, minute, second, millisecond, timezoneOffset1) {
635
- this.year = year != null ? year : null;
636
- this.month = month != null ? month : null;
669
+ function DateTime(year1, month1, day, hour, minute, second, millisecond, timezoneOffset1) {
670
+ this.year = year1 != null ? year1 : null;
671
+ this.month = month1 != null ? month1 : null;
637
672
  this.day = day != null ? day : null;
638
673
  this.hour = hour != null ? hour : null;
639
674
  this.minute = minute != null ? minute : null;
@@ -641,7 +676,7 @@
641
676
  this.millisecond = millisecond != null ? millisecond : null;
642
677
  this.timezoneOffset = timezoneOffset1;
643
678
  if (this.timezoneOffset == null) {
644
- this.timezoneOffset = (new Date()).getTimezoneOffset() / 60 * -1;
679
+ this.timezoneOffset = (new jsDate()).getTimezoneOffset() / 60 * -1;
645
680
  }
646
681
  }
647
682
 
@@ -698,138 +733,19 @@
698
733
  if (timezoneOffset == null) {
699
734
  timezoneOffset = 0;
700
735
  }
701
- d = DateTime.fromDate(this.toJSDate(), timezoneOffset);
736
+ d = DateTime.fromJSDate(this.toJSDate(), timezoneOffset);
702
737
  return d.reducedPrecision(this.getPrecision());
703
738
  };
704
739
 
705
- DateTime.prototype.sameAs = function(other, precision) {
706
- var diff;
707
- if (precision == null) {
708
- precision = DateTime.Unit.MILLISECOND;
709
- }
710
- if (!(other instanceof DateTime)) {
711
- null;
712
- }
713
- diff = this.differenceBetween(other, precision);
714
- switch (false) {
715
- case !(diff.low === 0 && diff.high === 0):
716
- return true;
717
- case !(diff.low <= 0 && diff.high >= 0):
718
- return null;
719
- default:
720
- return false;
721
- }
722
- };
723
-
724
- DateTime.prototype.equals = function(other) {
725
- return this.sameAs(other, DateTime.Unit.MILLISECOND);
726
- };
727
-
728
- DateTime.prototype.sameOrBefore = function(other, precision) {
729
- var diff;
730
- if (precision == null) {
731
- precision = DateTime.Unit.MILLISECOND;
732
- }
733
- if (!(other instanceof DateTime)) {
734
- return false;
735
- }
736
- diff = this.differenceBetween(other, precision);
737
- switch (false) {
738
- case !(diff.low >= 0 && diff.high >= 0):
739
- return true;
740
- case !(diff.low < 0 && diff.high < 0):
741
- return false;
742
- default:
743
- return null;
744
- }
745
- };
746
-
747
- DateTime.prototype.sameOrAfter = function(other, precision) {
748
- var diff;
749
- if (precision == null) {
750
- precision = DateTime.Unit.MILLISECOND;
751
- }
752
- if (!(other instanceof DateTime)) {
753
- return false;
754
- }
755
- diff = this.differenceBetween(other, precision);
756
- switch (false) {
757
- case !(diff.low <= 0 && diff.high <= 0):
758
- return true;
759
- case !(diff.low > 0 && diff.high > 0):
760
- return false;
761
- default:
762
- return null;
763
- }
764
- };
765
-
766
- DateTime.prototype.before = function(other, precision) {
767
- var diff;
768
- if (precision == null) {
769
- precision = DateTime.Unit.MILLISECOND;
770
- }
771
- if (!(other instanceof DateTime)) {
772
- return false;
773
- }
774
- diff = this.differenceBetween(other, precision);
775
- switch (false) {
776
- case !(diff.low > 0 && diff.high > 0):
777
- return true;
778
- case !(diff.low <= 0 && diff.high <= 0):
779
- return false;
780
- default:
781
- return null;
782
- }
783
- };
784
-
785
- DateTime.prototype.after = function(other, precision) {
786
- var diff;
787
- if (precision == null) {
788
- precision = DateTime.Unit.MILLISECOND;
789
- }
790
- if (!(other instanceof DateTime)) {
791
- return false;
792
- }
793
- diff = this.differenceBetween(other, precision);
794
- switch (false) {
795
- case !(diff.low < 0 && diff.high < 0):
796
- return true;
797
- case !(diff.low >= 0 && diff.high >= 0):
798
- return false;
799
- default:
800
- return null;
801
- }
802
- };
803
-
804
- DateTime.prototype.add = function(offset, field) {
805
- var i, len, normalized, ref, result;
806
- result = this.copy();
807
- if (field === DateTime.Unit.WEEK) {
808
- offset = offset * 7;
809
- field = DateTime.Unit.DAY;
810
- }
811
- if (result[field] != null) {
812
- result[field] = result[field] + offset;
813
- normalized = DateTime.fromDate(result.toJSDate(), this.timezoneOffset);
814
- ref = DateTime.FIELDS;
815
- for (i = 0, len = ref.length; i < len; i++) {
816
- field = ref[i];
817
- if (result[field] != null) {
818
- result[field] = normalized[field];
819
- }
820
- }
821
- }
822
- return result;
823
- };
824
-
825
740
  DateTime.prototype.differenceBetween = function(other, unitField) {
826
741
  var a, aHighMoment, aJS, aLowMoment, aUncertainty, b, bHighMoment, bJS, bLowMoment, bUncertainty, tzDiff;
742
+ other = this._implicitlyConvert(other);
827
743
  if (!(other instanceof DateTime)) {
828
744
  return null;
829
745
  }
830
746
  a = this.copy();
831
747
  b = other.copy();
832
- if (unitField === DateTime.Unit.MONTH || unitField === DateTime.Unit.YEAR) {
748
+ if (unitField === DateTime.Unit.MONTH || unitField === DateTime.Unit.YEAR || unitField === DateTime.Unit.WEEK || unitField === DateTime.Unit.DAY) {
833
749
  if (a.timezoneOffset !== b.timezoneOffset) {
834
750
  b = b.convertToTimezoneOffset(a.timezoneOffset);
835
751
  }
@@ -886,7 +802,7 @@
886
802
  if (d.day == null) {
887
803
  return d;
888
804
  }
889
- floored = new Date(d.year, d.month - 1, d.day);
805
+ floored = new jsDate(d.year, d.month - 1, d.day);
890
806
  while (floored.getDay() > 0) {
891
807
  floored.setDate(floored.getDate() - 1);
892
808
  }
@@ -895,6 +811,7 @@
895
811
 
896
812
  DateTime.prototype.durationBetween = function(other, unitField) {
897
813
  var a, b;
814
+ other = this._implicitlyConvert(other);
898
815
  if (!(other instanceof DateTime)) {
899
816
  return null;
900
817
  }
@@ -924,7 +841,7 @@
924
841
  return truncFunc(msDiff / (7 * 24 * 60 * 60 * 1000));
925
842
  } else if (unitField === DateTime.Unit.MONTH || unitField === DateTime.Unit.YEAR) {
926
843
  months = (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
927
- aInMonth = new Date(a.getTime());
844
+ aInMonth = new jsDate(a.getTime());
928
845
  aInMonthOriginalOffset = aInMonth.getTimezoneOffset();
929
846
  aInMonth.setMonth(a.getMonth() + months);
930
847
  if (aInMonthOriginalOffset !== aInMonth.getTimezoneOffset()) {
@@ -945,49 +862,6 @@
945
862
  }
946
863
  };
947
864
 
948
- DateTime.prototype.isPrecise = function() {
949
- return DateTime.FIELDS.every((function(_this) {
950
- return function(field) {
951
- return _this[field] != null;
952
- };
953
- })(this));
954
- };
955
-
956
- DateTime.prototype.isImprecise = function() {
957
- return !this.isPrecise();
958
- };
959
-
960
- DateTime.prototype.isMorePrecise = function(other) {
961
- var field, i, len, ref;
962
- ref = DateTime.FIELDS;
963
- for (i = 0, len = ref.length; i < len; i++) {
964
- field = ref[i];
965
- if ((other[field] != null) && (this[field] == null)) {
966
- return false;
967
- }
968
- }
969
- return !this.isSamePrecision(other);
970
- };
971
-
972
- DateTime.prototype.isLessPrecise = function(other) {
973
- return !this.isSamePrecision(other) && !this.isMorePrecise(other);
974
- };
975
-
976
- DateTime.prototype.isSamePrecision = function(other) {
977
- var field, i, len, ref;
978
- ref = DateTime.FIELDS;
979
- for (i = 0, len = ref.length; i < len; i++) {
980
- field = ref[i];
981
- if ((this[field] != null) && (other[field] == null)) {
982
- return false;
983
- }
984
- if ((this[field] == null) && (other[field] != null)) {
985
- return false;
986
- }
987
- }
988
- return true;
989
- };
990
-
991
865
  DateTime.prototype.isUTC = function() {
992
866
  return !this.timezoneOffset;
993
867
  };
@@ -1032,25 +906,25 @@
1032
906
  };
1033
907
 
1034
908
  DateTime.prototype.toUncertainty = function(ignoreTimezone) {
1035
- var high, low, ref, ref1, ref2, ref3, ref4, ref5, ref6;
909
+ var high, low, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
1036
910
  if (ignoreTimezone == null) {
1037
911
  ignoreTimezone = false;
1038
912
  }
1039
913
  low = this.toJSDate(ignoreTimezone);
1040
- high = (new DateTime(this.year, (ref = this.month) != null ? ref : 12, (ref1 = this.day) != null ? ref1 : (new Date(this.year, (ref2 = this.month) != null ? ref2 : 12, 0)).getDate(), (ref3 = this.hour) != null ? ref3 : 23, (ref4 = this.minute) != null ? ref4 : 59, (ref5 = this.second) != null ? ref5 : 59, (ref6 = this.millisecond) != null ? ref6 : 999, this.timezoneOffset)).toJSDate(ignoreTimezone);
914
+ high = (new DateTime(this.year, (ref1 = this.month) != null ? ref1 : 12, (ref2 = this.day) != null ? ref2 : (new jsDate(this.year, (ref3 = this.month) != null ? ref3 : 12, 0)).getDate(), (ref4 = this.hour) != null ? ref4 : 23, (ref5 = this.minute) != null ? ref5 : 59, (ref6 = this.second) != null ? ref6 : 59, (ref7 = this.millisecond) != null ? ref7 : 999, this.timezoneOffset)).toJSDate(ignoreTimezone);
1041
915
  return new Uncertainty(low, high);
1042
916
  };
1043
917
 
1044
918
  DateTime.prototype.toJSDate = function(ignoreTimezone) {
1045
- var d, h, mi, mo, ms, ref, ref1, ref2, ref3, ref4, ref5, s, y;
919
+ var d, h, mi, mo, ms, ref1, ref2, ref3, ref4, ref5, ref6, s, y;
1046
920
  if (ignoreTimezone == null) {
1047
921
  ignoreTimezone = false;
1048
922
  }
1049
- ref5 = [this.year, (this.month != null ? this.month - 1 : 0), (ref = this.day) != null ? ref : 1, (ref1 = this.hour) != null ? ref1 : 0, (ref2 = this.minute) != null ? ref2 : 0, (ref3 = this.second) != null ? ref3 : 0, (ref4 = this.millisecond) != null ? ref4 : 0], y = ref5[0], mo = ref5[1], d = ref5[2], h = ref5[3], mi = ref5[4], s = ref5[5], ms = ref5[6];
923
+ ref6 = [this.year, (this.month != null ? this.month - 1 : 0), (ref1 = this.day) != null ? ref1 : 1, (ref2 = this.hour) != null ? ref2 : 0, (ref3 = this.minute) != null ? ref3 : 0, (ref4 = this.second) != null ? ref4 : 0, (ref5 = this.millisecond) != null ? ref5 : 0], y = ref6[0], mo = ref6[1], d = ref6[2], h = ref6[3], mi = ref6[4], s = ref6[5], ms = ref6[6];
1050
924
  if ((this.timezoneOffset != null) && !ignoreTimezone) {
1051
- return new Date(Date.UTC(y, mo, d, h, mi, s, ms) - (this.timezoneOffset * 60 * 60 * 1000));
925
+ return new jsDate(jsDate.UTC(y, mo, d, h, mi, s, ms) - (this.timezoneOffset * 60 * 60 * 1000));
1052
926
  } else {
1053
- return new Date(y, mo, d, h, mi, s, ms);
927
+ return new jsDate(y, mo, d, h, mi, s, ms);
1054
928
  }
1055
929
  };
1056
930
 
@@ -1097,7 +971,7 @@
1097
971
  };
1098
972
 
1099
973
  DateTime.prototype.getDate = function() {
1100
- return this.reducedPrecision(DateTime.Unit.DAY);
974
+ return new Date(this.year, this.month, this.day);
1101
975
  };
1102
976
 
1103
977
  DateTime.prototype.getTime = function() {
@@ -1108,6 +982,13 @@
1108
982
  return this.year === 0 && this.month === 1 && this.day === 1;
1109
983
  };
1110
984
 
985
+ DateTime.prototype._implicitlyConvert = function(other) {
986
+ if (other instanceof Date) {
987
+ return other.getDateTime();
988
+ }
989
+ return other;
990
+ };
991
+
1111
992
  DateTime.prototype.reducedPrecision = function(unitField) {
1112
993
  var field, fieldIndex, fieldsToRemove, i, len, reduced;
1113
994
  if (unitField == null) {
@@ -1129,25 +1010,646 @@
1129
1010
 
1130
1011
  })();
1131
1012
 
1132
- normalizeMillisecondsFieldInString = function(string, matches) {
1133
- var beforeMs, msAndAfter, msString, ref, timezoneField, timezoneSeparator;
1134
- msString = matches[14];
1135
- msString = normalizeMillisecondsField(msString);
1136
- ref = string.split('.'), beforeMs = ref[0], msAndAfter = ref[1];
1137
- timezoneSeparator = getTimezoneSeparatorFromString(msAndAfter);
1138
- if (!!timezoneSeparator) {
1139
- timezoneField = msAndAfter != null ? msAndAfter.split(timezoneSeparator)[1] : void 0;
1013
+ Date = (function() {
1014
+ Date.Unit = {
1015
+ YEAR: 'year',
1016
+ MONTH: 'month',
1017
+ WEEK: 'week',
1018
+ DAY: 'day'
1019
+ };
1020
+
1021
+ Date.FIELDS = [Date.Unit.YEAR, Date.Unit.MONTH, Date.Unit.DAY];
1022
+
1023
+ Date.parse = function(string) {
1024
+ var arg, args, days, matches, months, years;
1025
+ if (string === null) {
1026
+ return null;
1027
+ }
1028
+ matches = /(\d{4})(-(\d{2}))?(-(\d{2}))?/.exec(string);
1029
+ if (matches == null) {
1030
+ return null;
1031
+ }
1032
+ years = matches[1];
1033
+ months = matches[3];
1034
+ days = matches[5];
1035
+ if (!isValidDateStringFormat(string)) {
1036
+ return null;
1037
+ }
1038
+ args = [years, months, days];
1039
+ args = (function() {
1040
+ var i, len, results;
1041
+ results = [];
1042
+ for (i = 0, len = args.length; i < len; i++) {
1043
+ arg = args[i];
1044
+ results.push(arg != null ? parseInt(arg, 10) : void 0);
1045
+ }
1046
+ return results;
1047
+ })();
1048
+ return (function(func, args, ctor) {
1049
+ ctor.prototype = func.prototype;
1050
+ var child = new ctor, result = func.apply(child, args);
1051
+ return Object(result) === result ? result : child;
1052
+ })(Date, args, function(){});
1053
+ };
1054
+
1055
+ function Date(year1, month1, day) {
1056
+ this.year = year1 != null ? year1 : null;
1057
+ this.month = month1 != null ? month1 : null;
1058
+ this.day = day != null ? day : null;
1059
+ return;
1140
1060
  }
1141
- if (timezoneField == null) {
1142
- timezoneField = '';
1061
+
1062
+ Object.defineProperties(Date.prototype, {
1063
+ isDate: {
1064
+ get: function() {
1065
+ return true;
1066
+ }
1067
+ }
1068
+ });
1069
+
1070
+ Date.prototype.copy = function() {
1071
+ return new Date(this.year, this.month, this.day);
1072
+ };
1073
+
1074
+ Date.prototype.successor = function() {
1075
+ if (this.day != null) {
1076
+ return this.add(1, Date.Unit.DAY);
1077
+ } else if (this.month != null) {
1078
+ return this.add(1, Date.Unit.MONTH);
1079
+ } else if (this.year != null) {
1080
+ return this.add(1, Date.Unit.YEAR);
1081
+ }
1082
+ };
1083
+
1084
+ Date.prototype.predecessor = function() {
1085
+ if (this.day != null) {
1086
+ return this.add(-1, Date.Unit.DAY);
1087
+ } else if (this.month != null) {
1088
+ return this.add(-1, Date.Unit.MONTH);
1089
+ } else if (this.year != null) {
1090
+ return this.add(-1, Date.Unit.YEAR);
1091
+ }
1092
+ };
1093
+
1094
+ Date.prototype.differenceBetween = function(other, unitField) {
1095
+ var a, b;
1096
+ if (other instanceof DateTime) {
1097
+ return this.getDateTime().differenceBetween(other, unitField);
1098
+ }
1099
+ if (!(other instanceof Date)) {
1100
+ return null;
1101
+ }
1102
+ a = this;
1103
+ b = other;
1104
+ if (unitField === Date.Unit.YEAR) {
1105
+ a = new Date(a.year, 1, 1);
1106
+ b = new Date(b.year, 1, 1);
1107
+ } else if (unitField === Date.Unit.MONTH) {
1108
+ a = new Date(a.year, a.month, 1);
1109
+ b = new Date(b.year, b.month, 1);
1110
+ } else if (unitField === Date.Unit.WEEK) {
1111
+ a = this._floorWeek(a);
1112
+ b = this._floorWeek(b);
1113
+ }
1114
+ return a.durationBetween(b, unitField);
1115
+ };
1116
+
1117
+ Date.prototype._floorWeek = function(d) {
1118
+ var floored;
1119
+ if (d.day == null) {
1120
+ return d;
1121
+ }
1122
+ floored = new jsDate(d.year, d.month - 1, d.day);
1123
+ while (floored.getDay() > 0) {
1124
+ floored.setDate(floored.getDate() - 1);
1125
+ }
1126
+ return new Date(floored.getFullYear(), floored.getMonth() + 1, floored.getDate());
1127
+ };
1128
+
1129
+ Date.prototype.durationBetween = function(other, unitField) {
1130
+ var a, b;
1131
+ if (other instanceof DateTime) {
1132
+ return this.getDateTime().durationBetween(other, unitField);
1133
+ }
1134
+ if (!(other instanceof Date)) {
1135
+ return null;
1136
+ }
1137
+ a = this.toUncertainty();
1138
+ b = other.toUncertainty();
1139
+ return new Uncertainty(this._durationBetweenDates(a.high, b.low, unitField), this._durationBetweenDates(a.low, b.high, unitField));
1140
+ };
1141
+
1142
+ Date.prototype._durationBetweenDates = function(a, b, unitField) {
1143
+ var aInMonth, aInMonthOriginalOffset, months, msDiff, truncFunc, tzdiff;
1144
+ a.setTime(a.getTime() + (12 * 60 * 60 * 1000));
1145
+ b.setTime(b.getTime() + (12 * 60 * 60 * 1000));
1146
+ tzdiff = a.getTimezoneOffset() - b.getTimezoneOffset();
1147
+ b.setTime(b.getTime() + (tzdiff * 60 * 1000));
1148
+ msDiff = b.getTime() - a.getTime();
1149
+ if (msDiff === 0) {
1150
+ return 0;
1151
+ }
1152
+ truncFunc = msDiff > 0 ? Math.floor : Math.ceil;
1153
+ if (unitField === Date.Unit.DAY) {
1154
+ return truncFunc(msDiff / (24 * 60 * 60 * 1000));
1155
+ } else if (unitField === Date.Unit.WEEK) {
1156
+ return truncFunc(msDiff / (7 * 24 * 60 * 60 * 1000));
1157
+ } else if (unitField === Date.Unit.MONTH || unitField === Date.Unit.YEAR) {
1158
+ months = (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
1159
+ aInMonth = new jsDate(a.getTime());
1160
+ aInMonthOriginalOffset = aInMonth.getTimezoneOffset();
1161
+ aInMonth.setMonth(a.getMonth() + months);
1162
+ if (aInMonthOriginalOffset !== aInMonth.getTimezoneOffset()) {
1163
+ aInMonth.setMinutes(aInMonth.getMinutes() + (aInMonthOriginalOffset - aInMonth.getTimezoneOffset()));
1164
+ }
1165
+ if (msDiff > 0 && aInMonth > b) {
1166
+ months = months - 1;
1167
+ } else if (msDiff < 0 && aInMonth < b) {
1168
+ months = months + 1;
1169
+ }
1170
+ if (unitField === Date.Unit.MONTH) {
1171
+ return months;
1172
+ } else {
1173
+ return truncFunc(months / 12);
1174
+ }
1175
+ } else {
1176
+ return null;
1177
+ }
1178
+ };
1179
+
1180
+ Date.prototype.getPrecision = function() {
1181
+ var result;
1182
+ result = null;
1183
+ if (this.year != null) {
1184
+ result = Date.Unit.YEAR;
1185
+ } else {
1186
+ return result;
1187
+ }
1188
+ if (this.month != null) {
1189
+ result = Date.Unit.MONTH;
1190
+ } else {
1191
+ return result;
1192
+ }
1193
+ if (this.day != null) {
1194
+ result = Date.Unit.DAY;
1195
+ } else {
1196
+ return result;
1197
+ }
1198
+ return result;
1199
+ };
1200
+
1201
+ Date.prototype.toUncertainty = function() {
1202
+ var high, low, ref1, ref2, ref3;
1203
+ low = this.toJSDate();
1204
+ high = new Date(this.year, (ref1 = this.month) != null ? ref1 : 12, (ref2 = this.day) != null ? ref2 : (new jsDate(this.year, (ref3 = this.month) != null ? ref3 : 12, 0)).getDate()).toJSDate();
1205
+ return new Uncertainty(low, high);
1206
+ };
1207
+
1208
+ Date.prototype.toJSDate = function() {
1209
+ var d, mo, ref1, ref2, y;
1210
+ ref2 = [this.year, (this.month != null ? this.month - 1 : 0), (ref1 = this.day) != null ? ref1 : 1], y = ref2[0], mo = ref2[1], d = ref2[2];
1211
+ return new jsDate(y, mo, d);
1212
+ };
1213
+
1214
+ Date.fromJSDate = function(date) {
1215
+ if (date instanceof Date) {
1216
+ return date;
1217
+ }
1218
+ return new Date(date.getFullYear(), date.getMonth() + 1, date.getDate());
1219
+ };
1220
+
1221
+ Date.prototype.toJSON = function() {
1222
+ return this.toString();
1223
+ };
1224
+
1225
+ Date.prototype.toString = function() {
1226
+ var str;
1227
+ str = '';
1228
+ if (this.year != null) {
1229
+ str += this.year.toString();
1230
+ if (this.month != null) {
1231
+ str += '-' + this.month.toString().padStart(2, "0");
1232
+ if (this.day != null) {
1233
+ str += '-' + this.day.toString().padStart(2, "0");
1234
+ }
1235
+ }
1236
+ }
1237
+ return str;
1238
+ };
1239
+
1240
+ Date.prototype.getDateTime = function() {
1241
+ if ((this.year != null) && (this.month != null) && (this.day != null)) {
1242
+ return new DateTime(this.year, this.month, this.day, 0, 0, 0, 0);
1243
+ } else {
1244
+ return new DateTime(this.year, this.month, this.day);
1245
+ }
1246
+ };
1247
+
1248
+ Date.prototype.reducedPrecision = function(unitField) {
1249
+ var field, fieldIndex, fieldsToRemove, i, len, reduced;
1250
+ if (unitField == null) {
1251
+ unitField = Date.Unit.DAY;
1252
+ }
1253
+ reduced = this.copy();
1254
+ if (unitField !== Date.Unit.DAY) {
1255
+ fieldIndex = Date.FIELDS.indexOf(unitField);
1256
+ fieldsToRemove = Date.FIELDS.slice(fieldIndex + 1);
1257
+ for (i = 0, len = fieldsToRemove.length; i < len; i++) {
1258
+ field = fieldsToRemove[i];
1259
+ reduced[field] = null;
1260
+ }
1261
+ }
1262
+ return reduced;
1263
+ };
1264
+
1265
+ return Date;
1266
+
1267
+ })();
1268
+
1269
+ DateTime.prototype.isPrecise = Date.prototype.isPrecise = function() {
1270
+ return this.constructor.FIELDS.every((function(_this) {
1271
+ return function(field) {
1272
+ return _this[field] != null;
1273
+ };
1274
+ })(this));
1275
+ };
1276
+
1277
+ DateTime.prototype.isImprecise = Date.prototype.isImprecise = function() {
1278
+ return !this.isPrecise();
1279
+ };
1280
+
1281
+ DateTime.prototype.isMorePrecise = Date.prototype.isMorePrecise = function(other) {
1282
+ var field, i, len, ref1;
1283
+ ref1 = this.constructor.FIELDS;
1284
+ for (i = 0, len = ref1.length; i < len; i++) {
1285
+ field = ref1[i];
1286
+ if ((other[field] != null) && (this[field] == null)) {
1287
+ return false;
1288
+ }
1143
1289
  }
1144
- return string = beforeMs + '.' + msString + timezoneSeparator + timezoneField;
1290
+ return !this.isSamePrecision(other);
1291
+ };
1292
+
1293
+ DateTime.prototype.isLessPrecise = Date.prototype.isLessPrecise = function(other) {
1294
+ return !this.isSamePrecision(other) && !this.isMorePrecise(other);
1295
+ };
1296
+
1297
+ DateTime.prototype.isSamePrecision = Date.prototype.isSamePrecision = function(other) {
1298
+ var field, i, len, ref1;
1299
+ ref1 = this.constructor.FIELDS;
1300
+ for (i = 0, len = ref1.length; i < len; i++) {
1301
+ field = ref1[i];
1302
+ if ((this[field] != null) && (other[field] == null)) {
1303
+ return false;
1304
+ }
1305
+ if ((this[field] == null) && (other[field] != null)) {
1306
+ return false;
1307
+ }
1308
+ }
1309
+ return true;
1310
+ };
1311
+
1312
+ DateTime.prototype.equals = Date.prototype.equals = function(other) {
1313
+ var field, i, len, ref1;
1314
+ if (!((this.isDate && other.isDate) || (this.isDateTime && other.isDateTime))) {
1315
+ return false;
1316
+ }
1317
+ if (this.timezoneOffset !== other.timezoneOffset) {
1318
+ other = other.convertToTimezoneOffset(this.timezoneOffset);
1319
+ }
1320
+ ref1 = this.constructor.FIELDS;
1321
+ for (i = 0, len = ref1.length; i < len; i++) {
1322
+ field = ref1[i];
1323
+ if ((this[field] != null) && (other[field] != null)) {
1324
+ if (this[field] !== other[field]) {
1325
+ return false;
1326
+ }
1327
+ } else if ((this[field] == null) && (other[field] == null)) {
1328
+ return true;
1329
+ } else {
1330
+ return null;
1331
+ }
1332
+ }
1333
+ return true;
1334
+ };
1335
+
1336
+ DateTime.prototype.sameAs = Date.prototype.sameAs = function(other, precision) {
1337
+ var field, i, len, ref1;
1338
+ if (!(other.isDate || other.isDateTime)) {
1339
+ return null;
1340
+ } else if (this.isDate && other.isDateTime) {
1341
+ return this.getDateTime().sameAs(other, precision);
1342
+ } else if (this.isDateTime && other.isDate) {
1343
+ other = other.getDateTime();
1344
+ }
1345
+ if ((precision != null) && this.constructor.FIELDS.indexOf(precision) < 0) {
1346
+ throw new Error("Invalid precision: " + precision);
1347
+ }
1348
+ if (this.timezoneOffset !== other.timezoneOffset) {
1349
+ other = other.convertToTimezoneOffset(this.timezoneOffset);
1350
+ }
1351
+ ref1 = this.constructor.FIELDS;
1352
+ for (i = 0, len = ref1.length; i < len; i++) {
1353
+ field = ref1[i];
1354
+ if ((this[field] != null) && (other[field] != null)) {
1355
+ if (this[field] !== other[field]) {
1356
+ return false;
1357
+ }
1358
+ } else if ((this[field] == null) && (other[field] == null)) {
1359
+ if (precision == null) {
1360
+ return true;
1361
+ } else {
1362
+ return null;
1363
+ }
1364
+ } else {
1365
+ return null;
1366
+ }
1367
+ if ((precision != null) && precision === field) {
1368
+ break;
1369
+ }
1370
+ }
1371
+ return true;
1372
+ };
1373
+
1374
+ DateTime.prototype.sameOrBefore = Date.prototype.sameOrBefore = function(other, precision) {
1375
+ var field, i, len, ref1;
1376
+ if (!(other.isDate || other.isDateTime)) {
1377
+ return null;
1378
+ } else if (this.isDate && other.isDateTime) {
1379
+ return this.getDateTime().sameOrBefore(other, precision);
1380
+ } else if (this.isDateTime && other.isDate) {
1381
+ other = other.getDateTime();
1382
+ }
1383
+ if ((precision != null) && this.constructor.FIELDS.indexOf(precision) < 0) {
1384
+ throw new Error("Invalid precision: " + precision);
1385
+ }
1386
+ if (this.timezoneOffset !== other.timezoneOffset) {
1387
+ other = other.convertToTimezoneOffset(this.timezoneOffset);
1388
+ }
1389
+ ref1 = this.constructor.FIELDS;
1390
+ for (i = 0, len = ref1.length; i < len; i++) {
1391
+ field = ref1[i];
1392
+ if ((this[field] != null) && (other[field] != null)) {
1393
+ if (this[field] < other[field]) {
1394
+ return true;
1395
+ } else if (this[field] > other[field]) {
1396
+ return false;
1397
+ }
1398
+ } else if ((this[field] == null) && (other[field] == null)) {
1399
+ if (precision == null) {
1400
+ return true;
1401
+ } else {
1402
+ return null;
1403
+ }
1404
+ } else {
1405
+ return null;
1406
+ }
1407
+ if ((precision != null) && precision === field) {
1408
+ break;
1409
+ }
1410
+ }
1411
+ return true;
1412
+ };
1413
+
1414
+ DateTime.prototype.sameOrAfter = Date.prototype.sameOrAfter = function(other, precision) {
1415
+ var field, i, len, ref1;
1416
+ if (!(other.isDate || other.isDateTime)) {
1417
+ return null;
1418
+ } else if (this.isDate && other.isDateTime) {
1419
+ return this.getDateTime().sameOrAfter(other, precision);
1420
+ } else if (this.isDateTime && other.isDate) {
1421
+ other = other.getDateTime();
1422
+ }
1423
+ if ((precision != null) && this.constructor.FIELDS.indexOf(precision) < 0) {
1424
+ throw new Error("Invalid precision: " + precision);
1425
+ }
1426
+ if (this.timezoneOffset !== other.timezoneOffset) {
1427
+ other = other.convertToTimezoneOffset(this.timezoneOffset);
1428
+ }
1429
+ ref1 = this.constructor.FIELDS;
1430
+ for (i = 0, len = ref1.length; i < len; i++) {
1431
+ field = ref1[i];
1432
+ if ((this[field] != null) && (other[field] != null)) {
1433
+ if (this[field] > other[field]) {
1434
+ return true;
1435
+ } else if (this[field] < other[field]) {
1436
+ return false;
1437
+ }
1438
+ } else if ((this[field] == null) && (other[field] == null)) {
1439
+ if (precision == null) {
1440
+ return true;
1441
+ } else {
1442
+ return null;
1443
+ }
1444
+ } else {
1445
+ return null;
1446
+ }
1447
+ if ((precision != null) && precision === field) {
1448
+ break;
1449
+ }
1450
+ }
1451
+ return true;
1452
+ };
1453
+
1454
+ DateTime.prototype.before = Date.prototype.before = function(other, precision) {
1455
+ var field, i, len, ref1;
1456
+ if (!(other.isDate || other.isDateTime)) {
1457
+ return null;
1458
+ } else if (this.isDate && other.isDateTime) {
1459
+ return this.getDateTime().before(other, precision);
1460
+ } else if (this.isDateTime && other.isDate) {
1461
+ other = other.getDateTime();
1462
+ }
1463
+ if ((precision != null) && this.constructor.FIELDS.indexOf(precision) < 0) {
1464
+ throw new Error("Invalid precision: " + precision);
1465
+ }
1466
+ if (this.timezoneOffset !== other.timezoneOffset) {
1467
+ other = other.convertToTimezoneOffset(this.timezoneOffset);
1468
+ }
1469
+ ref1 = this.constructor.FIELDS;
1470
+ for (i = 0, len = ref1.length; i < len; i++) {
1471
+ field = ref1[i];
1472
+ if ((this[field] != null) && (other[field] != null)) {
1473
+ if (this[field] < other[field]) {
1474
+ return true;
1475
+ } else if (this[field] > other[field]) {
1476
+ return false;
1477
+ }
1478
+ } else if ((this[field] == null) && (other[field] == null)) {
1479
+ if (precision == null) {
1480
+ return false;
1481
+ } else {
1482
+ return null;
1483
+ }
1484
+ } else {
1485
+ return null;
1486
+ }
1487
+ if ((precision != null) && precision === field) {
1488
+ break;
1489
+ }
1490
+ }
1491
+ return false;
1492
+ };
1493
+
1494
+ DateTime.prototype.after = Date.prototype.after = function(other, precision) {
1495
+ var field, i, len, ref1;
1496
+ if (!(other.isDate || other.isDateTime)) {
1497
+ return null;
1498
+ } else if (this.isDate && other.isDateTime) {
1499
+ return this.getDateTime().after(other, precision);
1500
+ } else if (this.isDateTime && other.isDate) {
1501
+ other = other.getDateTime();
1502
+ }
1503
+ if ((precision != null) && this.constructor.FIELDS.indexOf(precision) < 0) {
1504
+ throw new Error("Invalid precision: " + precision);
1505
+ }
1506
+ if (this.timezoneOffset !== other.timezoneOffset) {
1507
+ other = other.convertToTimezoneOffset(this.timezoneOffset);
1508
+ }
1509
+ ref1 = this.constructor.FIELDS;
1510
+ for (i = 0, len = ref1.length; i < len; i++) {
1511
+ field = ref1[i];
1512
+ if ((this[field] != null) && (other[field] != null)) {
1513
+ if (this[field] > other[field]) {
1514
+ return true;
1515
+ } else if (this[field] < other[field]) {
1516
+ return false;
1517
+ }
1518
+ } else if ((this[field] == null) && (other[field] == null)) {
1519
+ if (precision == null) {
1520
+ return false;
1521
+ } else {
1522
+ return null;
1523
+ }
1524
+ } else {
1525
+ return null;
1526
+ }
1527
+ if ((precision != null) && precision === field) {
1528
+ break;
1529
+ }
1530
+ }
1531
+ return false;
1532
+ };
1533
+
1534
+ DateTime.prototype.add = Date.prototype.add = function(offset, field) {
1535
+ var f, fieldFloorOrCiel, i, j, k, len, len1, len2, normalized, offsetIsMorePrecise, ref1, ref2, ref3, ref4, result;
1536
+ result = this.copy();
1537
+ if (offset === 0) {
1538
+ return result;
1539
+ }
1540
+ if (field === this.constructor.Unit.WEEK) {
1541
+ offset = offset * 7;
1542
+ field = this.constructor.Unit.DAY;
1543
+ }
1544
+ offsetIsMorePrecise = result[field] == null;
1545
+ if (offsetIsMorePrecise) {
1546
+ if (!this.year) {
1547
+ result.year = new jsDate().getFullYear();
1548
+ }
1549
+ fieldFloorOrCiel = offset >= 0 ? this.getFieldFloor : this.getFieldCieling;
1550
+ ref1 = this.constructor.FIELDS;
1551
+ for (i = 0, len = ref1.length; i < len; i++) {
1552
+ f = ref1[i];
1553
+ result[f] = (ref2 = result[f]) != null ? ref2 : fieldFloorOrCiel.call(result, f);
1554
+ if (result[field] != null) {
1555
+ break;
1556
+ }
1557
+ }
1558
+ }
1559
+ result[field] = result[field] + offset;
1560
+ normalized = this.constructor.fromJSDate(result.toJSDate(), this.timezoneOffset);
1561
+ ref3 = this.constructor.FIELDS;
1562
+ for (j = 0, len1 = ref3.length; j < len1; j++) {
1563
+ field = ref3[j];
1564
+ if (result[field] != null) {
1565
+ result[field] = normalized[field];
1566
+ }
1567
+ }
1568
+ if (offsetIsMorePrecise) {
1569
+ ref4 = this.constructor.FIELDS;
1570
+ for (k = 0, len2 = ref4.length; k < len2; k++) {
1571
+ f = ref4[k];
1572
+ if (this[f] == null) {
1573
+ result[f] = null;
1574
+ }
1575
+ }
1576
+ }
1577
+ return result;
1578
+ };
1579
+
1580
+ DateTime.prototype.getFieldFloor = Date.prototype.getFieldFloor = function(field) {
1581
+ if (field === 'month') {
1582
+ return 1;
1583
+ }
1584
+ if (field === 'day') {
1585
+ return 1;
1586
+ }
1587
+ if (field === 'hour') {
1588
+ return 0;
1589
+ }
1590
+ if (field === 'minute') {
1591
+ return 0;
1592
+ }
1593
+ if (field === 'second') {
1594
+ return 0;
1595
+ }
1596
+ if (field === 'millisecond') {
1597
+ return 0;
1598
+ }
1599
+ throw new Error('Tried to floor a field that has no floor value: ' + field);
1600
+ };
1601
+
1602
+ DateTime.prototype.getFieldCieling = Date.prototype.getFieldCieling = function(field) {
1603
+ if (field === 'month') {
1604
+ return 12;
1605
+ }
1606
+ if (field === 'day') {
1607
+ return daysInMonth(this.year, this.month);
1608
+ }
1609
+ if (field === 'hour') {
1610
+ return 23;
1611
+ }
1612
+ if (field === 'minute') {
1613
+ return 59;
1614
+ }
1615
+ if (field === 'second') {
1616
+ return 59;
1617
+ }
1618
+ if (field === 'millisecond') {
1619
+ return 999;
1620
+ }
1621
+ throw new Error('Tried to clieling a field that has no cieling value: ' + field);
1622
+ };
1623
+
1624
+ daysInMonth = function(year, month) {
1625
+ if (!((year != null) && (month != null))) {
1626
+ throw new Error('daysInMonth requires year and month as arguments');
1627
+ }
1628
+ return new jsDate(year, month, 0).getDate();
1145
1629
  };
1146
1630
 
1147
1631
  normalizeMillisecondsField = function(msString) {
1148
1632
  return msString = (msString + "00").substring(0, 3);
1149
1633
  };
1150
1634
 
1635
+ isValidDateStringFormat = function(string) {
1636
+ var cqlFormatStringWithLength, cqlFormats, format, i, len, strict;
1637
+ if (typeof string !== 'string') {
1638
+ return false;
1639
+ }
1640
+ cqlFormats = ['YYYY', 'YYYY-MM', 'YYYY-MM-DD'];
1641
+ cqlFormatStringWithLength = {};
1642
+ for (i = 0, len = cqlFormats.length; i < len; i++) {
1643
+ format = cqlFormats[i];
1644
+ cqlFormatStringWithLength[format.length] = format;
1645
+ }
1646
+ if (cqlFormatStringWithLength[string.length] == null) {
1647
+ return false;
1648
+ }
1649
+ strict = true;
1650
+ return moment(string, cqlFormatStringWithLength[string.length], strict).isValid();
1651
+ };
1652
+
1151
1653
  isValidDateTimeStringFormat = function(string) {
1152
1654
  var cqlFormatStringWithLength, cqlFormats, format, i, len, strict;
1153
1655
  if (typeof string !== 'string') {
@@ -1167,8 +1669,8 @@
1167
1669
  };
1168
1670
 
1169
1671
  cqlFormatStringToMomentFormatString = function(string) {
1170
- var momentString, ref, timeAndTimeZoneOffset, timezoneSeparator, yearMonthDay;
1171
- ref = string.split('T'), yearMonthDay = ref[0], timeAndTimeZoneOffset = ref[1];
1672
+ var momentString, ref1, timeAndTimeZoneOffset, timezoneSeparator, yearMonthDay;
1673
+ ref1 = string.split('T'), yearMonthDay = ref1[0], timeAndTimeZoneOffset = ref1[1];
1172
1674
  if (timeAndTimeZoneOffset != null) {
1173
1675
  timezoneSeparator = getTimezoneSeparatorFromString(timeAndTimeZoneOffset);
1174
1676
  }
@@ -1184,22 +1686,15 @@
1184
1686
  return momentString = momentString.replace(/f/g, 'S');
1185
1687
  };
1186
1688
 
1187
- getTimezoneSeparatorFromString = function(string) {
1188
- var ref, ref1, timezoneSeparator;
1189
- if ((string != null ? (ref = string.match(/-/)) != null ? ref.length : void 0 : void 0) === 1) {
1190
- return timezoneSeparator = '-';
1191
- } else if ((string != null ? (ref1 = string.match(/\+/)) != null ? ref1.length : void 0 : void 0) === 1) {
1192
- return timezoneSeparator = '+';
1193
- } else {
1194
- return timezoneSeparator = '';
1195
- }
1196
- };
1689
+ module.exports.DateTime = DateTime;
1690
+
1691
+ module.exports.Date = Date;
1197
1692
 
1198
1693
  }).call(this);
1199
1694
 
1200
1695
 
1201
1696
 
1202
- },{"./uncertainty":11,"moment":136}],8:[function(require,module,exports){
1697
+ },{"../util/util":136,"./uncertainty":11,"moment":137}],8:[function(require,module,exports){
1203
1698
  // Generated by CoffeeScript 1.12.7
1204
1699
  (function() {
1205
1700
  var Exception;
@@ -1255,10 +1750,10 @@
1255
1750
  var newHigh, newLow;
1256
1751
  newLow = this.low;
1257
1752
  newHigh = this.high;
1258
- if (typeof this.low.copy === 'function') {
1753
+ if ((this.low != null) && typeof this.low.copy === 'function') {
1259
1754
  newLow = this.low.copy();
1260
1755
  }
1261
- if (typeof this.high.copy === 'function') {
1756
+ if ((this.high != null) && typeof this.high.copy === 'function') {
1262
1757
  newHigh = this.high.copy();
1263
1758
  }
1264
1759
  return new Interval(newLow, newHigh, this.lowClosed, this.highClosed);
@@ -1283,18 +1778,19 @@
1283
1778
  Interval.prototype.includes = function(other, precision) {
1284
1779
  var a, b;
1285
1780
  if (!(other instanceof Interval)) {
1286
- throw new Error("Argument to includes must be an interval");
1781
+ return this.contains(other, precision);
1287
1782
  }
1288
1783
  a = this.toClosed();
1289
1784
  b = other.toClosed();
1290
1785
  return ThreeValuedLogic.and(cmp.lessThanOrEquals(a.low, b.low, precision), cmp.greaterThanOrEquals(a.high, b.high, precision));
1291
1786
  };
1292
1787
 
1293
- Interval.prototype.includedIn = function(other) {
1788
+ Interval.prototype.includedIn = function(other, precision) {
1294
1789
  if (!(other instanceof Interval)) {
1295
- throw new Error("Argument to includedIn must be an interval");
1790
+ return this.contains(other, precision);
1791
+ } else {
1792
+ return other.includes(this);
1296
1793
  }
1297
- return other.includes(this);
1298
1794
  };
1299
1795
 
1300
1796
  Interval.prototype.overlaps = function(item, precision) {
@@ -1612,7 +2108,7 @@
1612
2108
 
1613
2109
 
1614
2110
 
1615
- },{"../util/comparison":133,"../util/math":134,"./datetime":7,"./logic":10,"./uncertainty":11}],10:[function(require,module,exports){
2111
+ },{"../util/comparison":134,"../util/math":135,"./datetime":7,"./logic":10,"./uncertainty":11}],10:[function(require,module,exports){
1616
2112
  // Generated by CoffeeScript 1.12.7
1617
2113
  (function() {
1618
2114
  var ThreeValuedLogic,
@@ -1803,7 +2299,7 @@
1803
2299
  },{"./logic":10}],12:[function(require,module,exports){
1804
2300
  // Generated by CoffeeScript 1.12.7
1805
2301
  (function() {
1806
- var AggregateExpression, AllTrue, AnyTrue, Avg, Count, Exception, Expression, Max, Median, Min, Mode, PopulationStdDev, PopulationVariance, Quantity, StdDev, Sum, Variance, allTrue, anyTrue, build, compact, numerical_sort, quantitiesOrArg, quantityOrValue, ref, typeIsArray,
2302
+ var AggregateExpression, AllTrue, AnyTrue, Avg, Count, Exception, Expression, GeometricMean, Max, Median, Min, Mode, PopulationStdDev, PopulationVariance, Product, Quantity, StdDev, Sum, Variance, allTrue, anyTrue, build, compact, numerical_sort, productValue, quantitiesOrArg, quantityOrValue, ref, typeIsArray,
1807
2303
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1808
2304
  hasProp = {}.hasOwnProperty,
1809
2305
  indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
@@ -2100,6 +2596,77 @@
2100
2596
 
2101
2597
  })(AggregateExpression);
2102
2598
 
2599
+ module.exports.Product = Product = (function(superClass) {
2600
+ extend(Product, superClass);
2601
+
2602
+ function Product(json) {
2603
+ Product.__super__.constructor.apply(this, arguments);
2604
+ }
2605
+
2606
+ Product.prototype.exec = function(ctx) {
2607
+ var filtered, listOfValues, product, ref1;
2608
+ listOfValues = this.source.execute(ctx);
2609
+ if (listOfValues === null) {
2610
+ return null;
2611
+ }
2612
+ ref1 = productValue(listOfValues), product = ref1[0], filtered = ref1[1];
2613
+ if (product === null) {
2614
+ return null;
2615
+ }
2616
+ return quantityOrValue(product, listOfValues);
2617
+ };
2618
+
2619
+ return Product;
2620
+
2621
+ })(AggregateExpression);
2622
+
2623
+ module.exports.GeometricMean = GeometricMean = (function(superClass) {
2624
+ extend(GeometricMean, superClass);
2625
+
2626
+ function GeometricMean(json) {
2627
+ GeometricMean.__super__.constructor.apply(this, arguments);
2628
+ }
2629
+
2630
+ GeometricMean.prototype.exec = function(ctx) {
2631
+ var filtered, geoMean, listOfValues, product, ref1;
2632
+ listOfValues = this.source.execute(ctx);
2633
+ if (listOfValues === null) {
2634
+ return null;
2635
+ }
2636
+ ref1 = productValue(listOfValues), product = ref1[0], filtered = ref1[1];
2637
+ if (product === null) {
2638
+ return null;
2639
+ }
2640
+ geoMean = Math.pow(product, 1.0 / filtered.length);
2641
+ return geoMean;
2642
+ };
2643
+
2644
+ return GeometricMean;
2645
+
2646
+ })(AggregateExpression);
2647
+
2648
+ productValue = function(list) {
2649
+ var filtered, item, j, len, product;
2650
+ product = 1;
2651
+ if (typeIsArray(list)) {
2652
+ filtered = compact(list);
2653
+ if (filtered.length === 0) {
2654
+ return [null, null];
2655
+ }
2656
+ for (j = 0, len = filtered.length; j < len; j++) {
2657
+ item = filtered[j];
2658
+ if (item.isQuantity) {
2659
+ product = Quantity.doMultiplication(product, item);
2660
+ } else {
2661
+ product = product * item;
2662
+ }
2663
+ }
2664
+ return [product, filtered];
2665
+ } else {
2666
+ return [null, null];
2667
+ }
2668
+ };
2669
+
2103
2670
  module.exports.PopulationStdDev = PopulationStdDev = (function(superClass) {
2104
2671
  extend(PopulationStdDev, superClass);
2105
2672
 
@@ -2174,7 +2741,7 @@
2174
2741
 
2175
2742
 
2176
2743
 
2177
- },{"../datatypes/exception":8,"../util/util":135,"./builder":14,"./expression":20,"./quantity":32}],13:[function(require,module,exports){
2744
+ },{"../datatypes/exception":8,"../util/util":136,"./builder":14,"./expression":20,"./quantity":32}],13:[function(require,module,exports){
2178
2745
  // Generated by CoffeeScript 1.12.7
2179
2746
  (function() {
2180
2747
  var Abs, Add, Ceiling, Divide, Exp, Expression, Floor, Ln, Log, MathUtil, MaxValue, MinValue, Modulo, Multiply, Negate, Power, Predecessor, Quantity, Round, Subtract, Successor, Truncate, TruncatedDivide, allTrue, anyTrue, build, ref, typeIsArray,
@@ -2207,7 +2774,7 @@
2207
2774
  return null;
2208
2775
  } else {
2209
2776
  return args != null ? args.reduce(function(x, y) {
2210
- if (x.isQuantity || x.isDateTime) {
2777
+ if (x.isQuantity || x.isDateTime || x.isDate) {
2211
2778
  return Quantity.doAddition(x, y);
2212
2779
  } else {
2213
2780
  return x + y;
@@ -2236,7 +2803,7 @@
2236
2803
  return null;
2237
2804
  } else {
2238
2805
  return args.reduce(function(x, y) {
2239
- if (x.isQuantity || x.isDateTime) {
2806
+ if (x.isQuantity || x.isDateTime || x.isDate) {
2240
2807
  return Quantity.doSubtraction(x, y);
2241
2808
  } else {
2242
2809
  return x - y;
@@ -2681,7 +3248,7 @@
2681
3248
 
2682
3249
 
2683
3250
 
2684
- },{"../util/math":134,"../util/util":135,"./builder":14,"./expression":20,"./quantity":32}],14:[function(require,module,exports){
3251
+ },{"../util/math":135,"../util/util":136,"./builder":14,"./expression":20,"./quantity":32}],14:[function(require,module,exports){
2685
3252
  // Generated by CoffeeScript 1.12.7
2686
3253
  (function() {
2687
3254
  var E, build, constructByName, functionExists, typeIsArray;
@@ -2729,10 +3296,10 @@
2729
3296
 
2730
3297
 
2731
3298
 
2732
- },{"../util/util":135,"./expressions":21}],15:[function(require,module,exports){
3299
+ },{"../util/util":136,"./expressions":21}],15:[function(require,module,exports){
2733
3300
  // Generated by CoffeeScript 1.12.7
2734
3301
  (function() {
2735
- var CalculateAge, CalculateAgeAt, CodeDef, CodeRef, CodeSystemDef, Concept, ConceptDef, ConceptRef, Expression, InValueSet, ValueSetDef, ValueSetRef, build, dt,
3302
+ var AnyInValueSet, CalculateAge, CalculateAgeAt, CodeDef, CodeRef, CodeSystemDef, Concept, ConceptDef, ConceptRef, Expression, InValueSet, ValueSetDef, ValueSetRef, build, dt,
2736
3303
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
2737
3304
  hasProp = {}.hasOwnProperty;
2738
3305
 
@@ -2784,6 +3351,35 @@
2784
3351
 
2785
3352
  })(Expression);
2786
3353
 
3354
+ module.exports.AnyInValueSet = AnyInValueSet = (function(superClass) {
3355
+ extend(AnyInValueSet, superClass);
3356
+
3357
+ function AnyInValueSet(json) {
3358
+ AnyInValueSet.__super__.constructor.apply(this, arguments);
3359
+ this.codes = build(json.codes);
3360
+ this.valueset = new ValueSetRef(json.valueset);
3361
+ }
3362
+
3363
+ AnyInValueSet.prototype.exec = function(ctx) {
3364
+ var code, codes, i, len, valueset;
3365
+ valueset = this.valueset.execute(ctx);
3366
+ if (!((valueset != null) && valueset.isValueSet)) {
3367
+ throw new Error("ValueSet must be provided to InValueSet function");
3368
+ }
3369
+ codes = this.codes.exec(ctx);
3370
+ for (i = 0, len = codes.length; i < len; i++) {
3371
+ code = codes[i];
3372
+ if (valueset.hasMatch(code)) {
3373
+ return true;
3374
+ }
3375
+ }
3376
+ return false;
3377
+ };
3378
+
3379
+ return AnyInValueSet;
3380
+
3381
+ })(Expression);
3382
+
2787
3383
  module.exports.InValueSet = InValueSet = (function(superClass) {
2788
3384
  extend(InValueSet, superClass);
2789
3385
 
@@ -2806,7 +3402,7 @@
2806
3402
  return false;
2807
3403
  }
2808
3404
  valueset = this.valueset.execute(ctx);
2809
- if (valueset == null) {
3405
+ if (!((valueset != null) && valueset.isValueSet)) {
2810
3406
  throw new Error("ValueSet must be provided to InValueSet function");
2811
3407
  }
2812
3408
  return valueset.hasMatch(code);
@@ -2973,7 +3569,7 @@
2973
3569
  CalculateAge.prototype.exec = function(ctx) {
2974
3570
  var date1, date2, result;
2975
3571
  date1 = this.execArgs(ctx);
2976
- date2 = dt.DateTime.fromDate(ctx.getExecutionDateTime());
3572
+ date2 = dt.DateTime.fromJSDate(ctx.getExecutionDateTime());
2977
3573
  result = date1 != null ? date1.durationBetween(date2, this.precision.toLowerCase()) : void 0;
2978
3574
  if ((result != null) && result.isPoint()) {
2979
3575
  return result.low;
@@ -3020,7 +3616,7 @@
3020
3616
  },{"../datatypes/datatypes":6,"./builder":14,"./expression":20}],16:[function(require,module,exports){
3021
3617
  // Generated by CoffeeScript 1.12.7
3022
3618
  (function() {
3023
- var Expression, Greater, GreaterOrEqual, IncompatibleTypesException, Less, LessOrEqual, Uncertainty,
3619
+ var Expression, Greater, GreaterOrEqual, Less, LessOrEqual, Uncertainty,
3024
3620
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
3025
3621
  hasProp = {}.hasOwnProperty;
3026
3622
 
@@ -3028,8 +3624,6 @@
3028
3624
 
3029
3625
  Uncertainty = require('../datatypes/datatypes').Uncertainty;
3030
3626
 
3031
- IncompatibleTypesException = require('./quantity').IncompatibleTypesException;
3032
-
3033
3627
  module.exports.Less = Less = (function(superClass) {
3034
3628
  extend(Less, superClass);
3035
3629
 
@@ -3122,7 +3716,7 @@
3122
3716
 
3123
3717
 
3124
3718
 
3125
- },{"../datatypes/datatypes":6,"./expression":20,"./quantity":32}],17:[function(require,module,exports){
3719
+ },{"../datatypes/datatypes":6,"./expression":20}],17:[function(require,module,exports){
3126
3720
  // Generated by CoffeeScript 1.12.7
3127
3721
  (function() {
3128
3722
  var Case, CaseItem, Expression, If, build, equals,
@@ -3228,10 +3822,10 @@
3228
3822
 
3229
3823
 
3230
3824
 
3231
- },{"../util/comparison":133,"./builder":14,"./expression":20}],18:[function(require,module,exports){
3825
+ },{"../util/comparison":134,"./builder":14,"./expression":20}],18:[function(require,module,exports){
3232
3826
  // Generated by CoffeeScript 1.12.7
3233
3827
  (function() {
3234
- var DT, DateFrom, DateTime, DateTimeComponentFrom, DifferenceBetween, DurationBetween, Expression, Literal, Now, SameAs, SameOrAfter, SameOrBefore, Time, TimeFrom, TimeOfDay, TimezoneFrom, Today, build,
3828
+ var DT, Date, DateFrom, DateTime, DateTimeComponentFrom, DifferenceBetween, DurationBetween, Expression, Literal, Now, SameAs, SameOrAfter, SameOrBefore, Time, TimeFrom, TimeOfDay, TimezoneFrom, Today, build,
3235
3829
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
3236
3830
  hasProp = {}.hasOwnProperty,
3237
3831
  slice = [].slice;
@@ -3298,6 +3892,54 @@
3298
3892
 
3299
3893
  })(Expression);
3300
3894
 
3895
+ module.exports.Date = Date = (function(superClass) {
3896
+ extend(Date, superClass);
3897
+
3898
+ Date.PROPERTIES = ['year', 'month', 'day'];
3899
+
3900
+ function Date(json1) {
3901
+ this.json = json1;
3902
+ Date.__super__.constructor.apply(this, arguments);
3903
+ }
3904
+
3905
+ Object.defineProperties(Date.prototype, {
3906
+ isDate: {
3907
+ get: function() {
3908
+ return true;
3909
+ }
3910
+ }
3911
+ });
3912
+
3913
+ Date.prototype.exec = function(ctx) {
3914
+ var args, i, len, p, property, ref;
3915
+ ref = Date.PROPERTIES;
3916
+ for (i = 0, len = ref.length; i < len; i++) {
3917
+ property = ref[i];
3918
+ if (this.json[property] != null) {
3919
+ this[property] = build(this.json[property]);
3920
+ }
3921
+ }
3922
+ args = (function() {
3923
+ var j, len1, ref1, results;
3924
+ ref1 = Date.PROPERTIES;
3925
+ results = [];
3926
+ for (j = 0, len1 = ref1.length; j < len1; j++) {
3927
+ p = ref1[j];
3928
+ results.push(this[p] != null ? this[p].execute(ctx) : void 0);
3929
+ }
3930
+ return results;
3931
+ }).call(this);
3932
+ return (function(func, args, ctor) {
3933
+ ctor.prototype = func.prototype;
3934
+ var child = new ctor, result = func.apply(child, args);
3935
+ return Object(result) === result ? result : child;
3936
+ })(DT.Date, args, function(){});
3937
+ };
3938
+
3939
+ return Date;
3940
+
3941
+ })(Expression);
3942
+
3301
3943
  module.exports.Time = Time = (function(superClass) {
3302
3944
  extend(Time, superClass);
3303
3945
 
@@ -3736,10 +4378,10 @@
3736
4378
 
3737
4379
 
3738
4380
 
3739
- },{"../util/util":135,"./builder":14}],21:[function(require,module,exports){
4381
+ },{"../util/util":136,"./builder":14}],21:[function(require,module,exports){
3740
4382
  // Generated by CoffeeScript 1.12.7
3741
4383
  (function() {
3742
- var aggregate, arithmetic, clinical, comparison, conditional, datetime, declaration, element, expression, external, i, instance, interval, j, len, len1, lib, libs, list, literal, logical, nullological, overloaded, parameters, quantity, query, ref, reusable, string, structured, type;
4384
+ var aggregate, arithmetic, clinical, comparison, conditional, datetime, declaration, element, expression, external, i, instance, interval, j, len, len1, lib, libs, list, literal, logical, nullological, overloaded, parameters, quantity, query, ratio, ref, reusable, string, structured, type;
3743
4385
 
3744
4386
  expression = require('./expression');
3745
4387
 
@@ -3777,6 +4419,8 @@
3777
4419
 
3778
4420
  query = require('./query');
3779
4421
 
4422
+ ratio = require('./ratio');
4423
+
3780
4424
  reusable = require('./reusable');
3781
4425
 
3782
4426
  string = require('./string');
@@ -3787,7 +4431,7 @@
3787
4431
 
3788
4432
  overloaded = require('./overloaded');
3789
4433
 
3790
- libs = [expression, aggregate, arithmetic, clinical, comparison, conditional, datetime, declaration, external, instance, interval, list, literal, logical, nullological, parameters, query, quantity, reusable, string, structured, type, overloaded];
4434
+ libs = [expression, aggregate, arithmetic, clinical, comparison, conditional, datetime, declaration, external, instance, interval, list, literal, logical, nullological, parameters, query, quantity, ratio, reusable, string, structured, type, overloaded];
3791
4435
 
3792
4436
  for (i = 0, len = libs.length; i < len; i++) {
3793
4437
  lib = libs[i];
@@ -3802,7 +4446,7 @@
3802
4446
 
3803
4447
 
3804
4448
 
3805
- },{"./aggregate":12,"./arithmetic":13,"./clinical":15,"./comparison":16,"./conditional":17,"./datetime":18,"./declaration":19,"./expression":20,"./external":22,"./instance":23,"./interval":24,"./list":26,"./literal":27,"./logical":28,"./nullological":29,"./overloaded":30,"./parameters":31,"./quantity":32,"./query":33,"./reusable":34,"./string":35,"./structured":36,"./type":37}],22:[function(require,module,exports){
4449
+ },{"./aggregate":12,"./arithmetic":13,"./clinical":15,"./comparison":16,"./conditional":17,"./datetime":18,"./declaration":19,"./expression":20,"./external":22,"./instance":23,"./interval":24,"./list":26,"./literal":27,"./logical":28,"./nullological":29,"./overloaded":30,"./parameters":31,"./quantity":32,"./query":33,"./ratio":34,"./reusable":35,"./string":36,"./structured":37,"./type":38}],22:[function(require,module,exports){
3806
4450
  // Generated by CoffeeScript 1.12.7
3807
4451
  (function() {
3808
4452
  var Expression, Retrieve, build, typeIsArray,
@@ -3879,7 +4523,7 @@
3879
4523
 
3880
4524
 
3881
4525
 
3882
- },{"../util/util":135,"./builder":14,"./expression":20}],23:[function(require,module,exports){
4526
+ },{"../util/util":136,"./builder":14,"./expression":20}],23:[function(require,module,exports){
3883
4527
  // Generated by CoffeeScript 1.12.7
3884
4528
  (function() {
3885
4529
  var Code, Concept, Element, Expression, Instance, Quantity, build, ref,
@@ -3959,7 +4603,7 @@
3959
4603
  },{"../datatypes/datatypes":6,"./builder":14,"./expression":20,"./quantity":32}],24:[function(require,module,exports){
3960
4604
  // Generated by CoffeeScript 1.12.7
3961
4605
  (function() {
3962
- var Collapse, End, Ends, Expression, Interval, Meets, MeetsAfter, MeetsBefore, Overlaps, OverlapsAfter, OverlapsBefore, Start, Starts, ThreeValuedLogic, UnimplementedExpression, Width, build, cmp, doIncludes, dtivl, ref,
4606
+ var Collapse, End, Ends, Expression, Interval, Meets, MeetsAfter, MeetsBefore, Overlaps, OverlapsAfter, OverlapsBefore, Quantity, Start, Starts, ThreeValuedLogic, UnimplementedExpression, Width, build, cmp, doAddition, doIncludes, doSubtraction, dtivl, predecessor, ref, ref1, ref2, successor,
3963
4607
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
3964
4608
  hasProp = {}.hasOwnProperty;
3965
4609
 
@@ -3969,6 +4613,10 @@
3969
4613
 
3970
4614
  build = require('./builder').build;
3971
4615
 
4616
+ ref1 = require('./quantity'), Quantity = ref1.Quantity, doAddition = ref1.doAddition, doSubtraction = ref1.doSubtraction;
4617
+
4618
+ ref2 = require('../util/math'), successor = ref2.successor, predecessor = ref2.predecessor;
4619
+
3972
4620
  dtivl = require('../datatypes/interval');
3973
4621
 
3974
4622
  cmp = require('../util/comparison');
@@ -4024,14 +4672,14 @@
4024
4672
  extend(Meets, superClass);
4025
4673
 
4026
4674
  function Meets(json) {
4027
- var ref1;
4675
+ var ref3;
4028
4676
  Meets.__super__.constructor.apply(this, arguments);
4029
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4677
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4030
4678
  }
4031
4679
 
4032
4680
  Meets.prototype.exec = function(ctx) {
4033
- var a, b, ref1;
4034
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4681
+ var a, b, ref3;
4682
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4035
4683
  if ((a != null) && (b != null)) {
4036
4684
  return a.meets(b, this.precision);
4037
4685
  } else {
@@ -4047,14 +4695,14 @@
4047
4695
  extend(MeetsAfter, superClass);
4048
4696
 
4049
4697
  function MeetsAfter(json) {
4050
- var ref1;
4698
+ var ref3;
4051
4699
  MeetsAfter.__super__.constructor.apply(this, arguments);
4052
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4700
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4053
4701
  }
4054
4702
 
4055
4703
  MeetsAfter.prototype.exec = function(ctx) {
4056
- var a, b, ref1;
4057
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4704
+ var a, b, ref3;
4705
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4058
4706
  if ((a != null) && (b != null)) {
4059
4707
  return a.meetsAfter(b, this.precision);
4060
4708
  } else {
@@ -4070,14 +4718,14 @@
4070
4718
  extend(MeetsBefore, superClass);
4071
4719
 
4072
4720
  function MeetsBefore(json) {
4073
- var ref1;
4721
+ var ref3;
4074
4722
  MeetsBefore.__super__.constructor.apply(this, arguments);
4075
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4723
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4076
4724
  }
4077
4725
 
4078
4726
  MeetsBefore.prototype.exec = function(ctx) {
4079
- var a, b, ref1;
4080
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4727
+ var a, b, ref3;
4728
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4081
4729
  if ((a != null) && (b != null)) {
4082
4730
  return a.meetsBefore(b, this.precision);
4083
4731
  } else {
@@ -4093,14 +4741,14 @@
4093
4741
  extend(Overlaps, superClass);
4094
4742
 
4095
4743
  function Overlaps(json) {
4096
- var ref1;
4744
+ var ref3;
4097
4745
  Overlaps.__super__.constructor.apply(this, arguments);
4098
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4746
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4099
4747
  }
4100
4748
 
4101
4749
  Overlaps.prototype.exec = function(ctx) {
4102
- var a, b, ref1;
4103
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4750
+ var a, b, ref3;
4751
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4104
4752
  if ((a != null) && (b != null)) {
4105
4753
  return a.overlaps(b, this.precision);
4106
4754
  } else {
@@ -4116,14 +4764,14 @@
4116
4764
  extend(OverlapsAfter, superClass);
4117
4765
 
4118
4766
  function OverlapsAfter(json) {
4119
- var ref1;
4767
+ var ref3;
4120
4768
  OverlapsAfter.__super__.constructor.apply(this, arguments);
4121
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4769
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4122
4770
  }
4123
4771
 
4124
4772
  OverlapsAfter.prototype.exec = function(ctx) {
4125
- var a, b, ref1;
4126
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4773
+ var a, b, ref3;
4774
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4127
4775
  if ((a != null) && (b != null)) {
4128
4776
  return a.overlapsAfter(b, this.precision);
4129
4777
  } else {
@@ -4139,14 +4787,14 @@
4139
4787
  extend(OverlapsBefore, superClass);
4140
4788
 
4141
4789
  function OverlapsBefore(json) {
4142
- var ref1;
4790
+ var ref3;
4143
4791
  OverlapsBefore.__super__.constructor.apply(this, arguments);
4144
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4792
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4145
4793
  }
4146
4794
 
4147
4795
  OverlapsBefore.prototype.exec = function(ctx) {
4148
- var a, b, ref1;
4149
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4796
+ var a, b, ref3;
4797
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4150
4798
  if ((a != null) && (b != null)) {
4151
4799
  return a.overlapsBefore(b, this.precision);
4152
4800
  } else {
@@ -4186,8 +4834,8 @@
4186
4834
  }
4187
4835
 
4188
4836
  Width.prototype.exec = function(ctx) {
4189
- var ref1;
4190
- return (ref1 = this.arg.execute(ctx)) != null ? ref1.width() : void 0;
4837
+ var ref3;
4838
+ return (ref3 = this.arg.execute(ctx)) != null ? ref3.width() : void 0;
4191
4839
  };
4192
4840
 
4193
4841
  return Width;
@@ -4202,8 +4850,8 @@
4202
4850
  }
4203
4851
 
4204
4852
  Start.prototype.exec = function(ctx) {
4205
- var ref1;
4206
- return (ref1 = this.arg.execute(ctx)) != null ? ref1.low : void 0;
4853
+ var ref3;
4854
+ return (ref3 = this.arg.execute(ctx)) != null ? ref3.low : void 0;
4207
4855
  };
4208
4856
 
4209
4857
  return Start;
@@ -4218,8 +4866,8 @@
4218
4866
  }
4219
4867
 
4220
4868
  End.prototype.exec = function(ctx) {
4221
- var ref1;
4222
- return (ref1 = this.arg.execute(ctx)) != null ? ref1.high : void 0;
4869
+ var ref3;
4870
+ return (ref3 = this.arg.execute(ctx)) != null ? ref3.high : void 0;
4223
4871
  };
4224
4872
 
4225
4873
  return End;
@@ -4230,14 +4878,14 @@
4230
4878
  extend(Starts, superClass);
4231
4879
 
4232
4880
  function Starts(json) {
4233
- var ref1;
4881
+ var ref3;
4234
4882
  Starts.__super__.constructor.apply(this, arguments);
4235
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4883
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4236
4884
  }
4237
4885
 
4238
4886
  Starts.prototype.exec = function(ctx) {
4239
- var a, b, ref1;
4240
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4887
+ var a, b, ref3;
4888
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4241
4889
  if ((a != null) && (b != null)) {
4242
4890
  return a.starts(b, this.precision);
4243
4891
  } else {
@@ -4253,14 +4901,14 @@
4253
4901
  extend(Ends, superClass);
4254
4902
 
4255
4903
  function Ends(json) {
4256
- var ref1;
4904
+ var ref3;
4257
4905
  Ends.__super__.constructor.apply(this, arguments);
4258
- this.precision = (ref1 = json.precision) != null ? ref1.toLowerCase() : void 0;
4906
+ this.precision = (ref3 = json.precision) != null ? ref3.toLowerCase() : void 0;
4259
4907
  }
4260
4908
 
4261
4909
  Ends.prototype.exec = function(ctx) {
4262
- var a, b, ref1;
4263
- ref1 = this.execArgs(ctx), a = ref1[0], b = ref1[1];
4910
+ var a, b, ref3;
4911
+ ref3 = this.execArgs(ctx), a = ref3[0], b = ref3[1];
4264
4912
  if ((a != null) && (b != null)) {
4265
4913
  return a.ends(b, this.precision);
4266
4914
  } else {
@@ -4280,48 +4928,115 @@
4280
4928
  }
4281
4929
 
4282
4930
  Collapse.prototype.exec = function(ctx) {
4283
- var a, b, base, base1, collapsedIntervals, i, intervals, len;
4284
- intervals = this.execArgs(ctx);
4285
- if ((intervals != null ? intervals.length : void 0) <= 1) {
4286
- return intervals;
4931
+ var a, b, collapsedIntervals, i, interval, intervals, intervalsClone, len, perWidth, precisionUnits, ref3, ref4, ref5, ref6, ref7;
4932
+ ref3 = this.execArgs(ctx), intervals = ref3[0], perWidth = ref3[1];
4933
+ intervalsClone = [];
4934
+ for (i = 0, len = intervals.length; i < len; i++) {
4935
+ interval = intervals[i];
4936
+ if (interval != null) {
4937
+ intervalsClone.push(interval.copy());
4938
+ }
4939
+ }
4940
+ if (intervals == null) {
4941
+ return null;
4942
+ } else if ((intervalsClone != null ? intervalsClone.length : void 0) <= 1) {
4943
+ return intervalsClone;
4287
4944
  } else {
4288
- for (i = 0, len = intervals.length; i < len; i++) {
4289
- a = intervals[i];
4290
- if ((typeof (base = a.low).isImprecise === "function" ? base.isImprecise() : void 0) || (typeof (base1 = a.high).isImprecise === "function" ? base1.isImprecise() : void 0)) {
4291
- throw new Error("Collapse does not support imprecise dates at this time.");
4945
+ if (perWidth == null) {
4946
+ if (intervalsClone[0].low != null) {
4947
+ if (intervalsClone[0].low.isDateTime) {
4948
+ precisionUnits = intervalsClone[0].low.getPrecision();
4949
+ perWidth = new Quantity({
4950
+ value: 1,
4951
+ unit: precisionUnits
4952
+ });
4953
+ } else if (intervalsClone[0].low.isQuantity) {
4954
+ perWidth = doSubtraction(successor(intervalsClone[0].low), intervalsClone[0].low);
4955
+ } else {
4956
+ perWidth = successor(intervalsClone[0].low) - intervalsClone[0].low;
4957
+ }
4958
+ } else if (intervalsClone[0].high != null) {
4959
+ if (intervalsClone[0].high.isDateTime) {
4960
+ precisionUnits = intervalsClone[0].high.getPrecision();
4961
+ perWidth = new Quantity({
4962
+ value: 1,
4963
+ unit: precisionUnits
4964
+ });
4965
+ } else if (intervalsClone[0].high.isQuantity) {
4966
+ perWidth = doSubtraction(successor(intervalsClone[0].high), intervalsClone[0].high);
4967
+ } else {
4968
+ perWidth = successor(intervalsClone[0].high) - intervalsClone[0].high;
4969
+ }
4970
+ } else {
4971
+ throw new Error("Point type of intervals provided to collapse cannot be determined.");
4972
+ }
4973
+ if (typeof perWidth === 'number') {
4974
+ perWidth = new Quantity({
4975
+ value: perWidth,
4976
+ unit: '1'
4977
+ });
4292
4978
  }
4293
4979
  }
4294
- intervals.sort(function(a, b) {
4295
- if (typeof a.low.before === 'function') {
4296
- if (a.low.before(b.low)) {
4980
+ intervalsClone.sort(function(a, b) {
4981
+ var ref4, ref5;
4982
+ if (typeof ((ref4 = a.low) != null ? ref4.before : void 0) === 'function') {
4983
+ if ((b.low != null) && a.low.before(b.low)) {
4297
4984
  return -1;
4298
4985
  }
4299
- if (a.low.after(b.low)) {
4986
+ if ((b.low == null) || a.low.after(b.low)) {
4300
4987
  return 1;
4301
4988
  }
4302
- } else {
4989
+ } else if ((a.low != null) && (b.low != null)) {
4303
4990
  if (a.low < b.low) {
4304
4991
  return -1;
4305
4992
  }
4306
4993
  if (a.low > b.low) {
4307
4994
  return 1;
4308
4995
  }
4996
+ } else if ((a.low != null) && (b.low == null)) {
4997
+ return 1;
4998
+ } else if ((a.low == null) && (b.low != null)) {
4999
+ return -1;
5000
+ }
5001
+ if (typeof ((ref5 = a.high) != null ? ref5.before : void 0) === 'function') {
5002
+ if ((b.high == null) || a.high.before(b.high)) {
5003
+ return -1;
5004
+ }
5005
+ if (a.high.after(b.high)) {
5006
+ return 1;
5007
+ }
5008
+ } else if ((a.high != null) && (b.high != null)) {
5009
+ if (a.high < b.high) {
5010
+ return -1;
5011
+ }
5012
+ if (a.high > b.high) {
5013
+ return 1;
5014
+ }
5015
+ } else if ((a.high != null) && (b.high == null)) {
5016
+ return -1;
5017
+ } else if ((a.high == null) && (b.high != null)) {
5018
+ return 1;
4309
5019
  }
4310
5020
  return 0;
4311
5021
  });
4312
5022
  collapsedIntervals = [];
4313
- a = intervals.shift();
4314
- b = intervals.shift();
4315
- if (typeof a.copy === 'function') {
4316
- a = a.copy();
4317
- }
4318
- if (typeof b.copy === 'function') {
4319
- b = b.copy();
4320
- }
5023
+ a = intervalsClone.shift();
5024
+ b = intervalsClone.shift();
4321
5025
  while (b) {
4322
- if (typeof b.low.sameOrBefore === 'function') {
4323
- if (b.low.sameOrBefore(a.high)) {
4324
- if (b.high.after(a.high)) {
5026
+ if (typeof ((ref4 = b.low) != null ? ref4.durationBetween : void 0) === 'function') {
5027
+ if ((ref5 = a.high) != null ? ref5.sameOrAfter(b.low) : void 0) {
5028
+ if ((b.high == null) || b.high.after(a.high)) {
5029
+ a.high = b.high;
5030
+ }
5031
+ } else if (((ref6 = a.high) != null ? ref6.durationBetween(b.low, perWidth.unit).high : void 0) <= perWidth.value) {
5032
+ a.high = b.high;
5033
+ } else {
5034
+ collapsedIntervals.push(a);
5035
+ a = b;
5036
+ }
5037
+ } else if (typeof ((ref7 = b.low) != null ? ref7.sameOrBefore : void 0) === 'function') {
5038
+ if ((a.high != null) && b.low.sameOrBefore(doAddition(a.high, perWidth))) {
5039
+ if ((b.high == null) || b.high.after(a.high)) {
4325
5040
  a.high = b.high;
4326
5041
  }
4327
5042
  } else {
@@ -4329,8 +5044,8 @@
4329
5044
  a = b;
4330
5045
  }
4331
5046
  } else {
4332
- if (b.low <= a.high) {
4333
- if (b.high > a.high) {
5047
+ if ((b.low - a.high) <= perWidth.value) {
5048
+ if (b.high > a.high || (b.high == null)) {
4334
5049
  a.high = b.high;
4335
5050
  }
4336
5051
  } else {
@@ -4338,7 +5053,7 @@
4338
5053
  a = b;
4339
5054
  }
4340
5055
  }
4341
- b = intervals.shift();
5056
+ b = intervalsClone.shift();
4342
5057
  }
4343
5058
  collapsedIntervals.push(a);
4344
5059
  return collapsedIntervals;
@@ -4353,7 +5068,7 @@
4353
5068
 
4354
5069
 
4355
5070
 
4356
- },{"../datatypes/interval":9,"../datatypes/logic":10,"../util/comparison":133,"./builder":14,"./expression":20}],25:[function(require,module,exports){
5071
+ },{"../datatypes/interval":9,"../datatypes/logic":10,"../util/comparison":134,"../util/math":135,"./builder":14,"./expression":20,"./quantity":32}],25:[function(require,module,exports){
4357
5072
  // Generated by CoffeeScript 1.12.7
4358
5073
  (function() {
4359
5074
  var CodeDef, CodeSystemDef, ConceptDef, ExpressionDef, FunctionDef, Library, ParameterDef, Results, ValueSetDef, ref;
@@ -4455,10 +5170,10 @@
4455
5170
 
4456
5171
 
4457
5172
 
4458
- },{"../runtime/results":132,"./expressions":21}],26:[function(require,module,exports){
5173
+ },{"../runtime/results":133,"./expressions":21}],26:[function(require,module,exports){
4459
5174
  // Generated by CoffeeScript 1.12.7
4460
5175
  (function() {
4461
- var Current, Distinct, Exists, Expression, Filter, First, Flatten, ForEach, IndexOf, Last, List, SingletonFrom, Times, ToList, UnimplementedExpression, ValueSet, build, doContains, doDistinct, doIncludes, equals, equivalent, ref, ref1, typeIsArray,
5176
+ var Current, Distinct, Exists, Expression, Filter, First, Flatten, ForEach, IndexOf, Last, List, SingletonFrom, Times, ToList, UnimplementedExpression, ValueSet, build, doContains, doDistinct, doIncludes, equals, ref, typeIsArray,
4462
5177
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
4463
5178
  hasProp = {}.hasOwnProperty;
4464
5179
 
@@ -4470,15 +5185,15 @@
4470
5185
 
4471
5186
  typeIsArray = require('../util/util').typeIsArray;
4472
5187
 
4473
- ref1 = require('../util/comparison'), equals = ref1.equals, equivalent = ref1.equivalent;
5188
+ equals = require('../util/comparison').equals;
4474
5189
 
4475
5190
  module.exports.List = List = (function(superClass) {
4476
5191
  extend(List, superClass);
4477
5192
 
4478
5193
  function List(json) {
4479
- var ref2;
5194
+ var ref1;
4480
5195
  List.__super__.constructor.apply(this, arguments);
4481
- this.elements = (ref2 = build(json.element)) != null ? ref2 : [];
5196
+ this.elements = (ref1 = build(json.element)) != null ? ref1 : [];
4482
5197
  }
4483
5198
 
4484
5199
  Object.defineProperties(List.prototype, {
@@ -4490,11 +5205,11 @@
4490
5205
  });
4491
5206
 
4492
5207
  List.prototype.exec = function(ctx) {
4493
- var item, j, len, ref2, results;
4494
- ref2 = this.elements;
5208
+ var item, j, len, ref1, results;
5209
+ ref1 = this.elements;
4495
5210
  results = [];
4496
- for (j = 0, len = ref2.length; j < len; j++) {
4497
- item = ref2[j];
5211
+ for (j = 0, len = ref1.length; j < len; j++) {
5212
+ item = ref1[j];
4498
5213
  results.push(item.execute(ctx));
4499
5214
  }
4500
5215
  return results;
@@ -4512,8 +5227,17 @@
4512
5227
  }
4513
5228
 
4514
5229
  Exists.prototype.exec = function(ctx) {
4515
- var ref2;
4516
- return ((ref2 = this.execArgs(ctx)) != null ? ref2.length : void 0) > 0;
5230
+ var item, j, len, list;
5231
+ list = this.execArgs(ctx);
5232
+ if ((list != null ? list.length : void 0) > 0) {
5233
+ for (j = 0, len = list.length; j < len; j++) {
5234
+ item = list[j];
5235
+ if (item !== null) {
5236
+ return true;
5237
+ }
5238
+ }
5239
+ }
5240
+ return false;
4517
5241
  };
4518
5242
 
4519
5243
  return Exists;
@@ -4525,10 +5249,11 @@
4525
5249
  };
4526
5250
 
4527
5251
  module.exports.doExcept = function(a, b) {
4528
- var itm, j, len, results;
5252
+ var itm, j, len, results, setList;
5253
+ setList = doDistinct(a);
4529
5254
  results = [];
4530
- for (j = 0, len = a.length; j < len; j++) {
4531
- itm = a[j];
5255
+ for (j = 0, len = setList.length; j < len; j++) {
5256
+ itm = setList[j];
4532
5257
  if (!doContains(b, itm)) {
4533
5258
  results.push(itm);
4534
5259
  }
@@ -4537,10 +5262,11 @@
4537
5262
  };
4538
5263
 
4539
5264
  module.exports.doIntersect = function(a, b) {
4540
- var itm, j, len, results;
5265
+ var itm, j, len, results, setList;
5266
+ setList = doDistinct(a);
4541
5267
  results = [];
4542
- for (j = 0, len = a.length; j < len; j++) {
4543
- itm = a[j];
5268
+ for (j = 0, len = setList.length; j < len; j++) {
5269
+ itm = setList[j];
4544
5270
  if (doContains(b, itm)) {
4545
5271
  results.push(itm);
4546
5272
  }
@@ -4632,7 +5358,7 @@
4632
5358
  }
4633
5359
  for (i = j = 0, len = src.length; j < len; i = ++j) {
4634
5360
  itm = src[i];
4635
- if (equivalent(itm, el)) {
5361
+ if (equals(itm, el)) {
4636
5362
  index = i;
4637
5363
  break;
4638
5364
  }
@@ -4652,7 +5378,7 @@
4652
5378
  var element, j, len;
4653
5379
  for (j = 0, len = container.length; j < len; j++) {
4654
5380
  element = container[j];
4655
- if (equivalent(element, item)) {
5381
+ if (equals(element, item)) {
4656
5382
  return true;
4657
5383
  }
4658
5384
  }
@@ -4713,7 +5439,12 @@
4713
5439
  }
4714
5440
 
4715
5441
  Distinct.prototype.exec = function(ctx) {
4716
- return doDistinct(this.execArgs(ctx));
5442
+ var result;
5443
+ result = this.execArgs(ctx);
5444
+ if (result == null) {
5445
+ return null;
5446
+ }
5447
+ return doDistinct(result);
4717
5448
  };
4718
5449
 
4719
5450
  return Distinct;
@@ -4721,18 +5452,31 @@
4721
5452
  })(Expression);
4722
5453
 
4723
5454
  doDistinct = function(list) {
4724
- var seen;
5455
+ var firstNullFound, item, j, len, seen, setList;
4725
5456
  seen = [];
4726
- return list.filter(function(item) {
5457
+ list.filter(function(item) {
4727
5458
  var isNew;
4728
5459
  isNew = seen.every(function(seenItem) {
4729
- return !equivalent(item, seenItem);
5460
+ return !equals(item, seenItem);
4730
5461
  });
4731
5462
  if (isNew) {
4732
5463
  seen.push(item);
4733
5464
  }
4734
5465
  return isNew;
4735
5466
  });
5467
+ firstNullFound = false;
5468
+ setList = [];
5469
+ for (j = 0, len = seen.length; j < len; j++) {
5470
+ item = seen[j];
5471
+ if (item !== null) {
5472
+ setList.push(item);
5473
+ }
5474
+ if (item === null && !firstNullFound) {
5475
+ setList.push(item);
5476
+ firstNullFound = true;
5477
+ }
5478
+ }
5479
+ return setList;
4736
5480
  };
4737
5481
 
4738
5482
  module.exports.Current = Current = (function(superClass) {
@@ -4794,7 +5538,7 @@
4794
5538
 
4795
5539
 
4796
5540
 
4797
- },{"../datatypes/datatypes":6,"../util/comparison":133,"../util/util":135,"./builder":14,"./expression":20}],27:[function(require,module,exports){
5541
+ },{"../datatypes/datatypes":6,"../util/comparison":134,"../util/util":136,"./builder":14,"./expression":20}],27:[function(require,module,exports){
4798
5542
  // Generated by CoffeeScript 1.12.7
4799
5543
  (function() {
4800
5544
  var BooleanLiteral, DecimalLiteral, Expression, IntegerLiteral, Literal, StringLiteral,
@@ -5118,14 +5862,12 @@
5118
5862
  },{"./expression":20}],30:[function(require,module,exports){
5119
5863
  // Generated by CoffeeScript 1.12.7
5120
5864
  (function() {
5121
- var After, Contains, DT, DateTime, Equal, Equivalent, Except, Exception, Expression, IVL, In, IncludedIn, Includes, IncompatibleTypesException, Indexer, Intersect, LIST, Length, NotEqual, ProperIncludedIn, ProperIncludes, STRING, ThreeValuedLogic, Union, build, equals, equivalent, ref, typeIsArray,
5865
+ var After, Contains, DT, DateTime, Equal, Equivalent, Except, Exception, Expression, IVL, In, IncludedIn, Includes, Indexer, Intersect, LIST, Length, NotEqual, ProperIncludedIn, ProperIncludes, STRING, ThreeValuedLogic, Union, build, equals, equivalent, ref, typeIsArray,
5122
5866
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
5123
5867
  hasProp = {}.hasOwnProperty;
5124
5868
 
5125
5869
  Expression = require('./expression').Expression;
5126
5870
 
5127
- IncompatibleTypesException = require('./quantity').IncompatibleTypesException;
5128
-
5129
5871
  ThreeValuedLogic = require('../datatypes/logic').ThreeValuedLogic;
5130
5872
 
5131
5873
  DateTime = require('../datatypes/datetime').DateTime;
@@ -5328,7 +6070,7 @@
5328
6070
  In.prototype.exec = function(ctx) {
5329
6071
  var container, item, lib, ref1;
5330
6072
  ref1 = this.execArgs(ctx), item = ref1[0], container = ref1[1];
5331
- if (container == null) {
6073
+ if ((container == null) || (item == null)) {
5332
6074
  return null;
5333
6075
  }
5334
6076
  lib = (function() {
@@ -5358,7 +6100,7 @@
5358
6100
  Contains.prototype.exec = function(ctx) {
5359
6101
  var container, item, lib, ref1;
5360
6102
  ref1 = this.execArgs(ctx), container = ref1[0], item = ref1[1];
5361
- if (container == null) {
6103
+ if ((container == null) || (item == null)) {
5362
6104
  return null;
5363
6105
  }
5364
6106
  lib = (function() {
@@ -5581,7 +6323,7 @@
5581
6323
 
5582
6324
 
5583
6325
 
5584
- },{"../datatypes/datetime":7,"../datatypes/exception":8,"../datatypes/logic":10,"../util/comparison":133,"../util/util":135,"./builder":14,"./datetime":18,"./expression":20,"./interval":24,"./list":26,"./quantity":32,"./string":35}],31:[function(require,module,exports){
6326
+ },{"../datatypes/datetime":7,"../datatypes/exception":8,"../datatypes/logic":10,"../util/comparison":134,"../util/util":136,"./builder":14,"./datetime":18,"./expression":20,"./interval":24,"./list":26,"./string":36}],31:[function(require,module,exports){
5585
6327
  // Generated by CoffeeScript 1.12.7
5586
6328
  (function() {
5587
6329
  var Expression, ParameterDef, ParameterRef, build,
@@ -5643,7 +6385,7 @@
5643
6385
  },{"./builder":14,"./expression":20}],32:[function(require,module,exports){
5644
6386
  // Generated by CoffeeScript 1.12.7
5645
6387
  (function() {
5646
- var Code, Exception, Expression, FunctionRef, IncompatibleTypesException, Quantity, ValueSet, build, clean_unit, convert_value, createQuantity, decimalAdjust, isValidDecimal, is_valid_ucum_unit, ref, ref1, ucum, ucum_multiply, ucum_time_units, ucum_to_cql_units, ucum_unit, unitValidityCache, units_to_string,
6388
+ var Code, Exception, Expression, FunctionRef, Quantity, ValueSet, build, clean_unit, coalesceToOne, convert_value, createQuantity, decimalAdjust, doScaledAddition, isValidDecimal, is_valid_ucum_unit, ref, ref1, ucum, ucum_multiply, ucum_time_units, ucum_to_cql_units, ucum_unit, unitValidityCache, units_to_string,
5647
6389
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
5648
6390
  hasProp = {}.hasOwnProperty;
5649
6391
 
@@ -5661,19 +6403,6 @@
5661
6403
 
5662
6404
  ucum = require('ucum');
5663
6405
 
5664
- module.exports.IncompatibleTypesException = IncompatibleTypesException = IncompatibleTypesException = (function(superClass) {
5665
- extend(IncompatibleTypesException, superClass);
5666
-
5667
- function IncompatibleTypesException(a1, b1, e) {
5668
- this.a = a1;
5669
- this.b = b1;
5670
- IncompatibleTypesException.__super__.constructor.call(this, "Incompatible Types '" + this.a + "' and '" + this.b + "'", e);
5671
- }
5672
-
5673
- return IncompatibleTypesException;
5674
-
5675
- })(Exception);
5676
-
5677
6406
  module.exports.Quantity = Quantity = (function(superClass) {
5678
6407
  extend(Quantity, superClass);
5679
6408
 
@@ -5681,10 +6410,12 @@
5681
6410
  Quantity.__super__.constructor.apply(this, arguments);
5682
6411
  this.unit = json.unit;
5683
6412
  if (json.value == null) {
5684
- this.value = null;
6413
+ throw new Error("Cannot create a quantity with an undefined value");
5685
6414
  } else {
5686
6415
  this.value = parseFloat(json.value);
5687
- isValidDecimal(this.value);
6416
+ if (!isValidDecimal(this.value)) {
6417
+ throw new Error("Cannot create a quantity with an invalid decimal value");
6418
+ }
5688
6419
  }
5689
6420
  if ((this.unit != null) && !is_valid_ucum_unit(this.unit)) {
5690
6421
  throw new Error("\'" + this.unit + "\' is not a valid UCUM unit.");
@@ -5718,7 +6449,11 @@
5718
6449
  var other_v;
5719
6450
  if (other instanceof Quantity) {
5720
6451
  other_v = convert_value(other.value, ucum_unit(other.unit), ucum_unit(this.unit));
5721
- return this.value <= other_v;
6452
+ if (other_v == null) {
6453
+ return null;
6454
+ } else {
6455
+ return this.value <= other_v;
6456
+ }
5722
6457
  }
5723
6458
  };
5724
6459
 
@@ -5726,7 +6461,11 @@
5726
6461
  var other_v;
5727
6462
  if (other instanceof Quantity) {
5728
6463
  other_v = convert_value(other.value, ucum_unit(other.unit), ucum_unit(this.unit));
5729
- return this.value >= other_v;
6464
+ if (other_v == null) {
6465
+ return null;
6466
+ } else {
6467
+ return this.value >= other_v;
6468
+ }
5730
6469
  }
5731
6470
  };
5732
6471
 
@@ -5734,7 +6473,11 @@
5734
6473
  var other_v;
5735
6474
  if (other instanceof Quantity) {
5736
6475
  other_v = convert_value(other.value, ucum_unit(other.unit), ucum_unit(this.unit));
5737
- return this.value > other_v;
6476
+ if (other_v == null) {
6477
+ return null;
6478
+ } else {
6479
+ return this.value > other_v;
6480
+ }
5738
6481
  }
5739
6482
  };
5740
6483
 
@@ -5742,7 +6485,11 @@
5742
6485
  var other_v;
5743
6486
  if (other instanceof Quantity) {
5744
6487
  other_v = convert_value(other.value, ucum_unit(other.unit), ucum_unit(this.unit));
5745
- return this.value < other_v;
6488
+ if (other_v == null) {
6489
+ return null;
6490
+ } else {
6491
+ return this.value < other_v;
6492
+ }
5746
6493
  }
5747
6494
  };
5748
6495
 
@@ -5755,7 +6502,11 @@
5755
6502
  return this.value === other.value;
5756
6503
  } else {
5757
6504
  other_v = convert_value(other.value, ucum_unit(other.unit), ucum_unit(this.unit));
5758
- return decimalAdjust("round", this.value, -8) === decimalAdjust("round", other_v, -8);
6505
+ if (other_v == null) {
6506
+ return null;
6507
+ } else {
6508
+ return decimalAdjust("round", this.value, -8) === decimalAdjust("round", other_v, -8);
6509
+ }
5759
6510
  }
5760
6511
  }
5761
6512
  };
@@ -5773,21 +6524,31 @@
5773
6524
  };
5774
6525
 
5775
6526
  Quantity.prototype.multiplyDivide = function(other, operator) {
5776
- var can_val, other_can_value, ucum_value, unit, value;
6527
+ var a, b, can_val, other_can_value, ucum_value, value;
5777
6528
  if (other instanceof Quantity) {
5778
- if (this.unit && other.unit) {
5779
- can_val = this.to_ucum();
5780
- other_can_value = other.to_ucum();
5781
- ucum_value = ucum_multiply(can_val, [[operator, other_can_value]]);
6529
+ a = this.unit != null ? this : new Quantity({
6530
+ value: this.value,
6531
+ unit: "1"
6532
+ });
6533
+ b = other.unit != null ? other : new Quantity({
6534
+ value: other.value,
6535
+ unit: "1"
6536
+ });
6537
+ can_val = a.to_ucum();
6538
+ other_can_value = b.to_ucum();
6539
+ ucum_value = ucum_multiply(can_val, [[operator, other_can_value]]);
6540
+ try {
5782
6541
  return createQuantity(ucum_value.value, units_to_string(ucum_value.units));
5783
- } else {
5784
- value = operator === "/" ? this.value / other.value : this.value * other.value;
5785
- unit = this.unit || other.unit;
5786
- return createQuantity(decimalAdjust("round", value, -8), unit);
6542
+ } catch (error) {
6543
+ return null;
5787
6544
  }
5788
6545
  } else {
5789
6546
  value = operator === "/" ? this.value / other : this.value * other;
5790
- return createQuantity(decimalAdjust("round", value, -8), this.unit);
6547
+ try {
6548
+ return createQuantity(decimalAdjust("round", value, -8), coalesceToOne(this.unit));
6549
+ } catch (error) {
6550
+ return null;
6551
+ }
5791
6552
  }
5792
6553
  };
5793
6554
 
@@ -5880,7 +6641,7 @@
5880
6641
  }
5881
6642
  } catch (error) {
5882
6643
  e = error;
5883
- throw new IncompatibleTypesException(from, to, e);
6644
+ return null;
5884
6645
  }
5885
6646
  };
5886
6647
 
@@ -5928,7 +6689,7 @@
5928
6689
  unit_string += "/" + denom.join("/");
5929
6690
  }
5930
6691
  if (unit_string === "") {
5931
- return null;
6692
+ return "1";
5932
6693
  } else {
5933
6694
  return unit_string;
5934
6695
  }
@@ -5986,34 +6747,36 @@
5986
6747
  unit: unit
5987
6748
  });
5988
6749
  } else {
5989
- throw new Error("Unable to parse Quantity");
6750
+ return null;
5990
6751
  }
5991
6752
  };
5992
6753
 
5993
- module.exports.doAddition = function(a, b) {
5994
- var base, val;
6754
+ doScaledAddition = function(a, b, scaleForB) {
6755
+ var a_unit, b_unit, ref2, val;
5995
6756
  if (a instanceof Quantity && b instanceof Quantity) {
5996
- val = convert_value(b.value, b.unit, a.unit);
6757
+ ref2 = [coalesceToOne(a.unit), coalesceToOne(b.unit)], a_unit = ref2[0], b_unit = ref2[1];
6758
+ val = convert_value(b.value * scaleForB, b_unit, a_unit);
6759
+ if (val == null) {
6760
+ return null;
6761
+ }
5997
6762
  return new Quantity({
5998
- unit: a.unit,
6763
+ unit: a_unit,
5999
6764
  value: a.value + val
6000
6765
  });
6766
+ } else if (a.copy && a.add) {
6767
+ b_unit = b instanceof Quantity ? coalesceToOne(b.unit) : b.unit;
6768
+ return a.copy().add(b.value * scaleForB, clean_unit(b_unit));
6001
6769
  } else {
6002
- return typeof a.copy === "function" ? typeof (base = a.copy()).add === "function" ? base.add(b.value, clean_unit(b.unit)) : void 0 : void 0;
6770
+ throw new Error("Unsupported argument types.");
6003
6771
  }
6004
6772
  };
6005
6773
 
6774
+ module.exports.doAddition = function(a, b) {
6775
+ return doScaledAddition(a, b, 1);
6776
+ };
6777
+
6006
6778
  module.exports.doSubtraction = function(a, b) {
6007
- var base, val;
6008
- if (a instanceof Quantity && b instanceof Quantity) {
6009
- val = convert_value(b.value, b.unit, a.unit);
6010
- return new Quantity({
6011
- unit: a.unit,
6012
- value: a.value - val
6013
- });
6014
- } else {
6015
- return typeof a.copy === "function" ? typeof (base = a.copy()).add === "function" ? base.add(b.value * -1, clean_unit(b.unit)) : void 0 : void 0;
6016
- }
6779
+ return doScaledAddition(a, b, -1);
6017
6780
  };
6018
6781
 
6019
6782
  module.exports.doDivision = function(a, b) {
@@ -6030,11 +6793,19 @@
6030
6793
  }
6031
6794
  };
6032
6795
 
6796
+ coalesceToOne = function(o) {
6797
+ if ((o == null) || ((o.trim != null) && !o.trim())) {
6798
+ return '1';
6799
+ } else {
6800
+ return o;
6801
+ }
6802
+ };
6803
+
6033
6804
  }).call(this);
6034
6805
 
6035
6806
 
6036
6807
 
6037
- },{"../datatypes/datatypes":6,"../datatypes/exception":8,"../util/math":134,"./builder":14,"./expression":20,"./reusable":34,"ucum":145}],33:[function(require,module,exports){
6808
+ },{"../datatypes/datatypes":6,"../datatypes/exception":8,"../util/math":135,"./builder":14,"./expression":20,"./reusable":35,"ucum":146}],33:[function(require,module,exports){
6038
6809
  // Generated by CoffeeScript 1.12.7
6039
6810
  (function() {
6040
6811
  var AliasRef, AliasedQuerySource, ByColumn, ByDirection, ByExpression, Context, Expression, LetClause, MultiSource, Query, QueryLetRef, ReturnClause, Sort, SortClause, UnimplementedExpression, With, Without, allTrue, build, equals, ref, ref1, toDistinctList, typeIsArray,
@@ -6427,7 +7198,95 @@
6427
7198
 
6428
7199
 
6429
7200
 
6430
- },{"../runtime/context":129,"../util/comparison":133,"../util/util":135,"./builder":14,"./expression":20}],34:[function(require,module,exports){
7201
+ },{"../runtime/context":130,"../util/comparison":134,"../util/util":136,"./builder":14,"./expression":20}],34:[function(require,module,exports){
7202
+ // Generated by CoffeeScript 1.12.7
7203
+ (function() {
7204
+ var Exception, Expression, Quantity, Ratio, createRatio,
7205
+ extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
7206
+ hasProp = {}.hasOwnProperty;
7207
+
7208
+ Exception = require('../datatypes/exception').Exception;
7209
+
7210
+ Expression = require('./expression').Expression;
7211
+
7212
+ Quantity = require('./quantity').Quantity;
7213
+
7214
+ module.exports.Ratio = Ratio = (function(superClass) {
7215
+ extend(Ratio, superClass);
7216
+
7217
+ function Ratio(json) {
7218
+ Ratio.__super__.constructor.apply(this, arguments);
7219
+ if (json.numerator == null) {
7220
+ throw new Error("Cannot create a ratio with an undefined numerator value");
7221
+ } else {
7222
+ this.numerator = new Quantity(json.numerator);
7223
+ }
7224
+ if (json.denominator == null) {
7225
+ throw new Error("Cannot create a ratio with an undefined denominator value");
7226
+ } else {
7227
+ this.denominator = new Quantity(json.denominator);
7228
+ }
7229
+ }
7230
+
7231
+ Object.defineProperties(Ratio.prototype, {
7232
+ isRatio: {
7233
+ get: function() {
7234
+ return true;
7235
+ }
7236
+ }
7237
+ });
7238
+
7239
+ Ratio.prototype.clone = function() {
7240
+ return new Ratio({
7241
+ numerator: this.numerator.clone(),
7242
+ denominator: this.denominator.clone()
7243
+ });
7244
+ };
7245
+
7246
+ Ratio.prototype.exec = function(ctx) {
7247
+ return this;
7248
+ };
7249
+
7250
+ Ratio.prototype.toString = function() {
7251
+ return (this.numerator.toString()) + " : " + (this.denominator.toString());
7252
+ };
7253
+
7254
+ Ratio.prototype.equals = function(other) {
7255
+ var divided_other, divided_this;
7256
+ if (other instanceof Ratio) {
7257
+ divided_this = this.numerator.dividedBy(this.denominator);
7258
+ divided_other = other.numerator.dividedBy(other.denominator);
7259
+ return divided_this.equals(divided_other);
7260
+ } else {
7261
+ return false;
7262
+ }
7263
+ };
7264
+
7265
+ Ratio.prototype.equivalent = function(other) {
7266
+ var equal;
7267
+ equal = this.equals(other);
7268
+ if (equal == null) {
7269
+ return false;
7270
+ }
7271
+ return equal;
7272
+ };
7273
+
7274
+ return Ratio;
7275
+
7276
+ })(Expression);
7277
+
7278
+ module.exports.createRatio = createRatio = function(numerator, denominator) {
7279
+ return new Ratio({
7280
+ numerator: numerator,
7281
+ denominator: denominator
7282
+ });
7283
+ };
7284
+
7285
+ }).call(this);
7286
+
7287
+
7288
+
7289
+ },{"../datatypes/exception":8,"./expression":20,"./quantity":32}],35:[function(require,module,exports){
6431
7290
  // Generated by CoffeeScript 1.12.7
6432
7291
  (function() {
6433
7292
  var Expression, ExpressionDef, ExpressionRef, FunctionDef, FunctionRef, IdentifierRef, OperandRef, build,
@@ -6586,7 +7445,7 @@
6586
7445
 
6587
7446
 
6588
7447
 
6589
- },{"./builder":14,"./expression":20}],35:[function(require,module,exports){
7448
+ },{"./builder":14,"./expression":20}],36:[function(require,module,exports){
6590
7449
  // Generated by CoffeeScript 1.12.7
6591
7450
  (function() {
6592
7451
  var Combine, Concatenate, EndsWith, Expression, Lower, PositionOf, Split, StartsWith, Substring, Upper, build,
@@ -6816,7 +7675,7 @@
6816
7675
 
6817
7676
 
6818
7677
 
6819
- },{"./builder":14,"./expression":20}],36:[function(require,module,exports){
7678
+ },{"./builder":14,"./expression":20}],37:[function(require,module,exports){
6820
7679
  // Generated by CoffeeScript 1.12.7
6821
7680
  (function() {
6822
7681
  var Expression, Property, Tuple, TupleElement, TupleElementDefinition, UnimplementedExpression, build, ref,
@@ -6936,10 +7795,10 @@
6936
7795
 
6937
7796
 
6938
7797
 
6939
- },{"./builder":14,"./expression":20}],37:[function(require,module,exports){
7798
+ },{"./builder":14,"./expression":20}],38:[function(require,module,exports){
6940
7799
  // Generated by CoffeeScript 1.12.7
6941
7800
  (function() {
6942
- var As, Concept, Convert, DateTime, Expression, FunctionRef, IntervalTypeSpecifier, Is, ListTypeSpecifier, NamedTypeSpecifier, ToBoolean, ToConcept, ToDateTime, ToDecimal, ToInteger, ToQuantity, ToString, ToTime, TupleTypeSpecifier, UnimplementedExpression, isValidDecimal, isValidInteger, limitDecimalPrecision, parseQuantity, ref, ref1,
7801
+ var As, Concept, Convert, Date, DateTime, Expression, FunctionRef, IntervalTypeSpecifier, Is, ListTypeSpecifier, NamedTypeSpecifier, ToBoolean, ToConcept, ToDate, ToDateTime, ToDecimal, ToInteger, ToQuantity, ToString, ToTime, TupleTypeSpecifier, UnimplementedExpression, isValidDecimal, isValidInteger, limitDecimalPrecision, normalizeMillisecondsField, parseQuantity, ref, ref1, ref2,
6943
7802
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
6944
7803
  hasProp = {}.hasOwnProperty;
6945
7804
 
@@ -6947,23 +7806,25 @@
6947
7806
 
6948
7807
  FunctionRef = require('./reusable').FunctionRef;
6949
7808
 
6950
- DateTime = require('../datatypes/datetime').DateTime;
7809
+ ref1 = require('../datatypes/datetime'), DateTime = ref1.DateTime, Date = ref1.Date;
6951
7810
 
6952
7811
  Concept = require('../datatypes/clinical').Concept;
6953
7812
 
6954
7813
  parseQuantity = require('./quantity').parseQuantity;
6955
7814
 
6956
- ref1 = require('../util/math'), isValidDecimal = ref1.isValidDecimal, isValidInteger = ref1.isValidInteger, limitDecimalPrecision = ref1.limitDecimalPrecision;
7815
+ ref2 = require('../util/math'), isValidDecimal = ref2.isValidDecimal, isValidInteger = ref2.isValidInteger, limitDecimalPrecision = ref2.limitDecimalPrecision;
7816
+
7817
+ normalizeMillisecondsField = require('../util/util').normalizeMillisecondsField;
6957
7818
 
6958
7819
  module.exports.As = As = (function(superClass) {
6959
7820
  extend(As, superClass);
6960
7821
 
6961
7822
  function As(json) {
6962
- var ref2;
7823
+ var ref3;
6963
7824
  As.__super__.constructor.apply(this, arguments);
6964
7825
  this.asType = json.asType;
6965
7826
  this.asTypeSpecifier = json.asTypeSpecifier;
6966
- this.strict = (ref2 = json.strict) != null ? ref2 : false;
7827
+ this.strict = (ref3 = json.strict) != null ? ref3 : false;
6967
7828
  }
6968
7829
 
6969
7830
  As.prototype.exec = function(ctx) {
@@ -6985,7 +7846,7 @@
6985
7846
  var arg, strArg;
6986
7847
  arg = this.execArgs(ctx);
6987
7848
  if ((arg != null) && typeof arg !== 'undefined') {
6988
- strArg = arg.toString();
7849
+ strArg = arg.toString().toLowerCase();
6989
7850
  if (strArg === "true" || strArg === "t" || strArg === "yes" || strArg === "y" || strArg === "1") {
6990
7851
  return true;
6991
7852
  } else if (strArg === "false" || strArg === "f" || strArg === "no" || strArg === "n" || strArg === "0") {
@@ -7023,6 +7884,29 @@
7023
7884
 
7024
7885
  })(Expression);
7025
7886
 
7887
+ module.exports.ToDate = ToDate = (function(superClass) {
7888
+ extend(ToDate, superClass);
7889
+
7890
+ function ToDate(json) {
7891
+ ToDate.__super__.constructor.apply(this, arguments);
7892
+ }
7893
+
7894
+ ToDate.prototype.exec = function(ctx) {
7895
+ var arg;
7896
+ arg = this.execArgs(ctx);
7897
+ if (arg == null) {
7898
+ return null;
7899
+ } else if (arg.isDateTime) {
7900
+ return arg.getDate();
7901
+ } else {
7902
+ return Date.parse(arg.toString());
7903
+ }
7904
+ };
7905
+
7906
+ return ToDate;
7907
+
7908
+ })(Expression);
7909
+
7026
7910
  module.exports.ToDateTime = ToDateTime = (function(superClass) {
7027
7911
  extend(ToDateTime, superClass);
7028
7912
 
@@ -7033,10 +7917,12 @@
7033
7917
  ToDateTime.prototype.exec = function(ctx) {
7034
7918
  var arg;
7035
7919
  arg = this.execArgs(ctx);
7036
- if ((arg != null) && typeof arg !== 'undefined') {
7037
- return DateTime.parse(arg.toString());
7038
- } else {
7920
+ if (arg == null) {
7039
7921
  return null;
7922
+ } else if (arg.isDate) {
7923
+ return arg.getDateTime();
7924
+ } else {
7925
+ return DateTime.parse(arg.toString());
7040
7926
  }
7041
7927
  };
7042
7928
 
@@ -7060,9 +7946,8 @@
7060
7946
  if (isValidDecimal(decimal)) {
7061
7947
  return decimal;
7062
7948
  }
7063
- } else {
7064
- return null;
7065
7949
  }
7950
+ return null;
7066
7951
  };
7067
7952
 
7068
7953
  return ToDecimal;
@@ -7084,9 +7969,8 @@
7084
7969
  if (isValidInteger(integer)) {
7085
7970
  return integer;
7086
7971
  }
7087
- } else {
7088
- return null;
7089
7972
  }
7973
+ return null;
7090
7974
  };
7091
7975
 
7092
7976
  return ToInteger;
@@ -7144,15 +8028,46 @@
7144
8028
  }
7145
8029
 
7146
8030
  ToTime.prototype.exec = function(ctx) {
7147
- var arg, dt;
8031
+ var arg, hours, matches, milliseconds, minutes, seconds, timeString, timezoneOffset, tz;
7148
8032
  arg = this.execArgs(ctx);
7149
8033
  if ((arg != null) && typeof arg !== 'undefined') {
7150
- dt = DateTime.parse(arg.toString());
7151
- if ((dt != null) && typeof dt !== 'undefined') {
7152
- return dt.getTime();
7153
- } else {
8034
+ timeString = arg.toString();
8035
+ matches = /T((\d{2})(\:(\d{2})(\:(\d{2})(\.(\d+))?)?)?)?(Z|(([+-])(\d{2})(\:?(\d{2}))?))?/.exec(timeString);
8036
+ if (matches == null) {
7154
8037
  return null;
7155
8038
  }
8039
+ hours = matches[2];
8040
+ minutes = matches[4];
8041
+ seconds = matches[6];
8042
+ if (hours != null) {
8043
+ if (!(hours >= 0 && hours <= 23)) {
8044
+ return null;
8045
+ }
8046
+ hours = parseInt(hours, 10);
8047
+ }
8048
+ if (minutes != null) {
8049
+ if (!(minutes >= 0 && minutes <= 59)) {
8050
+ return null;
8051
+ }
8052
+ minutes = parseInt(minutes, 10);
8053
+ }
8054
+ if (seconds != null) {
8055
+ if (!(seconds >= 0 && seconds <= 59)) {
8056
+ return null;
8057
+ }
8058
+ seconds = parseInt(seconds, 10);
8059
+ }
8060
+ milliseconds = matches[8];
8061
+ if (milliseconds != null) {
8062
+ milliseconds = parseInt(normalizeMillisecondsField(milliseconds));
8063
+ }
8064
+ if (matches[11] != null) {
8065
+ tz = parseInt(matches[12], 10) + (matches[14] != null ? parseInt(matches[14], 10) / 60 : 0);
8066
+ timezoneOffset = matches[11] === '+' ? tz : tz * -1;
8067
+ } else if (matches[9] === 'Z') {
8068
+ timezoneOffset = 0;
8069
+ }
8070
+ return new DateTime(0, 1, 1, hours, minutes, seconds, milliseconds, timezoneOffset);
7156
8071
  } else {
7157
8072
  return null;
7158
8073
  }
@@ -7208,6 +8123,11 @@
7208
8123
  "type": "ToDateTime",
7209
8124
  "operand": this.operand
7210
8125
  }).execute(ctx);
8126
+ case "{urn:hl7-org:elm-types:r1}Date":
8127
+ return new ToDate({
8128
+ "type": "ToDate",
8129
+ "operand": this.operand
8130
+ }).execute(ctx);
7211
8131
  case "{urn:hl7-org:elm-types:r1}Time":
7212
8132
  return new ToTime({
7213
8133
  "type": "ToTime",
@@ -7281,7 +8201,7 @@
7281
8201
 
7282
8202
 
7283
8203
 
7284
- },{"../datatypes/clinical":5,"../datatypes/datetime":7,"../util/math":134,"./expression":20,"./quantity":32,"./reusable":34}],38:[function(require,module,exports){
8204
+ },{"../datatypes/clinical":5,"../datatypes/datetime":7,"../util/math":135,"../util/util":136,"./expression":20,"./quantity":32,"./reusable":35}],39:[function(require,module,exports){
7285
8205
  // Generated by CoffeeScript 1.12.7
7286
8206
  (function() {
7287
8207
  window.cql = require('../../cql');
@@ -7310,7 +8230,7 @@
7310
8230
 
7311
8231
 
7312
8232
 
7313
- },{"../../cql":4}],39:[function(require,module,exports){
8233
+ },{"../../cql":4}],40:[function(require,module,exports){
7314
8234
  // Generated by CoffeeScript 1.12.7
7315
8235
  (function() {
7316
8236
  var Address, Alert, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -7469,7 +8389,7 @@
7469
8389
 
7470
8390
 
7471
8391
 
7472
- },{"../cql-datatypes":2,"./core":56}],40:[function(require,module,exports){
8392
+ },{"../cql-datatypes":2,"./core":57}],41:[function(require,module,exports){
7473
8393
  // Generated by CoffeeScript 1.12.7
7474
8394
  (function() {
7475
8395
  var Address, AllergyIntolerance, AllergyIntoleranceEventComponent, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -7827,7 +8747,7 @@
7827
8747
 
7828
8748
 
7829
8749
 
7830
- },{"../cql-datatypes":2,"./core":56}],41:[function(require,module,exports){
8750
+ },{"../cql-datatypes":2,"./core":57}],42:[function(require,module,exports){
7831
8751
  // Generated by CoffeeScript 1.12.7
7832
8752
  (function() {
7833
8753
  var Address, Appointment, AppointmentParticipantComponent, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -8174,7 +9094,7 @@
8174
9094
 
8175
9095
 
8176
9096
 
8177
- },{"../cql-datatypes":2,"./core":56}],42:[function(require,module,exports){
9097
+ },{"../cql-datatypes":2,"./core":57}],43:[function(require,module,exports){
8178
9098
  // Generated by CoffeeScript 1.12.7
8179
9099
  (function() {
8180
9100
  var Address, AppointmentResponse, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -8395,7 +9315,7 @@
8395
9315
 
8396
9316
 
8397
9317
 
8398
- },{"../cql-datatypes":2,"./core":56}],43:[function(require,module,exports){
9318
+ },{"../cql-datatypes":2,"./core":57}],44:[function(require,module,exports){
8399
9319
  // Generated by CoffeeScript 1.12.7
8400
9320
  (function() {
8401
9321
  var Address, Attachment, Availability, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -8563,7 +9483,7 @@
8563
9483
 
8564
9484
 
8565
9485
 
8566
- },{"../cql-datatypes":2,"./core":56}],44:[function(require,module,exports){
9486
+ },{"../cql-datatypes":2,"./core":57}],45:[function(require,module,exports){
8567
9487
  // Generated by CoffeeScript 1.12.7
8568
9488
  (function() {
8569
9489
  var Address, Attachment, BackboneElement, Basic, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -8714,7 +9634,7 @@
8714
9634
 
8715
9635
 
8716
9636
 
8717
- },{"../cql-datatypes":2,"./core":56}],45:[function(require,module,exports){
9637
+ },{"../cql-datatypes":2,"./core":57}],46:[function(require,module,exports){
8718
9638
  // Generated by CoffeeScript 1.12.7
8719
9639
  (function() {
8720
9640
  var Address, Attachment, BackboneElement, Binary, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -8818,7 +9738,7 @@
8818
9738
 
8819
9739
 
8820
9740
 
8821
- },{"../cql-datatypes":2,"./core":56}],46:[function(require,module,exports){
9741
+ },{"../cql-datatypes":2,"./core":57}],47:[function(require,module,exports){
8822
9742
  // Generated by CoffeeScript 1.12.7
8823
9743
  (function() {
8824
9744
  var Address, Attachment, BackboneElement, Bundle, BundleEntryComponent, BundleEntryDeletedComponent, BundleLinkComponent, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -9166,7 +10086,7 @@
9166
10086
 
9167
10087
 
9168
10088
 
9169
- },{"../cql-datatypes":2,"./core":56}],47:[function(require,module,exports){
10089
+ },{"../cql-datatypes":2,"./core":57}],48:[function(require,module,exports){
9170
10090
  // Generated by CoffeeScript 1.12.7
9171
10091
  (function() {
9172
10092
  var Address, Attachment, BackboneElement, CORE, CarePlan, CarePlanActivityComponent, CarePlanActivitySimpleComponent, CarePlanGoalComponent, CarePlanParticipantComponent, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -9766,7 +10686,7 @@
9766
10686
 
9767
10687
 
9768
10688
 
9769
- },{"../cql-datatypes":2,"./core":56}],48:[function(require,module,exports){
10689
+ },{"../cql-datatypes":2,"./core":57}],49:[function(require,module,exports){
9770
10690
  // Generated by CoffeeScript 1.12.7
9771
10691
  (function() {
9772
10692
  var AddedItemAdjudicationComponent, AddedItemComponent, AddedItemDetailAdjudicationComponent, AddedItemsDetailComponent, Address, Attachment, BackboneElement, CORE, ClaimResponse, CodeableConcept, Coding, ContactPoint, DT, DetailAdjudicationComponent, DomainResource, Element, ElementDefinition, ErrorsComponent, Extension, HumanName, Identifier, ItemAdjudicationComponent, ItemDetailComponent, ItemSubdetailComponent, ItemsComponent, Narrative, NotesComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, SubdetailAdjudicationComponent, Timing,
@@ -10913,7 +11833,7 @@
10913
11833
 
10914
11834
 
10915
11835
 
10916
- },{"../cql-datatypes":2,"./core":56}],49:[function(require,module,exports){
11836
+ },{"../cql-datatypes":2,"./core":57}],50:[function(require,module,exports){
10917
11837
  // Generated by CoffeeScript 1.12.7
10918
11838
  (function() {
10919
11839
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, CommunicationRequest, CommunicationRequestMessagePartComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -11261,7 +12181,7 @@
11261
12181
 
11262
12182
 
11263
12183
 
11264
- },{"../cql-datatypes":2,"./core":56}],50:[function(require,module,exports){
12184
+ },{"../cql-datatypes":2,"./core":57}],51:[function(require,module,exports){
11265
12185
  // Generated by CoffeeScript 1.12.7
11266
12186
  (function() {
11267
12187
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, Composition, CompositionAttesterComponent, CompositionEventComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, SectionComponent, Timing,
@@ -11731,7 +12651,7 @@
11731
12651
 
11732
12652
 
11733
12653
 
11734
- },{"../cql-datatypes":2,"./core":56}],51:[function(require,module,exports){
12654
+ },{"../cql-datatypes":2,"./core":57}],52:[function(require,module,exports){
11735
12655
  // Generated by CoffeeScript 1.12.7
11736
12656
  (function() {
11737
12657
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ConceptMap, ConceptMapElementComponent, ConceptMapElementMapComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, OtherElementComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -12193,7 +13113,7 @@
12193
13113
 
12194
13114
 
12195
13115
 
12196
- },{"../cql-datatypes":2,"./core":56}],52:[function(require,module,exports){
13116
+ },{"../cql-datatypes":2,"./core":57}],53:[function(require,module,exports){
12197
13117
  // Generated by CoffeeScript 1.12.7
12198
13118
  (function() {
12199
13119
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, Condition, ConditionDueToComponent, ConditionEvidenceComponent, ConditionLocationComponent, ConditionOccurredFollowingComponent, ConditionStageComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -12769,7 +13689,7 @@
12769
13689
 
12770
13690
 
12771
13691
 
12772
- },{"../cql-datatypes":2,"./core":56}],53:[function(require,module,exports){
13692
+ },{"../cql-datatypes":2,"./core":57}],54:[function(require,module,exports){
12773
13693
  // Generated by CoffeeScript 1.12.7
12774
13694
  (function() {
12775
13695
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, Conformance, ConformanceDocumentComponent, ConformanceImplementationComponent, ConformanceMessagingComponent, ConformanceMessagingEventComponent, ConformanceRestComponent, ConformanceRestOperationComponent, ConformanceRestResourceComponent, ConformanceRestResourceSearchParamComponent, ConformanceRestSecurityCertificateComponent, ConformanceRestSecurityComponent, ConformanceSoftwareComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, ResourceInteractionComponent, SampledData, SystemInteractionComponent, Timing,
@@ -13958,7 +14878,7 @@
13958
14878
 
13959
14879
 
13960
14880
 
13961
- },{"../cql-datatypes":2,"./core":56}],54:[function(require,module,exports){
14881
+ },{"../cql-datatypes":2,"./core":57}],55:[function(require,module,exports){
13962
14882
  // Generated by CoffeeScript 1.12.7
13963
14883
  (function() {
13964
14884
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, Contract, ContractSignerComponent, ContractTermComponent, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -14497,7 +15417,7 @@
14497
15417
 
14498
15418
 
14499
15419
 
14500
- },{"../cql-datatypes":2,"./core":56}],55:[function(require,module,exports){
15420
+ },{"../cql-datatypes":2,"./core":57}],56:[function(require,module,exports){
14501
15421
  // Generated by CoffeeScript 1.12.7
14502
15422
  (function() {
14503
15423
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, Contraindication, ContraindicationMitigationComponent, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -14764,7 +15684,7 @@
14764
15684
 
14765
15685
 
14766
15686
 
14767
- },{"../cql-datatypes":2,"./core":56}],56:[function(require,module,exports){
15687
+ },{"../cql-datatypes":2,"./core":57}],57:[function(require,module,exports){
14768
15688
  // Generated by CoffeeScript 1.12.7
14769
15689
  (function() {
14770
15690
  var Address, Attachment, BackboneElement, Base, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, ElementDefinitionBindingComponent, ElementDefinitionConstraintComponent, ElementDefinitionMappingComponent, ElementDefinitionSlicingComponent, Extension, HumanName, Identifier, Narrative, Parameters, ParametersParameterComponent, Period, Quantity, Range, Ratio, Reference, Resource, ResourceMetaComponent, SampledData, Timing, TimingRepeatComponent, TypeRefComponent,
@@ -16951,7 +17871,7 @@
16951
17871
 
16952
17872
 
16953
17873
 
16954
- },{"../cql-datatypes":2}],57:[function(require,module,exports){
17874
+ },{"../cql-datatypes":2}],58:[function(require,module,exports){
16955
17875
  // Generated by CoffeeScript 1.12.7
16956
17876
  (function() {
16957
17877
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, Coverage, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -17183,7 +18103,7 @@
17183
18103
 
17184
18104
 
17185
18105
 
17186
- },{"../cql-datatypes":2,"./core":56}],58:[function(require,module,exports){
18106
+ },{"../cql-datatypes":2,"./core":57}],59:[function(require,module,exports){
17187
18107
  // Generated by CoffeeScript 1.12.7
17188
18108
  (function() {
17189
18109
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DataElement, DataElementBindingComponent, DataElementMappingComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -17641,7 +18561,7 @@
17641
18561
 
17642
18562
 
17643
18563
 
17644
- },{"../cql-datatypes":2,"./core":56}],59:[function(require,module,exports){
18564
+ },{"../cql-datatypes":2,"./core":57}],60:[function(require,module,exports){
17645
18565
  // Generated by CoffeeScript 1.12.7
17646
18566
  (function() {
17647
18567
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, Device, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -17883,7 +18803,7 @@
17883
18803
 
17884
18804
 
17885
18805
 
17886
- },{"../cql-datatypes":2,"./core":56}],60:[function(require,module,exports){
18806
+ },{"../cql-datatypes":2,"./core":57}],61:[function(require,module,exports){
17887
18807
  // Generated by CoffeeScript 1.12.7
17888
18808
  (function() {
17889
18809
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DeviceComponent, DeviceComponentProductionSpecificationComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -18152,7 +19072,7 @@
18152
19072
 
18153
19073
 
18154
19074
 
18155
- },{"../cql-datatypes":2,"./core":56}],61:[function(require,module,exports){
19075
+ },{"../cql-datatypes":2,"./core":57}],62:[function(require,module,exports){
18156
19076
  // Generated by CoffeeScript 1.12.7
18157
19077
  (function() {
18158
19078
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DeviceUseRequest, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -18448,7 +19368,7 @@
18448
19368
 
18449
19369
 
18450
19370
 
18451
- },{"../cql-datatypes":2,"./core":56}],62:[function(require,module,exports){
19371
+ },{"../cql-datatypes":2,"./core":57}],63:[function(require,module,exports){
18452
19372
  // Generated by CoffeeScript 1.12.7
18453
19373
  (function() {
18454
19374
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DeviceUseStatement, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -18683,7 +19603,7 @@
18683
19603
 
18684
19604
 
18685
19605
 
18686
- },{"../cql-datatypes":2,"./core":56}],63:[function(require,module,exports){
19606
+ },{"../cql-datatypes":2,"./core":57}],64:[function(require,module,exports){
18687
19607
  // Generated by CoffeeScript 1.12.7
18688
19608
  (function() {
18689
19609
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DiagnosticOrder, DiagnosticOrderEventComponent, DiagnosticOrderItemComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -19084,7 +20004,7 @@
19084
20004
 
19085
20005
 
19086
20006
 
19087
- },{"../cql-datatypes":2,"./core":56}],64:[function(require,module,exports){
20007
+ },{"../cql-datatypes":2,"./core":57}],65:[function(require,module,exports){
19088
20008
  // Generated by CoffeeScript 1.12.7
19089
20009
  (function() {
19090
20010
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DiagnosticReport, DiagnosticReportImageComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -19458,7 +20378,7 @@
19458
20378
 
19459
20379
 
19460
20380
 
19461
- },{"../cql-datatypes":2,"./core":56}],65:[function(require,module,exports){
20381
+ },{"../cql-datatypes":2,"./core":57}],66:[function(require,module,exports){
19462
20382
  // Generated by CoffeeScript 1.12.7
19463
20383
  (function() {
19464
20384
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DocumentManifest, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -19727,7 +20647,7 @@
19727
20647
 
19728
20648
 
19729
20649
 
19730
- },{"../cql-datatypes":2,"./core":56}],66:[function(require,module,exports){
20650
+ },{"../cql-datatypes":2,"./core":57}],67:[function(require,module,exports){
19731
20651
  // Generated by CoffeeScript 1.12.7
19732
20652
  (function() {
19733
20653
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DocumentReference, DocumentReferenceContextComponent, DocumentReferenceRelatesToComponent, DocumentReferenceServiceComponent, DocumentReferenceServiceParameterComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -20311,7 +21231,7 @@
20311
21231
 
20312
21232
 
20313
21233
 
20314
- },{"../cql-datatypes":2,"./core":56}],67:[function(require,module,exports){
21234
+ },{"../cql-datatypes":2,"./core":57}],68:[function(require,module,exports){
20315
21235
  // Generated by CoffeeScript 1.12.7
20316
21236
  (function() {
20317
21237
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Eligibility, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -20486,7 +21406,7 @@
20486
21406
 
20487
21407
 
20488
21408
 
20489
- },{"../cql-datatypes":2,"./core":56}],68:[function(require,module,exports){
21409
+ },{"../cql-datatypes":2,"./core":57}],69:[function(require,module,exports){
20490
21410
  // Generated by CoffeeScript 1.12.7
20491
21411
  (function() {
20492
21412
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, EligibilityResponse, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -20693,7 +21613,7 @@
20693
21613
 
20694
21614
 
20695
21615
 
20696
- },{"../cql-datatypes":2,"./core":56}],69:[function(require,module,exports){
21616
+ },{"../cql-datatypes":2,"./core":57}],70:[function(require,module,exports){
20697
21617
  // Generated by CoffeeScript 1.12.7
20698
21618
  (function() {
20699
21619
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Encounter, EncounterHospitalizationAccomodationComponent, EncounterHospitalizationComponent, EncounterLocationComponent, EncounterParticipantComponent, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -21311,7 +22231,7 @@
21311
22231
 
21312
22232
 
21313
22233
 
21314
- },{"../cql-datatypes":2,"./core":56}],70:[function(require,module,exports){
22234
+ },{"../cql-datatypes":2,"./core":57}],71:[function(require,module,exports){
21315
22235
  // Generated by CoffeeScript 1.12.7
21316
22236
  (function() {
21317
22237
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Enrollment, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -21522,7 +22442,7 @@
21522
22442
 
21523
22443
 
21524
22444
 
21525
- },{"../cql-datatypes":2,"./core":56}],71:[function(require,module,exports){
22445
+ },{"../cql-datatypes":2,"./core":57}],72:[function(require,module,exports){
21526
22446
  // Generated by CoffeeScript 1.12.7
21527
22447
  (function() {
21528
22448
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, EnrollmentResponse, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -21729,7 +22649,7 @@
21729
22649
 
21730
22650
 
21731
22651
 
21732
- },{"../cql-datatypes":2,"./core":56}],72:[function(require,module,exports){
22652
+ },{"../cql-datatypes":2,"./core":57}],73:[function(require,module,exports){
21733
22653
  // Generated by CoffeeScript 1.12.7
21734
22654
  (function() {
21735
22655
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, ExplanationOfBenefit, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -21936,7 +22856,7 @@
21936
22856
 
21937
22857
 
21938
22858
 
21939
- },{"../cql-datatypes":2,"./core":56}],73:[function(require,module,exports){
22859
+ },{"../cql-datatypes":2,"./core":57}],74:[function(require,module,exports){
21940
22860
  // Generated by CoffeeScript 1.12.7
21941
22861
  (function() {
21942
22862
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, ExtensionDefinition, ExtensionDefinitionMappingComponent, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -22286,7 +23206,7 @@
22286
23206
 
22287
23207
 
22288
23208
 
22289
- },{"../cql-datatypes":2,"./core":56}],74:[function(require,module,exports){
23209
+ },{"../cql-datatypes":2,"./core":57}],75:[function(require,module,exports){
22290
23210
  // Generated by CoffeeScript 1.12.7
22291
23211
  (function() {
22292
23212
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, FamilyHistory, FamilyHistoryRelationComponent, FamilyHistoryRelationConditionComponent, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -22699,7 +23619,7 @@
22699
23619
 
22700
23620
 
22701
23621
 
22702
- },{"../cql-datatypes":2,"./core":56}],75:[function(require,module,exports){
23622
+ },{"../cql-datatypes":2,"./core":57}],76:[function(require,module,exports){
22703
23623
  // Generated by CoffeeScript 1.12.7
22704
23624
  (function() {
22705
23625
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, Group, GroupCharacteristicComponent, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -22972,7 +23892,7 @@
22972
23892
 
22973
23893
 
22974
23894
 
22975
- },{"../cql-datatypes":2,"./core":56}],76:[function(require,module,exports){
23895
+ },{"../cql-datatypes":2,"./core":57}],77:[function(require,module,exports){
22976
23896
  // Generated by CoffeeScript 1.12.7
22977
23897
  (function() {
22978
23898
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HealthcareService, HealthcareServiceAvailableTimeComponent, HealthcareServiceNotAvailableTimeComponent, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, ServiceTypeComponent, Timing,
@@ -23599,7 +24519,7 @@
23599
24519
 
23600
24520
 
23601
24521
 
23602
- },{"../cql-datatypes":2,"./core":56}],77:[function(require,module,exports){
24522
+ },{"../cql-datatypes":2,"./core":57}],78:[function(require,module,exports){
23603
24523
  // Generated by CoffeeScript 1.12.7
23604
24524
  (function() {
23605
24525
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, ImagingObjectSelection, InstanceComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, SeriesComponent, StudyComponent, Timing,
@@ -23977,7 +24897,7 @@
23977
24897
 
23978
24898
 
23979
24899
 
23980
- },{"../cql-datatypes":2,"./core":56}],78:[function(require,module,exports){
24900
+ },{"../cql-datatypes":2,"./core":57}],79:[function(require,module,exports){
23981
24901
  // Generated by CoffeeScript 1.12.7
23982
24902
  (function() {
23983
24903
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, ImagingStudy, ImagingStudySeriesComponent, ImagingStudySeriesInstanceComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -24508,7 +25428,7 @@
24508
25428
 
24509
25429
 
24510
25430
 
24511
- },{"../cql-datatypes":2,"./core":56}],79:[function(require,module,exports){
25431
+ },{"../cql-datatypes":2,"./core":57}],80:[function(require,module,exports){
24512
25432
  // Generated by CoffeeScript 1.12.7
24513
25433
  (function() {
24514
25434
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Immunization, ImmunizationExplanationComponent, ImmunizationReactionComponent, ImmunizationVaccinationProtocolComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -25040,7 +25960,7 @@
25040
25960
 
25041
25961
 
25042
25962
 
25043
- },{"../cql-datatypes":2,"./core":56}],80:[function(require,module,exports){
25963
+ },{"../cql-datatypes":2,"./core":57}],81:[function(require,module,exports){
25044
25964
  // Generated by CoffeeScript 1.12.7
25045
25965
  (function() {
25046
25966
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, ImmunizationRecommendation, ImmunizationRecommendationRecommendationComponent, ImmunizationRecommendationRecommendationDateCriterionComponent, ImmunizationRecommendationRecommendationProtocolComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -25412,7 +26332,7 @@
25412
26332
 
25413
26333
 
25414
26334
 
25415
- },{"../cql-datatypes":2,"./core":56}],81:[function(require,module,exports){
26335
+ },{"../cql-datatypes":2,"./core":57}],82:[function(require,module,exports){
25416
26336
  // Generated by CoffeeScript 1.12.7
25417
26337
  (function() {
25418
26338
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, List, ListEntryComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -25686,7 +26606,7 @@
25686
26606
 
25687
26607
 
25688
26608
 
25689
- },{"../cql-datatypes":2,"./core":56}],82:[function(require,module,exports){
26609
+ },{"../cql-datatypes":2,"./core":57}],83:[function(require,module,exports){
25690
26610
  // Generated by CoffeeScript 1.12.7
25691
26611
  (function() {
25692
26612
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Location, LocationPositionComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -25969,7 +26889,7 @@
25969
26889
 
25970
26890
 
25971
26891
 
25972
- },{"../cql-datatypes":2,"./core":56}],83:[function(require,module,exports){
26892
+ },{"../cql-datatypes":2,"./core":57}],84:[function(require,module,exports){
25973
26893
  // Generated by CoffeeScript 1.12.7
25974
26894
  (function() {
25975
26895
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Media, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -26204,7 +27124,7 @@
26204
27124
 
26205
27125
 
26206
27126
 
26207
- },{"../cql-datatypes":2,"./core":56}],84:[function(require,module,exports){
27127
+ },{"../cql-datatypes":2,"./core":57}],85:[function(require,module,exports){
26208
27128
  // Generated by CoffeeScript 1.12.7
26209
27129
  (function() {
26210
27130
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Medication, MedicationPackageComponent, MedicationPackageContentComponent, MedicationProductComponent, MedicationProductIngredientComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -26552,7 +27472,7 @@
26552
27472
 
26553
27473
 
26554
27474
 
26555
- },{"../cql-datatypes":2,"./core":56}],85:[function(require,module,exports){
27475
+ },{"../cql-datatypes":2,"./core":57}],86:[function(require,module,exports){
26556
27476
  // Generated by CoffeeScript 1.12.7
26557
27477
  (function() {
26558
27478
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, MedicationAdministration, MedicationAdministrationDosageComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -26957,7 +27877,7 @@
26957
27877
 
26958
27878
 
26959
27879
 
26960
- },{"../cql-datatypes":2,"./core":56}],86:[function(require,module,exports){
27880
+ },{"../cql-datatypes":2,"./core":57}],87:[function(require,module,exports){
26961
27881
  // Generated by CoffeeScript 1.12.7
26962
27882
  (function() {
26963
27883
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, MedicationDispense, MedicationDispenseDispenseComponent, MedicationDispenseDispenseDosageComponent, MedicationDispenseSubstitutionComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -27520,7 +28440,7 @@
27520
28440
 
27521
28441
 
27522
28442
 
27523
- },{"../cql-datatypes":2,"./core":56}],87:[function(require,module,exports){
28443
+ },{"../cql-datatypes":2,"./core":57}],88:[function(require,module,exports){
27524
28444
  // Generated by CoffeeScript 1.12.7
27525
28445
  (function() {
27526
28446
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, MedicationPrescription, MedicationPrescriptionDispenseComponent, MedicationPrescriptionDosageInstructionComponent, MedicationPrescriptionSubstitutionComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -28057,7 +28977,7 @@
28057
28977
 
28058
28978
 
28059
28979
 
28060
- },{"../cql-datatypes":2,"./core":56}],88:[function(require,module,exports){
28980
+ },{"../cql-datatypes":2,"./core":57}],89:[function(require,module,exports){
28061
28981
  // Generated by CoffeeScript 1.12.7
28062
28982
  (function() {
28063
28983
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, MedicationStatement, MedicationStatementDosageComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -28390,7 +29310,7 @@
28390
29310
 
28391
29311
 
28392
29312
 
28393
- },{"../cql-datatypes":2,"./core":56}],89:[function(require,module,exports){
29313
+ },{"../cql-datatypes":2,"./core":57}],90:[function(require,module,exports){
28394
29314
  // Generated by CoffeeScript 1.12.7
28395
29315
  (function() {
28396
29316
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, MessageDestinationComponent, MessageHeader, MessageHeaderResponseComponent, MessageSourceComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -28803,7 +29723,7 @@
28803
29723
 
28804
29724
 
28805
29725
 
28806
- },{"../cql-datatypes":2,"./core":56}],90:[function(require,module,exports){
29726
+ },{"../cql-datatypes":2,"./core":57}],91:[function(require,module,exports){
28807
29727
  // Generated by CoffeeScript 1.12.7
28808
29728
  (function() {
28809
29729
  module.exports = require('./core');
@@ -28988,7 +29908,7 @@
28988
29908
 
28989
29909
 
28990
29910
 
28991
- },{"./alert":39,"./allergyintolerance":40,"./appointment":41,"./appointmentresponse":42,"./availability":43,"./basic":44,"./binary":45,"./bundle":46,"./careplan":47,"./claimresponse":48,"./communicationrequest":49,"./composition":50,"./conceptmap":51,"./condition":52,"./conformance":53,"./contract":54,"./contraindication":55,"./core":56,"./coverage":57,"./dataelement":58,"./device":59,"./devicecomponent":60,"./deviceuserequest":61,"./deviceusestatement":62,"./diagnosticorder":63,"./diagnosticreport":64,"./documentmanifest":65,"./documentreference":66,"./eligibility":67,"./eligibilityresponse":68,"./encounter":69,"./enrollment":70,"./enrollmentresponse":71,"./explanationofbenefit":72,"./extensiondefinition":73,"./familyhistory":74,"./group":75,"./healthcareservice":76,"./imagingobjectselection":77,"./imagingstudy":78,"./immunization":79,"./immunizationrecommendation":80,"./list":81,"./location":82,"./media":83,"./medication":84,"./medicationadministration":85,"./medicationdispense":86,"./medicationprescription":87,"./medicationstatement":88,"./messageheader":89,"./namingsystem":91,"./nutritionorder":92,"./observation":93,"./operationdefinition":94,"./operationoutcome":95,"./oralhealthclaim":96,"./order":97,"./orderresponse":98,"./organization":99,"./other":100,"./patient":101,"./paymentnotice":102,"./paymentreconciliation":103,"./pendedrequest":104,"./practitioner":105,"./procedure":106,"./procedurerequest":107,"./profile":108,"./provenance":109,"./query":110,"./questionnaire":111,"./questionnaireanswers":112,"./readjudicate":113,"./referralrequest":114,"./relatedperson":115,"./reversal":116,"./riskassessment":117,"./searchparameter":118,"./securityevent":119,"./slot":120,"./specimen":121,"./statusrequest":122,"./statusresponse":123,"./subscription":124,"./substance":125,"./supply":126,"./supportingdocumentation":127,"./valueset":128}],91:[function(require,module,exports){
29911
+ },{"./alert":40,"./allergyintolerance":41,"./appointment":42,"./appointmentresponse":43,"./availability":44,"./basic":45,"./binary":46,"./bundle":47,"./careplan":48,"./claimresponse":49,"./communicationrequest":50,"./composition":51,"./conceptmap":52,"./condition":53,"./conformance":54,"./contract":55,"./contraindication":56,"./core":57,"./coverage":58,"./dataelement":59,"./device":60,"./devicecomponent":61,"./deviceuserequest":62,"./deviceusestatement":63,"./diagnosticorder":64,"./diagnosticreport":65,"./documentmanifest":66,"./documentreference":67,"./eligibility":68,"./eligibilityresponse":69,"./encounter":70,"./enrollment":71,"./enrollmentresponse":72,"./explanationofbenefit":73,"./extensiondefinition":74,"./familyhistory":75,"./group":76,"./healthcareservice":77,"./imagingobjectselection":78,"./imagingstudy":79,"./immunization":80,"./immunizationrecommendation":81,"./list":82,"./location":83,"./media":84,"./medication":85,"./medicationadministration":86,"./medicationdispense":87,"./medicationprescription":88,"./medicationstatement":89,"./messageheader":90,"./namingsystem":92,"./nutritionorder":93,"./observation":94,"./operationdefinition":95,"./operationoutcome":96,"./oralhealthclaim":97,"./order":98,"./orderresponse":99,"./organization":100,"./other":101,"./patient":102,"./paymentnotice":103,"./paymentreconciliation":104,"./pendedrequest":105,"./practitioner":106,"./procedure":107,"./procedurerequest":108,"./profile":109,"./provenance":110,"./query":111,"./questionnaire":112,"./questionnaireanswers":113,"./readjudicate":114,"./referralrequest":115,"./relatedperson":116,"./reversal":117,"./riskassessment":118,"./searchparameter":119,"./securityevent":120,"./slot":121,"./specimen":122,"./statusrequest":123,"./statusresponse":124,"./subscription":125,"./substance":126,"./supply":127,"./supportingdocumentation":128,"./valueset":129}],92:[function(require,module,exports){
28992
29912
  // Generated by CoffeeScript 1.12.7
28993
29913
  (function() {
28994
29914
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, NamingSystem, NamingSystemContactComponent, NamingSystemUniqueIdComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -29308,7 +30228,7 @@
29308
30228
 
29309
30229
 
29310
30230
 
29311
- },{"../cql-datatypes":2,"./core":56}],92:[function(require,module,exports){
30231
+ },{"../cql-datatypes":2,"./core":57}],93:[function(require,module,exports){
29312
30232
  // Generated by CoffeeScript 1.12.7
29313
30233
  (function() {
29314
30234
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, NutritionOrder, NutritionOrderItemComponent, NutritionOrderItemEnteralFormulaComponent, NutritionOrderItemOralDietComponent, NutritionOrderItemOralDietNutrientsComponent, NutritionOrderItemOralDietTextureComponent, NutritionOrderItemSupplementComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -30014,7 +30934,7 @@
30014
30934
 
30015
30935
 
30016
30936
 
30017
- },{"../cql-datatypes":2,"./core":56}],93:[function(require,module,exports){
30937
+ },{"../cql-datatypes":2,"./core":57}],94:[function(require,module,exports){
30018
30938
  // Generated by CoffeeScript 1.12.7
30019
30939
  (function() {
30020
30940
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Observation, ObservationReferenceRangeComponent, ObservationRelatedComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -30551,7 +31471,7 @@
30551
31471
 
30552
31472
 
30553
31473
 
30554
- },{"../cql-datatypes":2,"./core":56}],94:[function(require,module,exports){
31474
+ },{"../cql-datatypes":2,"./core":57}],95:[function(require,module,exports){
30555
31475
  // Generated by CoffeeScript 1.12.7
30556
31476
  (function() {
30557
31477
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, OperationDefinition, OperationDefinitionParameterComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -30939,7 +31859,7 @@
30939
31859
 
30940
31860
 
30941
31861
 
30942
- },{"../cql-datatypes":2,"./core":56}],95:[function(require,module,exports){
31862
+ },{"../cql-datatypes":2,"./core":57}],96:[function(require,module,exports){
30943
31863
  // Generated by CoffeeScript 1.12.7
30944
31864
  (function() {
30945
31865
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, OperationOutcome, OperationOutcomeIssueComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -31103,7 +32023,7 @@
31103
32023
 
31104
32024
 
31105
32025
 
31106
- },{"../cql-datatypes":2,"./core":56}],96:[function(require,module,exports){
32026
+ },{"../cql-datatypes":2,"./core":57}],97:[function(require,module,exports){
31107
32027
  // Generated by CoffeeScript 1.12.7
31108
32028
  (function() {
31109
32029
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, CoverageComponent, DT, DetailComponent, DiagnosisComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, ItemsComponent, MissingTeethComponent, Narrative, OralHealthClaim, OrthodonticPlanComponent, Parameters, PayeeComponent, Period, ProsthesisComponent, Quantity, Range, Ratio, Reference, Resource, SampledData, SubDetailComponent, Timing,
@@ -32479,7 +33399,7 @@
32479
33399
 
32480
33400
 
32481
33401
 
32482
- },{"../cql-datatypes":2,"./core":56}],97:[function(require,module,exports){
33402
+ },{"../cql-datatypes":2,"./core":57}],98:[function(require,module,exports){
32483
33403
  // Generated by CoffeeScript 1.12.7
32484
33404
  (function() {
32485
33405
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Order, OrderWhenComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -32740,7 +33660,7 @@
32740
33660
 
32741
33661
 
32742
33662
 
32743
- },{"../cql-datatypes":2,"./core":56}],98:[function(require,module,exports){
33663
+ },{"../cql-datatypes":2,"./core":57}],99:[function(require,module,exports){
32744
33664
  // Generated by CoffeeScript 1.12.7
32745
33665
  (function() {
32746
33666
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, OrderResponse, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -32942,7 +33862,7 @@
32942
33862
 
32943
33863
 
32944
33864
 
32945
- },{"../cql-datatypes":2,"./core":56}],99:[function(require,module,exports){
33865
+ },{"../cql-datatypes":2,"./core":57}],100:[function(require,module,exports){
32946
33866
  // Generated by CoffeeScript 1.12.7
32947
33867
  (function() {
32948
33868
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Organization, OrganizationContactComponent, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -33249,7 +34169,7 @@
33249
34169
 
33250
34170
 
33251
34171
 
33252
- },{"../cql-datatypes":2,"./core":56}],100:[function(require,module,exports){
34172
+ },{"../cql-datatypes":2,"./core":57}],101:[function(require,module,exports){
33253
34173
  // Generated by CoffeeScript 1.12.7
33254
34174
  (function() {
33255
34175
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Other, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -33400,7 +34320,7 @@
33400
34320
 
33401
34321
 
33402
34322
 
33403
- },{"../cql-datatypes":2,"./core":56}],101:[function(require,module,exports){
34323
+ },{"../cql-datatypes":2,"./core":57}],102:[function(require,module,exports){
33404
34324
  // Generated by CoffeeScript 1.12.7
33405
34325
  (function() {
33406
34326
  var Address, AnimalComponent, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Patient, PatientLinkComponent, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -33976,7 +34896,7 @@
33976
34896
 
33977
34897
 
33978
34898
 
33979
- },{"../cql-datatypes":2,"./core":56}],102:[function(require,module,exports){
34899
+ },{"../cql-datatypes":2,"./core":57}],103:[function(require,module,exports){
33980
34900
  // Generated by CoffeeScript 1.12.7
33981
34901
  (function() {
33982
34902
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, PaymentNotice, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -34187,7 +35107,7 @@
34187
35107
 
34188
35108
 
34189
35109
 
34190
- },{"../cql-datatypes":2,"./core":56}],103:[function(require,module,exports){
35110
+ },{"../cql-datatypes":2,"./core":57}],104:[function(require,module,exports){
34191
35111
  // Generated by CoffeeScript 1.12.7
34192
35112
  (function() {
34193
35113
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DetailsComponent, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, NotesComponent, Parameters, PaymentReconciliation, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -34619,7 +35539,7 @@
34619
35539
 
34620
35540
 
34621
35541
 
34622
- },{"../cql-datatypes":2,"./core":56}],104:[function(require,module,exports){
35542
+ },{"../cql-datatypes":2,"./core":57}],105:[function(require,module,exports){
34623
35543
  // Generated by CoffeeScript 1.12.7
34624
35544
  (function() {
34625
35545
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, PendedRequest, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -34838,7 +35758,7 @@
34838
35758
 
34839
35759
 
34840
35760
 
34841
- },{"../cql-datatypes":2,"./core":56}],105:[function(require,module,exports){
35761
+ },{"../cql-datatypes":2,"./core":57}],106:[function(require,module,exports){
34842
35762
  // Generated by CoffeeScript 1.12.7
34843
35763
  (function() {
34844
35764
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Practitioner, PractitionerQualificationComponent, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -35225,7 +36145,7 @@
35225
36145
 
35226
36146
 
35227
36147
 
35228
- },{"../cql-datatypes":2,"./core":56}],106:[function(require,module,exports){
36148
+ },{"../cql-datatypes":2,"./core":57}],107:[function(require,module,exports){
35229
36149
  // Generated by CoffeeScript 1.12.7
35230
36150
  (function() {
35231
36151
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Procedure, ProcedurePerformerComponent, ProcedureRelatedItemComponent, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -35604,7 +36524,7 @@
35604
36524
 
35605
36525
 
35606
36526
 
35607
- },{"../cql-datatypes":2,"./core":56}],107:[function(require,module,exports){
36527
+ },{"../cql-datatypes":2,"./core":57}],108:[function(require,module,exports){
35608
36528
  // Generated by CoffeeScript 1.12.7
35609
36529
  (function() {
35610
36530
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, ProcedureRequest, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -35915,7 +36835,7 @@
35915
36835
 
35916
36836
 
35917
36837
 
35918
- },{"../cql-datatypes":2,"./core":56}],108:[function(require,module,exports){
36838
+ },{"../cql-datatypes":2,"./core":57}],109:[function(require,module,exports){
35919
36839
  // Generated by CoffeeScript 1.12.7
35920
36840
  (function() {
35921
36841
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ConstraintComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Profile, ProfileMappingComponent, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -36318,7 +37238,7 @@
36318
37238
 
36319
37239
 
36320
37240
 
36321
- },{"../cql-datatypes":2,"./core":56}],109:[function(require,module,exports){
37241
+ },{"../cql-datatypes":2,"./core":57}],110:[function(require,module,exports){
36322
37242
  // Generated by CoffeeScript 1.12.7
36323
37243
  (function() {
36324
37244
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Provenance, ProvenanceAgentComponent, ProvenanceEntityComponent, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -36663,7 +37583,7 @@
36663
37583
 
36664
37584
 
36665
37585
 
36666
- },{"../cql-datatypes":2,"./core":56}],110:[function(require,module,exports){
37586
+ },{"../cql-datatypes":2,"./core":57}],111:[function(require,module,exports){
36667
37587
  // Generated by CoffeeScript 1.12.7
36668
37588
  (function() {
36669
37589
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Query, QueryResponseComponent, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -36951,7 +37871,7 @@
36951
37871
 
36952
37872
 
36953
37873
 
36954
- },{"../cql-datatypes":2,"./core":56}],111:[function(require,module,exports){
37874
+ },{"../cql-datatypes":2,"./core":57}],112:[function(require,module,exports){
36955
37875
  // Generated by CoffeeScript 1.12.7
36956
37876
  (function() {
36957
37877
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, GroupComponent, HumanName, Identifier, Narrative, Parameters, Period, Quantity, QuestionComponent, Questionnaire, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -37353,7 +38273,7 @@
37353
38273
 
37354
38274
 
37355
38275
 
37356
- },{"../cql-datatypes":2,"./core":56}],112:[function(require,module,exports){
38276
+ },{"../cql-datatypes":2,"./core":57}],113:[function(require,module,exports){
37357
38277
  // Generated by CoffeeScript 1.12.7
37358
38278
  (function() {
37359
38279
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, GroupComponent, HumanName, Identifier, Narrative, Parameters, Period, Quantity, QuestionAnswerComponent, QuestionComponent, QuestionnaireAnswers, Range, Ratio, Reference, Resource, SampledData, Timing,
@@ -37874,7 +38794,7 @@
37874
38794
 
37875
38795
 
37876
38796
 
37877
- },{"../cql-datatypes":2,"./core":56}],113:[function(require,module,exports){
38797
+ },{"../cql-datatypes":2,"./core":57}],114:[function(require,module,exports){
37878
38798
  // Generated by CoffeeScript 1.12.7
37879
38799
  (function() {
37880
38800
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, ItemsComponent, Narrative, Parameters, Period, Quantity, Range, Ratio, Readjudicate, Reference, Resource, SampledData, Timing,
@@ -38131,7 +39051,7 @@
38131
39051
 
38132
39052
 
38133
39053
 
38134
- },{"../cql-datatypes":2,"./core":56}],114:[function(require,module,exports){
39054
+ },{"../cql-datatypes":2,"./core":57}],115:[function(require,module,exports){
38135
39055
  // Generated by CoffeeScript 1.12.7
38136
39056
  (function() {
38137
39057
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, ReferralRequest, Resource, SampledData, Timing,
@@ -38419,7 +39339,7 @@
38419
39339
 
38420
39340
 
38421
39341
 
38422
- },{"../cql-datatypes":2,"./core":56}],115:[function(require,module,exports){
39342
+ },{"../cql-datatypes":2,"./core":57}],116:[function(require,module,exports){
38423
39343
  // Generated by CoffeeScript 1.12.7
38424
39344
  (function() {
38425
39345
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, RelatedPerson, Resource, SampledData, Timing,
@@ -38618,7 +39538,7 @@
38618
39538
 
38619
39539
 
38620
39540
 
38621
- },{"../cql-datatypes":2,"./core":56}],116:[function(require,module,exports){
39541
+ },{"../cql-datatypes":2,"./core":57}],117:[function(require,module,exports){
38622
39542
  // Generated by CoffeeScript 1.12.7
38623
39543
  (function() {
38624
39544
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, PayeeComponent, Period, Quantity, Range, Ratio, Reference, Resource, Reversal, ReversalCoverageComponent, SampledData, Timing,
@@ -38991,7 +39911,7 @@
38991
39911
 
38992
39912
 
38993
39913
 
38994
- },{"../cql-datatypes":2,"./core":56}],117:[function(require,module,exports){
39914
+ },{"../cql-datatypes":2,"./core":57}],118:[function(require,module,exports){
38995
39915
  // Generated by CoffeeScript 1.12.7
38996
39916
  (function() {
38997
39917
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, RiskAssessment, RiskAssessmentPredictionComponent, SampledData, Timing,
@@ -39304,7 +40224,7 @@
39304
40224
 
39305
40225
 
39306
40226
 
39307
- },{"../cql-datatypes":2,"./core":56}],118:[function(require,module,exports){
40227
+ },{"../cql-datatypes":2,"./core":57}],119:[function(require,module,exports){
39308
40228
  // Generated by CoffeeScript 1.12.7
39309
40229
  (function() {
39310
40230
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, SearchParameter, Timing,
@@ -39497,7 +40417,7 @@
39497
40417
 
39498
40418
 
39499
40419
 
39500
- },{"../cql-datatypes":2,"./core":56}],119:[function(require,module,exports){
40420
+ },{"../cql-datatypes":2,"./core":57}],120:[function(require,module,exports){
39501
40421
  // Generated by CoffeeScript 1.12.7
39502
40422
  (function() {
39503
40423
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, SecurityEvent, SecurityEventEventComponent, SecurityEventObjectComponent, SecurityEventObjectDetailComponent, SecurityEventParticipantComponent, SecurityEventParticipantNetworkComponent, SecurityEventSourceComponent, Timing,
@@ -40119,7 +41039,7 @@
40119
41039
 
40120
41040
 
40121
41041
 
40122
- },{"../cql-datatypes":2,"./core":56}],120:[function(require,module,exports){
41042
+ },{"../cql-datatypes":2,"./core":57}],121:[function(require,module,exports){
40123
41043
  // Generated by CoffeeScript 1.12.7
40124
41044
  (function() {
40125
41045
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Slot, Timing,
@@ -40312,7 +41232,7 @@
40312
41232
 
40313
41233
 
40314
41234
 
40315
- },{"../cql-datatypes":2,"./core":56}],121:[function(require,module,exports){
41235
+ },{"../cql-datatypes":2,"./core":57}],122:[function(require,module,exports){
40316
41236
  // Generated by CoffeeScript 1.12.7
40317
41237
  (function() {
40318
41238
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Specimen, SpecimenCollectionComponent, SpecimenContainerComponent, SpecimenSourceComponent, SpecimenTreatmentComponent, Timing,
@@ -40849,7 +41769,7 @@
40849
41769
 
40850
41770
 
40851
41771
 
40852
- },{"../cql-datatypes":2,"./core":56}],122:[function(require,module,exports){
41772
+ },{"../cql-datatypes":2,"./core":57}],123:[function(require,module,exports){
40853
41773
  // Generated by CoffeeScript 1.12.7
40854
41774
  (function() {
40855
41775
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, StatusRequest, Timing,
@@ -41048,7 +41968,7 @@
41048
41968
 
41049
41969
 
41050
41970
 
41051
- },{"../cql-datatypes":2,"./core":56}],123:[function(require,module,exports){
41971
+ },{"../cql-datatypes":2,"./core":57}],124:[function(require,module,exports){
41052
41972
  // Generated by CoffeeScript 1.12.7
41053
41973
  (function() {
41054
41974
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, StatusResponse, StatusResponseNotesComponent, Timing,
@@ -41348,7 +42268,7 @@
41348
42268
 
41349
42269
 
41350
42270
 
41351
- },{"../cql-datatypes":2,"./core":56}],124:[function(require,module,exports){
42271
+ },{"../cql-datatypes":2,"./core":57}],125:[function(require,module,exports){
41352
42272
  // Generated by CoffeeScript 1.12.7
41353
42273
  (function() {
41354
42274
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Subscription, SubscriptionChannelComponent, SubscriptionTagComponent, Timing,
@@ -41642,7 +42562,7 @@
41642
42562
 
41643
42563
 
41644
42564
 
41645
- },{"../cql-datatypes":2,"./core":56}],125:[function(require,module,exports){
42565
+ },{"../cql-datatypes":2,"./core":57}],126:[function(require,module,exports){
41646
42566
  // Generated by CoffeeScript 1.12.7
41647
42567
  (function() {
41648
42568
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Substance, SubstanceIngredientComponent, SubstanceInstanceComponent, Timing,
@@ -41877,7 +42797,7 @@
41877
42797
 
41878
42798
 
41879
42799
 
41880
- },{"../cql-datatypes":2,"./core":56}],126:[function(require,module,exports){
42800
+ },{"../cql-datatypes":2,"./core":57}],127:[function(require,module,exports){
41881
42801
  // Generated by CoffeeScript 1.12.7
41882
42802
  (function() {
41883
42803
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Supply, SupplyDispenseComponent, Timing,
@@ -42182,7 +43102,7 @@
42182
43102
 
42183
43103
 
42184
43104
 
42185
- },{"../cql-datatypes":2,"./core":56}],127:[function(require,module,exports){
43105
+ },{"../cql-datatypes":2,"./core":57}],128:[function(require,module,exports){
42186
43106
  // Generated by CoffeeScript 1.12.7
42187
43107
  (function() {
42188
43108
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, SupportingDocumentation, SupportingDocumentationDetailComponent, Timing,
@@ -42489,7 +43409,7 @@
42489
43409
 
42490
43410
 
42491
43411
 
42492
- },{"../cql-datatypes":2,"./core":56}],128:[function(require,module,exports){
43412
+ },{"../cql-datatypes":2,"./core":57}],129:[function(require,module,exports){
42493
43413
  // Generated by CoffeeScript 1.12.7
42494
43414
  (function() {
42495
43415
  var Address, Attachment, BackboneElement, CORE, CodeableConcept, Coding, ConceptDefinitionComponent, ConceptDefinitionDesignationComponent, ConceptReferenceComponent, ConceptSetComponent, ConceptSetFilterComponent, ContactPoint, DT, DomainResource, Element, ElementDefinition, Extension, HumanName, Identifier, Narrative, Parameters, Period, Quantity, Range, Ratio, Reference, Resource, SampledData, Timing, ValueSet, ValueSetComposeComponent, ValueSetDefineComponent, ValueSetExpansionComponent, ValueSetExpansionContainsComponent,
@@ -43379,7 +44299,7 @@
43379
44299
 
43380
44300
 
43381
44301
 
43382
- },{"../cql-datatypes":2,"./core":56}],129:[function(require,module,exports){
44302
+ },{"../cql-datatypes":2,"./core":57}],130:[function(require,module,exports){
43383
44303
  // Generated by CoffeeScript 1.12.7
43384
44304
  (function() {
43385
44305
  var Context, Exception, Library, PatientContext, PopulationContext, dt, typeIsArray, util,
@@ -43650,7 +44570,7 @@
43650
44570
  Context.prototype.matchesTupleTypeSpecifier = function(val, spec) {
43651
44571
  return typeof val === "object" && !typeIsArray(val) && spec.element.every((function(_this) {
43652
44572
  return function(x) {
43653
- return typeof val[x.name] === "undefined" || _this.matchesTypeSpecifier(val[x.name], x.type);
44573
+ return typeof val[x.name] === "undefined" || _this.matchesTypeSpecifier(val[x.name], x.elementType);
43654
44574
  };
43655
44575
  })(this));
43656
44576
  };
@@ -43673,6 +44593,8 @@
43673
44593
  return val != null ? val.isConcept : void 0;
43674
44594
  case "{urn:hl7-org:elm-types:r1}DateTime":
43675
44595
  return val != null ? val.isDateTime : void 0;
44596
+ case "{urn:hl7-org:elm-types:r1}Date":
44597
+ return val != null ? val.isDate : void 0;
43676
44598
  case "{urn:hl7-org:elm-types:r1}Quantity":
43677
44599
  return val != null ? val.isQuantity : void 0;
43678
44600
  case "{urn:hl7-org:elm-types:r1}Time":
@@ -43743,7 +44665,7 @@
43743
44665
  function PatientContext(library1, patient, codeService, parameters, executionDateTime) {
43744
44666
  this.library = library1;
43745
44667
  this.patient = patient;
43746
- this.executionDateTime = executionDateTime != null ? executionDateTime : dt.DateTime.fromDate(new Date());
44668
+ this.executionDateTime = executionDateTime != null ? executionDateTime : dt.DateTime.fromJSDate(new Date());
43747
44669
  PatientContext.__super__.constructor.call(this, this.library, codeService, parameters);
43748
44670
  }
43749
44671
 
@@ -43776,7 +44698,7 @@
43776
44698
  function PopulationContext(library1, results, codeService, parameters, executionDateTime) {
43777
44699
  this.library = library1;
43778
44700
  this.results = results;
43779
- this.executionDateTime = executionDateTime != null ? executionDateTime : dt.DateTime.fromDate(new Date());
44701
+ this.executionDateTime = executionDateTime != null ? executionDateTime : dt.DateTime.fromJSDate(new Date());
43780
44702
  PopulationContext.__super__.constructor.call(this, this.library, codeService, parameters);
43781
44703
  }
43782
44704
 
@@ -43817,7 +44739,7 @@
43817
44739
 
43818
44740
 
43819
44741
 
43820
- },{"../datatypes/datatypes":6,"../datatypes/exception":8,"../elm/library":25,"../util/util":135,"util":148}],130:[function(require,module,exports){
44742
+ },{"../datatypes/datatypes":6,"../datatypes/exception":8,"../elm/library":25,"../util/util":136,"util":149}],131:[function(require,module,exports){
43821
44743
  // Generated by CoffeeScript 1.12.7
43822
44744
  (function() {
43823
44745
  var Executor, PatientContext, PopulationContext, Results, ref;
@@ -43899,7 +44821,7 @@
43899
44821
 
43900
44822
 
43901
44823
 
43902
- },{"./context":129,"./results":132}],131:[function(require,module,exports){
44824
+ },{"./context":130,"./results":133}],132:[function(require,module,exports){
43903
44825
  // Generated by CoffeeScript 1.12.7
43904
44826
  (function() {
43905
44827
  var Repository, cql;
@@ -43941,7 +44863,7 @@
43941
44863
 
43942
44864
 
43943
44865
 
43944
- },{"../cql":4}],132:[function(require,module,exports){
44866
+ },{"../cql":4}],133:[function(require,module,exports){
43945
44867
  // Generated by CoffeeScript 1.12.7
43946
44868
  (function() {
43947
44869
  var Results;
@@ -43976,7 +44898,7 @@
43976
44898
 
43977
44899
 
43978
44900
 
43979
- },{}],133:[function(require,module,exports){
44901
+ },{}],134:[function(require,module,exports){
43980
44902
  // Generated by CoffeeScript 1.12.7
43981
44903
  (function() {
43982
44904
  var DateTime, Uncertainty, areDateTimesOrQuantities, areNumbers, classesEqual, codesAreEquivalent, compareEveryItemInArrays, compareObjects, deepCompareKeysAndValues, equals, equivalent, getClassOfObjects, getKeysFromObject, isCode, isFunction, isUncertainty;
@@ -43998,9 +44920,6 @@
43998
44920
  };
43999
44921
 
44000
44922
  module.exports.lessThan = function(a, b, precision) {
44001
- if (precision == null) {
44002
- precision = DateTime.Unit.MILLISECOND;
44003
- }
44004
44923
  switch (false) {
44005
44924
  case !areNumbers(a, b):
44006
44925
  return a < b;
@@ -44016,9 +44935,6 @@
44016
44935
  };
44017
44936
 
44018
44937
  module.exports.lessThanOrEquals = function(a, b, precision) {
44019
- if (precision == null) {
44020
- precision = DateTime.Unit.MILLISECOND;
44021
- }
44022
44938
  switch (false) {
44023
44939
  case !areNumbers(a, b):
44024
44940
  return a <= b;
@@ -44034,9 +44950,6 @@
44034
44950
  };
44035
44951
 
44036
44952
  module.exports.greaterThan = function(a, b, precision) {
44037
- if (precision == null) {
44038
- precision = DateTime.Unit.MILLISECOND;
44039
- }
44040
44953
  switch (false) {
44041
44954
  case !areNumbers(a, b):
44042
44955
  return a > b;
@@ -44052,9 +44965,6 @@
44052
44965
  };
44053
44966
 
44054
44967
  module.exports.greaterThanOrEquals = function(a, b, precision) {
44055
- if (precision == null) {
44056
- precision = DateTime.Unit.MILLISECOND;
44057
- }
44058
44968
  switch (false) {
44059
44969
  case !areNumbers(a, b):
44060
44970
  return a >= b;
@@ -44080,12 +44990,21 @@
44080
44990
  if (isCode(a)) {
44081
44991
  return codesAreEquivalent(a, b);
44082
44992
  }
44993
+ if (a != null ? a.isRatio : void 0) {
44994
+ return a.equivalent(b);
44995
+ }
44083
44996
  ref = getClassOfObjects(a, b), aClass = ref[0], bClass = ref[1];
44084
44997
  switch (aClass) {
44085
44998
  case '[object Array]':
44086
44999
  return compareEveryItemInArrays(a, b, equivalent);
44087
45000
  case '[object Object]':
44088
45001
  return compareObjects(a, b, equivalent);
45002
+ case '[object String]':
45003
+ if (bClass === '[object String]') {
45004
+ return (a.localeCompare(b, 'en', {
45005
+ sensitivity: 'base'
45006
+ })) === 0;
45007
+ }
44089
45008
  }
44090
45009
  return equals(a, b);
44091
45010
  };
@@ -44131,17 +45050,28 @@
44131
45050
 
44132
45051
  deepCompareKeysAndValues = function(a, b, comparisonFunction) {
44133
45052
  var aKeys, bKeys, finalComparisonResult, shouldReturnNull;
44134
- aKeys = getKeysFromObject(a);
44135
- bKeys = getKeysFromObject(b);
45053
+ aKeys = getKeysFromObject(a).sort();
45054
+ bKeys = getKeysFromObject(b).sort();
44136
45055
  shouldReturnNull = false;
44137
- finalComparisonResult = aKeys.length === bKeys.length && aKeys.every(function(key) {
44138
- var comparisonResult;
44139
- comparisonResult = comparisonFunction(a[key], b[key]);
44140
- if (comparisonResult === null) {
44141
- shouldReturnNull = true;
44142
- }
44143
- return comparisonResult;
44144
- });
45056
+ if (aKeys.length === bKeys.length && aKeys.every((function(_this) {
45057
+ return function(value, index) {
45058
+ return value === bKeys[index];
45059
+ };
45060
+ })(this))) {
45061
+ finalComparisonResult = aKeys.every(function(key) {
45062
+ var comparisonResult;
45063
+ if ((a[key] == null) && (b[key] == null)) {
45064
+ return true;
45065
+ }
45066
+ comparisonResult = comparisonFunction(a[key], b[key]);
45067
+ if (comparisonResult === null) {
45068
+ shouldReturnNull = true;
45069
+ }
45070
+ return comparisonResult;
45071
+ });
45072
+ } else {
45073
+ finalComparisonResult = false;
45074
+ }
44145
45075
  if (shouldReturnNull) {
44146
45076
  return null;
44147
45077
  }
@@ -44175,6 +45105,9 @@
44175
45105
  if (a != null ? a.isQuantity : void 0) {
44176
45106
  return a.equals(b);
44177
45107
  }
45108
+ if (a != null ? a.isRatio : void 0) {
45109
+ return a.equals(b);
45110
+ }
44178
45111
  if (a instanceof Uncertainty) {
44179
45112
  b = Uncertainty.from(b);
44180
45113
  } else if (b instanceof Uncertainty) {
@@ -44214,7 +45147,7 @@
44214
45147
 
44215
45148
 
44216
45149
 
44217
- },{"../datatypes/datetime":7,"../datatypes/uncertainty":11}],134:[function(require,module,exports){
45150
+ },{"../datatypes/datetime":7,"../datatypes/uncertainty":11}],135:[function(require,module,exports){
44218
45151
  // Generated by CoffeeScript 1.12.7
44219
45152
  (function() {
44220
45153
  var DateTime, Exception, MAX_DATE_VALUE, MAX_FLOAT_VALUE, MAX_INT_VALUE, MAX_TIME_VALUE, MIN_DATE_VALUE, MIN_FLOAT_PRECISION_VALUE, MIN_FLOAT_VALUE, MIN_INT_VALUE, MIN_TIME_VALUE, OverFlowException, Uncertainty, isValidDecimal, isValidInteger, predecessor, successor,
@@ -44247,26 +45180,26 @@
44247
45180
 
44248
45181
  module.exports.isValidInteger = isValidInteger = function(integer) {
44249
45182
  if (isNaN(integer)) {
44250
- throw new Error("Unable to parse Integer");
45183
+ return false;
44251
45184
  }
44252
45185
  if (integer > MAX_INT_VALUE) {
44253
- throw new Error("Maximum Integer value exceeded");
45186
+ return false;
44254
45187
  }
44255
45188
  if (integer < MIN_INT_VALUE) {
44256
- throw new Error("Minimum Integer value exceeded");
45189
+ return false;
44257
45190
  }
44258
45191
  return true;
44259
45192
  };
44260
45193
 
44261
45194
  module.exports.isValidDecimal = isValidDecimal = function(decimal) {
44262
45195
  if (isNaN(decimal)) {
44263
- throw new Error("Unable to parse Decimal");
45196
+ return false;
44264
45197
  }
44265
45198
  if (decimal > MAX_FLOAT_VALUE) {
44266
- throw new Error("Maximum Decimal value exceeded");
45199
+ return false;
44267
45200
  }
44268
45201
  if (decimal < MIN_FLOAT_VALUE) {
44269
- throw new Error("Minimum Decimal value exceeded");
45202
+ return false;
44270
45203
  }
44271
45204
  return true;
44272
45205
  };
@@ -44430,10 +45363,10 @@
44430
45363
 
44431
45364
 
44432
45365
 
44433
- },{"../datatypes/datetime":7,"../datatypes/exception":8,"../datatypes/uncertainty":11}],135:[function(require,module,exports){
45366
+ },{"../datatypes/datetime":7,"../datatypes/exception":8,"../datatypes/uncertainty":11}],136:[function(require,module,exports){
44434
45367
  // Generated by CoffeeScript 1.12.7
44435
45368
  (function() {
44436
- var typeIsArray;
45369
+ var getTimezoneSeparatorFromString, normalizeMillisecondsField, normalizeMillisecondsFieldInString, typeIsArray;
44437
45370
 
44438
45371
  module.exports.compact = function(things) {
44439
45372
  return things.filter(function(x) {
@@ -44482,11 +45415,42 @@
44482
45415
  }
44483
45416
  };
44484
45417
 
45418
+ module.exports.jsDate = Date;
45419
+
45420
+ module.exports.normalizeMillisecondsFieldInString = normalizeMillisecondsFieldInString = function(string, msString) {
45421
+ var beforeMs, msAndAfter, ref, timezoneField, timezoneSeparator;
45422
+ msString = normalizeMillisecondsField(msString);
45423
+ ref = string.split('.'), beforeMs = ref[0], msAndAfter = ref[1];
45424
+ timezoneSeparator = getTimezoneSeparatorFromString(msAndAfter);
45425
+ if (!!timezoneSeparator) {
45426
+ timezoneField = msAndAfter != null ? msAndAfter.split(timezoneSeparator)[1] : void 0;
45427
+ }
45428
+ if (timezoneField == null) {
45429
+ timezoneField = '';
45430
+ }
45431
+ return string = beforeMs + '.' + msString + timezoneSeparator + timezoneField;
45432
+ };
45433
+
45434
+ module.exports.normalizeMillisecondsField = normalizeMillisecondsField = function(msString) {
45435
+ return msString = (msString + "00").substring(0, 3);
45436
+ };
45437
+
45438
+ module.exports.getTimezoneSeparatorFromString = getTimezoneSeparatorFromString = function(string) {
45439
+ var ref, ref1, timezoneSeparator;
45440
+ if ((string != null ? (ref = string.match(/-/)) != null ? ref.length : void 0 : void 0) === 1) {
45441
+ return timezoneSeparator = '-';
45442
+ } else if ((string != null ? (ref1 = string.match(/\+/)) != null ? ref1.length : void 0 : void 0) === 1) {
45443
+ return timezoneSeparator = '+';
45444
+ } else {
45445
+ return timezoneSeparator = '';
45446
+ }
45447
+ };
45448
+
44485
45449
  }).call(this);
44486
45450
 
44487
45451
 
44488
45452
 
44489
- },{}],136:[function(require,module,exports){
45453
+ },{}],137:[function(require,module,exports){
44490
45454
  //! moment.js
44491
45455
  //! version : 2.20.1
44492
45456
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -49023,7 +49987,7 @@ return hooks;
49023
49987
 
49024
49988
  })));
49025
49989
 
49026
- },{}],137:[function(require,module,exports){
49990
+ },{}],138:[function(require,module,exports){
49027
49991
  // shim for using process in browser
49028
49992
  var process = module.exports = {};
49029
49993
 
@@ -49209,7 +50173,7 @@ process.chdir = function (dir) {
49209
50173
  };
49210
50174
  process.umask = function() { return 0; };
49211
50175
 
49212
- },{}],138:[function(require,module,exports){
50176
+ },{}],139:[function(require,module,exports){
49213
50177
  module.exports={
49214
50178
  "10*": {
49215
50179
  "value": 10,
@@ -50413,10 +51377,10 @@ module.exports={
50413
51377
  }
50414
51378
  }
50415
51379
 
50416
- },{}],139:[function(require,module,exports){
51380
+ },{}],140:[function(require,module,exports){
50417
51381
  module.exports={"mol":true,"sr":true,"Hz":true,"N":true,"Pa":true,"J":true,"W":true,"A":true,"V":true,"F":true,"Ohm":true,"S":true,"Wb":true,"Cel":true,"T":true,"H":true,"lm":true,"lx":true,"Bq":true,"Gy":true,"Sv":true,"l":true,"L":true,"ar":true,"t":true,"bar":true,"u":true,"eV":true,"pc":true,"[c]":true,"[h]":true,"[k]":true,"[eps_0]":true,"[mu_0]":true,"[e]":true,"[m_e]":true,"[m_p]":true,"[G]":true,"[g]":true,"[ly]":true,"gf":true,"Ky":true,"Gal":true,"dyn":true,"erg":true,"P":true,"Bi":true,"St":true,"Mx":true,"G":true,"Oe":true,"Gb":true,"sb":true,"Lmb":true,"ph":true,"Ci":true,"R":true,"RAD":true,"REM":true,"cal_[15]":true,"cal_[20]":true,"cal_m":true,"cal_IT":true,"cal_th":true,"cal":true,"tex":true,"m[H2O]":true,"m[Hg]":true,"eq":true,"osm":true,"g%":true,"kat":true,"U":true,"[iU]":true,"[IU]":true,"Np":true,"B":true,"B[SPL]":true,"B[V]":true,"B[mV]":true,"B[uV]":true,"B[10.nV]":true,"B[W]":true,"B[kW]":true,"st":true,"mho":true,"bit":true,"By":true,"Bd":true,"m":true,"s":true,"g":true,"rad":true,"K":true,"C":true,"cd":true}
50418
51382
 
50419
- },{}],140:[function(require,module,exports){
51383
+ },{}],141:[function(require,module,exports){
50420
51384
  module.exports={
50421
51385
  "Y": {
50422
51386
  "CODE": "YA",
@@ -50780,7 +51744,7 @@ module.exports={
50780
51744
  }
50781
51745
  }
50782
51746
 
50783
- },{}],141:[function(require,module,exports){
51747
+ },{}],142:[function(require,module,exports){
50784
51748
  module.exports={
50785
51749
  "Y": 1e+24,
50786
51750
  "Z": 1e+21,
@@ -50808,7 +51772,7 @@ module.exports={
50808
51772
  "Ti": 1099511627776
50809
51773
  }
50810
51774
 
50811
- },{}],142:[function(require,module,exports){
51775
+ },{}],143:[function(require,module,exports){
50812
51776
  module.exports = function () {
50813
51777
  /*
50814
51778
  * Generated by PEG.js 0.8.0.
@@ -51965,7 +52929,7 @@ module.exports = function () {
51965
52929
  };
51966
52930
  }();
51967
52931
 
51968
- },{"../lib/helpers":144,"./metrics.json":139,"./prefixMetadata.json":140,"./prefixes.json":141,"./unitMetadata.json":143}],143:[function(require,module,exports){
52932
+ },{"../lib/helpers":145,"./metrics.json":140,"./prefixMetadata.json":141,"./prefixes.json":142,"./unitMetadata.json":144}],144:[function(require,module,exports){
51969
52933
  module.exports={
51970
52934
  "10*": {
51971
52935
  "isBase": false,
@@ -58152,7 +59116,7 @@ module.exports={
58152
59116
  }
58153
59117
  }
58154
59118
 
58155
- },{}],144:[function(require,module,exports){
59119
+ },{}],145:[function(require,module,exports){
58156
59120
  module.exports = {
58157
59121
 
58158
59122
  multiply: function multiply(t, ms) {
@@ -58222,7 +59186,7 @@ module.exports = {
58222
59186
  }
58223
59187
  };
58224
59188
 
58225
- },{}],145:[function(require,module,exports){
59189
+ },{}],146:[function(require,module,exports){
58226
59190
  parser = require('./generated/ucum-parser.js');
58227
59191
  equivalents = require('./generated/equivalents.json');
58228
59192
  helpers = require('./lib/helpers.js');
@@ -58443,7 +59407,7 @@ function unitQuery(criteria, resultFields) {
58443
59407
  });
58444
59408
  }
58445
59409
 
58446
- },{"./generated/equivalents.json":138,"./generated/ucum-parser.js":142,"./generated/unitMetadata.json":143,"./lib/helpers.js":144}],146:[function(require,module,exports){
59410
+ },{"./generated/equivalents.json":139,"./generated/ucum-parser.js":143,"./generated/unitMetadata.json":144,"./lib/helpers.js":145}],147:[function(require,module,exports){
58447
59411
  if (typeof Object.create === 'function') {
58448
59412
  // implementation from standard node.js 'util' module
58449
59413
  module.exports = function inherits(ctor, superCtor) {
@@ -58468,14 +59432,14 @@ if (typeof Object.create === 'function') {
58468
59432
  }
58469
59433
  }
58470
59434
 
58471
- },{}],147:[function(require,module,exports){
59435
+ },{}],148:[function(require,module,exports){
58472
59436
  module.exports = function isBuffer(arg) {
58473
59437
  return arg && typeof arg === 'object'
58474
59438
  && typeof arg.copy === 'function'
58475
59439
  && typeof arg.fill === 'function'
58476
59440
  && typeof arg.readUInt8 === 'function';
58477
59441
  }
58478
- },{}],148:[function(require,module,exports){
59442
+ },{}],149:[function(require,module,exports){
58479
59443
  (function (process,global){
58480
59444
  // Copyright Joyent, Inc. and other Node contributors.
58481
59445
  //
@@ -59065,4 +60029,4 @@ function hasOwnProperty(obj, prop) {
59065
60029
  }
59066
60030
 
59067
60031
  }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
59068
- },{"./support/isBuffer":147,"_process":137,"inherits":146}]},{},[38]);
60032
+ },{"./support/isBuffer":148,"_process":138,"inherits":147}]},{},[39]);