cqm-models 0.8.1 → 0.8.2

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
  SHA1:
3
- metadata.gz: f69ba79193a6df18a4a86fc508237fac9b1e9078
4
- data.tar.gz: 6ddf65c325e26a91823a84ff3a1fdb2b75323110
3
+ metadata.gz: 1db6adc6a07fd19b2bbf444b8f4f8fc36c5c7e53
4
+ data.tar.gz: 6ea8d2a9a7d1034fec223e96786ddff12e3f0b1e
5
5
  SHA512:
6
- metadata.gz: b2563e216ff73afed6947a86e68f7467c3091df0a8eb4846df375675e75e63923d353abe79b8304d588e164694e0c21cd53fee4efd6b97f3e174dbdea3622587
7
- data.tar.gz: 7791447027060f7e426a71214b818877c44b15962f656789f64cffaea55a8a9ecf12be3cbb2975280cd78c3a1e483aceb4e15346ee8a65f296c073ad6fc4ff97
6
+ metadata.gz: 74b863976c88fd23d4e382f1e59ecf10381d0411a2145ca5bc48d140ade7e4190f562e431ae806b6b492d2a050c09e7f593ce19ab1f1c263a7538b65e753b979
7
+ data.tar.gz: 47cdb5c41f3e81735b0b8f7a6f3c2ba375444cd8be22d157a32d49a20b1a5f32a767f081b6eb893c405151ae551863fa7b489adf0aff9139f89f747c48edbe4d
@@ -81,6 +81,9 @@ PatientSchema.methods.getDataElements = function getDataElements(params) {
81
81
 
82
82
  // Returns an array of dataElements that exist on the patient, queried by
83
83
  // QDM profile
84
+ // @param {string} profile - the data criteria requested by the execution engine
85
+ // @param {boolean} isNegated - whether dataElements should be returned based on their negation status
86
+ // @returns {DataElement[]}
84
87
  PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated = null) {
85
88
  // If isNegated == true, only return data elements with a negationRationale that is not null.
86
89
  // If isNegated == false, only return data elements with a null negationRationale.
@@ -89,11 +92,13 @@ PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated =
89
92
  return results.map((result) => {
90
93
  const getCodeFunction = Object.getPrototypeOf(result).getCode;
91
94
  const codeFunction = Object.getPrototypeOf(result).code;
95
+ const idField = result.id;
92
96
  const removedMongooseItems = AllDataElements[profile](result).toObject();
93
97
  // toObject() will remove all mongoose functions but also removed the getCode and code functions
94
98
  // the execution engine requires the code and getCode functions so we have to add them back
95
99
  removedMongooseItems.getCode = getCodeFunction;
96
100
  removedMongooseItems.code = codeFunction;
101
+ removedMongooseItems.id = idField;
97
102
  return removedMongooseItems;
98
103
  });
99
104
  };
@@ -61,6 +61,13 @@ module QDM
61
61
  if (send(field).is_a? Interval) || (send(field).is_a? DataElement)
62
62
  send(field + '=', send(field).shift_dates(seconds))
63
63
  end
64
+
65
+ # Special case for facility locations
66
+ next unless field == 'facilityLocations'
67
+ send(field).each do |facility_location|
68
+ facility_location['locationPeriod'][:low] = (facility_location['locationPeriod'][:low].to_time + seconds).to_datetime
69
+ facility_location['locationPeriod'][:high] = (facility_location['locationPeriod'][:high].to_time + seconds).to_datetime
70
+ end
64
71
  end
65
72
  end
66
73
 
@@ -7,7 +7,7 @@ module QDM
7
7
  field :admissionSource, type: QDM::Code
8
8
  field :relevantPeriod, type: QDM::Interval
9
9
  field :dischargeDisposition, type: QDM::Code
10
- field :facilityLocations, type: Array
10
+ field :facilityLocations, type: Array, default: []
11
11
  field :diagnoses, type: Array
12
12
  field :principalDiagnosis, type: QDM::Code
13
13
  field :negationRationale, type: QDM::Code
@@ -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 = '0.8.1'
7
+ spec.version = '0.8.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.'
@@ -1552,6 +1552,9 @@ PatientSchema.methods.getDataElements = function getDataElements(params) {
1552
1552
 
1553
1553
  // Returns an array of dataElements that exist on the patient, queried by
1554
1554
  // QDM profile
1555
+ // @param {string} profile - the data criteria requested by the execution engine
1556
+ // @param {boolean} isNegated - whether dataElements should be returned based on their negation status
1557
+ // @returns {DataElement[]}
1555
1558
  PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated = null) {
1556
1559
  // If isNegated == true, only return data elements with a negationRationale that is not null.
1557
1560
  // If isNegated == false, only return data elements with a null negationRationale.
@@ -1560,11 +1563,13 @@ PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated =
1560
1563
  return results.map((result) => {
1561
1564
  const getCodeFunction = Object.getPrototypeOf(result).getCode;
1562
1565
  const codeFunction = Object.getPrototypeOf(result).code;
1566
+ const idField = result.id;
1563
1567
  const removedMongooseItems = AllDataElements[profile](result).toObject();
1564
1568
  // toObject() will remove all mongoose functions but also removed the getCode and code functions
1565
1569
  // the execution engine requires the code and getCode functions so we have to add them back
1566
1570
  removedMongooseItems.getCode = getCodeFunction;
1567
1571
  removedMongooseItems.code = codeFunction;
1572
+ removedMongooseItems.id = idField;
1568
1573
  return removedMongooseItems;
1569
1574
  });
1570
1575
  };
@@ -208,6 +208,9 @@ Dir.glob(ruby_models_path + '*.rb').each do |file_name|
208
208
  # Add QDM version
209
209
  contents.gsub!(/field :qdmVersion, type: String/, "field :qdmVersion, type: String, default: '#{qdm_version}'")
210
210
 
211
+ # Add default to [] for facilityLocations
212
+ contents.gsub!(/field :facilityLocations, type: Array/, 'field :facilityLocations, type: Array, default: []')
213
+
211
214
  # Add HQMF oid (if it exists in the given HQMF oid mapping file)
212
215
  dc_name = File.basename(file_name, '.*')
213
216
  if oids[dc_name].present? && oids[dc_name]['hqmf_oid'].present?
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cqm-models",
3
- "version": "0.8.1",
3
+ "version": "0.8.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": {
@@ -80,6 +80,9 @@ PatientSchema.methods.getDataElements = function getDataElements(params) {
80
80
 
81
81
  // Returns an array of dataElements that exist on the patient, queried by
82
82
  // QDM profile
83
+ // @param {string} profile - the data criteria requested by the execution engine
84
+ // @param {boolean} isNegated - whether dataElements should be returned based on their negation status
85
+ // @returns {DataElement[]}
83
86
  PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated = null) {
84
87
  // If isNegated == true, only return data elements with a negationRationale that is not null.
85
88
  // If isNegated == false, only return data elements with a null negationRationale.
@@ -88,11 +91,13 @@ PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated =
88
91
  return results.map((result) => {
89
92
  const getCodeFunction = Object.getPrototypeOf(result).getCode;
90
93
  const codeFunction = Object.getPrototypeOf(result).code;
94
+ const idField = result.id;
91
95
  const removedMongooseItems = AllDataElements[profile](result).toObject();
92
96
  // toObject() will remove all mongoose functions but also removed the getCode and code functions
93
97
  // the execution engine requires the code and getCode functions so we have to add them back
94
98
  removedMongooseItems.getCode = getCodeFunction;
95
99
  removedMongooseItems.code = codeFunction;
100
+ removedMongooseItems.id = idField;
96
101
  return removedMongooseItems;
97
102
  });
98
103
  };
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: 0.8.1
4
+ version: 0.8.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-07-18 00:00:00.000000000 Z
13
+ date: 2018-07-25 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.12
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.