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.
- checksums.yaml +4 -4
- data/.eslintrc.json +0 -7
- data/.github/workflows/ci.yml +2 -2
- data/README.md +3 -2
- data/app/assets/javascripts/AdverseEvent.js +2 -2
- data/app/assets/javascripts/AllDataElements.js +2 -2
- data/app/assets/javascripts/AllergyIntolerance.js +2 -2
- data/app/assets/javascripts/AssessmentOrder.js +2 -2
- data/app/assets/javascripts/AssessmentPerformed.js +3 -2
- data/app/assets/javascripts/AssessmentRecommended.js +2 -2
- data/app/assets/javascripts/CareGoal.js +2 -2
- data/app/assets/javascripts/CommunicationPerformed.js +3 -3
- data/app/assets/javascripts/DeviceOrder.js +2 -2
- data/app/assets/javascripts/DeviceRecommended.js +2 -2
- data/app/assets/javascripts/Diagnosis.js +2 -2
- data/app/assets/javascripts/DiagnosticStudyOrder.js +2 -2
- data/app/assets/javascripts/DiagnosticStudyPerformed.js +4 -2
- data/app/assets/javascripts/DiagnosticStudyRecommended.js +2 -2
- data/app/assets/javascripts/EncounterOrder.js +2 -2
- data/app/assets/javascripts/EncounterPerformed.js +7 -3
- data/app/assets/javascripts/EncounterRecommended.js +2 -2
- data/app/assets/javascripts/FamilyHistory.js +2 -2
- data/app/assets/javascripts/ImmunizationAdministered.js +2 -2
- data/app/assets/javascripts/ImmunizationOrder.js +2 -2
- data/app/assets/javascripts/InterventionOrder.js +2 -2
- data/app/assets/javascripts/InterventionPerformed.js +3 -2
- data/app/assets/javascripts/InterventionRecommended.js +2 -2
- data/app/assets/javascripts/LaboratoryTestOrder.js +2 -2
- data/app/assets/javascripts/LaboratoryTestPerformed.js +4 -2
- data/app/assets/javascripts/LaboratoryTestRecommended.js +2 -2
- data/app/assets/javascripts/MedicationActive.js +2 -2
- data/app/assets/javascripts/MedicationAdministered.js +2 -2
- data/app/assets/javascripts/MedicationDischarge.js +3 -3
- data/app/assets/javascripts/MedicationDispensed.js +4 -3
- data/app/assets/javascripts/MedicationOrder.js +3 -2
- data/app/assets/javascripts/Participation.js +1 -2
- data/app/assets/javascripts/PatientCareExperience.js +2 -2
- data/app/assets/javascripts/PatientCharacteristic.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicBirthdate.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicEthnicity.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicExpired.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicPayer.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicRace.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicSex.js +1 -1
- data/app/assets/javascripts/PhysicalExamOrder.js +2 -2
- data/app/assets/javascripts/PhysicalExamPerformed.js +3 -2
- data/app/assets/javascripts/PhysicalExamRecommended.js +2 -2
- data/app/assets/javascripts/ProcedureOrder.js +2 -2
- data/app/assets/javascripts/ProcedurePerformed.js +3 -3
- data/app/assets/javascripts/ProcedureRecommended.js +2 -2
- data/app/assets/javascripts/ProviderCareExperience.js +2 -2
- data/app/assets/javascripts/QDMPatient.js +1 -1
- data/app/assets/javascripts/RelatedPerson.js +1 -1
- data/app/assets/javascripts/SubstanceAdministered.js +2 -2
- data/app/assets/javascripts/SubstanceOrder.js +2 -2
- data/app/assets/javascripts/SubstanceRecommended.js +2 -2
- data/app/assets/javascripts/Symptom.js +2 -2
- data/app/assets/javascripts/attributes/Component.js +2 -2
- data/app/assets/javascripts/attributes/DiagnosisComponent.js +1 -1
- data/app/assets/javascripts/attributes/Entity.js +2 -2
- data/app/assets/javascripts/attributes/FacilityLocation.js +1 -1
- data/app/assets/javascripts/attributes/Identifier.js +1 -1
- data/app/assets/javascripts/attributes/Location.js +32 -0
- data/app/assets/javascripts/attributes/Organization.js +1 -1
- data/app/assets/javascripts/basetypes/Any.js +1 -1
- data/app/assets/javascripts/basetypes/AnyEntity.js +3 -0
- data/app/models/cqm/individual_result.rb +2 -2
- data/app/models/cqm/measure.rb +1 -1
- data/app/models/cqm/patient.rb +1 -1
- data/app/models/hqmfOid_to_datatype_map.json +1 -1
- data/app/models/models.rb +2 -2
- data/app/models/qdm/adverse_event.rb +2 -2
- data/app/models/qdm/allergy_intolerance.rb +2 -2
- data/app/models/qdm/assessment_order.rb +2 -2
- data/app/models/qdm/assessment_performed.rb +3 -2
- data/app/models/qdm/assessment_recommended.rb +2 -2
- data/app/models/qdm/attributes/component.rb +1 -1
- data/app/models/qdm/attributes/diagnosis_component.rb +1 -1
- data/app/models/qdm/attributes/entity.rb +1 -1
- data/app/models/qdm/attributes/facility_location.rb +1 -1
- data/app/models/qdm/attributes/identifier.rb +1 -1
- data/app/models/qdm/attributes/location.rb +9 -0
- data/app/models/qdm/attributes/organization.rb +1 -1
- data/app/models/qdm/basetypes/data_element.rb +5 -0
- data/app/models/qdm/care_goal.rb +2 -2
- data/app/models/qdm/communication_performed.rb +3 -3
- data/app/models/qdm/device_order.rb +2 -2
- data/app/models/qdm/device_recommended.rb +2 -2
- data/app/models/qdm/diagnosis.rb +2 -2
- data/app/models/qdm/diagnostic_study_order.rb +2 -2
- data/app/models/qdm/diagnostic_study_performed.rb +4 -2
- data/app/models/qdm/diagnostic_study_recommended.rb +2 -2
- data/app/models/qdm/encounter_order.rb +2 -2
- data/app/models/qdm/encounter_performed.rb +4 -3
- data/app/models/qdm/encounter_recommended.rb +2 -2
- data/app/models/qdm/family_history.rb +2 -2
- data/app/models/qdm/immunization_administered.rb +2 -2
- data/app/models/qdm/immunization_order.rb +2 -2
- data/app/models/qdm/intervention_order.rb +2 -2
- data/app/models/qdm/intervention_performed.rb +3 -2
- data/app/models/qdm/intervention_recommended.rb +2 -2
- data/app/models/qdm/laboratory_test_order.rb +2 -2
- data/app/models/qdm/laboratory_test_performed.rb +4 -2
- data/app/models/qdm/laboratory_test_recommended.rb +2 -2
- data/app/models/qdm/medication_active.rb +2 -2
- data/app/models/qdm/medication_administered.rb +2 -2
- data/app/models/qdm/medication_discharge.rb +3 -3
- data/app/models/qdm/medication_dispensed.rb +4 -3
- data/app/models/qdm/medication_order.rb +3 -2
- data/app/models/qdm/participation.rb +1 -2
- data/app/models/qdm/patient.rb +1 -1
- data/app/models/qdm/patient_care_experience.rb +2 -2
- data/app/models/qdm/patient_characteristic.rb +1 -1
- data/app/models/qdm/patient_characteristic_birthdate.rb +1 -1
- data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +1 -1
- data/app/models/qdm/patient_characteristic_ethnicity.rb +1 -1
- data/app/models/qdm/patient_characteristic_expired.rb +1 -1
- data/app/models/qdm/patient_characteristic_payer.rb +1 -1
- data/app/models/qdm/patient_characteristic_race.rb +1 -1
- data/app/models/qdm/patient_characteristic_sex.rb +1 -1
- data/app/models/qdm/physical_exam_order.rb +2 -2
- data/app/models/qdm/physical_exam_performed.rb +3 -2
- data/app/models/qdm/physical_exam_recommended.rb +2 -2
- data/app/models/qdm/procedure_order.rb +2 -2
- data/app/models/qdm/procedure_performed.rb +3 -3
- data/app/models/qdm/procedure_recommended.rb +2 -2
- data/app/models/qdm/provider_care_experience.rb +2 -2
- data/app/models/qdm/related_person.rb +1 -1
- data/app/models/qdm/substance_administered.rb +2 -2
- data/app/models/qdm/substance_order.rb +2 -2
- data/app/models/qdm/substance_recommended.rb +2 -2
- data/app/models/qdm/symptom.rb +2 -2
- data/bin/validate_generator.sh +1 -1
- data/cqm-models.gemspec +1 -1
- data/data/oids_qdm_5.6.json +335 -0
- data/dist/browser.js +887 -1340
- data/dist/index.js +887 -1340
- data/lib/generate_entities.rb +18 -10
- data/lib/generate_models.rb +27 -19
- data/lib/generate_patients.rb +1 -1
- data/modelinfo/qdm-modelinfo-5.6.xml +1102 -0
- data/package.json +3 -3
- data/templates/models_template.rb.erb +3 -1
- data/templates/mongoose_template.js.erb +9 -2
- data/yarn.lock +999 -899
- metadata +11 -9
- data/app/assets/javascripts/DeviceApplied.js +0 -48
- data/app/models/qdm/device_applied.rb +0 -19
data/lib/generate_entities.rb
CHANGED
@@ -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(
|
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.
|
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
|
data/lib/generate_models.rb
CHANGED
@@ -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/, "
|
269
|
-
contents.gsub!(/field :sender/, "
|
270
|
-
contents.gsub!(/field :recipient/, "
|
271
|
-
contents.gsub!(/field :recorder/, "
|
272
|
-
contents.gsub!(/field :performer/, "
|
273
|
-
contents.gsub!(/field :requester/, "
|
274
|
-
contents.gsub!(/field :prescriber/, "
|
275
|
-
contents.gsub!(/field :dispenser/, "
|
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
|
data/lib/generate_patients.rb
CHANGED
@@ -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.
|
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
|