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.
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cqm-models",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
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": {
@@ -16,20 +16,21 @@
16
16
  ],
17
17
  "license": "Apache-2.0",
18
18
  "dependencies": {
19
- "cql-execution": "~2.2.0",
20
- "mongoose": "^5.11.10"
19
+ "cql-execution": "~2.4.1",
20
+ "mongoose": "^5.13.12"
21
21
  },
22
22
  "devDependencies": {
23
23
  "browserify": "^16.1.0",
24
- "eslint": "^4.17.19",
25
- "eslint-config-airbnb-base": "^12.1.0",
24
+ "eslint": "^7.0.0",
25
+ "eslint-config-airbnb-base": "^14.2.1",
26
26
  "eslint-plugin-import": "^2.8.0",
27
- "istanbul": "^0.4.5",
28
- "jasmine": "^2.9.0"
27
+ "jasmine": "^2.9.0",
28
+ "nyc": "^15.1.0"
29
29
  },
30
30
  "scripts": {
31
31
  "prepublish": "./bin/build_cql_execution.sh",
32
- "test": "istanbul cover jasmine -x 'spec/**/*'",
32
+ "test": "jasmine",
33
+ "coverage": "nyc npm run test",
33
34
  "lint": "eslint 'app/assets/javascripts/**/*.js'",
34
35
  "dist": "yarn && browserify app/assets/javascripts/index.js > dist/index.js",
35
36
  "browser": "browserify app/assets/javascripts/browser.js > dist/browser.js",
@@ -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