cqm-models 3.1.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +0 -7
  3. data/.github/workflows/ci.yml +2 -2
  4. data/README.md +3 -2
  5. data/app/assets/javascripts/AdverseEvent.js +2 -2
  6. data/app/assets/javascripts/AllDataElements.js +2 -2
  7. data/app/assets/javascripts/AllergyIntolerance.js +2 -2
  8. data/app/assets/javascripts/AssessmentOrder.js +2 -2
  9. data/app/assets/javascripts/AssessmentPerformed.js +3 -2
  10. data/app/assets/javascripts/AssessmentRecommended.js +2 -2
  11. data/app/assets/javascripts/CareGoal.js +2 -2
  12. data/app/assets/javascripts/CommunicationPerformed.js +3 -3
  13. data/app/assets/javascripts/DeviceOrder.js +2 -2
  14. data/app/assets/javascripts/DeviceRecommended.js +2 -2
  15. data/app/assets/javascripts/Diagnosis.js +2 -2
  16. data/app/assets/javascripts/DiagnosticStudyOrder.js +2 -2
  17. data/app/assets/javascripts/DiagnosticStudyPerformed.js +4 -2
  18. data/app/assets/javascripts/DiagnosticStudyRecommended.js +2 -2
  19. data/app/assets/javascripts/EncounterOrder.js +2 -2
  20. data/app/assets/javascripts/EncounterPerformed.js +7 -3
  21. data/app/assets/javascripts/EncounterRecommended.js +2 -2
  22. data/app/assets/javascripts/FamilyHistory.js +2 -2
  23. data/app/assets/javascripts/ImmunizationAdministered.js +2 -2
  24. data/app/assets/javascripts/ImmunizationOrder.js +2 -2
  25. data/app/assets/javascripts/InterventionOrder.js +2 -2
  26. data/app/assets/javascripts/InterventionPerformed.js +3 -2
  27. data/app/assets/javascripts/InterventionRecommended.js +2 -2
  28. data/app/assets/javascripts/LaboratoryTestOrder.js +2 -2
  29. data/app/assets/javascripts/LaboratoryTestPerformed.js +4 -2
  30. data/app/assets/javascripts/LaboratoryTestRecommended.js +2 -2
  31. data/app/assets/javascripts/MedicationActive.js +2 -2
  32. data/app/assets/javascripts/MedicationAdministered.js +2 -2
  33. data/app/assets/javascripts/MedicationDischarge.js +3 -3
  34. data/app/assets/javascripts/MedicationDispensed.js +4 -3
  35. data/app/assets/javascripts/MedicationOrder.js +3 -2
  36. data/app/assets/javascripts/Participation.js +1 -2
  37. data/app/assets/javascripts/PatientCareExperience.js +2 -2
  38. data/app/assets/javascripts/PatientCharacteristic.js +1 -1
  39. data/app/assets/javascripts/PatientCharacteristicBirthdate.js +1 -1
  40. data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +1 -1
  41. data/app/assets/javascripts/PatientCharacteristicEthnicity.js +1 -1
  42. data/app/assets/javascripts/PatientCharacteristicExpired.js +1 -1
  43. data/app/assets/javascripts/PatientCharacteristicPayer.js +1 -1
  44. data/app/assets/javascripts/PatientCharacteristicRace.js +1 -1
  45. data/app/assets/javascripts/PatientCharacteristicSex.js +1 -1
  46. data/app/assets/javascripts/PhysicalExamOrder.js +2 -2
  47. data/app/assets/javascripts/PhysicalExamPerformed.js +3 -2
  48. data/app/assets/javascripts/PhysicalExamRecommended.js +2 -2
  49. data/app/assets/javascripts/ProcedureOrder.js +2 -2
  50. data/app/assets/javascripts/ProcedurePerformed.js +3 -3
  51. data/app/assets/javascripts/ProcedureRecommended.js +2 -2
  52. data/app/assets/javascripts/ProviderCareExperience.js +2 -2
  53. data/app/assets/javascripts/QDMPatient.js +1 -1
  54. data/app/assets/javascripts/RelatedPerson.js +1 -1
  55. data/app/assets/javascripts/SubstanceAdministered.js +2 -2
  56. data/app/assets/javascripts/SubstanceOrder.js +2 -2
  57. data/app/assets/javascripts/SubstanceRecommended.js +2 -2
  58. data/app/assets/javascripts/Symptom.js +2 -2
  59. data/app/assets/javascripts/attributes/Component.js +2 -2
  60. data/app/assets/javascripts/attributes/DiagnosisComponent.js +1 -1
  61. data/app/assets/javascripts/attributes/Entity.js +2 -2
  62. data/app/assets/javascripts/attributes/FacilityLocation.js +1 -1
  63. data/app/assets/javascripts/attributes/Identifier.js +1 -1
  64. data/app/assets/javascripts/attributes/Location.js +32 -0
  65. data/app/assets/javascripts/attributes/Organization.js +1 -1
  66. data/app/assets/javascripts/basetypes/Any.js +1 -1
  67. data/app/assets/javascripts/basetypes/AnyEntity.js +3 -0
  68. data/app/models/cqm/individual_result.rb +2 -2
  69. data/app/models/cqm/measure.rb +1 -1
  70. data/app/models/cqm/patient.rb +1 -1
  71. data/app/models/hqmfOid_to_datatype_map.json +1 -1
  72. data/app/models/models.rb +2 -2
  73. data/app/models/qdm/adverse_event.rb +2 -2
  74. data/app/models/qdm/allergy_intolerance.rb +2 -2
  75. data/app/models/qdm/assessment_order.rb +2 -2
  76. data/app/models/qdm/assessment_performed.rb +3 -2
  77. data/app/models/qdm/assessment_recommended.rb +2 -2
  78. data/app/models/qdm/attributes/component.rb +1 -1
  79. data/app/models/qdm/attributes/diagnosis_component.rb +1 -1
  80. data/app/models/qdm/attributes/entity.rb +1 -1
  81. data/app/models/qdm/attributes/facility_location.rb +1 -1
  82. data/app/models/qdm/attributes/identifier.rb +1 -1
  83. data/app/models/qdm/attributes/location.rb +9 -0
  84. data/app/models/qdm/attributes/organization.rb +1 -1
  85. data/app/models/qdm/basetypes/data_element.rb +5 -0
  86. data/app/models/qdm/care_goal.rb +2 -2
  87. data/app/models/qdm/communication_performed.rb +3 -3
  88. data/app/models/qdm/device_order.rb +2 -2
  89. data/app/models/qdm/device_recommended.rb +2 -2
  90. data/app/models/qdm/diagnosis.rb +2 -2
  91. data/app/models/qdm/diagnostic_study_order.rb +2 -2
  92. data/app/models/qdm/diagnostic_study_performed.rb +4 -2
  93. data/app/models/qdm/diagnostic_study_recommended.rb +2 -2
  94. data/app/models/qdm/encounter_order.rb +2 -2
  95. data/app/models/qdm/encounter_performed.rb +4 -3
  96. data/app/models/qdm/encounter_recommended.rb +2 -2
  97. data/app/models/qdm/family_history.rb +2 -2
  98. data/app/models/qdm/immunization_administered.rb +2 -2
  99. data/app/models/qdm/immunization_order.rb +2 -2
  100. data/app/models/qdm/intervention_order.rb +2 -2
  101. data/app/models/qdm/intervention_performed.rb +3 -2
  102. data/app/models/qdm/intervention_recommended.rb +2 -2
  103. data/app/models/qdm/laboratory_test_order.rb +2 -2
  104. data/app/models/qdm/laboratory_test_performed.rb +4 -2
  105. data/app/models/qdm/laboratory_test_recommended.rb +2 -2
  106. data/app/models/qdm/medication_active.rb +2 -2
  107. data/app/models/qdm/medication_administered.rb +2 -2
  108. data/app/models/qdm/medication_discharge.rb +3 -3
  109. data/app/models/qdm/medication_dispensed.rb +4 -3
  110. data/app/models/qdm/medication_order.rb +3 -2
  111. data/app/models/qdm/participation.rb +1 -2
  112. data/app/models/qdm/patient.rb +1 -1
  113. data/app/models/qdm/patient_care_experience.rb +2 -2
  114. data/app/models/qdm/patient_characteristic.rb +1 -1
  115. data/app/models/qdm/patient_characteristic_birthdate.rb +1 -1
  116. data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +1 -1
  117. data/app/models/qdm/patient_characteristic_ethnicity.rb +1 -1
  118. data/app/models/qdm/patient_characteristic_expired.rb +1 -1
  119. data/app/models/qdm/patient_characteristic_payer.rb +1 -1
  120. data/app/models/qdm/patient_characteristic_race.rb +1 -1
  121. data/app/models/qdm/patient_characteristic_sex.rb +1 -1
  122. data/app/models/qdm/physical_exam_order.rb +2 -2
  123. data/app/models/qdm/physical_exam_performed.rb +3 -2
  124. data/app/models/qdm/physical_exam_recommended.rb +2 -2
  125. data/app/models/qdm/procedure_order.rb +2 -2
  126. data/app/models/qdm/procedure_performed.rb +3 -3
  127. data/app/models/qdm/procedure_recommended.rb +2 -2
  128. data/app/models/qdm/provider_care_experience.rb +2 -2
  129. data/app/models/qdm/related_person.rb +1 -1
  130. data/app/models/qdm/substance_administered.rb +2 -2
  131. data/app/models/qdm/substance_order.rb +2 -2
  132. data/app/models/qdm/substance_recommended.rb +2 -2
  133. data/app/models/qdm/symptom.rb +2 -2
  134. data/bin/validate_generator.sh +1 -1
  135. data/cqm-models.gemspec +1 -1
  136. data/data/oids_qdm_5.6.json +335 -0
  137. data/dist/browser.js +887 -1340
  138. data/dist/index.js +887 -1340
  139. data/lib/generate_entities.rb +18 -10
  140. data/lib/generate_models.rb +27 -19
  141. data/lib/generate_patients.rb +1 -1
  142. data/modelinfo/qdm-modelinfo-5.6.xml +1102 -0
  143. data/package.json +3 -3
  144. data/templates/models_template.rb.erb +3 -1
  145. data/templates/mongoose_template.js.erb +9 -2
  146. data/yarn.lock +999 -899
  147. metadata +11 -9
  148. data/app/assets/javascripts/DeviceApplied.js +0 -48
  149. data/app/models/qdm/device_applied.rb +0 -19
@@ -5,22 +5,23 @@ module QDM
5
5
  # BaseTypeGeneration contains functions to randomly generate basetypes used by PatientGeneration
6
6
  module EntityGeneration
7
7
  def self.generate_entities(data_element)
8
- data_element.performer = generate_entity if data_element.respond_to? 'performer'
9
- data_element.recorder = generate_entity if data_element.respond_to? 'recorder'
10
- data_element.requester = generate_entity if data_element.respond_to? 'requester'
11
- data_element.sender = generate_entity if data_element.respond_to? 'sender'
12
- data_element.recipient = generate_entity if data_element.respond_to? 'recipient'
13
- data_element.participant = generate_entity if data_element.respond_to? 'participant'
14
- data_element.prescriber = generate_entity if data_element.respond_to? 'prescriber'
15
- data_element.dispenser = generate_entity if data_element.respond_to? 'dispenser'
8
+ data_element.performer = [generate_entity] if data_element.respond_to? 'performer'
9
+ data_element.recorder = [generate_entity] if data_element.respond_to? 'recorder'
10
+ data_element.requester = [generate_entity] if data_element.respond_to? 'requester'
11
+ data_element.sender = [generate_entity] if data_element.respond_to? 'sender'
12
+ data_element.recipient = [generate_entity] if data_element.respond_to? 'recipient'
13
+ data_element.participant = [generate_entity] if data_element.respond_to? 'participant'
14
+ data_element.prescriber = [generate_entity] if data_element.respond_to? 'prescriber'
15
+ data_element.dispenser = [generate_entity] if data_element.respond_to? 'dispenser'
16
16
  end
17
17
 
18
18
  def self.generate_entity
19
- case Random.rand(4)
19
+ case Random.rand(5)
20
20
  when 0 then return generate_patient_entity
21
21
  when 1 then return generate_care_partner_entity
22
22
  when 2 then return generate_organization_entity
23
23
  when 3 then return generate_practitioner_entity
24
+ when 4 then return generate_location_entity
24
25
  end
25
26
  end
26
27
 
@@ -40,7 +41,7 @@ module QDM
40
41
  def self.generate_organization_entity
41
42
  organization_entity = QDM::Organization.new
42
43
  organization_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id
43
- organization_entity.type = QDM::BaseTypeGeneration.generate_code_field
44
+ organization_entity.organizationType = QDM::BaseTypeGeneration.generate_code_field
44
45
  organization_entity
45
46
  end
46
47
 
@@ -52,5 +53,12 @@ module QDM
52
53
  practitioner_entity.qualification = QDM::BaseTypeGeneration.generate_code_field
53
54
  practitioner_entity
54
55
  end
56
+
57
+ def self.generate_location_entity
58
+ location_entity = QDM::Location.new
59
+ location_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id
60
+ location_entity.locationType = QDM::BaseTypeGeneration.generate_code_field
61
+ location_entity
62
+ end
55
63
  end
56
64
  end
@@ -62,6 +62,10 @@ TYPE_LOOKUP_JS = {
62
62
  'System.Concept': '{}'
63
63
  }.stringify_keys!
64
64
 
65
+ RESERVED_WORDS = {
66
+ 'class': 'clazz'
67
+ }.stringify_keys!
68
+
65
69
  ###############################################################################
66
70
  # Start of modelinfo file parsing
67
71
  ###############################################################################
@@ -240,6 +244,7 @@ unless IS_TEST
240
244
  contents.gsub!(%r{\/Practitioner.js}, '/attributes/Practitioner.js')
241
245
  contents.gsub!(%r{\/ResultComponent.js}, '/attributes/ResultComponent.js')
242
246
  contents.gsub!(%r{\/Identifier.js}, '/attributes/Identifier.js')
247
+ contents.gsub!(%r{\/Location.js}, '/attributes/Location.js')
243
248
  File.open(file_path, 'w') { |file| file.puts contents }
244
249
  end
245
250
 
@@ -265,16 +270,19 @@ Dir.glob(ruby_models_path + '*.rb').each do |file_name|
265
270
  contents.gsub!(/field :facilityLocation, type: Code/, 'field :facilityLocation, type: QDM::FacilityLocation')
266
271
 
267
272
  # Make Entity subclasses of type QDM::Entity
268
- contents.gsub!(/field :participant/, "embeds_one :participant, class_name: 'QDM::Entity'")
269
- contents.gsub!(/field :sender/, "embeds_one :sender, class_name: 'QDM::Entity'")
270
- contents.gsub!(/field :recipient/, "embeds_one :recipient, class_name: 'QDM::Entity'")
271
- contents.gsub!(/field :recorder/, "embeds_one :recorder, class_name: 'QDM::Entity'")
272
- contents.gsub!(/field :performer/, "embeds_one :performer, class_name: 'QDM::Entity'")
273
- contents.gsub!(/field :requester/, "embeds_one :requester, class_name: 'QDM::Entity'")
274
- contents.gsub!(/field :prescriber/, "embeds_one :prescriber, class_name: 'QDM::Entity'")
275
- contents.gsub!(/field :dispenser/, "embeds_one :dispenser, class_name: 'QDM::Entity'")
273
+ contents.gsub!(/field :participant/, "embeds_many :participant, class_name: 'QDM::Entity'")
274
+ contents.gsub!(/field :sender/, "embeds_many :sender, class_name: 'QDM::Entity'")
275
+ contents.gsub!(/field :recipient/, "embeds_many :recipient, class_name: 'QDM::Entity'")
276
+ contents.gsub!(/field :recorder/, "embeds_many :recorder, class_name: 'QDM::Entity'")
277
+ contents.gsub!(/field :performer/, "embeds_many :performer, class_name: 'QDM::Entity'")
278
+ contents.gsub!(/field :requester/, "embeds_many :requester, class_name: 'QDM::Entity'")
279
+ contents.gsub!(/field :prescriber/, "embeds_many :prescriber, class_name: 'QDM::Entity'")
280
+ contents.gsub!(/field :dispenser/, "embeds_many :dispenser, class_name: 'QDM::Entity'")
276
281
  contents.gsub!(/field :identifier, type: Identifier/, "embeds_one :identifier, class_name: 'QDM::Identifier'")
277
282
 
283
+ # EncounterPerformed
284
+ contents.gsub!(/field :class/, 'field :clazz')
285
+
278
286
  File.open(file_name, 'w') { |file| file.puts contents }
279
287
  end
280
288
 
@@ -293,14 +301,14 @@ Dir.glob(js_models_path + '*.js').each do |file_name|
293
301
  contents.gsub!(/components: \[\]/, 'components: [ComponentSchema]')
294
302
  contents.gsub!(/component: Code/, 'component: ComponentSchema')
295
303
  contents.gsub!(/diagnoses: \[\]/, 'diagnoses: [DiagnosisComponentSchema]')
296
- contents.gsub!(/sender: Any/, 'sender: AnyEntity')
297
- contents.gsub!(/recipient: Any/, 'recipient: AnyEntity')
298
- contents.gsub!(/participant: Any/, 'participant: AnyEntity')
299
- contents.gsub!(/recorder: Any/, 'recorder: AnyEntity')
300
- contents.gsub!(/performer: Any/, 'performer: AnyEntity')
301
- contents.gsub!(/requester: Any/, 'requester: AnyEntity')
302
- contents.gsub!(/prescriber: Any/, 'prescriber: AnyEntity')
303
- contents.gsub!(/dispenser: Any/, 'dispenser: AnyEntity')
304
+ contents.gsub!(/sender: Any/, 'sender: [AnyEntity]')
305
+ contents.gsub!(/recipient: Any/, 'recipient: [AnyEntity]')
306
+ contents.gsub!(/participant: Any/, 'participant: [AnyEntity]')
307
+ contents.gsub!(/recorder: Any/, 'recorder: [AnyEntity]')
308
+ contents.gsub!(/performer: Any/, 'performer: [AnyEntity]')
309
+ contents.gsub!(/requester: Any/, 'requester: [AnyEntity]')
310
+ contents.gsub!(/prescriber: Any/, 'prescriber: [AnyEntity]')
311
+ contents.gsub!(/dispenser: Any/, 'dispenser: [AnyEntity]')
304
312
  contents.gsub!(/relatedTo: \[\]/, 'relatedTo: [String]')
305
313
 
306
314
  File.open(file_name, 'w') { |file| file.puts contents }
@@ -325,15 +333,15 @@ Dir.glob(ruby_models_path + '*.rb').each do |file_name|
325
333
  File.open(file_name, 'w') { |file| file.puts contents }
326
334
  end
327
335
 
328
- types_not_inherited_by_data_element = ['/patient.rb', '/identifier.rb', '/component.rb', '/facility_location.rb', '/entity.rb', '/organization.rb', '/patient_entity.rb', '/practitioner.rb', '/care_partner.rb', '/diagnosis_component.rb', '/result_component.rb']
336
+ types_not_inherited_by_data_element = ['/patient.rb', '/identifier.rb', '/component.rb', '/facility_location.rb', '/entity.rb', '/organization.rb', '/patient_entity.rb', '/practitioner.rb', '/care_partner.rb', '/location.rb', '/diagnosis_component.rb', '/result_component.rb']
329
337
  types_inherited_by_attribute = ['/component', '/facility_location', '/entity', '/diagnosis_component', '/identifier']
330
- types_inherited_by_entity = ['/patient_entity', '/care_partner', '/practitioner', '/organization']
338
+ types_inherited_by_entity = ['/patient_entity', '/care_partner', '/practitioner', '/organization', '/location']
331
339
  types_inherited_by_component = ['/result_component']
332
340
 
333
341
  # Set embedded in for datatypes
334
342
  Dir.glob(ruby_models_path + '*.rb').each do |file_name|
335
343
  contents = File.read(file_name)
336
- if ['entity.rb', 'organization.rb', 'patient_entity.rb', 'practitioner.rb', 'care_partner.rb'].any? { |sub_string| sub_string.include?(File.basename(file_name)) }
344
+ if ['entity.rb', 'organization.rb', 'patient_entity.rb', 'practitioner.rb', 'care_partner.rb', 'location.rb'].any? { |sub_string| sub_string.include?(File.basename(file_name)) }
337
345
  contents.gsub!(/ include Mongoid::Document\n/, " include Mongoid::Document\n embedded_in :data_element\n")
338
346
  File.open(file_name, 'w') { |file| file.puts contents }
339
347
  end
@@ -9,7 +9,7 @@ module QDM
9
9
  module PatientGeneration
10
10
  # Generates patient(s) with fully-loaded dataElements if new_patient_for_each_type is false then a
11
11
  # single patient will be returned that has every data element on it
12
- def self.generate_exhaustive_data_element_patients(new_patient_for_each_type = true, model_info_file = 'qdm-modelinfo-5.5.xml')
12
+ def self.generate_exhaustive_data_element_patients(new_patient_for_each_type = true, model_info_file = 'qdm-modelinfo-5.6.xml')
13
13
  datatypes = get_datatypes(File.join(File.dirname(__FILE__), "../modelinfo/#{model_info_file}"))
14
14
  patients = []
15
15
  cqm_patient = nil