cqm-models 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85bf553127da27f99d10b18c86684ddfa57c4f2f7e992ca54d093c6e27888db6
4
- data.tar.gz: b899eb5db26a8cf98655d34b82ae8ff2c105c98c6332af7b1e3b37bb18b19a85
3
+ metadata.gz: 824c04168aff91f769c20c2ebdb0eebc5b5b63f457ca424002e71c833260b6fc
4
+ data.tar.gz: ec4fad1105bef87c9e4acde4ec0639db03b6b96d77146ebb62a7e1a64068d2df
5
5
  SHA512:
6
- metadata.gz: aeb672673dbb27b9ecef2d1e1e1b718d84ebd9ad793bfd75a8b733b7c113e45604281865916fe82e5e12fa4034fa1ea6c0598b76e0e615979fc31e3fc822381c
7
- data.tar.gz: 8102ced4699a1bdd4ec549ffb7cc8c649a61d1fd0d2f123ab5bed1a1b2aeff0c5194d49e1f6163cb4dcc15c822ec1e913558b84ab63af10c855542180fe0c358
6
+ metadata.gz: d4c6e1020981220cb7227caef2dc7423d3bc3374e1b9ff5b1a85ffabe226e2fb8428fbe63abce00cbfda68f21ede488fc9d6122d5fd8ccf8a641cd7903d0baa4
7
+ data.tar.gz: b8cf4f3ede2e516a194f3879ce5a96980782b9227bffdc6d3a3c1a2779945b9d0d7455a9b33c84b59ed3ac89c4756eedfda6a8cb230285e8c620396fd8a0b723
data/.eslintrc.json CHANGED
@@ -2,8 +2,14 @@
2
2
  "extends": "airbnb-base",
3
3
  "rules": {
4
4
  "max-len": ["error", {"code": 200, "ignoreComments": true}],
5
+ "no-multiple-empty-lines": "off",
6
+ "import/extensions": "off",
7
+ "max-classes-per-file": "off",
8
+ "operator-linebreak": "off",
9
+ "no-else-return": "off",
5
10
  "no-unused-vars": ["error", { "varsIgnorePattern": "EntitySchema|Identifier|IdentifierSchema|DataElementSchema|ComponentSchema|FacilityLocationSchema|Code|Quantity|Interval|Integer|Array|Float|Time|Number|Date|Mixed|Any" }],
6
11
  "camelcase": "off",
12
+ "arrow-parens": "off",
7
13
  "comma-dangle": ["error", {
8
14
  "arrays": "always-multiline",
9
15
  "objects": "always-multiline",
@@ -12,7 +12,7 @@ jobs:
12
12
 
13
13
  strategy:
14
14
  matrix:
15
- ruby-version: [2.5]
15
+ ruby-version: [2.6, 2.7]
16
16
  mongodb-version: [4.0.18, 4.4]
17
17
  node-version: [12.x, 14.x]
18
18
 
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
+ /.nyc_output
3
4
  /Gemfile.lock
4
5
  /_yardoc/
5
6
  /coverage/
@@ -56,6 +56,31 @@ QDMPatientSchema.methods.getByQrdaOid = function getByQrdaOid(qrdaOid) {
56
56
  return this.dataElements.filter(element => element.qrdaOid === qrdaOid);
57
57
  };
58
58
 
59
+ // cql-execution prefers getId() over id() because some data models may have an id property
60
+ QDMPatientSchema.methods.getId = function getId() {
61
+ return this._id;
62
+ };
63
+
64
+ /* eslint no-underscore-dangle: 0 */
65
+ QDMPatientSchema.methods._is = function _is(typeSpecifier) {
66
+ return this._typeHierarchy().some(
67
+ t => t.type === typeSpecifier.type && t.name === typeSpecifier.name
68
+ );
69
+ };
70
+
71
+ /* eslint no-underscore-dangle: 0 */
72
+ QDMPatientSchema.methods._typeHierarchy = function _typeHierarchy() {
73
+ const ver = this.qdmVersion.replace('.', '_');
74
+ return [
75
+ {
76
+ name: `{urn:healthit-gov:qdm:v${ver}}Patient`,
77
+ type: 'NamedTypeSpecifier',
78
+ },
79
+ { name: '{urn:hl7-org:elm-types:r1}Tuple', type: 'NamedTypeSpecifier' },
80
+ { name: '{urn:hl7-org:elm-types:r1}Any', type: 'NamedTypeSpecifier' },
81
+ ];
82
+ };
83
+
59
84
  // Returns an array of elements that exist on this patient. Optionally
60
85
  // takes a qdmCategory, which returns all elements of that QDM qdmCategory.
61
86
  // Example: patient.getDataElements({qdmCategory: 'encounters'}) will return
@@ -1,6 +1,6 @@
1
1
  const mongoose = require('mongoose/browser');
2
- const Code = require('./Code.js');
3
2
  const cql = require('cql-execution');
3
+ const Code = require('./Code.js');
4
4
  const Identifier = require('../attributes/Identifier');
5
5
 
6
6
  const [Schema] = [mongoose.Schema];
@@ -49,6 +49,31 @@ function DataElementSchema(add, options) {
49
49
  return null;
50
50
  };
51
51
 
52
+ /* eslint no-underscore-dangle: 0 */
53
+ extended.methods._is = function _is(typeSpecifier) {
54
+ return this._typeHierarchy().some(
55
+ t => t.type === typeSpecifier.type && t.name === typeSpecifier.name
56
+ );
57
+ };
58
+
59
+ /* eslint no-underscore-dangle: 0 */
60
+ extended.methods._typeHierarchy = function _typeHierarchy() {
61
+ const typeName = this._type.replace(/QDM::/, '');
62
+ const prefix = this.negationRationale ? 'Negative' : 'Positive';
63
+ const ver = this.qdmVersion.replace('.', '_');
64
+ return [
65
+ {
66
+ name: `{urn:healthit-gov:qdm:v${ver}}${prefix}${typeName}`,
67
+ type: 'NamedTypeSpecifier',
68
+ },
69
+ {
70
+ name: `{urn:healthit-gov:qdm:v${ver}}${typeName}`,
71
+ type: 'NamedTypeSpecifier',
72
+ },
73
+ { name: '{urn:hl7-org:elm-types:r1}Tuple', type: 'NamedTypeSpecifier' },
74
+ { name: '{urn:hl7-org:elm-types:r1}Any', type: 'NamedTypeSpecifier' },
75
+ ];
76
+ };
52
77
  return extended;
53
78
  }
54
79
 
@@ -65,6 +65,7 @@ module QDM
65
65
  def shift_dates(seconds)
66
66
  fields.keys.each do |field|
67
67
  send(field + '=', (send(field).to_time + seconds.seconds).to_datetime) if send(field).is_a? DateTime
68
+ send(field + '=', (send(field).to_time + seconds.seconds).to_datetime) if send(field).is_a? Time
68
69
  send(field + '=', send(field).shift_dates(seconds)) if (send(field).is_a? Interval) || (send(field).is_a? DataElement)
69
70
 
70
71
  # Special case for facility locations
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 = '4.0.0'
7
+ spec.version = '4.1.0'
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.'