cqm-models 4.0.0 → 4.0.1

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: 7f8d38da5e177b43176227723a4e46b7d95a1bb244db13b08708e63e1669b274
4
+ data.tar.gz: 87558e6ac3846616a2c8b3d9d489363f5584f0248fc3168228f82980c992a834
5
5
  SHA512:
6
- metadata.gz: aeb672673dbb27b9ecef2d1e1e1b718d84ebd9ad793bfd75a8b733b7c113e45604281865916fe82e5e12fa4034fa1ea6c0598b76e0e615979fc31e3fc822381c
7
- data.tar.gz: 8102ced4699a1bdd4ec549ffb7cc8c649a61d1fd0d2f123ab5bed1a1b2aeff0c5194d49e1f6163cb4dcc15c822ec1e913558b84ab63af10c855542180fe0c358
6
+ metadata.gz: f498c76a3ee4feea47218ae47e2979ec5c67df1d24d5418cfc717d3e0ccdfffab3dfacfd44d4f9c9178aeeb9c9d20a5d6ff97d3b6624c516db8fe1c0507ff64e
7
+ data.tar.gz: 5148490633c94e498b13835beffd194fc3fab981aafc6546400f0da50272fe8cbf195f1f5d1dc8e28b9f19c656b206ad1c2c1b01818af0c2e4d670f16dc900bd
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",
@@ -56,6 +56,30 @@ 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}Any', type: 'NamedTypeSpecifier' },
80
+ ];
81
+ };
82
+
59
83
  // Returns an array of elements that exist on this patient. Optionally
60
84
  // takes a qdmCategory, which returns all elements of that QDM qdmCategory.
61
85
  // 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,30 @@ 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}Any', type: 'NamedTypeSpecifier' },
74
+ ];
75
+ };
52
76
  return extended;
53
77
  }
54
78
 
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.0.1'
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.'