cqm-models 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/cqm-models.gemspec +1 -1
- data/dist/index.js +543 -125
- data/package.json +2 -2
- data/yarn.lock +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9d47b3179ff71c148dc93685264bb99d67450df
|
4
|
+
data.tar.gz: ce27d319bba38981c36c9f39c1a4f73c1568baa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 945986b71beeb3de8d60896a831b55662c8b34c09681e303534c415b57b1e98310be61846fa176e004ec553f94174f3a8707ab2968336924161c0f27f90c56e4
|
7
|
+
data.tar.gz: 7811109c26110d36417c1967baf46cbf51f8fd9feed91f20e7491a96b181b561758b0a18274619f14b461f1d6472623af47451b873cb6e12108ceec313764e3c
|
@@ -10,6 +10,7 @@ Pull requests into cqm-models require the following. Submitter and reviewer shou
|
|
10
10
|
- [ ] If there were any JavaScript changes, this PR has updated the `dist` directory using `npm run dist`
|
11
11
|
- [ ] If applicable, the library version number in `package.json` and `cqm-models.gemspec` has been updated
|
12
12
|
- [ ] All changes can be reproduced by running the generator script
|
13
|
+
- [ ] Cqm-execution fixtures have been updated with the update_cqm_execution_fixtures.sh script inside server-scripts using this branch in the cqm-converter
|
13
14
|
|
14
15
|
**Bonnie Reviewer:**
|
15
16
|
|
data/cqm-models.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'cqm-models'
|
7
|
-
spec.version = '1.0.
|
7
|
+
spec.version = '1.0.2'
|
8
8
|
spec.authors = ['aholmes@mitre.org', 'mokeefe@mitre.org', 'lades@mitre.org']
|
9
9
|
|
10
10
|
spec.summary = 'Mongo models that correspond to the QDM specification.'
|
data/dist/index.js
CHANGED
@@ -26004,7 +26004,8 @@ function objectToString(o) {
|
|
26004
26004
|
},{"./clinical":150,"./datetime":152,"./interval":154,"./logic":155,"./uncertainty":156}],152:[function(require,module,exports){
|
26005
26005
|
// Generated by CoffeeScript 1.12.7
|
26006
26006
|
(function() {
|
26007
|
-
var Date, DateTime, Uncertainty, cqlFormatStringToMomentFormatString, daysInMonth, getTimezoneSeparatorFromString, isValidDateStringFormat, isValidDateTimeStringFormat, jsDate, moment, normalizeMillisecondsField, normalizeMillisecondsFieldInString, ref
|
26007
|
+
var Date, DateTime, Uncertainty, cqlFormatStringToMomentFormatString, daysInMonth, getTimezoneSeparatorFromString, isValidDateStringFormat, isValidDateTimeStringFormat, jsDate, moment, normalizeMillisecondsField, normalizeMillisecondsFieldInString, ref,
|
26008
|
+
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; };
|
26008
26009
|
|
26009
26010
|
Uncertainty = require('./uncertainty').Uncertainty;
|
26010
26011
|
|
@@ -26357,6 +26358,32 @@ function objectToString(o) {
|
|
26357
26358
|
};
|
26358
26359
|
|
26359
26360
|
DateTime.prototype.toString = function() {
|
26361
|
+
if (this.isTime()) {
|
26362
|
+
return this.toStringTime();
|
26363
|
+
} else {
|
26364
|
+
return this.toStringDateTime();
|
26365
|
+
}
|
26366
|
+
};
|
26367
|
+
|
26368
|
+
DateTime.prototype.toStringTime = function() {
|
26369
|
+
var str;
|
26370
|
+
str = 'T';
|
26371
|
+
if (this.hour != null) {
|
26372
|
+
str += +this._pad(this.hour);
|
26373
|
+
if (this.minute != null) {
|
26374
|
+
str += ':' + this._pad(this.minute);
|
26375
|
+
if (this.second != null) {
|
26376
|
+
str += ':' + this._pad(this.second);
|
26377
|
+
if (this.millisecond != null) {
|
26378
|
+
str += '.' + String("00" + this.millisecond).slice(-3);
|
26379
|
+
}
|
26380
|
+
}
|
26381
|
+
}
|
26382
|
+
}
|
26383
|
+
return str;
|
26384
|
+
};
|
26385
|
+
|
26386
|
+
DateTime.prototype.toStringDateTime = function() {
|
26360
26387
|
var offsetHours, offsetMin, str;
|
26361
26388
|
str = '';
|
26362
26389
|
if (this.year != null) {
|
@@ -26390,6 +26417,10 @@ function objectToString(o) {
|
|
26390
26417
|
return str;
|
26391
26418
|
};
|
26392
26419
|
|
26420
|
+
DateTime.prototype.getDateTime = function() {
|
26421
|
+
return this;
|
26422
|
+
};
|
26423
|
+
|
26393
26424
|
DateTime.prototype.getDate = function() {
|
26394
26425
|
return new Date(this.year, this.month, this.day);
|
26395
26426
|
};
|
@@ -26700,12 +26731,18 @@ function objectToString(o) {
|
|
26700
26731
|
|
26701
26732
|
DateTime.prototype.isMorePrecise = Date.prototype.isMorePrecise = function(other) {
|
26702
26733
|
var field, i, len, ref1;
|
26703
|
-
|
26704
|
-
|
26705
|
-
field = ref1[i];
|
26706
|
-
if ((other[field] != null) && (this[field] == null)) {
|
26734
|
+
if (typeof other === 'string' && indexOf.call(this.constructor.FIELDS, other) >= 0) {
|
26735
|
+
if (this[other] == null) {
|
26707
26736
|
return false;
|
26708
26737
|
}
|
26738
|
+
} else {
|
26739
|
+
ref1 = this.constructor.FIELDS;
|
26740
|
+
for (i = 0, len = ref1.length; i < len; i++) {
|
26741
|
+
field = ref1[i];
|
26742
|
+
if ((other[field] != null) && (this[field] == null)) {
|
26743
|
+
return false;
|
26744
|
+
}
|
26745
|
+
}
|
26709
26746
|
}
|
26710
26747
|
return !this.isSamePrecision(other);
|
26711
26748
|
};
|
@@ -26716,6 +26753,9 @@ function objectToString(o) {
|
|
26716
26753
|
|
26717
26754
|
DateTime.prototype.isSamePrecision = Date.prototype.isSamePrecision = function(other) {
|
26718
26755
|
var field, i, len, ref1;
|
26756
|
+
if (typeof other === 'string' && indexOf.call(this.constructor.FIELDS, other) >= 0) {
|
26757
|
+
return other === this.getPrecision();
|
26758
|
+
}
|
26719
26759
|
ref1 = this.constructor.FIELDS;
|
26720
26760
|
for (i = 0, len = ref1.length; i < len; i++) {
|
26721
26761
|
field = ref1[i];
|
@@ -27520,6 +27560,13 @@ function objectToString(o) {
|
|
27520
27560
|
}
|
27521
27561
|
};
|
27522
27562
|
|
27563
|
+
Interval.prototype.toString = function() {
|
27564
|
+
var end, start;
|
27565
|
+
start = this.lowClosed ? '[' : '(';
|
27566
|
+
end = this.highClosed ? ']' : ')';
|
27567
|
+
return start + this.low.toString() + ', ' + this.high.toString() + end;
|
27568
|
+
};
|
27569
|
+
|
27523
27570
|
return Interval;
|
27524
27571
|
|
27525
27572
|
})();
|
@@ -29014,6 +29061,9 @@ function objectToString(o) {
|
|
29014
29061
|
var date1, date2, ref, result;
|
29015
29062
|
ref = this.execArgs(ctx), date1 = ref[0], date2 = ref[1];
|
29016
29063
|
if ((date1 != null) && (date2 != null)) {
|
29064
|
+
if (date2.isDate && date1.isDateTime) {
|
29065
|
+
date1 = date1.getDate();
|
29066
|
+
}
|
29017
29067
|
result = date1.durationBetween(date2, this.precision.toLowerCase());
|
29018
29068
|
if ((result != null) && result.isPoint()) {
|
29019
29069
|
return result.low;
|
@@ -30023,9 +30073,10 @@ function objectToString(o) {
|
|
30023
30073
|
},{"../datatypes/datatypes":151,"./builder":159,"./expression":165,"./quantity":177}],169:[function(require,module,exports){
|
30024
30074
|
// Generated by CoffeeScript 1.12.7
|
30025
30075
|
(function() {
|
30026
|
-
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,
|
30076
|
+
var Collapse, End, Ends, Expand, Expression, Interval, MIN_FLOAT_PRECISION_VALUE, Meets, MeetsAfter, MeetsBefore, Overlaps, OverlapsAfter, OverlapsBefore, Quantity, Start, Starts, ThreeValuedLogic, UnimplementedExpression, Width, build, cmp, collapseIntervals, compare_units, convert_value, doAddition, doIncludes, doSubtraction, dtivl, intervalListType, predecessor, ref, ref1, ref2, successor,
|
30027
30077
|
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; },
|
30028
|
-
hasProp = {}.hasOwnProperty
|
30078
|
+
hasProp = {}.hasOwnProperty,
|
30079
|
+
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; };
|
30029
30080
|
|
30030
30081
|
ref = require('./expression'), Expression = ref.Expression, UnimplementedExpression = ref.UnimplementedExpression;
|
30031
30082
|
|
@@ -30033,9 +30084,9 @@ function objectToString(o) {
|
|
30033
30084
|
|
30034
30085
|
build = require('./builder').build;
|
30035
30086
|
|
30036
|
-
ref1 = require('./quantity'), Quantity = ref1.Quantity, doAddition = ref1.doAddition, doSubtraction = ref1.doSubtraction;
|
30087
|
+
ref1 = require('./quantity'), Quantity = ref1.Quantity, doAddition = ref1.doAddition, doSubtraction = ref1.doSubtraction, compare_units = ref1.compare_units, convert_value = ref1.convert_value;
|
30037
30088
|
|
30038
|
-
ref2 = require('../util/math'), successor = ref2.successor, predecessor = ref2.predecessor;
|
30089
|
+
ref2 = require('../util/math'), successor = ref2.successor, predecessor = ref2.predecessor, MIN_FLOAT_PRECISION_VALUE = ref2.MIN_FLOAT_PRECISION_VALUE;
|
30039
30090
|
|
30040
30091
|
dtivl = require('../datatypes/interval');
|
30041
30092
|
|
@@ -30340,6 +30391,252 @@ function objectToString(o) {
|
|
30340
30391
|
|
30341
30392
|
})(Expression);
|
30342
30393
|
|
30394
|
+
intervalListType = function(intervals) {
|
30395
|
+
var high, itvl, j, len, low, ref3, ref4, type;
|
30396
|
+
type = null;
|
30397
|
+
for (j = 0, len = intervals.length; j < len; j++) {
|
30398
|
+
itvl = intervals[j];
|
30399
|
+
if (itvl == null) {
|
30400
|
+
continue;
|
30401
|
+
}
|
30402
|
+
if ((itvl.low == null) && (itvl.high == null)) {
|
30403
|
+
continue;
|
30404
|
+
}
|
30405
|
+
low = (ref3 = itvl.low) != null ? ref3 : itvl.high;
|
30406
|
+
high = (ref4 = itvl.high) != null ? ref4 : itvl.low;
|
30407
|
+
if ((typeof low.isTime === "function" ? low.isTime() : void 0) && (typeof high.isTime === "function" ? high.isTime() : void 0)) {
|
30408
|
+
if (type == null) {
|
30409
|
+
type = 'time';
|
30410
|
+
} else if (type === 'time') {
|
30411
|
+
continue;
|
30412
|
+
} else {
|
30413
|
+
return 'mismatch';
|
30414
|
+
}
|
30415
|
+
} else if ((low.isDateTime || high.isDateTime) && (low.isDateTime || low.isDate) && (high.isDateTime || high.isDate)) {
|
30416
|
+
if ((type == null) || type === 'date') {
|
30417
|
+
type = 'datetime';
|
30418
|
+
} else if (type === 'datetime') {
|
30419
|
+
continue;
|
30420
|
+
} else {
|
30421
|
+
return 'mismatch';
|
30422
|
+
}
|
30423
|
+
} else if (low.isDate && high.isDate) {
|
30424
|
+
if (type == null) {
|
30425
|
+
type = 'date';
|
30426
|
+
} else if (type === 'date' || 'datetime') {
|
30427
|
+
continue;
|
30428
|
+
} else {
|
30429
|
+
return 'mismatch';
|
30430
|
+
}
|
30431
|
+
} else if (low.isQuantity && high.isQuantity) {
|
30432
|
+
if (type == null) {
|
30433
|
+
type = 'quantity';
|
30434
|
+
} else if (type === 'quantity') {
|
30435
|
+
continue;
|
30436
|
+
} else {
|
30437
|
+
return 'mismatch';
|
30438
|
+
}
|
30439
|
+
} else if (Number.isInteger(low) && Number.isInteger(high)) {
|
30440
|
+
if (type == null) {
|
30441
|
+
type = 'integer';
|
30442
|
+
} else if (type === 'integer' || 'decimal') {
|
30443
|
+
continue;
|
30444
|
+
} else {
|
30445
|
+
return 'mismatch';
|
30446
|
+
}
|
30447
|
+
} else if (typeof low === 'number' && typeof high === 'number') {
|
30448
|
+
if ((type == null) || type === 'integer') {
|
30449
|
+
type = 'decimal';
|
30450
|
+
} else if (type === 'decimal') {
|
30451
|
+
continue;
|
30452
|
+
} else {
|
30453
|
+
return 'mismatch';
|
30454
|
+
}
|
30455
|
+
} else {
|
30456
|
+
return 'mismatch';
|
30457
|
+
}
|
30458
|
+
}
|
30459
|
+
return type;
|
30460
|
+
};
|
30461
|
+
|
30462
|
+
module.exports.Expand = Expand = (function(superClass) {
|
30463
|
+
extend(Expand, superClass);
|
30464
|
+
|
30465
|
+
function Expand(json) {
|
30466
|
+
Expand.__super__.constructor.apply(this, arguments);
|
30467
|
+
}
|
30468
|
+
|
30469
|
+
Expand.prototype.exec = function(ctx) {
|
30470
|
+
var defaultPer, expandFunction, interval, intervals, items, j, len, per, ref3, results, type;
|
30471
|
+
ref3 = this.execArgs(ctx), intervals = ref3[0], per = ref3[1];
|
30472
|
+
type = intervalListType(intervals);
|
30473
|
+
if (type === 'mismatch') {
|
30474
|
+
throw new Error("List of intervals contains mismatched types.");
|
30475
|
+
}
|
30476
|
+
if (type == null) {
|
30477
|
+
return null;
|
30478
|
+
}
|
30479
|
+
intervals = collapseIntervals(intervals, per);
|
30480
|
+
if (intervals.length === 0) {
|
30481
|
+
return [];
|
30482
|
+
}
|
30483
|
+
if (type === "time" || type === "date" || type === "datetime") {
|
30484
|
+
expandFunction = this.expandDTishInterval;
|
30485
|
+
defaultPer = function(interval) {
|
30486
|
+
return new Quantity({
|
30487
|
+
value: 1,
|
30488
|
+
unit: interval.low.getPrecision()
|
30489
|
+
});
|
30490
|
+
};
|
30491
|
+
} else if (type === "quantity") {
|
30492
|
+
expandFunction = this.expandQuantityInterval;
|
30493
|
+
defaultPer = function(interval) {
|
30494
|
+
return new Quantity({
|
30495
|
+
value: 1,
|
30496
|
+
unit: interval.low.unit
|
30497
|
+
});
|
30498
|
+
};
|
30499
|
+
} else if (type === "integer" || type === "decimal") {
|
30500
|
+
expandFunction = this.expandNumericInterval;
|
30501
|
+
defaultPer = function(interval) {
|
30502
|
+
return new Quantity({
|
30503
|
+
value: 1,
|
30504
|
+
unit: '1'
|
30505
|
+
});
|
30506
|
+
};
|
30507
|
+
} else {
|
30508
|
+
throw new Error("Interval list type not yet supported.");
|
30509
|
+
}
|
30510
|
+
results = [];
|
30511
|
+
for (j = 0, len = intervals.length; j < len; j++) {
|
30512
|
+
interval = intervals[j];
|
30513
|
+
if (interval == null) {
|
30514
|
+
continue;
|
30515
|
+
}
|
30516
|
+
if ((interval.low == null) || (interval.high == null)) {
|
30517
|
+
return null;
|
30518
|
+
}
|
30519
|
+
if (type === 'datetime') {
|
30520
|
+
interval.low = interval.low.getDateTime();
|
30521
|
+
interval.high = interval.high.getDateTime();
|
30522
|
+
}
|
30523
|
+
per = per != null ? per : defaultPer(interval);
|
30524
|
+
items = expandFunction.call(this, interval, per);
|
30525
|
+
if (items === null) {
|
30526
|
+
return null;
|
30527
|
+
}
|
30528
|
+
results.push.apply(results, items);
|
30529
|
+
}
|
30530
|
+
return results;
|
30531
|
+
};
|
30532
|
+
|
30533
|
+
Expand.prototype.expandDTishInterval = function(interval, per) {
|
30534
|
+
var count, current_high, current_low, high, i, j, k, low, point_intervals, ref3, ref4, ref5, ref6, results;
|
30535
|
+
if ((ref3 = per.unit) === 'week' || ref3 === 'weeks') {
|
30536
|
+
per.value *= 7;
|
30537
|
+
per.unit = 'day';
|
30538
|
+
}
|
30539
|
+
if (ref4 = per.unit, indexOf.call(interval.low.constructor.FIELDS, ref4) < 0) {
|
30540
|
+
return null;
|
30541
|
+
}
|
30542
|
+
if (interval.low.isLessPrecise(per.unit)) {
|
30543
|
+
return null;
|
30544
|
+
}
|
30545
|
+
low = interval.lowClosed ? interval.low : interval.low.successor();
|
30546
|
+
high = interval.highClosed ? interval.high : interval.high.predecessor();
|
30547
|
+
if (low.after(high)) {
|
30548
|
+
return [];
|
30549
|
+
}
|
30550
|
+
current_low = low;
|
30551
|
+
results = [];
|
30552
|
+
point_intervals = current_low.add(per.value, per.unit).predecessor().equals(current_low);
|
30553
|
+
if (per.unit === low.getPrecision()) {
|
30554
|
+
count = Math.floor((low.durationBetween(high, per.unit).high + 1) / per.value);
|
30555
|
+
} else {
|
30556
|
+
count = Math.floor((low.durationBetween(high, per.unit).low + 1) / per.value);
|
30557
|
+
}
|
30558
|
+
if (point_intervals) {
|
30559
|
+
for (i = j = 1, ref5 = count + 1; 1 <= ref5 ? j <= ref5 : j >= ref5; i = 1 <= ref5 ? ++j : --j) {
|
30560
|
+
results.push(new dtivl.Interval(current_low, current_low.copy(), true, true));
|
30561
|
+
current_low = current_low.add(per.value, per.unit);
|
30562
|
+
}
|
30563
|
+
} else {
|
30564
|
+
for (i = k = 1, ref6 = count; 1 <= ref6 ? k <= ref6 : k >= ref6; i = 1 <= ref6 ? ++k : --k) {
|
30565
|
+
current_high = current_low.add(per.value, per.unit).predecessor();
|
30566
|
+
results.push(new dtivl.Interval(current_low, current_high, true, true));
|
30567
|
+
current_low = current_low.add(per.value, per.unit);
|
30568
|
+
}
|
30569
|
+
}
|
30570
|
+
if (results.length > 0 && !results[results.length - 1].high.sameOrBefore(high)) {
|
30571
|
+
results.pop();
|
30572
|
+
}
|
30573
|
+
return results;
|
30574
|
+
};
|
30575
|
+
|
30576
|
+
Expand.prototype.expandQuantityInterval = function(interval, per) {
|
30577
|
+
var high_value, itvl, j, len, low_value, per_value, result_units, results;
|
30578
|
+
if (compare_units(interval.low.unit, per.unit) > 0) {
|
30579
|
+
result_units = per.unit;
|
30580
|
+
} else {
|
30581
|
+
result_units = interval.low.unit;
|
30582
|
+
}
|
30583
|
+
low_value = convert_value(interval.low.value, interval.low.unit, result_units);
|
30584
|
+
high_value = convert_value(interval.high.value, interval.high.unit, result_units);
|
30585
|
+
per_value = convert_value(per.value, per.unit, result_units);
|
30586
|
+
if (!((low_value != null) && (high_value != null) && (per_value != null))) {
|
30587
|
+
return null;
|
30588
|
+
}
|
30589
|
+
results = this.makeNumericIntervalList(low_value, high_value, interval.lowClosed, interval.highClosed, per_value);
|
30590
|
+
for (j = 0, len = results.length; j < len; j++) {
|
30591
|
+
itvl = results[j];
|
30592
|
+
itvl.low = new Quantity({
|
30593
|
+
value: itvl.low,
|
30594
|
+
unit: result_units
|
30595
|
+
});
|
30596
|
+
itvl.high = new Quantity({
|
30597
|
+
value: itvl.high,
|
30598
|
+
unit: result_units
|
30599
|
+
});
|
30600
|
+
}
|
30601
|
+
return results;
|
30602
|
+
};
|
30603
|
+
|
30604
|
+
Expand.prototype.expandNumericInterval = function(interval, per) {
|
30605
|
+
if (per.unit !== '1') {
|
30606
|
+
return null;
|
30607
|
+
}
|
30608
|
+
return this.makeNumericIntervalList(interval.low, interval.high, interval.lowClosed, interval.highClosed, per.value);
|
30609
|
+
};
|
30610
|
+
|
30611
|
+
Expand.prototype.makeNumericIntervalList = function(low, high, lowClosed, highClosed, per) {
|
30612
|
+
var gap, point_intervals, results, width, x;
|
30613
|
+
point_intervals = Number.isInteger(low) && Number.isInteger(high) && Number.isInteger(per);
|
30614
|
+
gap = point_intervals ? 1 : MIN_FLOAT_PRECISION_VALUE;
|
30615
|
+
if (!lowClosed) {
|
30616
|
+
low = low + gap;
|
30617
|
+
}
|
30618
|
+
if (!highClosed) {
|
30619
|
+
high = high - gap;
|
30620
|
+
}
|
30621
|
+
width = per - gap;
|
30622
|
+
if (low > high) {
|
30623
|
+
return [];
|
30624
|
+
}
|
30625
|
+
results = (function() {
|
30626
|
+
var j, ref3, ref4, ref5, results1;
|
30627
|
+
results1 = [];
|
30628
|
+
for (x = j = ref3 = low, ref4 = high - width, ref5 = per; ref5 > 0 ? j <= ref4 : j >= ref4; x = j += ref5) {
|
30629
|
+
results1.push(new dtivl.Interval(x, x + width, true, true));
|
30630
|
+
}
|
30631
|
+
return results1;
|
30632
|
+
})();
|
30633
|
+
return results;
|
30634
|
+
};
|
30635
|
+
|
30636
|
+
return Expand;
|
30637
|
+
|
30638
|
+
})(Expression);
|
30639
|
+
|
30343
30640
|
module.exports.Collapse = Collapse = (function(superClass) {
|
30344
30641
|
extend(Collapse, superClass);
|
30345
30642
|
|
@@ -30348,141 +30645,146 @@ function objectToString(o) {
|
|
30348
30645
|
}
|
30349
30646
|
|
30350
30647
|
Collapse.prototype.exec = function(ctx) {
|
30351
|
-
var
|
30648
|
+
var intervals, perWidth, ref3;
|
30352
30649
|
ref3 = this.execArgs(ctx), intervals = ref3[0], perWidth = ref3[1];
|
30353
|
-
|
30354
|
-
|
30355
|
-
|
30356
|
-
|
30357
|
-
|
30358
|
-
|
30650
|
+
return collapseIntervals(intervals, perWidth);
|
30651
|
+
};
|
30652
|
+
|
30653
|
+
return Collapse;
|
30654
|
+
|
30655
|
+
})(Expression);
|
30656
|
+
|
30657
|
+
collapseIntervals = function(intervals, perWidth) {
|
30658
|
+
var a, b, collapsedIntervals, interval, intervalsClone, j, len, precisionUnits, ref3, ref4, ref5, ref6;
|
30659
|
+
intervalsClone = [];
|
30660
|
+
for (j = 0, len = intervals.length; j < len; j++) {
|
30661
|
+
interval = intervals[j];
|
30662
|
+
if (interval != null) {
|
30663
|
+
intervalsClone.push(interval.copy());
|
30359
30664
|
}
|
30360
|
-
|
30361
|
-
|
30362
|
-
|
30363
|
-
|
30364
|
-
|
30365
|
-
|
30366
|
-
|
30367
|
-
|
30368
|
-
|
30369
|
-
|
30370
|
-
|
30371
|
-
|
30372
|
-
|
30373
|
-
}
|
30374
|
-
|
30375
|
-
|
30376
|
-
perWidth = successor(intervalsClone[0].low) - intervalsClone[0].low;
|
30377
|
-
}
|
30378
|
-
} else if (intervalsClone[0].high != null) {
|
30379
|
-
if (intervalsClone[0].high.isDateTime) {
|
30380
|
-
precisionUnits = intervalsClone[0].high.getPrecision();
|
30381
|
-
perWidth = new Quantity({
|
30382
|
-
value: 1,
|
30383
|
-
unit: precisionUnits
|
30384
|
-
});
|
30385
|
-
} else if (intervalsClone[0].high.isQuantity) {
|
30386
|
-
perWidth = doSubtraction(successor(intervalsClone[0].high), intervalsClone[0].high);
|
30387
|
-
} else {
|
30388
|
-
perWidth = successor(intervalsClone[0].high) - intervalsClone[0].high;
|
30389
|
-
}
|
30665
|
+
}
|
30666
|
+
if (intervals == null) {
|
30667
|
+
return null;
|
30668
|
+
} else if ((intervalsClone != null ? intervalsClone.length : void 0) <= 1) {
|
30669
|
+
return intervalsClone;
|
30670
|
+
} else {
|
30671
|
+
if (perWidth == null) {
|
30672
|
+
if (intervalsClone[0].low != null) {
|
30673
|
+
if (intervalsClone[0].low.isDateTime) {
|
30674
|
+
precisionUnits = intervalsClone[0].low.getPrecision();
|
30675
|
+
perWidth = new Quantity({
|
30676
|
+
value: 1,
|
30677
|
+
unit: precisionUnits
|
30678
|
+
});
|
30679
|
+
} else if (intervalsClone[0].low.isQuantity) {
|
30680
|
+
perWidth = doSubtraction(successor(intervalsClone[0].low), intervalsClone[0].low);
|
30390
30681
|
} else {
|
30391
|
-
|
30682
|
+
perWidth = successor(intervalsClone[0].low) - intervalsClone[0].low;
|
30392
30683
|
}
|
30393
|
-
|
30684
|
+
} else if (intervalsClone[0].high != null) {
|
30685
|
+
if (intervalsClone[0].high.isDateTime) {
|
30686
|
+
precisionUnits = intervalsClone[0].high.getPrecision();
|
30394
30687
|
perWidth = new Quantity({
|
30395
|
-
value:
|
30396
|
-
unit:
|
30688
|
+
value: 1,
|
30689
|
+
unit: precisionUnits
|
30397
30690
|
});
|
30691
|
+
} else if (intervalsClone[0].high.isQuantity) {
|
30692
|
+
perWidth = doSubtraction(successor(intervalsClone[0].high), intervalsClone[0].high);
|
30693
|
+
} else {
|
30694
|
+
perWidth = successor(intervalsClone[0].high) - intervalsClone[0].high;
|
30398
30695
|
}
|
30696
|
+
} else {
|
30697
|
+
throw new Error("Point type of intervals provided to collapse cannot be determined.");
|
30399
30698
|
}
|
30400
|
-
|
30401
|
-
|
30402
|
-
|
30403
|
-
|
30404
|
-
|
30405
|
-
|
30406
|
-
|
30407
|
-
|
30408
|
-
|
30409
|
-
|
30410
|
-
|
30411
|
-
|
30412
|
-
|
30413
|
-
|
30414
|
-
return 1;
|
30415
|
-
}
|
30416
|
-
} else if ((a.low != null) && (b.low == null)) {
|
30699
|
+
if (typeof perWidth === 'number') {
|
30700
|
+
perWidth = new Quantity({
|
30701
|
+
value: perWidth,
|
30702
|
+
unit: '1'
|
30703
|
+
});
|
30704
|
+
}
|
30705
|
+
}
|
30706
|
+
intervalsClone.sort(function(a, b) {
|
30707
|
+
var ref3, ref4;
|
30708
|
+
if (typeof ((ref3 = a.low) != null ? ref3.before : void 0) === 'function') {
|
30709
|
+
if ((b.low != null) && a.low.before(b.low)) {
|
30710
|
+
return -1;
|
30711
|
+
}
|
30712
|
+
if ((b.low == null) || a.low.after(b.low)) {
|
30417
30713
|
return 1;
|
30418
|
-
}
|
30714
|
+
}
|
30715
|
+
} else if ((a.low != null) && (b.low != null)) {
|
30716
|
+
if (a.low < b.low) {
|
30419
30717
|
return -1;
|
30420
30718
|
}
|
30421
|
-
if (
|
30422
|
-
|
30423
|
-
|
30424
|
-
|
30425
|
-
|
30426
|
-
|
30427
|
-
|
30428
|
-
|
30429
|
-
|
30430
|
-
|
30431
|
-
}
|
30432
|
-
if (a.high > b.high) {
|
30433
|
-
return 1;
|
30434
|
-
}
|
30435
|
-
} else if ((a.high != null) && (b.high == null)) {
|
30719
|
+
if (a.low > b.low) {
|
30720
|
+
return 1;
|
30721
|
+
}
|
30722
|
+
} else if ((a.low != null) && (b.low == null)) {
|
30723
|
+
return 1;
|
30724
|
+
} else if ((a.low == null) && (b.low != null)) {
|
30725
|
+
return -1;
|
30726
|
+
}
|
30727
|
+
if (typeof ((ref4 = a.high) != null ? ref4.before : void 0) === 'function') {
|
30728
|
+
if ((b.high == null) || a.high.before(b.high)) {
|
30436
30729
|
return -1;
|
30437
|
-
}
|
30730
|
+
}
|
30731
|
+
if (a.high.after(b.high)) {
|
30438
30732
|
return 1;
|
30439
30733
|
}
|
30440
|
-
|
30441
|
-
|
30442
|
-
|
30443
|
-
|
30444
|
-
|
30445
|
-
|
30446
|
-
|
30447
|
-
|
30448
|
-
|
30449
|
-
|
30450
|
-
|
30451
|
-
|
30734
|
+
} else if ((a.high != null) && (b.high != null)) {
|
30735
|
+
if (a.high < b.high) {
|
30736
|
+
return -1;
|
30737
|
+
}
|
30738
|
+
if (a.high > b.high) {
|
30739
|
+
return 1;
|
30740
|
+
}
|
30741
|
+
} else if ((a.high != null) && (b.high == null)) {
|
30742
|
+
return -1;
|
30743
|
+
} else if ((a.high == null) && (b.high != null)) {
|
30744
|
+
return 1;
|
30745
|
+
}
|
30746
|
+
return 0;
|
30747
|
+
});
|
30748
|
+
collapsedIntervals = [];
|
30749
|
+
a = intervalsClone.shift();
|
30750
|
+
b = intervalsClone.shift();
|
30751
|
+
while (b) {
|
30752
|
+
if (typeof ((ref3 = b.low) != null ? ref3.durationBetween : void 0) === 'function') {
|
30753
|
+
if ((ref4 = a.high) != null ? ref4.sameOrAfter(b.low) : void 0) {
|
30754
|
+
if ((b.high == null) || b.high.after(a.high)) {
|
30452
30755
|
a.high = b.high;
|
30453
|
-
} else {
|
30454
|
-
collapsedIntervals.push(a);
|
30455
|
-
a = b;
|
30456
30756
|
}
|
30457
|
-
} else if (
|
30458
|
-
|
30459
|
-
|
30460
|
-
|
30461
|
-
|
30462
|
-
|
30463
|
-
|
30464
|
-
|
30757
|
+
} else if (((ref5 = a.high) != null ? ref5.durationBetween(b.low, perWidth.unit).high : void 0) <= perWidth.value) {
|
30758
|
+
a.high = b.high;
|
30759
|
+
} else {
|
30760
|
+
collapsedIntervals.push(a);
|
30761
|
+
a = b;
|
30762
|
+
}
|
30763
|
+
} else if (typeof ((ref6 = b.low) != null ? ref6.sameOrBefore : void 0) === 'function') {
|
30764
|
+
if ((a.high != null) && b.low.sameOrBefore(doAddition(a.high, perWidth))) {
|
30765
|
+
if ((b.high == null) || b.high.after(a.high)) {
|
30766
|
+
a.high = b.high;
|
30465
30767
|
}
|
30466
30768
|
} else {
|
30467
|
-
|
30468
|
-
|
30469
|
-
|
30470
|
-
|
30471
|
-
|
30472
|
-
|
30473
|
-
a = b;
|
30769
|
+
collapsedIntervals.push(a);
|
30770
|
+
a = b;
|
30771
|
+
}
|
30772
|
+
} else {
|
30773
|
+
if ((b.low - a.high) <= perWidth.value) {
|
30774
|
+
if (b.high > a.high || (b.high == null)) {
|
30775
|
+
a.high = b.high;
|
30474
30776
|
}
|
30777
|
+
} else {
|
30778
|
+
collapsedIntervals.push(a);
|
30779
|
+
a = b;
|
30475
30780
|
}
|
30476
|
-
b = intervalsClone.shift();
|
30477
30781
|
}
|
30478
|
-
|
30479
|
-
return collapsedIntervals;
|
30782
|
+
b = intervalsClone.shift();
|
30480
30783
|
}
|
30481
|
-
|
30482
|
-
|
30483
|
-
|
30484
|
-
|
30485
|
-
})(Expression);
|
30784
|
+
collapsedIntervals.push(a);
|
30785
|
+
return collapsedIntervals;
|
30786
|
+
}
|
30787
|
+
};
|
30486
30788
|
|
30487
30789
|
}).call(this);
|
30488
30790
|
|
@@ -32221,6 +32523,23 @@ function objectToString(o) {
|
|
32221
32523
|
}
|
32222
32524
|
};
|
32223
32525
|
|
32526
|
+
module.exports.compare_units = function(unit_a, unit_b) {
|
32527
|
+
var c, e;
|
32528
|
+
try {
|
32529
|
+
c = ucum.convert(1, ucum_unit(unit_a), ucum_unit(unit_b));
|
32530
|
+
if (c > 1) {
|
32531
|
+
return 1;
|
32532
|
+
}
|
32533
|
+
if (c < 1) {
|
32534
|
+
return -1;
|
32535
|
+
}
|
32536
|
+
return 0;
|
32537
|
+
} catch (error) {
|
32538
|
+
e = error;
|
32539
|
+
return null;
|
32540
|
+
}
|
32541
|
+
};
|
32542
|
+
|
32224
32543
|
}).call(this);
|
32225
32544
|
|
32226
32545
|
|
@@ -32868,11 +33187,11 @@ function objectToString(o) {
|
|
32868
33187
|
},{"./builder":159,"./expression":165}],181:[function(require,module,exports){
|
32869
33188
|
// Generated by CoffeeScript 1.12.7
|
32870
33189
|
(function() {
|
32871
|
-
var Combine, Concatenate, EndsWith, Expression, Lower, PositionOf, Split, StartsWith, Substring, Upper, build,
|
33190
|
+
var Combine, Concatenate, EndsWith, Expression, Lower, PositionOf, Split, SplitOnMatches, StartsWith, Substring, UnimplementedExpression, Upper, build, ref,
|
32872
33191
|
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; },
|
32873
33192
|
hasProp = {}.hasOwnProperty;
|
32874
33193
|
|
32875
|
-
|
33194
|
+
ref = require('./expression'), Expression = ref.Expression, UnimplementedExpression = ref.UnimplementedExpression;
|
32876
33195
|
|
32877
33196
|
build = require('./builder').build;
|
32878
33197
|
|
@@ -32951,6 +33270,17 @@ function objectToString(o) {
|
|
32951
33270
|
|
32952
33271
|
})(Expression);
|
32953
33272
|
|
33273
|
+
module.exports.SplitOnMatches = SplitOnMatches = (function(superClass) {
|
33274
|
+
extend(SplitOnMatches, superClass);
|
33275
|
+
|
33276
|
+
function SplitOnMatches() {
|
33277
|
+
return SplitOnMatches.__super__.constructor.apply(this, arguments);
|
33278
|
+
}
|
33279
|
+
|
33280
|
+
return SplitOnMatches;
|
33281
|
+
|
33282
|
+
})(UnimplementedExpression);
|
33283
|
+
|
32954
33284
|
module.exports.Upper = Upper = (function(superClass) {
|
32955
33285
|
extend(Upper, superClass);
|
32956
33286
|
|
@@ -33218,7 +33548,7 @@ function objectToString(o) {
|
|
33218
33548
|
},{"./builder":159,"./expression":165}],183:[function(require,module,exports){
|
33219
33549
|
// Generated by CoffeeScript 1.12.7
|
33220
33550
|
(function() {
|
33221
|
-
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,
|
33551
|
+
var As, Concept, Convert, ConvertsToBoolean, ConvertsToDate, ConvertsToDateTime, ConvertsToDecimal, ConvertsToInteger, ConvertsToQuantity, ConvertsToString, ConvertsToTime, 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,
|
33222
33552
|
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; },
|
33223
33553
|
hasProp = {}.hasOwnProperty;
|
33224
33554
|
|
@@ -33573,6 +33903,94 @@ function objectToString(o) {
|
|
33573
33903
|
|
33574
33904
|
})(UnimplementedExpression);
|
33575
33905
|
|
33906
|
+
module.exports.ConvertsToBoolean = ConvertsToBoolean = (function(superClass) {
|
33907
|
+
extend(ConvertsToBoolean, superClass);
|
33908
|
+
|
33909
|
+
function ConvertsToBoolean() {
|
33910
|
+
return ConvertsToBoolean.__super__.constructor.apply(this, arguments);
|
33911
|
+
}
|
33912
|
+
|
33913
|
+
return ConvertsToBoolean;
|
33914
|
+
|
33915
|
+
})(UnimplementedExpression);
|
33916
|
+
|
33917
|
+
module.exports.ConvertsToDate = ConvertsToDate = (function(superClass) {
|
33918
|
+
extend(ConvertsToDate, superClass);
|
33919
|
+
|
33920
|
+
function ConvertsToDate() {
|
33921
|
+
return ConvertsToDate.__super__.constructor.apply(this, arguments);
|
33922
|
+
}
|
33923
|
+
|
33924
|
+
return ConvertsToDate;
|
33925
|
+
|
33926
|
+
})(UnimplementedExpression);
|
33927
|
+
|
33928
|
+
module.exports.ConvertsToDateTime = ConvertsToDateTime = (function(superClass) {
|
33929
|
+
extend(ConvertsToDateTime, superClass);
|
33930
|
+
|
33931
|
+
function ConvertsToDateTime() {
|
33932
|
+
return ConvertsToDateTime.__super__.constructor.apply(this, arguments);
|
33933
|
+
}
|
33934
|
+
|
33935
|
+
return ConvertsToDateTime;
|
33936
|
+
|
33937
|
+
})(UnimplementedExpression);
|
33938
|
+
|
33939
|
+
module.exports.ConvertsToDecimal = ConvertsToDecimal = (function(superClass) {
|
33940
|
+
extend(ConvertsToDecimal, superClass);
|
33941
|
+
|
33942
|
+
function ConvertsToDecimal() {
|
33943
|
+
return ConvertsToDecimal.__super__.constructor.apply(this, arguments);
|
33944
|
+
}
|
33945
|
+
|
33946
|
+
return ConvertsToDecimal;
|
33947
|
+
|
33948
|
+
})(UnimplementedExpression);
|
33949
|
+
|
33950
|
+
module.exports.ConvertsToInteger = ConvertsToInteger = (function(superClass) {
|
33951
|
+
extend(ConvertsToInteger, superClass);
|
33952
|
+
|
33953
|
+
function ConvertsToInteger() {
|
33954
|
+
return ConvertsToInteger.__super__.constructor.apply(this, arguments);
|
33955
|
+
}
|
33956
|
+
|
33957
|
+
return ConvertsToInteger;
|
33958
|
+
|
33959
|
+
})(UnimplementedExpression);
|
33960
|
+
|
33961
|
+
module.exports.ConvertsToQuantity = ConvertsToQuantity = (function(superClass) {
|
33962
|
+
extend(ConvertsToQuantity, superClass);
|
33963
|
+
|
33964
|
+
function ConvertsToQuantity() {
|
33965
|
+
return ConvertsToQuantity.__super__.constructor.apply(this, arguments);
|
33966
|
+
}
|
33967
|
+
|
33968
|
+
return ConvertsToQuantity;
|
33969
|
+
|
33970
|
+
})(UnimplementedExpression);
|
33971
|
+
|
33972
|
+
module.exports.ConvertsToString = ConvertsToString = (function(superClass) {
|
33973
|
+
extend(ConvertsToString, superClass);
|
33974
|
+
|
33975
|
+
function ConvertsToString() {
|
33976
|
+
return ConvertsToString.__super__.constructor.apply(this, arguments);
|
33977
|
+
}
|
33978
|
+
|
33979
|
+
return ConvertsToString;
|
33980
|
+
|
33981
|
+
})(UnimplementedExpression);
|
33982
|
+
|
33983
|
+
module.exports.ConvertsToTime = ConvertsToTime = (function(superClass) {
|
33984
|
+
extend(ConvertsToTime, superClass);
|
33985
|
+
|
33986
|
+
function ConvertsToTime() {
|
33987
|
+
return ConvertsToTime.__super__.constructor.apply(this, arguments);
|
33988
|
+
}
|
33989
|
+
|
33990
|
+
return ConvertsToTime;
|
33991
|
+
|
33992
|
+
})(UnimplementedExpression);
|
33993
|
+
|
33576
33994
|
module.exports.IntervalTypeSpecifier = IntervalTypeSpecifier = (function(superClass) {
|
33577
33995
|
extend(IntervalTypeSpecifier, superClass);
|
33578
33996
|
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cqm-models",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "This library contains auto generated Mongo (Mongoose.js) models that correspond to the QDM (Quality Data Model) specification.",
|
5
5
|
"main": "app/assets/javascripts/index.js",
|
6
6
|
"browser": {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
],
|
16
16
|
"license": "Apache-2.0",
|
17
17
|
"dependencies": {
|
18
|
-
"cql-execution": "1.3.
|
18
|
+
"cql-execution": "1.3.2",
|
19
19
|
"mongoose": "^5.0.7"
|
20
20
|
},
|
21
21
|
"devDependencies": {
|
data/yarn.lock
CHANGED
@@ -442,9 +442,9 @@ core-util-is@~1.0.0:
|
|
442
442
|
version "1.0.2"
|
443
443
|
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
444
444
|
|
445
|
-
cql-execution@1.3.
|
446
|
-
version "1.3.
|
447
|
-
resolved "https://registry.yarnpkg.com/cql-execution/-/cql-execution-1.3.
|
445
|
+
cql-execution@1.3.2:
|
446
|
+
version "1.3.2"
|
447
|
+
resolved "https://registry.yarnpkg.com/cql-execution/-/cql-execution-1.3.2.tgz#3599ef31a0196e8ee679a37e1eee1911d731360b"
|
448
448
|
dependencies:
|
449
449
|
moment "^2.20.1"
|
450
450
|
ucum "0.0.7"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cqm-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aholmes@mitre.org
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
version: '0'
|
317
317
|
requirements: []
|
318
318
|
rubyforge_project:
|
319
|
-
rubygems_version: 2.6.
|
319
|
+
rubygems_version: 2.6.14
|
320
320
|
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: Mongo models that correspond to the QDM specification.
|