cqm-models 0.7.5 → 0.7.6

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: a275eb0bb5b371b954c33d53ad6be1c53169eeb0
4
- data.tar.gz: b4c6b589f4b866f0f28f141aad406bae2518a031
3
+ metadata.gz: 5719a43a0d7e79b0d881d2df7d0e55603ddd5ecc
4
+ data.tar.gz: d62e876c02b6b0a99d50d13022487212a67e414c
5
5
  SHA512:
6
- metadata.gz: 1763d6ba4dbb585eea6c9befe1d8a0bfb9bb7bc6726d2f0df931e509ae0244d212b1dc6fb212b66545a6059f17aa99deeb80d5c424a43f5fc6584934e1f23e09
7
- data.tar.gz: cb7ef1d12c8a4e4a361058c563f79adc5b76f39db33ffc8e4cd11be19f35041af739978f2a8a5e8809112871342110b4bc3c8b9676521d1443470408eb75d4a3
6
+ metadata.gz: 8bf239fcba90769d346d67834f7242ff85ba2e62ea4f0def666aa5f6a1c9bbdb03550fbba2542628a8532f351367a8edca884b562d66ee61e982ab0e492badc6
7
+ data.tar.gz: 958e5fe5c4e250e501bbf459158c2bb20cd92be577f8c4cacb14274db4971ab80a39b46dd0c031b64a29081a41dea143b2bfe27a7e6ed5ea9897ecde3e8f5f0d
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const { ComponentSchema } = require('./Component');
7
8
  const Any = require('./basetypes/Any');
8
9
 
9
10
  const [Number, String] = [
@@ -17,7 +18,7 @@ const AssessmentPerformedSchema = DataElementSchema({
17
18
  reason: Code,
18
19
  method: Code,
19
20
  result: Any,
20
- components: [],
21
+ components: [ComponentSchema],
21
22
  relatedTo: [String],
22
23
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.117' },
23
24
  category: { type: String, default: 'assessment' },
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const { ComponentSchema } = require('./Component');
7
8
  const Any = require('./basetypes/Any');
8
9
 
9
10
  const [Number, String] = [
@@ -21,7 +22,7 @@ const DiagnosticStudyPerformedSchema = DataElementSchema({
21
22
  method: Code,
22
23
  facilityLocation: Code,
23
24
  negationRationale: Code,
24
- components: [],
25
+ components: [ComponentSchema],
25
26
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.23' },
26
27
  category: { type: String, default: 'diagnostic_study' },
27
28
  qdmStatus: { type: String, default: 'performed' },
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const { FacilityLocationSchema } = require('./FacilityLocation');
7
8
  const Any = require('./basetypes/Any');
8
9
 
9
10
  const [Number, String] = [
@@ -16,7 +17,7 @@ const EncounterPerformedSchema = DataElementSchema({
16
17
  admissionSource: Code,
17
18
  relevantPeriod: Interval,
18
19
  dischargeDisposition: Code,
19
- facilityLocations: [],
20
+ facilityLocations: [FacilityLocationSchema],
20
21
  diagnoses: [Code],
21
22
  principalDiagnosis: Code,
22
23
  negationRationale: Code,
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const { ComponentSchema } = require('./Component');
7
8
  const Any = require('./basetypes/Any');
8
9
 
9
10
  const [Number, String] = [
@@ -21,7 +22,7 @@ const LaboratoryTestPerformedSchema = DataElementSchema({
21
22
  reason: Code,
22
23
  referenceRange: Interval,
23
24
  negationRationale: Code,
24
- components: [],
25
+ components: [ComponentSchema],
25
26
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.42' },
26
27
  category: { type: String, default: 'laboratory_test' },
27
28
  qdmStatus: { type: String, default: 'performed' },
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const { ComponentSchema } = require('./Component');
7
8
  const Any = require('./basetypes/Any');
8
9
 
9
10
  const [Number, String] = [
@@ -19,7 +20,7 @@ const PhysicalExamPerformedSchema = DataElementSchema({
19
20
  result: Any,
20
21
  anatomicalLocationSite: Code,
21
22
  negationRationale: Code,
22
- components: [],
23
+ components: [ComponentSchema],
23
24
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.62' },
24
25
  category: { type: String, default: 'physical_exam' },
25
26
  qdmStatus: { type: String, default: 'performed' },
@@ -6,6 +6,8 @@ const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
7
  const Any = require('./basetypes/Any');
8
8
 
9
+ const { ComponentSchema } = require('./Component');
10
+
9
11
  const [Number, String] = [
10
12
  mongoose.Schema.Types.Number,
11
13
  mongoose.Schema.Types.String,
@@ -23,7 +25,7 @@ const ProcedurePerformedSchema = DataElementSchema({
23
25
  ordinality: Code,
24
26
  incisionDatetime: DateTime,
25
27
  negationRationale: Code,
26
- components: [],
28
+ components: [ComponentSchema],
27
29
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.67' },
28
30
  category: { type: String, default: 'procedure' },
29
31
  qdmStatus: { type: String, default: 'performed' },
@@ -14,7 +14,7 @@ module QDM
14
14
 
15
15
  # Converts an object of this instance into a database friendly value.
16
16
  def mongoize
17
- { code: @code, codeSystem: @codeSystem, descriptor: @descriptor, codeSystemOid: @codeSystemOid, version: @version }
17
+ { code: @code, codeSystem: @codeSystem, descriptor: @descriptor, codeSystemOid: @codeSystemOid, version: @version, _type: 'QDM::Code' }
18
18
  end
19
19
 
20
20
  class << self
@@ -34,9 +34,52 @@ module QDM
34
34
  _id
35
35
  end
36
36
 
37
+ def mongoize
38
+ json_representation = {}
39
+ attribute_names.each do |field|
40
+ json_representation[field] = send(field).mongoize
41
+ end
42
+ json_representation
43
+ end
44
+
37
45
  # Include '_type' in any JSON output. This is necessary for deserialization.
38
46
  def to_json(options = nil)
39
47
  serializable_hash(methods: :_type).to_json(options)
40
48
  end
49
+
50
+ class << self
51
+ # Get the object as it was stored in the database, and instantiate
52
+ # this custom class from it.
53
+ #
54
+ def demongoize(object)
55
+ return nil unless object
56
+ object = object.symbolize_keys
57
+ if object.is_a?(Hash)
58
+ data_element = QDM::DataElement.new
59
+ data_element.attribute_names.each do |field|
60
+ data_element.send(field + '=', object[field.to_sym])
61
+ end
62
+ data_element
63
+ else object
64
+ end
65
+ end
66
+
67
+ # Takes any possible object and converts it to how it would be
68
+ # stored in the database.
69
+ def mongoize(object)
70
+ case object
71
+ when nil then nil
72
+ when QDM::DataElement then object.mongoize
73
+ when Hash
74
+ object = object.symbolize_keys
75
+ data_element = QDM::DataElement.new
76
+ data_element.attribute_names.each do |field|
77
+ data_element.send(field + '=', object[field.to_sym])
78
+ end
79
+ data_element.mongoize
80
+ else object
81
+ end
82
+ end
83
+ end
41
84
  end
42
85
  end
@@ -13,7 +13,7 @@ module QDM
13
13
 
14
14
  # Converts an object of this instance into a database friendly value.
15
15
  def mongoize
16
- { low: @low, high: @high, lowClosed: @lowClosed, highClosed: @highClosed }
16
+ { low: @low, high: @high, lowClosed: @lowClosed, highClosed: @highClosed, _type: 'QDM::Interval' }
17
17
  end
18
18
 
19
19
  class << self
@@ -11,7 +11,7 @@ module QDM
11
11
 
12
12
  # Converts an object of this instance into a database friendly value.
13
13
  def mongoize
14
- { value: @value, unit: @unit }
14
+ { value: @value, unit: @unit, _type: 'QDM::Quantity' }
15
15
  end
16
16
 
17
17
  class << self
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 = '0.7.5'
7
+ spec.version = '0.7.6'
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
@@ -187,6 +187,7 @@ const Code = require('./basetypes/Code');
187
187
  const Interval = require('./basetypes/Interval');
188
188
  const Quantity = require('./basetypes/Quantity');
189
189
  const DateTime = require('./basetypes/DateTime');
190
+ const { ComponentSchema } = require('./Component');
190
191
  const Any = require('./basetypes/Any');
191
192
 
192
193
  const [Number, String] = [
@@ -200,7 +201,7 @@ const AssessmentPerformedSchema = DataElementSchema({
200
201
  reason: Code,
201
202
  method: Code,
202
203
  result: Any,
203
- components: [],
204
+ components: [ComponentSchema],
204
205
  relatedTo: [String],
205
206
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.117' },
206
207
  category: { type: String, default: 'assessment' },
@@ -213,7 +214,7 @@ const AssessmentPerformedSchema = DataElementSchema({
213
214
  module.exports.AssessmentPerformedSchema = AssessmentPerformedSchema;
214
215
  module.exports.AssessmentPerformed = mongoose.model('AssessmentPerformed', AssessmentPerformedSchema);
215
216
 
216
- },{"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],5:[function(require,module,exports){
217
+ },{"./Component":10,"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],5:[function(require,module,exports){
217
218
  const mongoose = require('mongoose');
218
219
  const { DataElementSchema } = require('./basetypes/DataElement');
219
220
  const Code = require('./basetypes/Code');
@@ -556,6 +557,7 @@ const Code = require('./basetypes/Code');
556
557
  const Interval = require('./basetypes/Interval');
557
558
  const Quantity = require('./basetypes/Quantity');
558
559
  const DateTime = require('./basetypes/DateTime');
560
+ const { ComponentSchema } = require('./Component');
559
561
  const Any = require('./basetypes/Any');
560
562
 
561
563
  const [Number, String] = [
@@ -573,7 +575,7 @@ const DiagnosticStudyPerformedSchema = DataElementSchema({
573
575
  method: Code,
574
576
  facilityLocation: Code,
575
577
  negationRationale: Code,
576
- components: [],
578
+ components: [ComponentSchema],
577
579
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.23' },
578
580
  category: { type: String, default: 'diagnostic_study' },
579
581
  qdmStatus: { type: String, default: 'performed' },
@@ -585,7 +587,7 @@ const DiagnosticStudyPerformedSchema = DataElementSchema({
585
587
  module.exports.DiagnosticStudyPerformedSchema = DiagnosticStudyPerformedSchema;
586
588
  module.exports.DiagnosticStudyPerformed = mongoose.model('DiagnosticStudyPerformed', DiagnosticStudyPerformedSchema);
587
589
 
588
- },{"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],18:[function(require,module,exports){
590
+ },{"./Component":10,"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],18:[function(require,module,exports){
589
591
  const mongoose = require('mongoose');
590
592
  const { DataElementSchema } = require('./basetypes/DataElement');
591
593
  const Code = require('./basetypes/Code');
@@ -652,6 +654,7 @@ const Code = require('./basetypes/Code');
652
654
  const Interval = require('./basetypes/Interval');
653
655
  const Quantity = require('./basetypes/Quantity');
654
656
  const DateTime = require('./basetypes/DateTime');
657
+ const { FacilityLocationSchema } = require('./FacilityLocation');
655
658
  const Any = require('./basetypes/Any');
656
659
 
657
660
  const [Number, String] = [
@@ -664,7 +667,7 @@ const EncounterPerformedSchema = DataElementSchema({
664
667
  admissionSource: Code,
665
668
  relevantPeriod: Interval,
666
669
  dischargeDisposition: Code,
667
- facilityLocations: [],
670
+ facilityLocations: [FacilityLocationSchema],
668
671
  diagnoses: [Code],
669
672
  principalDiagnosis: Code,
670
673
  negationRationale: Code,
@@ -680,7 +683,7 @@ const EncounterPerformedSchema = DataElementSchema({
680
683
  module.exports.EncounterPerformedSchema = EncounterPerformedSchema;
681
684
  module.exports.EncounterPerformed = mongoose.model('EncounterPerformed', EncounterPerformedSchema);
682
685
 
683
- },{"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],21:[function(require,module,exports){
686
+ },{"./FacilityLocation":22,"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],21:[function(require,module,exports){
684
687
  const mongoose = require('mongoose');
685
688
  const { DataElementSchema } = require('./basetypes/DataElement');
686
689
  const Code = require('./basetypes/Code');
@@ -981,6 +984,7 @@ const Code = require('./basetypes/Code');
981
984
  const Interval = require('./basetypes/Interval');
982
985
  const Quantity = require('./basetypes/Quantity');
983
986
  const DateTime = require('./basetypes/DateTime');
987
+ const { ComponentSchema } = require('./Component');
984
988
  const Any = require('./basetypes/Any');
985
989
 
986
990
  const [Number, String] = [
@@ -998,7 +1002,7 @@ const LaboratoryTestPerformedSchema = DataElementSchema({
998
1002
  reason: Code,
999
1003
  referenceRange: Interval,
1000
1004
  negationRationale: Code,
1001
- components: [],
1005
+ components: [ComponentSchema],
1002
1006
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.42' },
1003
1007
  category: { type: String, default: 'laboratory_test' },
1004
1008
  qdmStatus: { type: String, default: 'performed' },
@@ -1010,7 +1014,7 @@ const LaboratoryTestPerformedSchema = DataElementSchema({
1010
1014
  module.exports.LaboratoryTestPerformedSchema = LaboratoryTestPerformedSchema;
1011
1015
  module.exports.LaboratoryTestPerformed = mongoose.model('LaboratoryTestPerformed', LaboratoryTestPerformedSchema);
1012
1016
 
1013
- },{"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],32:[function(require,module,exports){
1017
+ },{"./Component":10,"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],32:[function(require,module,exports){
1014
1018
  const mongoose = require('mongoose');
1015
1019
  const { DataElementSchema } = require('./basetypes/DataElement');
1016
1020
  const Code = require('./basetypes/Code');
@@ -1864,6 +1868,7 @@ const Code = require('./basetypes/Code');
1864
1868
  const Interval = require('./basetypes/Interval');
1865
1869
  const Quantity = require('./basetypes/Quantity');
1866
1870
  const DateTime = require('./basetypes/DateTime');
1871
+ const { ComponentSchema } = require('./Component');
1867
1872
  const Any = require('./basetypes/Any');
1868
1873
 
1869
1874
  const [Number, String] = [
@@ -1879,7 +1884,7 @@ const PhysicalExamPerformedSchema = DataElementSchema({
1879
1884
  result: Any,
1880
1885
  anatomicalLocationSite: Code,
1881
1886
  negationRationale: Code,
1882
- components: [],
1887
+ components: [ComponentSchema],
1883
1888
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.62' },
1884
1889
  category: { type: String, default: 'physical_exam' },
1885
1890
  qdmStatus: { type: String, default: 'performed' },
@@ -1891,7 +1896,7 @@ const PhysicalExamPerformedSchema = DataElementSchema({
1891
1896
  module.exports.PhysicalExamPerformedSchema = PhysicalExamPerformedSchema;
1892
1897
  module.exports.PhysicalExamPerformed = mongoose.model('PhysicalExamPerformed', PhysicalExamPerformedSchema);
1893
1898
 
1894
- },{"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],53:[function(require,module,exports){
1899
+ },{"./Component":10,"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],53:[function(require,module,exports){
1895
1900
  const mongoose = require('mongoose');
1896
1901
  const { DataElementSchema } = require('./basetypes/DataElement');
1897
1902
  const Code = require('./basetypes/Code');
@@ -1964,6 +1969,8 @@ const Quantity = require('./basetypes/Quantity');
1964
1969
  const DateTime = require('./basetypes/DateTime');
1965
1970
  const Any = require('./basetypes/Any');
1966
1971
 
1972
+ const { ComponentSchema } = require('./Component');
1973
+
1967
1974
  const [Number, String] = [
1968
1975
  mongoose.Schema.Types.Number,
1969
1976
  mongoose.Schema.Types.String,
@@ -1981,7 +1988,7 @@ const ProcedurePerformedSchema = DataElementSchema({
1981
1988
  ordinality: Code,
1982
1989
  incisionDatetime: DateTime,
1983
1990
  negationRationale: Code,
1984
- components: [],
1991
+ components: [ComponentSchema],
1985
1992
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.67' },
1986
1993
  category: { type: String, default: 'procedure' },
1987
1994
  qdmStatus: { type: String, default: 'performed' },
@@ -1993,7 +2000,7 @@ const ProcedurePerformedSchema = DataElementSchema({
1993
2000
  module.exports.ProcedurePerformedSchema = ProcedurePerformedSchema;
1994
2001
  module.exports.ProcedurePerformed = mongoose.model('ProcedurePerformed', ProcedurePerformedSchema);
1995
2002
 
1996
- },{"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],56:[function(require,module,exports){
2003
+ },{"./Component":10,"./basetypes/Any":67,"./basetypes/Code":68,"./basetypes/DataElement":69,"./basetypes/DateTime":70,"./basetypes/Interval":71,"./basetypes/Quantity":72,"mongoose":401}],56:[function(require,module,exports){
1997
2004
  const mongoose = require('mongoose');
1998
2005
  const { DataElementSchema } = require('./basetypes/DataElement');
1999
2006
  const Code = require('./basetypes/Code');
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cqm-models",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
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": {
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.7.5
4
+ version: 0.7.6
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-06-18 00:00:00.000000000 Z
13
+ date: 2018-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler