cqm-models 1.1.1.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +1 -1
  3. data/.github/workflows/gitleaks_github_actions.yml +28 -0
  4. data/.travis.yml +3 -3
  5. data/README.md +12 -9
  6. data/app/assets/javascripts/AdverseEvent.js +9 -3
  7. data/app/assets/javascripts/AllDataElements.js +18 -6
  8. data/app/assets/javascripts/AllergyIntolerance.js +8 -2
  9. data/app/assets/javascripts/AssessmentOrder.js +8 -2
  10. data/app/assets/javascripts/AssessmentPerformed.js +11 -3
  11. data/app/assets/javascripts/AssessmentRecommended.js +8 -2
  12. data/app/assets/javascripts/CareGoal.js +10 -3
  13. data/app/assets/javascripts/CommunicationPerformed.js +12 -6
  14. data/app/assets/javascripts/DeviceApplied.js +9 -2
  15. data/app/assets/javascripts/DeviceOrder.js +8 -2
  16. data/app/assets/javascripts/DeviceRecommended.js +8 -2
  17. data/app/assets/javascripts/Diagnosis.js +8 -2
  18. data/app/assets/javascripts/DiagnosticStudyOrder.js +8 -2
  19. data/app/assets/javascripts/DiagnosticStudyPerformed.js +9 -2
  20. data/app/assets/javascripts/DiagnosticStudyRecommended.js +8 -2
  21. data/app/assets/javascripts/EncounterOrder.js +9 -2
  22. data/app/assets/javascripts/EncounterPerformed.js +11 -5
  23. data/app/assets/javascripts/EncounterRecommended.js +8 -2
  24. data/app/assets/javascripts/FamilyHistory.js +8 -2
  25. data/app/assets/javascripts/ImmunizationAdministered.js +9 -2
  26. data/app/assets/javascripts/ImmunizationOrder.js +8 -2
  27. data/app/assets/javascripts/InterventionOrder.js +8 -2
  28. data/app/assets/javascripts/InterventionPerformed.js +9 -2
  29. data/app/assets/javascripts/InterventionRecommended.js +8 -2
  30. data/app/assets/javascripts/LaboratoryTestOrder.js +8 -2
  31. data/app/assets/javascripts/LaboratoryTestPerformed.js +9 -2
  32. data/app/assets/javascripts/LaboratoryTestRecommended.js +8 -2
  33. data/app/assets/javascripts/MedicationActive.js +9 -2
  34. data/app/assets/javascripts/MedicationAdministered.js +9 -2
  35. data/app/assets/javascripts/MedicationDischarge.js +9 -2
  36. data/app/assets/javascripts/MedicationDispensed.js +10 -4
  37. data/app/assets/javascripts/MedicationOrder.js +9 -4
  38. data/app/assets/javascripts/Participation.js +8 -2
  39. data/app/assets/javascripts/PatientCareExperience.js +8 -2
  40. data/app/assets/javascripts/PatientCharacteristic.js +7 -2
  41. data/app/assets/javascripts/PatientCharacteristicBirthdate.js +7 -2
  42. data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +7 -2
  43. data/app/assets/javascripts/PatientCharacteristicEthnicity.js +7 -2
  44. data/app/assets/javascripts/PatientCharacteristicExpired.js +7 -2
  45. data/app/assets/javascripts/PatientCharacteristicPayer.js +7 -2
  46. data/app/assets/javascripts/PatientCharacteristicRace.js +7 -2
  47. data/app/assets/javascripts/PatientCharacteristicSex.js +7 -2
  48. data/app/assets/javascripts/PhysicalExamOrder.js +8 -2
  49. data/app/assets/javascripts/PhysicalExamPerformed.js +9 -2
  50. data/app/assets/javascripts/PhysicalExamRecommended.js +8 -2
  51. data/app/assets/javascripts/ProcedureOrder.js +10 -3
  52. data/app/assets/javascripts/ProcedurePerformed.js +11 -3
  53. data/app/assets/javascripts/ProcedureRecommended.js +9 -3
  54. data/app/assets/javascripts/ProviderCareExperience.js +8 -2
  55. data/app/assets/javascripts/QDMPatient.js +25 -9
  56. data/app/assets/javascripts/RelatedPerson.js +42 -0
  57. data/app/assets/javascripts/SubstanceAdministered.js +9 -2
  58. data/app/assets/javascripts/SubstanceOrder.js +9 -2
  59. data/app/assets/javascripts/SubstanceRecommended.js +8 -2
  60. data/app/assets/javascripts/Symptom.js +8 -2
  61. data/app/assets/javascripts/attributes/CarePartner.js +33 -0
  62. data/app/assets/javascripts/attributes/Component.js +22 -1
  63. data/app/assets/javascripts/attributes/DiagnosisComponent.js +34 -0
  64. data/app/assets/javascripts/attributes/Entity.js +58 -0
  65. data/app/assets/javascripts/attributes/FacilityLocation.js +4 -1
  66. data/app/assets/javascripts/attributes/Identifier.js +23 -0
  67. data/app/assets/javascripts/attributes/Organization.js +33 -0
  68. data/app/assets/javascripts/attributes/PatientEntity.js +32 -0
  69. data/app/assets/javascripts/attributes/Practitioner.js +35 -0
  70. data/app/assets/javascripts/attributes/ResultComponent.js +31 -0
  71. data/app/assets/javascripts/basetypes/Any.js +24 -15
  72. data/app/assets/javascripts/basetypes/AnyEntity.js +44 -0
  73. data/app/assets/javascripts/basetypes/Code.js +8 -12
  74. data/app/assets/javascripts/basetypes/DataElement.js +17 -6
  75. data/app/assets/javascripts/basetypes/Interval.js +10 -8
  76. data/app/assets/javascripts/basetypes/QDMDate.js +36 -0
  77. data/app/assets/javascripts/basetypes/Quantity.js +1 -1
  78. data/app/assets/javascripts/basetypes/Ratio.js +1 -1
  79. data/app/assets/javascripts/cqm/AllCQMModels.js +2 -0
  80. data/app/assets/javascripts/cqm/ClauseResult.js +28 -0
  81. data/app/assets/javascripts/{IndividualResult.js → cqm/IndividualResult.js} +28 -2
  82. data/app/assets/javascripts/cqm/Measure.js +1 -1
  83. data/app/assets/javascripts/cqm/Provider.js +0 -2
  84. data/app/assets/javascripts/cqm/StatementResult.js +41 -0
  85. data/app/assets/javascripts/index.js +6 -2
  86. data/app/models/cqm/clause_result.rb +21 -0
  87. data/app/models/{qdm/tacoma → cqm}/individual_result.rb +24 -3
  88. data/app/models/cqm/measure.rb +2 -0
  89. data/app/models/cqm/patient.rb +1 -0
  90. data/app/models/cqm/provider.rb +4 -4
  91. data/app/models/cqm/statement_result.rb +27 -0
  92. data/app/models/hqmfOid_to_datatype_map.json +5 -1
  93. data/app/models/model_finder.rb +1 -0
  94. data/app/models/models.rb +15 -6
  95. data/app/models/qdm/adverse_event.rb +3 -2
  96. data/app/models/qdm/allergy_intolerance.rb +2 -1
  97. data/app/models/qdm/assessment_order.rb +2 -1
  98. data/app/models/qdm/assessment_performed.rb +5 -2
  99. data/app/models/qdm/assessment_recommended.rb +2 -1
  100. data/app/models/qdm/attributes/attribute.rb +1 -0
  101. data/app/models/qdm/attributes/care_partner.rb +10 -0
  102. data/app/models/qdm/attributes/component.rb +1 -1
  103. data/app/models/qdm/attributes/diagnosis_component.rb +10 -0
  104. data/app/models/qdm/attributes/entity.rb +15 -0
  105. data/app/models/qdm/attributes/facility_location.rb +1 -1
  106. data/app/models/qdm/{id.rb → attributes/identifier.rb} +3 -4
  107. data/app/models/qdm/attributes/organization.rb +10 -0
  108. data/app/models/qdm/attributes/patient_entity.rb +9 -0
  109. data/app/models/qdm/attributes/practitioner.rb +12 -0
  110. data/app/models/qdm/{result_component.rb → attributes/result_component.rb} +1 -3
  111. data/app/models/qdm/basetypes/code.rb +9 -10
  112. data/app/models/qdm/basetypes/data_element.rb +64 -12
  113. data/app/models/qdm/basetypes/date.rb +39 -0
  114. data/app/models/qdm/basetypes/interval.rb +26 -3
  115. data/app/models/qdm/basetypes/quantity.rb +1 -0
  116. data/app/models/qdm/basetypes/ratio.rb +1 -0
  117. data/app/models/qdm/care_goal.rb +4 -2
  118. data/app/models/qdm/communication_performed.rb +6 -5
  119. data/app/models/qdm/device_applied.rb +3 -1
  120. data/app/models/qdm/device_order.rb +2 -1
  121. data/app/models/qdm/device_recommended.rb +2 -1
  122. data/app/models/qdm/diagnosis.rb +2 -1
  123. data/app/models/qdm/diagnostic_study_order.rb +2 -1
  124. data/app/models/qdm/diagnostic_study_performed.rb +3 -1
  125. data/app/models/qdm/diagnostic_study_recommended.rb +2 -1
  126. data/app/models/qdm/encounter_order.rb +3 -1
  127. data/app/models/qdm/encounter_performed.rb +3 -2
  128. data/app/models/qdm/encounter_recommended.rb +2 -1
  129. data/app/models/qdm/family_history.rb +2 -1
  130. data/app/models/qdm/immunization_administered.rb +3 -1
  131. data/app/models/qdm/immunization_order.rb +2 -1
  132. data/app/models/qdm/intervention_order.rb +2 -1
  133. data/app/models/qdm/intervention_performed.rb +3 -1
  134. data/app/models/qdm/intervention_recommended.rb +2 -1
  135. data/app/models/qdm/laboratory_test_order.rb +2 -1
  136. data/app/models/qdm/laboratory_test_performed.rb +3 -1
  137. data/app/models/qdm/laboratory_test_recommended.rb +2 -1
  138. data/app/models/qdm/medication_active.rb +3 -1
  139. data/app/models/qdm/medication_administered.rb +3 -1
  140. data/app/models/qdm/medication_discharge.rb +3 -1
  141. data/app/models/qdm/medication_dispensed.rb +4 -3
  142. data/app/models/qdm/medication_order.rb +3 -3
  143. data/app/models/qdm/participation.rb +2 -1
  144. data/app/models/qdm/patient.rb +2 -2
  145. data/app/models/qdm/patient_care_experience.rb +2 -1
  146. data/app/models/qdm/patient_characteristic.rb +1 -1
  147. data/app/models/qdm/patient_characteristic_birthdate.rb +1 -1
  148. data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +1 -1
  149. data/app/models/qdm/patient_characteristic_ethnicity.rb +1 -1
  150. data/app/models/qdm/patient_characteristic_expired.rb +1 -1
  151. data/app/models/qdm/patient_characteristic_payer.rb +1 -1
  152. data/app/models/qdm/patient_characteristic_race.rb +1 -1
  153. data/app/models/qdm/patient_characteristic_sex.rb +1 -1
  154. data/app/models/qdm/physical_exam_order.rb +2 -1
  155. data/app/models/qdm/physical_exam_performed.rb +3 -1
  156. data/app/models/qdm/physical_exam_recommended.rb +2 -1
  157. data/app/models/qdm/procedure_order.rb +4 -2
  158. data/app/models/qdm/procedure_performed.rb +5 -2
  159. data/app/models/qdm/procedure_recommended.rb +3 -2
  160. data/app/models/qdm/provider_care_experience.rb +2 -1
  161. data/app/models/qdm/related_person.rb +13 -0
  162. data/app/models/qdm/substance_administered.rb +3 -1
  163. data/app/models/qdm/substance_order.rb +3 -1
  164. data/app/models/qdm/substance_recommended.rb +2 -1
  165. data/app/models/qdm/symptom.rb +2 -1
  166. data/bin/validate_generator.sh +1 -1
  167. data/cqm-models.gemspec +5 -5
  168. data/data/oids_qdm_5.5.json +337 -0
  169. data/dist/browser.js +41069 -34668
  170. data/dist/index.js +41068 -34667
  171. data/lib/generate_entities.rb +56 -0
  172. data/lib/generate_models.rb +77 -39
  173. data/lib/generate_patients.rb +20 -14
  174. data/lib/generate_types.rb +54 -14
  175. data/lib/generator_helpers.rb +14 -0
  176. data/modelinfo/qdm-modelinfo-5.5.xml +982 -0
  177. data/package.json +4 -4
  178. data/templates/entity_extension.rb.erb +6 -0
  179. data/templates/identifier_extension.rb.erb +58 -0
  180. data/templates/{id_template.js.erb → identifier_template.js.erb} +6 -5
  181. data/templates/index_template.js.erb +6 -2
  182. data/templates/models_template.rb.erb +22 -5
  183. data/templates/mongoose_template.js.erb +86 -12
  184. data/templates/patient_extension.rb.erb +1 -1
  185. data/templates/patient_template.js.erb +0 -4
  186. data/yarn.lock +525 -391
  187. metadata +46 -21
  188. data/app/assets/javascripts/Id.js +0 -21
  189. data/app/assets/javascripts/ProviderCharacteristic.js +0 -36
  190. data/app/assets/javascripts/ResultComponent.js +0 -33
  191. data/app/models/qdm/provider_characteristic.rb +0 -12
@@ -1,14 +1,17 @@
1
1
  const mongoose = require('mongoose/browser');
2
2
 
3
- const { IdSchema } = require('./Id');
3
+ const { IdentifierSchema } = require('./attributes/Identifier');
4
4
  const { DataElementSchema } = require('./basetypes/DataElement');
5
5
  const Code = require('./basetypes/Code');
6
6
  const Interval = require('./basetypes/Interval');
7
7
  const Quantity = require('./basetypes/Quantity');
8
8
  const DateTime = require('./basetypes/DateTime');
9
+ const QDMDate = require('./basetypes/QDMDate');
9
10
  const Any = require('./basetypes/Any');
11
+ const AnyEntity = require('./basetypes/AnyEntity');
10
12
  const { ComponentSchema } = require('./attributes/Component');
11
13
  const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
14
+ const { EntitySchema } = require('./attributes/Entity');
12
15
 
13
16
 
14
17
  const [Number, String] = [
@@ -18,6 +21,7 @@ const [Number, String] = [
18
21
 
19
22
  const SubstanceOrderSchema = DataElementSchema({
20
23
  authorDatetime: DateTime,
24
+ relevantPeriod: Interval,
21
25
  reason: Code,
22
26
  dosage: Quantity,
23
27
  supply: Quantity,
@@ -25,11 +29,12 @@ const SubstanceOrderSchema = DataElementSchema({
25
29
  refills: Number,
26
30
  route: Code,
27
31
  negationRationale: Code,
32
+ requester: AnyEntity,
28
33
  qdmTitle: { type: String, default: 'Substance, Order' },
29
34
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.77' },
30
35
  qdmCategory: { type: String, default: 'substance' },
31
36
  qdmStatus: { type: String, default: 'order' },
32
- qdmVersion: { type: String, default: '5.4' },
37
+ qdmVersion: { type: String, default: '5.5' },
33
38
  _type: { type: String, default: 'QDM::SubstanceOrder' },
34
39
 
35
40
  });
@@ -41,4 +46,6 @@ class SubstanceOrder extends mongoose.Document {
41
46
  this._type = 'QDM::SubstanceOrder';
42
47
  }
43
48
  }
49
+
44
50
  module.exports.SubstanceOrder = SubstanceOrder;
51
+
@@ -1,14 +1,17 @@
1
1
  const mongoose = require('mongoose/browser');
2
2
 
3
- const { IdSchema } = require('./Id');
3
+ const { IdentifierSchema } = require('./attributes/Identifier');
4
4
  const { DataElementSchema } = require('./basetypes/DataElement');
5
5
  const Code = require('./basetypes/Code');
6
6
  const Interval = require('./basetypes/Interval');
7
7
  const Quantity = require('./basetypes/Quantity');
8
8
  const DateTime = require('./basetypes/DateTime');
9
+ const QDMDate = require('./basetypes/QDMDate');
9
10
  const Any = require('./basetypes/Any');
11
+ const AnyEntity = require('./basetypes/AnyEntity');
10
12
  const { ComponentSchema } = require('./attributes/Component');
11
13
  const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
14
+ const { EntitySchema } = require('./attributes/Entity');
12
15
 
13
16
 
14
17
  const [Number, String] = [
@@ -24,11 +27,12 @@ const SubstanceRecommendedSchema = DataElementSchema({
24
27
  refills: Number,
25
28
  route: Code,
26
29
  negationRationale: Code,
30
+ requester: AnyEntity,
27
31
  qdmTitle: { type: String, default: 'Substance, Recommended' },
28
32
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.78' },
29
33
  qdmCategory: { type: String, default: 'substance' },
30
34
  qdmStatus: { type: String, default: 'recommended' },
31
- qdmVersion: { type: String, default: '5.4' },
35
+ qdmVersion: { type: String, default: '5.5' },
32
36
  _type: { type: String, default: 'QDM::SubstanceRecommended' },
33
37
 
34
38
  });
@@ -40,4 +44,6 @@ class SubstanceRecommended extends mongoose.Document {
40
44
  this._type = 'QDM::SubstanceRecommended';
41
45
  }
42
46
  }
47
+
43
48
  module.exports.SubstanceRecommended = SubstanceRecommended;
49
+
@@ -1,14 +1,17 @@
1
1
  const mongoose = require('mongoose/browser');
2
2
 
3
- const { IdSchema } = require('./Id');
3
+ const { IdentifierSchema } = require('./attributes/Identifier');
4
4
  const { DataElementSchema } = require('./basetypes/DataElement');
5
5
  const Code = require('./basetypes/Code');
6
6
  const Interval = require('./basetypes/Interval');
7
7
  const Quantity = require('./basetypes/Quantity');
8
8
  const DateTime = require('./basetypes/DateTime');
9
+ const QDMDate = require('./basetypes/QDMDate');
9
10
  const Any = require('./basetypes/Any');
11
+ const AnyEntity = require('./basetypes/AnyEntity');
10
12
  const { ComponentSchema } = require('./attributes/Component');
11
13
  const { FacilityLocationSchema } = require('./attributes/FacilityLocation');
14
+ const { EntitySchema } = require('./attributes/Entity');
12
15
 
13
16
 
14
17
  const [Number, String] = [
@@ -19,11 +22,12 @@ const [Number, String] = [
19
22
  const SymptomSchema = DataElementSchema({
20
23
  prevalencePeriod: Interval,
21
24
  severity: Code,
25
+ recorder: AnyEntity,
22
26
  qdmTitle: { type: String, default: 'Symptom' },
23
27
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.116' },
24
28
  qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.136' },
25
29
  qdmCategory: { type: String, default: 'symptom' },
26
- qdmVersion: { type: String, default: '5.4' },
30
+ qdmVersion: { type: String, default: '5.5' },
27
31
  _type: { type: String, default: 'QDM::Symptom' },
28
32
 
29
33
  });
@@ -35,4 +39,6 @@ class Symptom extends mongoose.Document {
35
39
  this._type = 'QDM::Symptom';
36
40
  }
37
41
  }
42
+
38
43
  module.exports.Symptom = Symptom;
44
+
@@ -0,0 +1,33 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { EntitySchemaFunction } = require('./Entity');
4
+ const Code = require('../basetypes/Code');
5
+ const Interval = require('../basetypes/Interval');
6
+ const Quantity = require('../basetypes/Quantity');
7
+ const DateTime = require('../basetypes/DateTime');
8
+ const QDMDate = require('../basetypes/QDMDate');
9
+ const Any = require('../basetypes/Any');
10
+
11
+ const [Number, String] = [
12
+ mongoose.Schema.Types.Number,
13
+ mongoose.Schema.Types.String,
14
+ ];
15
+
16
+ const CarePartnerSchema = EntitySchemaFunction({
17
+ relationship: Code,
18
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.134' },
19
+ qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.160' },
20
+ _type: { type: String, default: 'QDM::CarePartner' },
21
+
22
+ });
23
+
24
+ module.exports.CarePartnerSchema = CarePartnerSchema;
25
+ class CarePartner extends mongoose.Document {
26
+ constructor(object) {
27
+ super(object, CarePartnerSchema);
28
+ this._type = 'QDM::CarePartner';
29
+ }
30
+ }
31
+
32
+ module.exports.CarePartner = CarePartner;
33
+
@@ -4,8 +4,10 @@ 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 QDMDate = require('../basetypes/QDMDate');
7
8
  const Any = require('../basetypes/Any');
8
9
 
10
+ const [Schema] = [mongoose.Schema];
9
11
 
10
12
  const [Number, String] = [
11
13
  mongoose.Schema.Types.Number,
@@ -15,7 +17,7 @@ const [Number, String] = [
15
17
  const ComponentSchema = new mongoose.Schema({
16
18
  code: Code,
17
19
  result: Any,
18
- qdmVersion: { type: String, default: '5.4' },
20
+ qdmVersion: { type: String, default: '5.5' },
19
21
  _type: { type: String, default: 'QDM::Component' },
20
22
 
21
23
  });
@@ -27,4 +29,23 @@ class Component extends mongoose.Document {
27
29
  this._type = 'QDM::Component';
28
30
  }
29
31
  }
32
+
33
+ function ComponentSchemaFunction(add, options) {
34
+ const extended = new Schema({
35
+ code: Code,
36
+ result: Any,
37
+ qdmVersion: { type: String, default: '5.5' },
38
+ _type: { type: String, default: 'QDM::Component' },
39
+
40
+
41
+ }, options);
42
+
43
+ if (add) {
44
+ extended.add(add);
45
+ }
46
+
47
+ return extended;
48
+ }
49
+
30
50
  module.exports.Component = Component;
51
+ module.exports.ComponentSchemaFunction = ComponentSchemaFunction;
@@ -0,0 +1,34 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const Code = require('../basetypes/Code');
4
+ const Interval = require('../basetypes/Interval');
5
+ const Quantity = require('../basetypes/Quantity');
6
+ const DateTime = require('../basetypes/DateTime');
7
+ const QDMDate = require('../basetypes/QDMDate');
8
+ const Any = require('../basetypes/Any');
9
+
10
+
11
+ const [Number, String] = [
12
+ mongoose.Schema.Types.Number,
13
+ mongoose.Schema.Types.String,
14
+ ];
15
+
16
+ const DiagnosisComponentSchema = new mongoose.Schema({
17
+ code: Code,
18
+ presentOnAdmissionIndicator: Code,
19
+ rank: Number,
20
+ qdmVersion: { type: String, default: '5.5' },
21
+ _type: { type: String, default: 'QDM::DiagnosisComponent' },
22
+
23
+ });
24
+
25
+ module.exports.DiagnosisComponentSchema = DiagnosisComponentSchema;
26
+ class DiagnosisComponent extends mongoose.Document {
27
+ constructor(object) {
28
+ super(object, DiagnosisComponentSchema);
29
+ this._type = 'QDM::DiagnosisComponent';
30
+ }
31
+ }
32
+
33
+ module.exports.DiagnosisComponent = DiagnosisComponent;
34
+
@@ -0,0 +1,58 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { IdentifierSchema } = require('./Identifier');
4
+ const Code = require('../basetypes/Code');
5
+ const Interval = require('../basetypes/Interval');
6
+ const Quantity = require('../basetypes/Quantity');
7
+ const DateTime = require('../basetypes/DateTime');
8
+ const QDMDate = require('../basetypes/QDMDate');
9
+ const Any = require('../basetypes/Any');
10
+
11
+ const [Schema] = [mongoose.Schema];
12
+
13
+ const [Number, String] = [
14
+ mongoose.Schema.Types.Number,
15
+ mongoose.Schema.Types.String,
16
+ ];
17
+
18
+ const EntitySchema = new mongoose.Schema({
19
+ id: String,
20
+ identifier: IdentifierSchema,
21
+ qdmVersion: { type: String, default: '5.5' },
22
+ _type: { type: String, default: 'QDM::Entity' },
23
+
24
+ });
25
+
26
+ module.exports.EntitySchema = EntitySchema;
27
+ class Entity extends mongoose.Document {
28
+ constructor(object) {
29
+ super(object, EntitySchema);
30
+ this._type = 'QDM::Entity';
31
+ }
32
+ }
33
+
34
+ function EntitySchemaFunction(add, options) {
35
+ const extended = new Schema({
36
+ identifier: IdentifierSchema,
37
+ qdmVersion: { type: String, default: '5.5' },
38
+ _type: { type: String, default: 'QDM::Entity' },
39
+
40
+
41
+ id: {
42
+ type: String,
43
+ default() {
44
+ return this._id ? this._id.toString() : mongoose.Types.ObjectId().toString();
45
+ },
46
+ },
47
+
48
+ }, options);
49
+
50
+ if (add) {
51
+ extended.add(add);
52
+ }
53
+
54
+ return extended;
55
+ }
56
+
57
+ module.exports.Entity = Entity;
58
+ module.exports.EntitySchemaFunction = EntitySchemaFunction;
@@ -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 QDMDate = require('../basetypes/QDMDate');
7
8
  const Any = require('../basetypes/Any');
8
9
 
9
10
 
@@ -15,7 +16,7 @@ const [Number, String] = [
15
16
  const FacilityLocationSchema = new mongoose.Schema({
16
17
  code: Code,
17
18
  locationPeriod: Interval,
18
- qdmVersion: { type: String, default: '5.4' },
19
+ qdmVersion: { type: String, default: '5.5' },
19
20
  _type: { type: String, default: 'QDM::FacilityLocation' },
20
21
 
21
22
  });
@@ -27,4 +28,6 @@ class FacilityLocation extends mongoose.Document {
27
28
  this._type = 'QDM::FacilityLocation';
28
29
  }
29
30
  }
31
+
30
32
  module.exports.FacilityLocation = FacilityLocation;
33
+
@@ -0,0 +1,23 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const [Number, String] = [
4
+ mongoose.Schema.Types.Number,
5
+ mongoose.Schema.Types.String,
6
+ ];
7
+
8
+ const IdentifierSchema = mongoose.Schema({
9
+ namingSystem: String,
10
+ value: String,
11
+ qdmVersion: { type: String, default: '5.5' },
12
+ _type: { type: String, default: 'QDM::Identifier' },
13
+
14
+ }, { _id: false, id: false });
15
+
16
+ module.exports.IdentifierSchema = IdentifierSchema;
17
+ class Identifier extends mongoose.Document {
18
+ constructor(object) {
19
+ super(object, IdentifierSchema);
20
+ this._type = 'QDM::Identifier';
21
+ }
22
+ }
23
+ module.exports.Identifier = Identifier;
@@ -0,0 +1,33 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { EntitySchemaFunction } = require('./Entity');
4
+ const Code = require('../basetypes/Code');
5
+ const Interval = require('../basetypes/Interval');
6
+ const Quantity = require('../basetypes/Quantity');
7
+ const DateTime = require('../basetypes/DateTime');
8
+ const QDMDate = require('../basetypes/QDMDate');
9
+ const Any = require('../basetypes/Any');
10
+
11
+ const [Number, String] = [
12
+ mongoose.Schema.Types.Number,
13
+ mongoose.Schema.Types.String,
14
+ ];
15
+
16
+ const OrganizationSchema = EntitySchemaFunction({
17
+ type: Code,
18
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.135' },
19
+ qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.163' },
20
+ _type: { type: String, default: 'QDM::Organization' },
21
+
22
+ });
23
+
24
+ module.exports.OrganizationSchema = OrganizationSchema;
25
+ class Organization extends mongoose.Document {
26
+ constructor(object) {
27
+ super(object, OrganizationSchema);
28
+ this._type = 'QDM::Organization';
29
+ }
30
+ }
31
+
32
+ module.exports.Organization = Organization;
33
+
@@ -0,0 +1,32 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { EntitySchemaFunction } = require('./Entity');
4
+ const Code = require('../basetypes/Code');
5
+ const Interval = require('../basetypes/Interval');
6
+ const Quantity = require('../basetypes/Quantity');
7
+ const DateTime = require('../basetypes/DateTime');
8
+ const QDMDate = require('../basetypes/QDMDate');
9
+ const Any = require('../basetypes/Any');
10
+
11
+ const [Number, String] = [
12
+ mongoose.Schema.Types.Number,
13
+ mongoose.Schema.Types.String,
14
+ ];
15
+
16
+ const PatientEntitySchema = EntitySchemaFunction({
17
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.136' },
18
+ qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.161' },
19
+ _type: { type: String, default: 'QDM::PatientEntity' },
20
+
21
+ });
22
+
23
+ module.exports.PatientEntitySchema = PatientEntitySchema;
24
+ class PatientEntity extends mongoose.Document {
25
+ constructor(object) {
26
+ super(object, PatientEntitySchema);
27
+ this._type = 'QDM::PatientEntity';
28
+ }
29
+ }
30
+
31
+ module.exports.PatientEntity = PatientEntity;
32
+
@@ -0,0 +1,35 @@
1
+ const mongoose = require('mongoose/browser');
2
+
3
+ const { EntitySchemaFunction } = require('./Entity');
4
+ const Code = require('../basetypes/Code');
5
+ const Interval = require('../basetypes/Interval');
6
+ const Quantity = require('../basetypes/Quantity');
7
+ const DateTime = require('../basetypes/DateTime');
8
+ const QDMDate = require('../basetypes/QDMDate');
9
+ const Any = require('../basetypes/Any');
10
+
11
+ const [Number, String] = [
12
+ mongoose.Schema.Types.Number,
13
+ mongoose.Schema.Types.String,
14
+ ];
15
+
16
+ const PractitionerSchema = EntitySchemaFunction({
17
+ role: Code,
18
+ specialty: Code,
19
+ qualification: Code,
20
+ hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.137' },
21
+ qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.162' },
22
+ _type: { type: String, default: 'QDM::Practitioner' },
23
+
24
+ });
25
+
26
+ module.exports.PractitionerSchema = PractitionerSchema;
27
+ class Practitioner extends mongoose.Document {
28
+ constructor(object) {
29
+ super(object, PractitionerSchema);
30
+ this._type = 'QDM::Practitioner';
31
+ }
32
+ }
33
+
34
+ module.exports.Practitioner = Practitioner;
35
+