cqm-models 1.0.3 → 1.1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +5 -5
  2. data/.eslintrc.json +10 -2
  3. data/.github/PULL_REQUEST_TEMPLATE.md +0 -4
  4. data/.rubocop.yml +3 -0
  5. data/.travis.yml +31 -1
  6. data/README.md +59 -2
  7. data/app/assets/javascripts/AdverseEvent.js +16 -7
  8. data/app/assets/javascripts/AllDataElements.js +6 -6
  9. data/app/assets/javascripts/AllergyIntolerance.js +16 -7
  10. data/app/assets/javascripts/AssessmentOrder.js +15 -6
  11. data/app/assets/javascripts/AssessmentPerformed.js +16 -7
  12. data/app/assets/javascripts/AssessmentRecommended.js +16 -7
  13. data/app/assets/javascripts/CareGoal.js +16 -7
  14. data/app/assets/javascripts/CommunicationPerformed.js +15 -6
  15. data/app/assets/javascripts/DeviceApplied.js +16 -7
  16. data/app/assets/javascripts/DeviceOrder.js +16 -7
  17. data/app/assets/javascripts/DeviceRecommended.js +16 -7
  18. data/app/assets/javascripts/Diagnosis.js +16 -7
  19. data/app/assets/javascripts/DiagnosticStudyOrder.js +16 -7
  20. data/app/assets/javascripts/DiagnosticStudyPerformed.js +16 -7
  21. data/app/assets/javascripts/DiagnosticStudyRecommended.js +16 -7
  22. data/app/assets/javascripts/EncounterOrder.js +16 -7
  23. data/app/assets/javascripts/EncounterPerformed.js +16 -7
  24. data/app/assets/javascripts/EncounterRecommended.js +16 -7
  25. data/app/assets/javascripts/FamilyHistory.js +16 -7
  26. data/app/assets/javascripts/Id.js +7 -3
  27. data/app/assets/javascripts/ImmunizationAdministered.js +16 -7
  28. data/app/assets/javascripts/ImmunizationOrder.js +16 -7
  29. data/app/assets/javascripts/IndividualResult.js +7 -2
  30. data/app/assets/javascripts/InterventionOrder.js +16 -7
  31. data/app/assets/javascripts/InterventionPerformed.js +16 -7
  32. data/app/assets/javascripts/InterventionRecommended.js +16 -7
  33. data/app/assets/javascripts/LaboratoryTestOrder.js +16 -7
  34. data/app/assets/javascripts/LaboratoryTestPerformed.js +16 -7
  35. data/app/assets/javascripts/LaboratoryTestRecommended.js +16 -7
  36. data/app/assets/javascripts/MedicationActive.js +16 -7
  37. data/app/assets/javascripts/MedicationAdministered.js +16 -7
  38. data/app/assets/javascripts/MedicationDischarge.js +16 -7
  39. data/app/assets/javascripts/MedicationDispensed.js +16 -7
  40. data/app/assets/javascripts/MedicationOrder.js +16 -7
  41. data/app/assets/javascripts/Participation.js +15 -6
  42. data/app/assets/javascripts/PatientCareExperience.js +16 -7
  43. data/app/assets/javascripts/PatientCharacteristic.js +16 -7
  44. data/app/assets/javascripts/PatientCharacteristicBirthdate.js +16 -7
  45. data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +16 -7
  46. data/app/assets/javascripts/PatientCharacteristicEthnicity.js +16 -7
  47. data/app/assets/javascripts/PatientCharacteristicExpired.js +16 -7
  48. data/app/assets/javascripts/PatientCharacteristicPayer.js +16 -7
  49. data/app/assets/javascripts/PatientCharacteristicRace.js +16 -7
  50. data/app/assets/javascripts/PatientCharacteristicSex.js +16 -7
  51. data/app/assets/javascripts/PhysicalExamOrder.js +16 -7
  52. data/app/assets/javascripts/PhysicalExamPerformed.js +16 -7
  53. data/app/assets/javascripts/PhysicalExamRecommended.js +16 -7
  54. data/app/assets/javascripts/ProcedureOrder.js +16 -7
  55. data/app/assets/javascripts/ProcedurePerformed.js +16 -7
  56. data/app/assets/javascripts/ProcedureRecommended.js +16 -7
  57. data/app/assets/javascripts/ProviderCareExperience.js +16 -7
  58. data/app/assets/javascripts/ProviderCharacteristic.js +16 -7
  59. data/app/assets/javascripts/QDMPatient.js +262 -0
  60. data/app/assets/javascripts/Result.js +7 -2
  61. data/app/assets/javascripts/ResultComponent.js +14 -6
  62. data/app/assets/javascripts/SubstanceAdministered.js +16 -7
  63. data/app/assets/javascripts/SubstanceOrder.js +16 -7
  64. data/app/assets/javascripts/SubstanceRecommended.js +16 -7
  65. data/app/assets/javascripts/Symptom.js +16 -7
  66. data/app/assets/javascripts/attributes/Component.js +30 -0
  67. data/app/assets/javascripts/attributes/FacilityLocation.js +30 -0
  68. data/app/assets/javascripts/basetypes/Any.js +1 -1
  69. data/app/assets/javascripts/basetypes/Code.js +1 -1
  70. data/app/assets/javascripts/basetypes/DataElement.js +2 -1
  71. data/app/assets/javascripts/basetypes/DateTime.js +5 -1
  72. data/app/assets/javascripts/basetypes/Interval.js +1 -1
  73. data/app/assets/javascripts/basetypes/Quantity.js +1 -1
  74. data/app/assets/javascripts/basetypes/Ratio.js +1 -1
  75. data/app/assets/javascripts/browser.js +3 -0
  76. data/app/assets/javascripts/cqm/AllCQMModels.js +24 -0
  77. data/app/assets/javascripts/cqm/CQLLibrary.js +32 -0
  78. data/app/assets/javascripts/cqm/CQLStatementDependency.js +28 -0
  79. data/app/assets/javascripts/cqm/Concept.js +17 -0
  80. data/app/assets/javascripts/cqm/Measure.js +108 -0
  81. data/app/assets/javascripts/{MeasurePackage.js → cqm/MeasurePackage.js} +9 -3
  82. data/app/assets/javascripts/cqm/Patient.js +38 -0
  83. data/app/assets/javascripts/cqm/PopulationSet.js +88 -0
  84. data/app/assets/javascripts/cqm/Provider.js +44 -0
  85. data/app/assets/javascripts/cqm/ValueSet.js +26 -0
  86. data/app/assets/javascripts/index.js +18 -8
  87. data/app/models/{qdm/tacoma → cqm}/concept.rb +4 -4
  88. data/app/models/cqm/cql_library.rb +22 -0
  89. data/app/models/cqm/cql_statement_dependency.rb +24 -0
  90. data/app/models/cqm/measure.rb +105 -0
  91. data/app/models/{qdm/tacoma → cqm}/measure_package.rb +2 -2
  92. data/app/models/cqm/patient.rb +20 -0
  93. data/app/models/cqm/population_set.rb +86 -0
  94. data/app/models/cqm/provider.rb +110 -0
  95. data/app/models/cqm/valueset.rb +15 -0
  96. data/app/models/hqmfOid_to_datatype_map.json +55 -0
  97. data/app/models/model_finder.rb +12 -0
  98. data/app/models/models.rb +18 -6
  99. data/app/models/qdm/adverse_event.rb +3 -2
  100. data/app/models/qdm/allergy_intolerance.rb +2 -1
  101. data/app/models/qdm/assessment_order.rb +1 -0
  102. data/app/models/qdm/assessment_performed.rb +2 -1
  103. data/app/models/qdm/assessment_recommended.rb +2 -1
  104. data/app/models/qdm/attributes/attribute.rb +63 -0
  105. data/app/models/qdm/{component.rb → attributes/component.rb} +1 -1
  106. data/app/models/qdm/{facility_location.rb → attributes/facility_location.rb} +1 -1
  107. data/app/models/qdm/basetypes/data_element.rb +21 -6
  108. data/app/models/qdm/basetypes/interval.rb +2 -1
  109. data/app/models/qdm/care_goal.rb +2 -1
  110. data/app/models/qdm/communication_performed.rb +1 -0
  111. data/app/models/qdm/device_applied.rb +2 -1
  112. data/app/models/qdm/device_order.rb +2 -1
  113. data/app/models/qdm/device_recommended.rb +2 -1
  114. data/app/models/qdm/diagnosis.rb +2 -1
  115. data/app/models/qdm/diagnostic_study_order.rb +2 -1
  116. data/app/models/qdm/diagnostic_study_performed.rb +3 -2
  117. data/app/models/qdm/diagnostic_study_recommended.rb +2 -1
  118. data/app/models/qdm/encounter_order.rb +3 -2
  119. data/app/models/qdm/encounter_performed.rb +2 -1
  120. data/app/models/qdm/encounter_recommended.rb +3 -2
  121. data/app/models/qdm/family_history.rb +2 -1
  122. data/app/models/qdm/immunization_administered.rb +2 -1
  123. data/app/models/qdm/immunization_order.rb +2 -1
  124. data/app/models/qdm/intervention_order.rb +2 -1
  125. data/app/models/qdm/intervention_performed.rb +2 -1
  126. data/app/models/qdm/intervention_recommended.rb +2 -1
  127. data/app/models/qdm/laboratory_test_order.rb +2 -1
  128. data/app/models/qdm/laboratory_test_performed.rb +2 -1
  129. data/app/models/qdm/laboratory_test_recommended.rb +2 -1
  130. data/app/models/qdm/medication_active.rb +2 -1
  131. data/app/models/qdm/medication_administered.rb +2 -1
  132. data/app/models/qdm/medication_discharge.rb +2 -1
  133. data/app/models/qdm/medication_dispensed.rb +4 -3
  134. data/app/models/qdm/medication_order.rb +3 -2
  135. data/app/models/qdm/participation.rb +1 -0
  136. data/app/models/qdm/patient.rb +7 -4
  137. data/app/models/qdm/patient_care_experience.rb +2 -1
  138. data/app/models/qdm/patient_characteristic.rb +2 -1
  139. data/app/models/qdm/patient_characteristic_birthdate.rb +2 -1
  140. data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +2 -1
  141. data/app/models/qdm/patient_characteristic_ethnicity.rb +2 -1
  142. data/app/models/qdm/patient_characteristic_expired.rb +2 -1
  143. data/app/models/qdm/patient_characteristic_payer.rb +2 -1
  144. data/app/models/qdm/patient_characteristic_race.rb +2 -1
  145. data/app/models/qdm/patient_characteristic_sex.rb +2 -1
  146. data/app/models/qdm/physical_exam_order.rb +2 -1
  147. data/app/models/qdm/physical_exam_performed.rb +2 -1
  148. data/app/models/qdm/physical_exam_recommended.rb +2 -1
  149. data/app/models/qdm/procedure_order.rb +2 -1
  150. data/app/models/qdm/procedure_performed.rb +2 -1
  151. data/app/models/qdm/procedure_recommended.rb +2 -1
  152. data/app/models/qdm/provider_care_experience.rb +2 -1
  153. data/app/models/qdm/provider_characteristic.rb +2 -1
  154. data/app/models/qdm/substance_administered.rb +2 -1
  155. data/app/models/qdm/substance_order.rb +2 -1
  156. data/app/models/qdm/substance_recommended.rb +2 -1
  157. data/app/models/qdm/symptom.rb +2 -1
  158. data/bin/build_cql_execution.sh +8 -0
  159. data/bin/validate_browser.sh +17 -0
  160. data/bin/validate_generator.sh +12 -0
  161. data/cqm-models.gemspec +5 -2
  162. data/data/oids_qdm_5.4.json +321 -0
  163. data/data/{oids.json → oids_unversioned.json} +0 -0
  164. data/dist/browser.js +102937 -0
  165. data/dist/index.js +36637 -36540
  166. data/lib/generate_models.rb +89 -93
  167. data/lib/generate_patients.rb +125 -0
  168. data/lib/generate_types.rb +64 -0
  169. data/lib/generators/custom_mongo/model.rb.tt +20 -0
  170. data/lib/generators/custom_mongo/model_generator.rb +34 -0
  171. data/notice.md +9 -0
  172. data/package.json +12 -6
  173. data/templates/id_template.js.erb +8 -3
  174. data/templates/index_template.js.erb +18 -8
  175. data/templates/models_template.rb.erb +20 -4
  176. data/templates/mongoose_template.js.erb +23 -15
  177. data/templates/patient_extension.rb.erb +7 -4
  178. data/templates/patient_template.js.erb +88 -87
  179. data/yarn.lock +552 -347
  180. metadata +86 -19
  181. data/app/assets/javascripts/Component.js +0 -26
  182. data/app/assets/javascripts/Concept.js +0 -14
  183. data/app/assets/javascripts/FacilityLocation.js +0 -26
  184. data/app/assets/javascripts/Measure.js +0 -78
  185. data/app/assets/javascripts/Patient.js +0 -262
  186. data/app/assets/javascripts/ValueSet.js +0 -30
  187. data/app/models/qdm/tacoma/measure.rb +0 -174
  188. data/app/models/qdm/tacoma/valueset.rb +0 -68
@@ -0,0 +1,262 @@
1
+ const mongoose = require('mongoose/browser');
2
+ const Code = require('./basetypes/Code');
3
+ const Interval = require('./basetypes/Interval');
4
+ const Quantity = require('./basetypes/Quantity');
5
+ const DateTime = require('./basetypes/DateTime');
6
+ const AllDataElements = require('./AllDataElements');
7
+
8
+ const [Schema, Number, String, Mixed] = [
9
+ mongoose.Schema,
10
+ mongoose.Schema.Types.Number,
11
+ mongoose.Schema.Types.String,
12
+ mongoose.Schema.Types.Mixed,
13
+ ];
14
+
15
+ const QDMPatientSchema = new Schema({
16
+ birthDatetime: DateTime,
17
+ qdmVersion: { type: String, default: '5.4' },
18
+
19
+ // These are the "data criteria", or QDM datatype elements that exist on a
20
+ // patient.
21
+ dataElements: [],
22
+ // This field is for application specific information only. If both Bonnie
23
+ // Cypress use a common field, it should be made a field on this model,
24
+ // and not put into extendedData.
25
+ extendedData: {
26
+ type: Mixed,
27
+ default: {},
28
+ },
29
+ }, { id: false });
30
+
31
+ // After initialization of a Patient model, initialize every individual data element
32
+ // to its respective Mongoose Model
33
+ QDMPatientSchema.methods.initializeDataElements = function initializeDataElements() {
34
+ let typeStripped;
35
+ const dataElementsInit = [];
36
+ this.dataElements.forEach((element) => {
37
+ typeStripped = element._type.replace(/QDM::/, '');
38
+ dataElementsInit.push(new AllDataElements[typeStripped](element));
39
+ });
40
+ this.set({ dataElements: dataElementsInit });
41
+ };
42
+
43
+ QDMPatientSchema.methods.id = function id() {
44
+ return this._id;
45
+ };
46
+
47
+ // Returns an array of elements that exist on this patient, that
48
+ // match the given HQMF data criteria OID.
49
+ QDMPatientSchema.methods.getByHqmfOid = function getByHqmfOid(hqmfOid) {
50
+ return this.dataElements.filter(element => element.hqmfOid === hqmfOid);
51
+ };
52
+
53
+ // Returns an array of elements that exist on this patient, that
54
+ // match the given QRDA data criteria OID.
55
+ QDMPatientSchema.methods.getByQrdaOid = function getByQrdaOid(qrdaOid) {
56
+ return this.dataElements.filter(element => element.qrdaOid === qrdaOid);
57
+ };
58
+
59
+ // Returns an array of elements that exist on this patient. Optionally
60
+ // takes a qdmCategory, which returns all elements of that QDM qdmCategory.
61
+ // Example: patient.getDataElements({qdmCategory: 'encounters'}) will return
62
+ // all Encounter QDM data types active on the patient.
63
+ QDMPatientSchema.methods.getDataElements = function getDataElements(params) {
64
+ if (params !== undefined && params.qdmCategory !== undefined && params.qdmStatus !== undefined) {
65
+ return this.dataElements.filter(element => (element.qdmCategory === params.qdmCategory) && (element.qdmStatus === params.qdmStatus));
66
+ } else if (params !== undefined && params.qdmCategory !== undefined) {
67
+ return this.dataElements.filter(element => element.qdmCategory === params.qdmCategory);
68
+ }
69
+ return this.dataElements;
70
+ };
71
+
72
+ // Returns an array of dataElements that exist on the patient, queried by
73
+ // QDM profile
74
+ // @param {string} profile - the data criteria requested by the execution engine
75
+ // @param {boolean} isNegated - whether dataElements should be returned based on their negation status
76
+ // @returns {DataElement[]}
77
+ QDMPatientSchema.methods.getByProfile = function getByProfile(profile, isNegated = null) {
78
+ // If isNegated == true, only return data elements with a negationRationale that is not null.
79
+ // If isNegated == false, only return data elements with a null negationRationale.
80
+ // If isNegated == null, return all matching data elements by type, regardless of negationRationale.
81
+ const results = this.dataElements.filter(element => (element._type === `QDM::${profile}` || element._type === profile) && (isNegated === null || !!element.negationRationale === isNegated));
82
+ return results.map((result) => {
83
+ const removedMongooseItems = new AllDataElements[profile](result).toObject({ virtuals: true });
84
+ // toObject() will remove all mongoose functions but also remove the schema methods, so we add them back
85
+ Object.entries(result.schema.methods).forEach(([method_name, method]) => {
86
+ removedMongooseItems[method_name] = method;
87
+ });
88
+ return removedMongooseItems;
89
+ });
90
+ };
91
+
92
+ // This method is called by the CQL execution engine on a CQLPatient when
93
+ // the execution engine wants information on a record. A record could be patient
94
+ // characteristic information about the patient, or it could be data criteria
95
+ // that currently exist on this patient (data criteria you drag on a patient
96
+ // in Bonnie patient builder).
97
+ // @param {String} profile - the data criteria requested by the execution engine
98
+ // @returns {Object}
99
+ QDMPatientSchema.methods.findRecords = function findRecords(profile) {
100
+ let profileStripped;
101
+ if (profile === 'Patient') {
102
+ // Requested generic patient info
103
+ const info = { birthDatetime: this.birthDatetime };
104
+ return [info];
105
+ } else if (/PatientCharacteristic/.test(profile)) {
106
+ // Requested a patient characteristic
107
+ profileStripped = profile.replace(/ *\{[^)]*\} */g, '');
108
+ return this.getByProfile(profileStripped);
109
+ } else if (profile != null) {
110
+ // Requested something else (probably a QDM data type).
111
+
112
+ // Strip model details from request. The requested profile string contains
113
+ // a lot of things we do not need or care about. Example, we might see
114
+ // something like:
115
+ // "{urn:healthit-gov:qdm:v5_0_draft}PatientCharacteristicEthnicity"
116
+ // Where we only care about: "PatientCharacteristicEthnicity".
117
+ profileStripped = profile.replace(/ *\{[^)]*\} */g, '');
118
+
119
+ // Check and handle negation status
120
+ if (/Positive/.test(profileStripped)) {
121
+ profileStripped = profileStripped.replace(/Positive/, '');
122
+ // Since the data criteria is 'Positive', it is not negated.
123
+ return this.getByProfile(profileStripped, false);
124
+ } else if (/Negative/.test(profileStripped)) {
125
+ profileStripped = profileStripped.replace(/Negative/, '');
126
+ // Since the data criteria is 'Negative', it is negated.
127
+ return this.getByProfile(profileStripped, true);
128
+ }
129
+ // No negation status, proceed normally
130
+ return this.getByProfile(profileStripped);
131
+ }
132
+ return [];
133
+ };
134
+
135
+ QDMPatientSchema.methods.adverse_events = function adverse_events() {
136
+ return this.getDataElements({ qdmCategory: 'adverse_event' });
137
+ };
138
+
139
+ QDMPatientSchema.methods.allergies = function allergies() {
140
+ return this.getDataElements({ qdmCategory: 'allergy' });
141
+ };
142
+
143
+ QDMPatientSchema.methods.assessments = function assessments() {
144
+ return this.getDataElements({ qdmCategory: 'assessment' });
145
+ };
146
+
147
+ QDMPatientSchema.methods.care_experiences = function care_experiences() {
148
+ return this.getDataElements({ qdmCategory: 'care_experience' });
149
+ };
150
+
151
+ QDMPatientSchema.methods.care_goals = function care_goals() {
152
+ return this.getDataElements({ qdmCategory: 'care_goal' });
153
+ };
154
+
155
+ QDMPatientSchema.methods.communications = function communications() {
156
+ return this.getDataElements({ qdmCategory: 'communication' });
157
+ };
158
+
159
+ QDMPatientSchema.methods.conditions = function conditions() {
160
+ return this.getDataElements({ qdmCategory: 'condition' });
161
+ };
162
+
163
+ QDMPatientSchema.methods.devices = function devices() {
164
+ return this.getDataElements({ qdmCategory: 'device' });
165
+ };
166
+
167
+ QDMPatientSchema.methods.diagnostic_studies = function diagnostic_studies() {
168
+ return this.getDataElements({ qdmCategory: 'diagnostic_study' });
169
+ };
170
+
171
+ QDMPatientSchema.methods.encounters = function encounters() {
172
+ return this.getDataElements({ qdmCategory: 'encounter' });
173
+ };
174
+
175
+ QDMPatientSchema.methods.family_history = function family_history() {
176
+ return this.getDataElements({ qdmCategory: 'family_history' });
177
+ };
178
+
179
+ QDMPatientSchema.methods.functional_statuses = function functional_statuses() {
180
+ return this.getDataElements({ qdmCategory: 'functional_status' });
181
+ };
182
+
183
+ QDMPatientSchema.methods.immunizations = function immunizations() {
184
+ return this.getDataElements({ qdmCategory: 'immunization' });
185
+ };
186
+
187
+ QDMPatientSchema.methods.interventions = function interventions() {
188
+ return this.getDataElements({ qdmCategory: 'intervention' });
189
+ };
190
+
191
+ QDMPatientSchema.methods.laboratory_tests = function laboratory_tests() {
192
+ return this.getDataElements({ qdmCategory: 'laboratory_test' });
193
+ };
194
+
195
+ QDMPatientSchema.methods.medical_equipment = function medical_equipment() {
196
+ return this.getDataElements({ qdmCategory: 'medical_equipment' });
197
+ };
198
+
199
+ QDMPatientSchema.methods.medications = function medications() {
200
+ return this.getDataElements({ qdmCategory: 'medication' });
201
+ };
202
+
203
+ QDMPatientSchema.methods.patient_characteristics = function patient_characteristics() {
204
+ return this.getDataElements({ qdmCategory: 'patient_characteristic' });
205
+ };
206
+
207
+ QDMPatientSchema.methods.physical_exams = function physical_exams() {
208
+ return this.getDataElements({ qdmCategory: 'physical_exam' });
209
+ };
210
+
211
+ QDMPatientSchema.methods.preferences = function preferences() {
212
+ return this.getDataElements({ qdmCategory: 'preference' });
213
+ };
214
+
215
+ QDMPatientSchema.methods.provider_characteristics = function provider_characteristics() {
216
+ return this.getDataElements({ qdmCategory: 'provider_characteristic' });
217
+ };
218
+
219
+ QDMPatientSchema.methods.procedures = function procedures() {
220
+ return this.getDataElements({ qdmCategory: 'procedure' });
221
+ };
222
+
223
+ QDMPatientSchema.methods.results = function results() {
224
+ return this.getDataElements({ qdmCategory: 'result' });
225
+ };
226
+
227
+ QDMPatientSchema.methods.risk_category_assessments = function risk_category_assessments() {
228
+ return this.getDataElements({ qdmCategory: 'risk_category_assessment' });
229
+ };
230
+
231
+ QDMPatientSchema.methods.social_history = function social_history() {
232
+ return this.getDataElements({ qdmCategory: 'social_history' });
233
+ };
234
+
235
+ QDMPatientSchema.methods.substances = function substances() {
236
+ return this.getDataElements({ qdmCategory: 'substance' });
237
+ };
238
+
239
+ QDMPatientSchema.methods.symptoms = function symptoms() {
240
+ return this.getDataElements({ qdmCategory: 'symptom' });
241
+ };
242
+
243
+ QDMPatientSchema.methods.system_characteristics = function system_characteristics() {
244
+ return this.getDataElements({ qdmCategory: 'system_characteristic' });
245
+ };
246
+
247
+ QDMPatientSchema.methods.transfers = function transfers() {
248
+ return this.getDataElements({ qdmCategory: 'transfer' });
249
+ };
250
+
251
+ QDMPatientSchema.methods.vital_signs = function vital_signs() {
252
+ return this.getDataElements({ qdmCategory: 'vital_sign' });
253
+ };
254
+
255
+ module.exports.QDMPatientSchema = QDMPatientSchema;
256
+ class QDMPatient extends mongoose.Document {
257
+ constructor(object) {
258
+ super(object, QDMPatientSchema);
259
+ this.initializeDataElements();
260
+ }
261
+ }
262
+ module.exports.QDMPatient = QDMPatient;
@@ -1,4 +1,4 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require('mongoose/browser');
2
2
 
3
3
  const PlaceholderResultSchema = mongoose.Schema({
4
4
  cache_id: String,
@@ -25,4 +25,9 @@ const PlaceholderResultSchema = mongoose.Schema({
25
25
  });
26
26
 
27
27
  module.exports.ResultSchema = PlaceholderResultSchema;
28
- module.exports.Result = mongoose.model('Result', PlaceholderResultSchema);
28
+ class PlaceholderResult extends mongoose.Document {
29
+ constructor(object) {
30
+ super(object, PlaceholderResultSchema);
31
+ }
32
+ }
33
+ module.exports.PlaceholderResult = PlaceholderResult;
@@ -1,13 +1,15 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { IdSchema } = require('./Id');
2
4
  const { DataElementSchema } = require('./basetypes/DataElement');
3
5
  const Code = require('./basetypes/Code');
4
6
  const Interval = require('./basetypes/Interval');
5
7
  const Quantity = require('./basetypes/Quantity');
6
8
  const DateTime = require('./basetypes/DateTime');
7
-
8
- const { FacilityLocationSchema } = require('./FacilityLocation');
9
- const { IdSchema } = require('./Id');
10
9
  const Any = require('./basetypes/Any');
10
+ const { ComponentSchema } = require('./attributes/Component');
11
+ const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
12
+
11
13
 
12
14
  const [Number, String] = [
13
15
  mongoose.Schema.Types.Number,
@@ -17,9 +19,15 @@ const [Number, String] = [
17
19
  const ResultComponentSchema = DataElementSchema({
18
20
  referenceRange: Interval,
19
21
  qdmVersion: { type: String, default: '5.4' },
20
- _type: { type: String, default: 'ResultComponent' },
22
+ _type: { type: String, default: 'QDM::ResultComponent' },
21
23
 
22
24
  });
23
25
 
24
26
  module.exports.ResultComponentSchema = ResultComponentSchema;
25
- module.exports.ResultComponent = mongoose.model('ResultComponent', ResultComponentSchema);
27
+ class ResultComponent extends mongoose.Document {
28
+ constructor(object) {
29
+ super(object, ResultComponentSchema);
30
+ this._type = 'QDM::ResultComponent';
31
+ }
32
+ }
33
+ module.exports.ResultComponent = ResultComponent;
@@ -1,13 +1,15 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { IdSchema } = require('./Id');
2
4
  const { DataElementSchema } = require('./basetypes/DataElement');
3
5
  const Code = require('./basetypes/Code');
4
6
  const Interval = require('./basetypes/Interval');
5
7
  const Quantity = require('./basetypes/Quantity');
6
8
  const DateTime = require('./basetypes/DateTime');
7
- const { ComponentSchema } = require('./Component');
8
- const { FacilityLocationSchema } = require('./FacilityLocation');
9
- const { IdSchema } = require('./Id');
10
9
  const Any = require('./basetypes/Any');
10
+ const { ComponentSchema } = require('./attributes/Component');
11
+ const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
12
+
11
13
 
12
14
  const [Number, String] = [
13
15
  mongoose.Schema.Types.Number,
@@ -21,13 +23,20 @@ const SubstanceAdministeredSchema = DataElementSchema({
21
23
  frequency: Code,
22
24
  route: Code,
23
25
  negationRationale: Code,
24
- hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.73' },
26
+ qdmTitle: { type: String, default: 'Substance, Administered' },
27
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.73' },
25
28
  qdmCategory: { type: String, default: 'substance' },
26
29
  qdmStatus: { type: String, default: 'administered' },
27
30
  qdmVersion: { type: String, default: '5.4' },
28
- _type: { type: String, default: 'SubstanceAdministered' },
31
+ _type: { type: String, default: 'QDM::SubstanceAdministered' },
29
32
 
30
33
  });
31
34
 
32
35
  module.exports.SubstanceAdministeredSchema = SubstanceAdministeredSchema;
33
- module.exports.SubstanceAdministered = mongoose.model('SubstanceAdministered', SubstanceAdministeredSchema);
36
+ class SubstanceAdministered extends mongoose.Document {
37
+ constructor(object) {
38
+ super(object, SubstanceAdministeredSchema);
39
+ this._type = 'QDM::SubstanceAdministered';
40
+ }
41
+ }
42
+ module.exports.SubstanceAdministered = SubstanceAdministered;
@@ -1,13 +1,15 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { IdSchema } = require('./Id');
2
4
  const { DataElementSchema } = require('./basetypes/DataElement');
3
5
  const Code = require('./basetypes/Code');
4
6
  const Interval = require('./basetypes/Interval');
5
7
  const Quantity = require('./basetypes/Quantity');
6
8
  const DateTime = require('./basetypes/DateTime');
7
- const { ComponentSchema } = require('./Component');
8
- const { FacilityLocationSchema } = require('./FacilityLocation');
9
- const { IdSchema } = require('./Id');
10
9
  const Any = require('./basetypes/Any');
10
+ const { ComponentSchema } = require('./attributes/Component');
11
+ const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
12
+
11
13
 
12
14
  const [Number, String] = [
13
15
  mongoose.Schema.Types.Number,
@@ -23,13 +25,20 @@ const SubstanceOrderSchema = DataElementSchema({
23
25
  refills: Number,
24
26
  route: Code,
25
27
  negationRationale: Code,
26
- hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.77' },
28
+ qdmTitle: { type: String, default: 'Substance, Order' },
29
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.77' },
27
30
  qdmCategory: { type: String, default: 'substance' },
28
31
  qdmStatus: { type: String, default: 'order' },
29
32
  qdmVersion: { type: String, default: '5.4' },
30
- _type: { type: String, default: 'SubstanceOrder' },
33
+ _type: { type: String, default: 'QDM::SubstanceOrder' },
31
34
 
32
35
  });
33
36
 
34
37
  module.exports.SubstanceOrderSchema = SubstanceOrderSchema;
35
- module.exports.SubstanceOrder = mongoose.model('SubstanceOrder', SubstanceOrderSchema);
38
+ class SubstanceOrder extends mongoose.Document {
39
+ constructor(object) {
40
+ super(object, SubstanceOrderSchema);
41
+ this._type = 'QDM::SubstanceOrder';
42
+ }
43
+ }
44
+ module.exports.SubstanceOrder = SubstanceOrder;
@@ -1,13 +1,15 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { IdSchema } = require('./Id');
2
4
  const { DataElementSchema } = require('./basetypes/DataElement');
3
5
  const Code = require('./basetypes/Code');
4
6
  const Interval = require('./basetypes/Interval');
5
7
  const Quantity = require('./basetypes/Quantity');
6
8
  const DateTime = require('./basetypes/DateTime');
7
- const { ComponentSchema } = require('./Component');
8
- const { FacilityLocationSchema } = require('./FacilityLocation');
9
- const { IdSchema } = require('./Id');
10
9
  const Any = require('./basetypes/Any');
10
+ const { ComponentSchema } = require('./attributes/Component');
11
+ const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
12
+
11
13
 
12
14
  const [Number, String] = [
13
15
  mongoose.Schema.Types.Number,
@@ -22,13 +24,20 @@ const SubstanceRecommendedSchema = DataElementSchema({
22
24
  refills: Number,
23
25
  route: Code,
24
26
  negationRationale: Code,
25
- hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.78' },
27
+ qdmTitle: { type: String, default: 'Substance, Recommended' },
28
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.78' },
26
29
  qdmCategory: { type: String, default: 'substance' },
27
30
  qdmStatus: { type: String, default: 'recommended' },
28
31
  qdmVersion: { type: String, default: '5.4' },
29
- _type: { type: String, default: 'SubstanceRecommended' },
32
+ _type: { type: String, default: 'QDM::SubstanceRecommended' },
30
33
 
31
34
  });
32
35
 
33
36
  module.exports.SubstanceRecommendedSchema = SubstanceRecommendedSchema;
34
- module.exports.SubstanceRecommended = mongoose.model('SubstanceRecommended', SubstanceRecommendedSchema);
37
+ class SubstanceRecommended extends mongoose.Document {
38
+ constructor(object) {
39
+ super(object, SubstanceRecommendedSchema);
40
+ this._type = 'QDM::SubstanceRecommended';
41
+ }
42
+ }
43
+ module.exports.SubstanceRecommended = SubstanceRecommended;
@@ -1,13 +1,15 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { IdSchema } = require('./Id');
2
4
  const { DataElementSchema } = require('./basetypes/DataElement');
3
5
  const Code = require('./basetypes/Code');
4
6
  const Interval = require('./basetypes/Interval');
5
7
  const Quantity = require('./basetypes/Quantity');
6
8
  const DateTime = require('./basetypes/DateTime');
7
- const { ComponentSchema } = require('./Component');
8
- const { FacilityLocationSchema } = require('./FacilityLocation');
9
- const { IdSchema } = require('./Id');
10
9
  const Any = require('./basetypes/Any');
10
+ const { ComponentSchema } = require('./attributes/Component');
11
+ const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
12
+
11
13
 
12
14
  const [Number, String] = [
13
15
  mongoose.Schema.Types.Number,
@@ -17,13 +19,20 @@ const [Number, String] = [
17
19
  const SymptomSchema = DataElementSchema({
18
20
  prevalencePeriod: Interval,
19
21
  severity: Code,
20
- hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.116' },
22
+ qdmTitle: { type: String, default: 'Symptom' },
23
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.116' },
21
24
  qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.136' },
22
25
  qdmCategory: { type: String, default: 'symptom' },
23
26
  qdmVersion: { type: String, default: '5.4' },
24
- _type: { type: String, default: 'Symptom' },
27
+ _type: { type: String, default: 'QDM::Symptom' },
25
28
 
26
29
  });
27
30
 
28
31
  module.exports.SymptomSchema = SymptomSchema;
29
- module.exports.Symptom = mongoose.model('Symptom', SymptomSchema);
32
+ class Symptom extends mongoose.Document {
33
+ constructor(object) {
34
+ super(object, SymptomSchema);
35
+ this._type = 'QDM::Symptom';
36
+ }
37
+ }
38
+ module.exports.Symptom = Symptom;