cqm-models 3.1.0 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.json +6 -0
- data/.github/workflows/ci.yml +2 -1
- 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 +26 -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/AnyEntity.js +3 -0
- data/app/assets/javascripts/basetypes/DataElement.js +26 -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 +2200 -1451
- data/dist/index.js +2200 -1451
- 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 +5 -5
- data/templates/models_template.rb.erb +3 -1
- data/templates/mongoose_template.js.erb +9 -2
- data/templates/patient_template.js.erb +25 -0
- data/yarn.lock +699 -682
- metadata +6 -4
- data/app/assets/javascripts/DeviceApplied.js +0 -48
- data/app/models/qdm/device_applied.rb +0 -19
@@ -21,11 +21,11 @@ const [Number, String] = [
|
|
21
21
|
|
22
22
|
const PatientCareExperienceSchema = DataElementSchema({
|
23
23
|
authorDatetime: DateTime,
|
24
|
-
recorder: AnyEntity,
|
24
|
+
recorder: [AnyEntity],
|
25
25
|
qdmTitle: { type: String, default: 'Patient Care Experience' },
|
26
26
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.52' },
|
27
27
|
qdmCategory: { type: String, default: 'care_experience' },
|
28
|
-
qdmVersion: { type: String, default: '5.
|
28
|
+
qdmVersion: { type: String, default: '5.6' },
|
29
29
|
_type: { type: String, default: 'QDM::PatientCareExperience' },
|
30
30
|
|
31
31
|
});
|
@@ -24,7 +24,7 @@ const PatientCharacteristicSchema = DataElementSchema({
|
|
24
24
|
qdmTitle: { type: String, default: 'Patient Characteristic' },
|
25
25
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.53' },
|
26
26
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
27
|
-
qdmVersion: { type: String, default: '5.
|
27
|
+
qdmVersion: { type: String, default: '5.6' },
|
28
28
|
_type: { type: String, default: 'QDM::PatientCharacteristic' },
|
29
29
|
|
30
30
|
});
|
@@ -25,7 +25,7 @@ const PatientCharacteristicBirthdateSchema = DataElementSchema({
|
|
25
25
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.54' },
|
26
26
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
27
27
|
qdmStatus: { type: String, default: 'birthdate' },
|
28
|
-
qdmVersion: { type: String, default: '5.
|
28
|
+
qdmVersion: { type: String, default: '5.6' },
|
29
29
|
_type: { type: String, default: 'QDM::PatientCharacteristicBirthdate' },
|
30
30
|
|
31
31
|
});
|
@@ -27,7 +27,7 @@ const PatientCharacteristicClinicalTrialParticipantSchema = DataElementSchema({
|
|
27
27
|
qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.51' },
|
28
28
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
29
29
|
qdmStatus: { type: String, default: 'clinical_trial_participant' },
|
30
|
-
qdmVersion: { type: String, default: '5.
|
30
|
+
qdmVersion: { type: String, default: '5.6' },
|
31
31
|
_type: { type: String, default: 'QDM::PatientCharacteristicClinicalTrialParticipant' },
|
32
32
|
|
33
33
|
});
|
@@ -24,7 +24,7 @@ const PatientCharacteristicEthnicitySchema = DataElementSchema({
|
|
24
24
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.56' },
|
25
25
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
26
26
|
qdmStatus: { type: String, default: 'ethnicity' },
|
27
|
-
qdmVersion: { type: String, default: '5.
|
27
|
+
qdmVersion: { type: String, default: '5.6' },
|
28
28
|
_type: { type: String, default: 'QDM::PatientCharacteristicEthnicity' },
|
29
29
|
|
30
30
|
});
|
@@ -26,7 +26,7 @@ const PatientCharacteristicExpiredSchema = DataElementSchema({
|
|
26
26
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.57' },
|
27
27
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
28
28
|
qdmStatus: { type: String, default: 'expired' },
|
29
|
-
qdmVersion: { type: String, default: '5.
|
29
|
+
qdmVersion: { type: String, default: '5.6' },
|
30
30
|
_type: { type: String, default: 'QDM::PatientCharacteristicExpired' },
|
31
31
|
|
32
32
|
});
|
@@ -25,7 +25,7 @@ const PatientCharacteristicPayerSchema = DataElementSchema({
|
|
25
25
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.58' },
|
26
26
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
27
27
|
qdmStatus: { type: String, default: 'payer' },
|
28
|
-
qdmVersion: { type: String, default: '5.
|
28
|
+
qdmVersion: { type: String, default: '5.6' },
|
29
29
|
_type: { type: String, default: 'QDM::PatientCharacteristicPayer' },
|
30
30
|
|
31
31
|
});
|
@@ -24,7 +24,7 @@ const PatientCharacteristicRaceSchema = DataElementSchema({
|
|
24
24
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.59' },
|
25
25
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
26
26
|
qdmStatus: { type: String, default: 'race' },
|
27
|
-
qdmVersion: { type: String, default: '5.
|
27
|
+
qdmVersion: { type: String, default: '5.6' },
|
28
28
|
_type: { type: String, default: 'QDM::PatientCharacteristicRace' },
|
29
29
|
|
30
30
|
});
|
@@ -24,7 +24,7 @@ const PatientCharacteristicSexSchema = DataElementSchema({
|
|
24
24
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.55' },
|
25
25
|
qdmCategory: { type: String, default: 'patient_characteristic' },
|
26
26
|
qdmStatus: { type: String, default: 'gender' },
|
27
|
-
qdmVersion: { type: String, default: '5.
|
27
|
+
qdmVersion: { type: String, default: '5.6' },
|
28
28
|
_type: { type: String, default: 'QDM::PatientCharacteristicSex' },
|
29
29
|
|
30
30
|
});
|
@@ -24,12 +24,12 @@ const PhysicalExamOrderSchema = DataElementSchema({
|
|
24
24
|
reason: Code,
|
25
25
|
anatomicalLocationSite: Code,
|
26
26
|
negationRationale: Code,
|
27
|
-
requester: AnyEntity,
|
27
|
+
requester: [AnyEntity],
|
28
28
|
qdmTitle: { type: String, default: 'Physical Exam, Order' },
|
29
29
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.61' },
|
30
30
|
qdmCategory: { type: String, default: 'physical_exam' },
|
31
31
|
qdmStatus: { type: String, default: 'order' },
|
32
|
-
qdmVersion: { type: String, default: '5.
|
32
|
+
qdmVersion: { type: String, default: '5.6' },
|
33
33
|
_type: { type: String, default: 'QDM::PhysicalExamOrder' },
|
34
34
|
|
35
35
|
});
|
@@ -29,12 +29,13 @@ const PhysicalExamPerformedSchema = DataElementSchema({
|
|
29
29
|
anatomicalLocationSite: Code,
|
30
30
|
negationRationale: Code,
|
31
31
|
components: [ComponentSchema],
|
32
|
-
performer: AnyEntity,
|
32
|
+
performer: [AnyEntity],
|
33
|
+
relatedTo: [String],
|
33
34
|
qdmTitle: { type: String, default: 'Physical Exam, Performed' },
|
34
35
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.62' },
|
35
36
|
qdmCategory: { type: String, default: 'physical_exam' },
|
36
37
|
qdmStatus: { type: String, default: 'performed' },
|
37
|
-
qdmVersion: { type: String, default: '5.
|
38
|
+
qdmVersion: { type: String, default: '5.6' },
|
38
39
|
_type: { type: String, default: 'QDM::PhysicalExamPerformed' },
|
39
40
|
|
40
41
|
});
|
@@ -24,12 +24,12 @@ const PhysicalExamRecommendedSchema = DataElementSchema({
|
|
24
24
|
reason: Code,
|
25
25
|
anatomicalLocationSite: Code,
|
26
26
|
negationRationale: Code,
|
27
|
-
requester: AnyEntity,
|
27
|
+
requester: [AnyEntity],
|
28
28
|
qdmTitle: { type: String, default: 'Physical Exam, Recommended' },
|
29
29
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.63' },
|
30
30
|
qdmCategory: { type: String, default: 'physical_exam' },
|
31
31
|
qdmStatus: { type: String, default: 'recommended' },
|
32
|
-
qdmVersion: { type: String, default: '5.
|
32
|
+
qdmVersion: { type: String, default: '5.6' },
|
33
33
|
_type: { type: String, default: 'QDM::PhysicalExamRecommended' },
|
34
34
|
|
35
35
|
});
|
@@ -26,12 +26,12 @@ const ProcedureOrderSchema = DataElementSchema({
|
|
26
26
|
rank: Number,
|
27
27
|
priority: Code,
|
28
28
|
negationRationale: Code,
|
29
|
-
requester: AnyEntity,
|
29
|
+
requester: [AnyEntity],
|
30
30
|
qdmTitle: { type: String, default: 'Procedure, Order' },
|
31
31
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.66' },
|
32
32
|
qdmCategory: { type: String, default: 'procedure' },
|
33
33
|
qdmStatus: { type: String, default: 'order' },
|
34
|
-
qdmVersion: { type: String, default: '5.
|
34
|
+
qdmVersion: { type: String, default: '5.6' },
|
35
35
|
_type: { type: String, default: 'QDM::ProcedureOrder' },
|
36
36
|
|
37
37
|
});
|
@@ -29,16 +29,16 @@ const ProcedurePerformedSchema = DataElementSchema({
|
|
29
29
|
status: Code,
|
30
30
|
anatomicalLocationSite: Code,
|
31
31
|
rank: Number,
|
32
|
-
priority: Code,
|
33
32
|
incisionDatetime: DateTime,
|
34
33
|
negationRationale: Code,
|
35
34
|
components: [ComponentSchema],
|
36
|
-
performer: AnyEntity,
|
35
|
+
performer: [AnyEntity],
|
36
|
+
relatedTo: [String],
|
37
37
|
qdmTitle: { type: String, default: 'Procedure, Performed' },
|
38
38
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.67' },
|
39
39
|
qdmCategory: { type: String, default: 'procedure' },
|
40
40
|
qdmStatus: { type: String, default: 'performed' },
|
41
|
-
qdmVersion: { type: String, default: '5.
|
41
|
+
qdmVersion: { type: String, default: '5.6' },
|
42
42
|
_type: { type: String, default: 'QDM::ProcedurePerformed' },
|
43
43
|
|
44
44
|
});
|
@@ -24,13 +24,13 @@ const ProcedureRecommendedSchema = DataElementSchema({
|
|
24
24
|
reason: Code,
|
25
25
|
anatomicalLocationSite: Code,
|
26
26
|
rank: Number,
|
27
|
-
requester: AnyEntity,
|
27
|
+
requester: [AnyEntity],
|
28
28
|
negationRationale: Code,
|
29
29
|
qdmTitle: { type: String, default: 'Procedure, Recommended' },
|
30
30
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.68' },
|
31
31
|
qdmCategory: { type: String, default: 'procedure' },
|
32
32
|
qdmStatus: { type: String, default: 'recommended' },
|
33
|
-
qdmVersion: { type: String, default: '5.
|
33
|
+
qdmVersion: { type: String, default: '5.6' },
|
34
34
|
_type: { type: String, default: 'QDM::ProcedureRecommended' },
|
35
35
|
|
36
36
|
});
|
@@ -21,11 +21,11 @@ const [Number, String] = [
|
|
21
21
|
|
22
22
|
const ProviderCareExperienceSchema = DataElementSchema({
|
23
23
|
authorDatetime: DateTime,
|
24
|
-
recorder: AnyEntity,
|
24
|
+
recorder: [AnyEntity],
|
25
25
|
qdmTitle: { type: String, default: 'Provider Care Experience' },
|
26
26
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.70' },
|
27
27
|
qdmCategory: { type: String, default: 'care_experience' },
|
28
|
-
qdmVersion: { type: String, default: '5.
|
28
|
+
qdmVersion: { type: String, default: '5.6' },
|
29
29
|
_type: { type: String, default: 'QDM::ProviderCareExperience' },
|
30
30
|
|
31
31
|
});
|
@@ -14,7 +14,7 @@ const [Schema, Number, String, Mixed] = [
|
|
14
14
|
|
15
15
|
const QDMPatientSchema = new Schema({
|
16
16
|
birthDatetime: DateTime,
|
17
|
-
qdmVersion: { type: String, default: '5.
|
17
|
+
qdmVersion: { type: String, default: '5.6' },
|
18
18
|
|
19
19
|
// These are the "data criteria", or QDM datatype elements that exist on a
|
20
20
|
// patient.
|
@@ -56,6 +56,31 @@ QDMPatientSchema.methods.getByQrdaOid = function getByQrdaOid(qrdaOid) {
|
|
56
56
|
return this.dataElements.filter(element => element.qrdaOid === qrdaOid);
|
57
57
|
};
|
58
58
|
|
59
|
+
// cql-execution prefers getId() over id() because some data models may have an id property
|
60
|
+
QDMPatientSchema.methods.getId = function getId() {
|
61
|
+
return this._id;
|
62
|
+
};
|
63
|
+
|
64
|
+
/* eslint no-underscore-dangle: 0 */
|
65
|
+
QDMPatientSchema.methods._is = function _is(typeSpecifier) {
|
66
|
+
return this._typeHierarchy().some(
|
67
|
+
t => t.type === typeSpecifier.type && t.name === typeSpecifier.name
|
68
|
+
);
|
69
|
+
};
|
70
|
+
|
71
|
+
/* eslint no-underscore-dangle: 0 */
|
72
|
+
QDMPatientSchema.methods._typeHierarchy = function _typeHierarchy() {
|
73
|
+
const ver = this.qdmVersion.replace('.', '_');
|
74
|
+
return [
|
75
|
+
{
|
76
|
+
name: `{urn:healthit-gov:qdm:v${ver}}Patient`,
|
77
|
+
type: 'NamedTypeSpecifier',
|
78
|
+
},
|
79
|
+
{ name: '{urn:hl7-org:elm-types:r1}Tuple', type: 'NamedTypeSpecifier' },
|
80
|
+
{ name: '{urn:hl7-org:elm-types:r1}Any', type: 'NamedTypeSpecifier' },
|
81
|
+
];
|
82
|
+
};
|
83
|
+
|
59
84
|
// Returns an array of elements that exist on this patient. Optionally
|
60
85
|
// takes a qdmCategory, which returns all elements of that QDM qdmCategory.
|
61
86
|
// Example: patient.getDataElements({qdmCategory: 'encounters'}) will return
|
@@ -25,7 +25,7 @@ const RelatedPersonSchema = DataElementSchema({
|
|
25
25
|
qdmTitle: { type: String, default: 'Related Person' },
|
26
26
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.141' },
|
27
27
|
qdmCategory: { type: String, default: 'related_person' },
|
28
|
-
qdmVersion: { type: String, default: '5.
|
28
|
+
qdmVersion: { type: String, default: '5.6' },
|
29
29
|
_type: { type: String, default: 'QDM::RelatedPerson' },
|
30
30
|
|
31
31
|
});
|
@@ -27,12 +27,12 @@ const SubstanceAdministeredSchema = DataElementSchema({
|
|
27
27
|
frequency: Code,
|
28
28
|
route: Code,
|
29
29
|
negationRationale: Code,
|
30
|
-
performer: AnyEntity,
|
30
|
+
performer: [AnyEntity],
|
31
31
|
qdmTitle: { type: String, default: 'Substance, Administered' },
|
32
32
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.73' },
|
33
33
|
qdmCategory: { type: String, default: 'substance' },
|
34
34
|
qdmStatus: { type: String, default: 'administered' },
|
35
|
-
qdmVersion: { type: String, default: '5.
|
35
|
+
qdmVersion: { type: String, default: '5.6' },
|
36
36
|
_type: { type: String, default: 'QDM::SubstanceAdministered' },
|
37
37
|
|
38
38
|
});
|
@@ -29,12 +29,12 @@ const SubstanceOrderSchema = DataElementSchema({
|
|
29
29
|
refills: Number,
|
30
30
|
route: Code,
|
31
31
|
negationRationale: Code,
|
32
|
-
requester: AnyEntity,
|
32
|
+
requester: [AnyEntity],
|
33
33
|
qdmTitle: { type: String, default: 'Substance, Order' },
|
34
34
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.77' },
|
35
35
|
qdmCategory: { type: String, default: 'substance' },
|
36
36
|
qdmStatus: { type: String, default: 'order' },
|
37
|
-
qdmVersion: { type: String, default: '5.
|
37
|
+
qdmVersion: { type: String, default: '5.6' },
|
38
38
|
_type: { type: String, default: 'QDM::SubstanceOrder' },
|
39
39
|
|
40
40
|
});
|
@@ -27,12 +27,12 @@ const SubstanceRecommendedSchema = DataElementSchema({
|
|
27
27
|
refills: Number,
|
28
28
|
route: Code,
|
29
29
|
negationRationale: Code,
|
30
|
-
requester: AnyEntity,
|
30
|
+
requester: [AnyEntity],
|
31
31
|
qdmTitle: { type: String, default: 'Substance, Recommended' },
|
32
32
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.78' },
|
33
33
|
qdmCategory: { type: String, default: 'substance' },
|
34
34
|
qdmStatus: { type: String, default: 'recommended' },
|
35
|
-
qdmVersion: { type: String, default: '5.
|
35
|
+
qdmVersion: { type: String, default: '5.6' },
|
36
36
|
_type: { type: String, default: 'QDM::SubstanceRecommended' },
|
37
37
|
|
38
38
|
});
|
@@ -22,12 +22,12 @@ const [Number, String] = [
|
|
22
22
|
const SymptomSchema = DataElementSchema({
|
23
23
|
prevalencePeriod: Interval,
|
24
24
|
severity: Code,
|
25
|
-
recorder: AnyEntity,
|
25
|
+
recorder: [AnyEntity],
|
26
26
|
qdmTitle: { type: String, default: 'Symptom' },
|
27
27
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.116' },
|
28
28
|
qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.136' },
|
29
29
|
qdmCategory: { type: String, default: 'symptom' },
|
30
|
-
qdmVersion: { type: String, default: '5.
|
30
|
+
qdmVersion: { type: String, default: '5.6' },
|
31
31
|
_type: { type: String, default: 'QDM::Symptom' },
|
32
32
|
|
33
33
|
});
|
@@ -17,7 +17,7 @@ const [Number, String] = [
|
|
17
17
|
const ComponentSchema = new mongoose.Schema({
|
18
18
|
code: Code,
|
19
19
|
result: Any,
|
20
|
-
qdmVersion: { type: String, default: '5.
|
20
|
+
qdmVersion: { type: String, default: '5.6' },
|
21
21
|
_type: { type: String, default: 'QDM::Component' },
|
22
22
|
|
23
23
|
});
|
@@ -34,7 +34,7 @@ function ComponentSchemaFunction(add, options) {
|
|
34
34
|
const extended = new Schema({
|
35
35
|
code: Code,
|
36
36
|
result: Any,
|
37
|
-
qdmVersion: { type: String, default: '5.
|
37
|
+
qdmVersion: { type: String, default: '5.6' },
|
38
38
|
_type: { type: String, default: 'QDM::Component' },
|
39
39
|
|
40
40
|
|
@@ -17,7 +17,7 @@ const DiagnosisComponentSchema = new mongoose.Schema({
|
|
17
17
|
code: Code,
|
18
18
|
presentOnAdmissionIndicator: Code,
|
19
19
|
rank: Number,
|
20
|
-
qdmVersion: { type: String, default: '5.
|
20
|
+
qdmVersion: { type: String, default: '5.6' },
|
21
21
|
_type: { type: String, default: 'QDM::DiagnosisComponent' },
|
22
22
|
|
23
23
|
});
|
@@ -18,7 +18,7 @@ const [Number, String] = [
|
|
18
18
|
const EntitySchema = new mongoose.Schema({
|
19
19
|
id: String,
|
20
20
|
identifier: IdentifierSchema,
|
21
|
-
qdmVersion: { type: String, default: '5.
|
21
|
+
qdmVersion: { type: String, default: '5.6' },
|
22
22
|
_type: { type: String, default: 'QDM::Entity' },
|
23
23
|
|
24
24
|
});
|
@@ -34,7 +34,7 @@ class Entity extends mongoose.Document {
|
|
34
34
|
function EntitySchemaFunction(add, options) {
|
35
35
|
const extended = new Schema({
|
36
36
|
identifier: IdentifierSchema,
|
37
|
-
qdmVersion: { type: String, default: '5.
|
37
|
+
qdmVersion: { type: String, default: '5.6' },
|
38
38
|
_type: { type: String, default: 'QDM::Entity' },
|
39
39
|
|
40
40
|
|
@@ -16,7 +16,7 @@ const [Number, String] = [
|
|
16
16
|
const FacilityLocationSchema = new mongoose.Schema({
|
17
17
|
code: Code,
|
18
18
|
locationPeriod: Interval,
|
19
|
-
qdmVersion: { type: String, default: '5.
|
19
|
+
qdmVersion: { type: String, default: '5.6' },
|
20
20
|
_type: { type: String, default: 'QDM::FacilityLocation' },
|
21
21
|
|
22
22
|
});
|
@@ -8,7 +8,7 @@ const [Number, String] = [
|
|
8
8
|
const IdentifierSchema = mongoose.Schema({
|
9
9
|
namingSystem: String,
|
10
10
|
value: String,
|
11
|
-
qdmVersion: { type: String, default: '5.
|
11
|
+
qdmVersion: { type: String, default: '5.6' },
|
12
12
|
_type: { type: String, default: 'QDM::Identifier' },
|
13
13
|
|
14
14
|
}, { _id: false, id: false });
|
@@ -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 LocationSchema = EntitySchemaFunction({
|
17
|
+
locationType: Code,
|
18
|
+
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.142' },
|
19
|
+
_type: { type: String, default: 'QDM::Location' },
|
20
|
+
|
21
|
+
});
|
22
|
+
|
23
|
+
module.exports.LocationSchema = LocationSchema;
|
24
|
+
class Location extends mongoose.Document {
|
25
|
+
constructor(object) {
|
26
|
+
super(object, LocationSchema);
|
27
|
+
this._type = 'QDM::Location';
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
module.exports.Location = Location;
|
32
|
+
|
@@ -14,7 +14,7 @@ const [Number, String] = [
|
|
14
14
|
];
|
15
15
|
|
16
16
|
const OrganizationSchema = EntitySchemaFunction({
|
17
|
-
|
17
|
+
organizationType: Code,
|
18
18
|
hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.4.135' },
|
19
19
|
qrdaOid: { type: String, default: '2.16.840.1.113883.10.20.24.3.163' },
|
20
20
|
_type: { type: String, default: 'QDM::Organization' },
|
@@ -3,6 +3,7 @@ const { PatientEntity } = require('../attributes/PatientEntity');
|
|
3
3
|
const { Practitioner } = require('../attributes/Practitioner');
|
4
4
|
const { CarePartner } = require('../attributes/CarePartner');
|
5
5
|
const { Organization } = require('../attributes/Organization');
|
6
|
+
const { Location } = require('../attributes/Location');
|
6
7
|
|
7
8
|
function AnyEntity(key, options) {
|
8
9
|
mongoose.SchemaType.call(this, key, options, 'AnyEntity');
|
@@ -32,6 +33,8 @@ AnyEntity.prototype.cast = (entity) => {
|
|
32
33
|
return new CarePartner(entity);
|
33
34
|
case 'QDM::Organization':
|
34
35
|
return new Organization(entity);
|
36
|
+
case 'QDM::Location':
|
37
|
+
return new Location(entity);
|
35
38
|
default:
|
36
39
|
throw new Error(`Could not find entity type "${entity._type}".`);
|
37
40
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const mongoose = require('mongoose/browser');
|
2
|
-
const Code = require('./Code.js');
|
3
2
|
const cql = require('cql-execution');
|
3
|
+
const Code = require('./Code.js');
|
4
4
|
const Identifier = require('../attributes/Identifier');
|
5
5
|
|
6
6
|
const [Schema] = [mongoose.Schema];
|
@@ -49,6 +49,31 @@ function DataElementSchema(add, options) {
|
|
49
49
|
return null;
|
50
50
|
};
|
51
51
|
|
52
|
+
/* eslint no-underscore-dangle: 0 */
|
53
|
+
extended.methods._is = function _is(typeSpecifier) {
|
54
|
+
return this._typeHierarchy().some(
|
55
|
+
t => t.type === typeSpecifier.type && t.name === typeSpecifier.name
|
56
|
+
);
|
57
|
+
};
|
58
|
+
|
59
|
+
/* eslint no-underscore-dangle: 0 */
|
60
|
+
extended.methods._typeHierarchy = function _typeHierarchy() {
|
61
|
+
const typeName = this._type.replace(/QDM::/, '');
|
62
|
+
const prefix = this.negationRationale ? 'Negative' : 'Positive';
|
63
|
+
const ver = this.qdmVersion.replace('.', '_');
|
64
|
+
return [
|
65
|
+
{
|
66
|
+
name: `{urn:healthit-gov:qdm:v${ver}}${prefix}${typeName}`,
|
67
|
+
type: 'NamedTypeSpecifier',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
name: `{urn:healthit-gov:qdm:v${ver}}${typeName}`,
|
71
|
+
type: 'NamedTypeSpecifier',
|
72
|
+
},
|
73
|
+
{ name: '{urn:hl7-org:elm-types:r1}Tuple', type: 'NamedTypeSpecifier' },
|
74
|
+
{ name: '{urn:hl7-org:elm-types:r1}Any', type: 'NamedTypeSpecifier' },
|
75
|
+
];
|
76
|
+
};
|
52
77
|
return extended;
|
53
78
|
}
|
54
79
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
"2.16.840.1.113883.10.20.28.4.141": "RelatedPerson",
|
5
5
|
"2.16.840.1.113883.10.20.28.4.137": "Practitioner",
|
6
6
|
"2.16.840.1.113883.10.20.28.4.135": "Organization",
|
7
|
+
"2.16.840.1.113883.10.20.28.4.142": "Location",
|
7
8
|
"2.16.840.1.113883.10.20.28.4.61": "PhysicalExamOrder",
|
8
9
|
"2.16.840.1.113883.10.20.28.4.130": "Participation",
|
9
10
|
"2.16.840.1.113883.10.20.28.4.55": "PatientCharacteristicSex",
|
@@ -42,7 +43,6 @@
|
|
42
43
|
"2.16.840.1.113883.10.20.28.4.54": "PatientCharacteristicBirthdate",
|
43
44
|
"2.16.840.1.113883.10.20.28.4.120": "AdverseEvent",
|
44
45
|
"2.16.840.1.113883.10.20.28.4.16": "DeviceRecommended",
|
45
|
-
"2.16.840.1.113883.10.20.28.4.13": "DeviceApplied",
|
46
46
|
"2.16.840.1.113883.10.20.28.4.48": "MedicationDischarge",
|
47
47
|
"2.16.840.1.113883.10.20.28.4.36": "InterventionPerformed",
|
48
48
|
"2.16.840.1.113883.10.20.28.4.43": "LaboratoryTestRecommended",
|
data/app/models/models.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Base QDM module (generated from lib/generate_models.rb) for QDM 5.
|
1
|
+
# Base QDM module (generated from lib/generate_models.rb) for QDM 5.6
|
2
2
|
module QDM
|
3
3
|
end
|
4
4
|
require 'mongoid'
|
@@ -25,6 +25,7 @@ require_relative 'qdm/attributes/diagnosis_component'
|
|
25
25
|
require_relative 'qdm/attributes/organization'
|
26
26
|
require_relative 'qdm/attributes/patient_entity'
|
27
27
|
require_relative 'qdm/attributes/practitioner'
|
28
|
+
require_relative 'qdm/attributes/location'
|
28
29
|
require_relative 'qdm/attributes/result_component'
|
29
30
|
|
30
31
|
# Tacoma-specific models
|
@@ -85,7 +86,6 @@ require_relative 'qdm/physical_exam_recommended'
|
|
85
86
|
require_relative 'qdm/patient_characteristic_birthdate'
|
86
87
|
require_relative 'qdm/adverse_event'
|
87
88
|
require_relative 'qdm/device_recommended'
|
88
|
-
require_relative 'qdm/device_applied'
|
89
89
|
require_relative 'qdm/medication_discharge'
|
90
90
|
require_relative 'qdm/intervention_performed'
|
91
91
|
require_relative 'qdm/laboratory_test_recommended'
|
@@ -8,10 +8,10 @@ module QDM
|
|
8
8
|
field :severity, type: QDM::Code
|
9
9
|
field :facilityLocation, type: QDM::FacilityLocation
|
10
10
|
field :type, type: QDM::Code
|
11
|
-
|
11
|
+
embeds_many :recorder, class_name: 'QDM::Entity'
|
12
12
|
field :qdmTitle, type: String, default: 'Adverse Event'
|
13
13
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.120'
|
14
14
|
field :qdmCategory, type: String, default: 'adverse_event'
|
15
|
-
field :qdmVersion, type: String, default: '5.
|
15
|
+
field :qdmVersion, type: String, default: '5.6'
|
16
16
|
end
|
17
17
|
end
|
@@ -7,11 +7,11 @@ module QDM
|
|
7
7
|
field :prevalencePeriod, type: QDM::Interval
|
8
8
|
field :type, type: QDM::Code
|
9
9
|
field :severity, type: QDM::Code
|
10
|
-
|
10
|
+
embeds_many :recorder, class_name: 'QDM::Entity'
|
11
11
|
field :qdmTitle, type: String, default: 'Allergy/Intolerance'
|
12
12
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.119'
|
13
13
|
field :qdmCategory, type: String, default: 'allergy'
|
14
14
|
field :qdmStatus, type: String, default: 'intolerance'
|
15
|
-
field :qdmVersion, type: String, default: '5.
|
15
|
+
field :qdmVersion, type: String, default: '5.6'
|
16
16
|
end
|
17
17
|
end
|
@@ -6,11 +6,11 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
8
|
field :reason, type: QDM::Code
|
9
|
-
|
9
|
+
embeds_many :requester, class_name: 'QDM::Entity'
|
10
10
|
field :qdmTitle, type: String, default: 'Assessment, Order'
|
11
11
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.131'
|
12
12
|
field :qdmCategory, type: String, default: 'assessment'
|
13
13
|
field :qdmStatus, type: String, default: 'order'
|
14
|
-
field :qdmVersion, type: String, default: '5.
|
14
|
+
field :qdmVersion, type: String, default: '5.6'
|
15
15
|
end
|
16
16
|
end
|
@@ -10,13 +10,14 @@ module QDM
|
|
10
10
|
field :reason, type: QDM::Code
|
11
11
|
field :method, type: QDM::Code
|
12
12
|
field :result
|
13
|
+
field :interpretation, type: QDM::Code
|
13
14
|
field :components, type: Array
|
14
15
|
field :relatedTo, type: Array
|
15
|
-
|
16
|
+
embeds_many :performer, class_name: 'QDM::Entity'
|
16
17
|
field :qdmTitle, type: String, default: 'Assessment, Performed'
|
17
18
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.117'
|
18
19
|
field :qdmCategory, type: String, default: 'assessment'
|
19
20
|
field :qdmStatus, type: String, default: 'performed'
|
20
|
-
field :qdmVersion, type: String, default: '5.
|
21
|
+
field :qdmVersion, type: String, default: '5.6'
|
21
22
|
end
|
22
23
|
end
|
@@ -6,11 +6,11 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
8
|
field :reason, type: QDM::Code
|
9
|
-
|
9
|
+
embeds_many :requester, class_name: 'QDM::Entity'
|
10
10
|
field :qdmTitle, type: String, default: 'Assessment, Recommended'
|
11
11
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.118'
|
12
12
|
field :qdmCategory, type: String, default: 'assessment'
|
13
13
|
field :qdmStatus, type: String, default: 'recommended'
|
14
|
-
field :qdmVersion, type: String, default: '5.
|
14
|
+
field :qdmVersion, type: String, default: '5.6'
|
15
15
|
end
|
16
16
|
end
|