cqm-models 1.0.3 → 1.1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.eslintrc.json +10 -2
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -4
- data/.rubocop.yml +3 -0
- data/.travis.yml +31 -1
- data/README.md +59 -2
- data/app/assets/javascripts/AdverseEvent.js +16 -7
- data/app/assets/javascripts/AllDataElements.js +6 -6
- data/app/assets/javascripts/AllergyIntolerance.js +16 -7
- data/app/assets/javascripts/AssessmentOrder.js +15 -6
- data/app/assets/javascripts/AssessmentPerformed.js +16 -7
- data/app/assets/javascripts/AssessmentRecommended.js +16 -7
- data/app/assets/javascripts/CareGoal.js +16 -7
- data/app/assets/javascripts/CommunicationPerformed.js +15 -6
- data/app/assets/javascripts/DeviceApplied.js +16 -7
- data/app/assets/javascripts/DeviceOrder.js +16 -7
- data/app/assets/javascripts/DeviceRecommended.js +16 -7
- data/app/assets/javascripts/Diagnosis.js +16 -7
- data/app/assets/javascripts/DiagnosticStudyOrder.js +16 -7
- data/app/assets/javascripts/DiagnosticStudyPerformed.js +16 -7
- data/app/assets/javascripts/DiagnosticStudyRecommended.js +16 -7
- data/app/assets/javascripts/EncounterOrder.js +16 -7
- data/app/assets/javascripts/EncounterPerformed.js +16 -7
- data/app/assets/javascripts/EncounterRecommended.js +16 -7
- data/app/assets/javascripts/FamilyHistory.js +16 -7
- data/app/assets/javascripts/Id.js +7 -3
- data/app/assets/javascripts/ImmunizationAdministered.js +16 -7
- data/app/assets/javascripts/ImmunizationOrder.js +16 -7
- data/app/assets/javascripts/IndividualResult.js +7 -2
- data/app/assets/javascripts/InterventionOrder.js +16 -7
- data/app/assets/javascripts/InterventionPerformed.js +16 -7
- data/app/assets/javascripts/InterventionRecommended.js +16 -7
- data/app/assets/javascripts/LaboratoryTestOrder.js +16 -7
- data/app/assets/javascripts/LaboratoryTestPerformed.js +16 -7
- data/app/assets/javascripts/LaboratoryTestRecommended.js +16 -7
- data/app/assets/javascripts/MedicationActive.js +16 -7
- data/app/assets/javascripts/MedicationAdministered.js +16 -7
- data/app/assets/javascripts/MedicationDischarge.js +16 -7
- data/app/assets/javascripts/MedicationDispensed.js +16 -7
- data/app/assets/javascripts/MedicationOrder.js +16 -7
- data/app/assets/javascripts/Participation.js +15 -6
- data/app/assets/javascripts/PatientCareExperience.js +16 -7
- data/app/assets/javascripts/PatientCharacteristic.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicBirthdate.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicEthnicity.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicExpired.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicPayer.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicRace.js +16 -7
- data/app/assets/javascripts/PatientCharacteristicSex.js +16 -7
- data/app/assets/javascripts/PhysicalExamOrder.js +16 -7
- data/app/assets/javascripts/PhysicalExamPerformed.js +16 -7
- data/app/assets/javascripts/PhysicalExamRecommended.js +16 -7
- data/app/assets/javascripts/ProcedureOrder.js +16 -7
- data/app/assets/javascripts/ProcedurePerformed.js +16 -7
- data/app/assets/javascripts/ProcedureRecommended.js +16 -7
- data/app/assets/javascripts/ProviderCareExperience.js +16 -7
- data/app/assets/javascripts/ProviderCharacteristic.js +16 -7
- data/app/assets/javascripts/QDMPatient.js +262 -0
- data/app/assets/javascripts/Result.js +7 -2
- data/app/assets/javascripts/ResultComponent.js +14 -6
- data/app/assets/javascripts/SubstanceAdministered.js +16 -7
- data/app/assets/javascripts/SubstanceOrder.js +16 -7
- data/app/assets/javascripts/SubstanceRecommended.js +16 -7
- data/app/assets/javascripts/Symptom.js +16 -7
- data/app/assets/javascripts/attributes/Component.js +30 -0
- data/app/assets/javascripts/attributes/FacilityLocation.js +30 -0
- data/app/assets/javascripts/basetypes/Any.js +1 -1
- data/app/assets/javascripts/basetypes/Code.js +1 -1
- data/app/assets/javascripts/basetypes/DataElement.js +2 -1
- data/app/assets/javascripts/basetypes/DateTime.js +5 -1
- data/app/assets/javascripts/basetypes/Interval.js +1 -1
- data/app/assets/javascripts/basetypes/Quantity.js +1 -1
- data/app/assets/javascripts/basetypes/Ratio.js +1 -1
- data/app/assets/javascripts/browser.js +3 -0
- data/app/assets/javascripts/cqm/AllCQMModels.js +24 -0
- data/app/assets/javascripts/cqm/CQLLibrary.js +32 -0
- data/app/assets/javascripts/cqm/CQLStatementDependency.js +28 -0
- data/app/assets/javascripts/cqm/Concept.js +17 -0
- data/app/assets/javascripts/cqm/Measure.js +108 -0
- data/app/assets/javascripts/{MeasurePackage.js → cqm/MeasurePackage.js} +9 -3
- data/app/assets/javascripts/cqm/Patient.js +38 -0
- data/app/assets/javascripts/cqm/PopulationSet.js +88 -0
- data/app/assets/javascripts/cqm/Provider.js +44 -0
- data/app/assets/javascripts/cqm/ValueSet.js +26 -0
- data/app/assets/javascripts/index.js +18 -8
- data/app/models/{qdm/tacoma → cqm}/concept.rb +4 -4
- data/app/models/cqm/cql_library.rb +22 -0
- data/app/models/cqm/cql_statement_dependency.rb +24 -0
- data/app/models/cqm/measure.rb +105 -0
- data/app/models/{qdm/tacoma → cqm}/measure_package.rb +2 -2
- data/app/models/cqm/patient.rb +20 -0
- data/app/models/cqm/population_set.rb +86 -0
- data/app/models/cqm/provider.rb +110 -0
- data/app/models/cqm/valueset.rb +15 -0
- data/app/models/hqmfOid_to_datatype_map.json +55 -0
- data/app/models/model_finder.rb +12 -0
- data/app/models/models.rb +18 -6
- data/app/models/qdm/adverse_event.rb +3 -2
- data/app/models/qdm/allergy_intolerance.rb +2 -1
- data/app/models/qdm/assessment_order.rb +1 -0
- data/app/models/qdm/assessment_performed.rb +2 -1
- data/app/models/qdm/assessment_recommended.rb +2 -1
- data/app/models/qdm/attributes/attribute.rb +63 -0
- data/app/models/qdm/{component.rb → attributes/component.rb} +1 -1
- data/app/models/qdm/{facility_location.rb → attributes/facility_location.rb} +1 -1
- data/app/models/qdm/basetypes/data_element.rb +21 -6
- data/app/models/qdm/basetypes/interval.rb +2 -1
- data/app/models/qdm/care_goal.rb +2 -1
- data/app/models/qdm/communication_performed.rb +1 -0
- data/app/models/qdm/device_applied.rb +2 -1
- data/app/models/qdm/device_order.rb +2 -1
- data/app/models/qdm/device_recommended.rb +2 -1
- data/app/models/qdm/diagnosis.rb +2 -1
- data/app/models/qdm/diagnostic_study_order.rb +2 -1
- data/app/models/qdm/diagnostic_study_performed.rb +3 -2
- data/app/models/qdm/diagnostic_study_recommended.rb +2 -1
- data/app/models/qdm/encounter_order.rb +3 -2
- data/app/models/qdm/encounter_performed.rb +2 -1
- data/app/models/qdm/encounter_recommended.rb +3 -2
- data/app/models/qdm/family_history.rb +2 -1
- data/app/models/qdm/immunization_administered.rb +2 -1
- data/app/models/qdm/immunization_order.rb +2 -1
- data/app/models/qdm/intervention_order.rb +2 -1
- data/app/models/qdm/intervention_performed.rb +2 -1
- data/app/models/qdm/intervention_recommended.rb +2 -1
- data/app/models/qdm/laboratory_test_order.rb +2 -1
- data/app/models/qdm/laboratory_test_performed.rb +2 -1
- data/app/models/qdm/laboratory_test_recommended.rb +2 -1
- data/app/models/qdm/medication_active.rb +2 -1
- data/app/models/qdm/medication_administered.rb +2 -1
- data/app/models/qdm/medication_discharge.rb +2 -1
- 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 -0
- data/app/models/qdm/patient.rb +7 -4
- data/app/models/qdm/patient_care_experience.rb +2 -1
- data/app/models/qdm/patient_characteristic.rb +2 -1
- data/app/models/qdm/patient_characteristic_birthdate.rb +2 -1
- data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +2 -1
- data/app/models/qdm/patient_characteristic_ethnicity.rb +2 -1
- data/app/models/qdm/patient_characteristic_expired.rb +2 -1
- data/app/models/qdm/patient_characteristic_payer.rb +2 -1
- data/app/models/qdm/patient_characteristic_race.rb +2 -1
- data/app/models/qdm/patient_characteristic_sex.rb +2 -1
- data/app/models/qdm/physical_exam_order.rb +2 -1
- data/app/models/qdm/physical_exam_performed.rb +2 -1
- data/app/models/qdm/physical_exam_recommended.rb +2 -1
- data/app/models/qdm/procedure_order.rb +2 -1
- data/app/models/qdm/procedure_performed.rb +2 -1
- data/app/models/qdm/procedure_recommended.rb +2 -1
- data/app/models/qdm/provider_care_experience.rb +2 -1
- data/app/models/qdm/provider_characteristic.rb +2 -1
- data/app/models/qdm/substance_administered.rb +2 -1
- data/app/models/qdm/substance_order.rb +2 -1
- data/app/models/qdm/substance_recommended.rb +2 -1
- data/app/models/qdm/symptom.rb +2 -1
- data/bin/build_cql_execution.sh +8 -0
- data/bin/validate_browser.sh +17 -0
- data/bin/validate_generator.sh +12 -0
- data/cqm-models.gemspec +5 -2
- data/data/oids_qdm_5.4.json +321 -0
- data/data/{oids.json → oids_unversioned.json} +0 -0
- data/dist/browser.js +102937 -0
- data/dist/index.js +36637 -36540
- data/lib/generate_models.rb +89 -93
- data/lib/generate_patients.rb +125 -0
- data/lib/generate_types.rb +64 -0
- data/lib/generators/custom_mongo/model.rb.tt +20 -0
- data/lib/generators/custom_mongo/model_generator.rb +34 -0
- data/notice.md +9 -0
- data/package.json +12 -6
- data/templates/id_template.js.erb +8 -3
- data/templates/index_template.js.erb +18 -8
- data/templates/models_template.rb.erb +20 -4
- data/templates/mongoose_template.js.erb +23 -15
- data/templates/patient_extension.rb.erb +7 -4
- data/templates/patient_template.js.erb +88 -87
- data/yarn.lock +552 -347
- metadata +86 -19
- data/app/assets/javascripts/Component.js +0 -26
- data/app/assets/javascripts/Concept.js +0 -14
- data/app/assets/javascripts/FacilityLocation.js +0 -26
- data/app/assets/javascripts/Measure.js +0 -78
- data/app/assets/javascripts/Patient.js +0 -262
- data/app/assets/javascripts/ValueSet.js +0 -30
- data/app/models/qdm/tacoma/measure.rb +0 -174
- data/app/models/qdm/tacoma/valueset.rb +0 -68
@@ -0,0 +1,15 @@
|
|
1
|
+
module CQM
|
2
|
+
# ValueSet represents a collection of Concepts, used by the Measures to specify a set of codes for a particular topic
|
3
|
+
class ValueSet
|
4
|
+
include Mongoid::Document
|
5
|
+
field :oid, type: String
|
6
|
+
field :display_name, type: String
|
7
|
+
field :version, type: String
|
8
|
+
|
9
|
+
index oid: 1
|
10
|
+
|
11
|
+
embeds_many :concepts
|
12
|
+
|
13
|
+
scope :by_oid, ->(oid) { where(oid: oid) }
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"2.16.840.1.113883.10.20.28.4.61": "PhysicalExamOrder",
|
3
|
+
"2.16.840.1.113883.10.20.28.4.130": "Participation",
|
4
|
+
"2.16.840.1.113883.10.20.28.4.55": "PatientCharacteristicSex",
|
5
|
+
"2.16.840.1.113883.10.20.28.4.7": "CareGoal",
|
6
|
+
"2.16.840.1.113883.10.20.28.4.53": "PatientCharacteristic",
|
7
|
+
"2.16.840.1.113883.10.20.28.4.56": "PatientCharacteristicEthnicity",
|
8
|
+
"2.16.840.1.113883.10.20.28.4.59": "PatientCharacteristicRace",
|
9
|
+
"2.16.840.1.113883.10.20.28.4.42": "LaboratoryTestPerformed",
|
10
|
+
"2.16.840.1.113883.10.20.28.4.116": "Symptom",
|
11
|
+
"2.16.840.1.113883.10.20.28.4.45": "MedicationAdministered",
|
12
|
+
"2.16.840.1.113883.10.20.28.4.68": "ProcedureRecommended",
|
13
|
+
"2.16.840.1.113883.10.20.28.4.5": "EncounterPerformed",
|
14
|
+
"2.16.840.1.113883.10.20.28.4.110": "Diagnosis",
|
15
|
+
"2.16.840.1.113883.10.20.28.4.132": "CommunicationPerformed",
|
16
|
+
"2.16.840.1.113883.10.20.28.4.117": "AssessmentPerformed",
|
17
|
+
"2.16.840.1.113883.10.20.28.4.6": "PatientCharacteristicClinicalTrialParticipant",
|
18
|
+
"2.16.840.1.113883.10.20.28.4.15": "DeviceOrder",
|
19
|
+
"2.16.840.1.113883.10.20.28.4.23": "DiagnosticStudyPerformed",
|
20
|
+
"2.16.840.1.113883.10.20.28.4.35": "InterventionOrder",
|
21
|
+
"2.16.840.1.113883.10.20.28.4.111": "FamilyHistory",
|
22
|
+
"2.16.840.1.113883.10.20.28.4.44": "MedicationActive",
|
23
|
+
"2.16.840.1.113883.10.20.28.4.41": "LaboratoryTestOrder",
|
24
|
+
"2.16.840.1.113883.10.20.28.4.22": "DiagnosticStudyOrder",
|
25
|
+
"2.16.840.1.113883.10.20.28.4.77": "SubstanceOrder",
|
26
|
+
"2.16.840.1.113883.10.20.28.4.58": "PatientCharacteristicPayer",
|
27
|
+
"2.16.840.1.113883.10.20.28.4.57": "PatientCharacteristicExpired",
|
28
|
+
"2.16.840.1.113883.10.20.28.4.131": "AssessmentOrder",
|
29
|
+
"2.16.840.1.113883.10.20.28.4.118": "AssessmentRecommended",
|
30
|
+
"2.16.840.1.113883.10.20.28.4.112": "ImmunizationAdministered",
|
31
|
+
"2.16.840.1.113883.10.20.28.4.73": "SubstanceAdministered",
|
32
|
+
"2.16.840.1.113883.10.20.28.4.27": "EncounterOrder",
|
33
|
+
"2.16.840.1.113883.10.20.28.4.28": "EncounterRecommended",
|
34
|
+
"2.16.840.1.113883.10.20.28.4.67": "ProcedurePerformed",
|
35
|
+
"2.16.840.1.113883.10.20.28.4.119": "AllergyIntolerance",
|
36
|
+
"2.16.840.1.113883.10.20.28.4.71": "ProviderCharacteristic",
|
37
|
+
"22.16.840.1.113883.10.20.28.4.63": "PhysicalExamRecommended",
|
38
|
+
"2.16.840.1.113883.10.20.28.4.54": "PatientCharacteristicBirthdate",
|
39
|
+
"2.16.840.1.113883.10.20.28.4.120": "AdverseEvent",
|
40
|
+
"2.16.840.1.113883.10.20.28.4.16": "DeviceRecommended",
|
41
|
+
"2.16.840.1.113883.10.20.28.4.13": "DeviceApplied",
|
42
|
+
"2.16.840.1.113883.10.20.28.4.48": "MedicationDischarge",
|
43
|
+
"2.16.840.1.113883.10.20.28.4.36": "InterventionPerformed",
|
44
|
+
"2.16.840.1.113883.10.20.28.4.43": "LaboratoryTestRecommended",
|
45
|
+
"2.16.840.1.113883.10.20.28.4.49": "MedicationDispensed",
|
46
|
+
"2.16.840.1.113883.10.20.28.4.24": "DiagnosticStudyRecommended",
|
47
|
+
"2.16.840.1.113883.10.20.28.4.113": "ImmunizationOrder",
|
48
|
+
"2.16.840.1.113883.10.20.28.4.52": "PatientCareExperience",
|
49
|
+
"2.16.840.1.113883.10.20.28.4.70": "ProviderCareExperience",
|
50
|
+
"2.16.840.1.113883.10.20.28.4.66": "ProcedureOrder",
|
51
|
+
"2.16.840.1.113883.10.20.28.4.51": "MedicationOrder",
|
52
|
+
"2.16.840.1.113883.10.20.28.4.78": "SubstanceRecommended",
|
53
|
+
"2.16.840.1.113883.10.20.28.4.37": "InterventionRecommended",
|
54
|
+
"2.16.840.1.113883.10.20.28.4.62": "PhysicalExamPerformed"
|
55
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module QDM
|
2
|
+
# Find the right datatype model.
|
3
|
+
class ModelFinder
|
4
|
+
@hqmfOidToDatatypeMap = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'hqmfOid_to_datatype_map.json')))
|
5
|
+
|
6
|
+
def self.by_hqmf_oid(hqmfOid)
|
7
|
+
datatype = @hqmfOidToDatatypeMap[hqmfOid]
|
8
|
+
return nil if datatype.nil?
|
9
|
+
return QDM.const_get(datatype)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/app/models/models.rb
CHANGED
@@ -3,6 +3,9 @@ module QDM
|
|
3
3
|
end
|
4
4
|
require 'mongoid'
|
5
5
|
|
6
|
+
# ModelFinder
|
7
|
+
require_relative 'model_finder'
|
8
|
+
|
6
9
|
# Generated models that are dependencies for base types
|
7
10
|
require_relative 'qdm/id'
|
8
11
|
|
@@ -12,14 +15,25 @@ require_relative 'qdm/basetypes/data_element'
|
|
12
15
|
require_relative 'qdm/basetypes/interval'
|
13
16
|
require_relative 'qdm/basetypes/quantity'
|
14
17
|
require_relative 'qdm/basetypes/ratio'
|
18
|
+
require_relative 'qdm/attributes/attribute'
|
19
|
+
require_relative 'qdm/attributes/facility_location'
|
20
|
+
require_relative 'qdm/attributes/component'
|
15
21
|
|
16
22
|
# Tacoma-specific models
|
17
|
-
require_relative '
|
18
|
-
require_relative '
|
19
|
-
require_relative '
|
20
|
-
require_relative '
|
23
|
+
require_relative 'cqm/measure'
|
24
|
+
require_relative 'cqm/measure_package'
|
25
|
+
require_relative 'cqm/valueset'
|
26
|
+
require_relative 'cqm/concept'
|
27
|
+
require_relative 'cqm/cql_statement_dependency'
|
28
|
+
require_relative 'cqm/cql_library'
|
29
|
+
require_relative 'cqm/population_set'
|
30
|
+
require_relative 'cqm/patient'
|
31
|
+
require_relative 'cqm/provider'
|
21
32
|
require_relative 'qdm/tacoma/individual_result'
|
22
33
|
|
34
|
+
# Make Patient Generation Available
|
35
|
+
require_relative '../../lib/generate_patients'
|
36
|
+
|
23
37
|
# Generated models
|
24
38
|
require_relative 'qdm/patient'
|
25
39
|
require_relative 'qdm/physical_exam_order'
|
@@ -42,9 +56,7 @@ require_relative 'qdm/device_order'
|
|
42
56
|
require_relative 'qdm/diagnostic_study_performed'
|
43
57
|
require_relative 'qdm/intervention_order'
|
44
58
|
require_relative 'qdm/family_history'
|
45
|
-
require_relative 'qdm/component'
|
46
59
|
require_relative 'qdm/result_component'
|
47
|
-
require_relative 'qdm/facility_location'
|
48
60
|
require_relative 'qdm/medication_active'
|
49
61
|
require_relative 'qdm/laboratory_test_order'
|
50
62
|
require_relative 'qdm/diagnostic_study_order'
|
@@ -6,9 +6,10 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :relevantPeriod, type: QDM::Interval
|
8
8
|
field :severity, type: QDM::Code
|
9
|
-
field :facilityLocation, type: QDM::
|
9
|
+
field :facilityLocation, type: QDM::FacilityLocation
|
10
10
|
field :type, type: QDM::Code
|
11
|
-
field :
|
11
|
+
field :qdmTitle, type: String, default: 'Adverse Event'
|
12
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.120'
|
12
13
|
field :qdmCategory, type: String, default: 'adverse_event'
|
13
14
|
field :qdmVersion, type: String, default: '5.4'
|
14
15
|
end
|
@@ -7,7 +7,8 @@ module QDM
|
|
7
7
|
field :prevalencePeriod, type: QDM::Interval
|
8
8
|
field :type, type: QDM::Code
|
9
9
|
field :severity, type: QDM::Code
|
10
|
-
field :
|
10
|
+
field :qdmTitle, type: String, default: 'Allergy/Intolerance'
|
11
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.119'
|
11
12
|
field :qdmCategory, type: String, default: 'allergy'
|
12
13
|
field :qdmStatus, type: String, default: 'intolerance'
|
13
14
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -6,6 +6,7 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
8
|
field :reason, type: QDM::Code
|
9
|
+
field :qdmTitle, type: String, default: 'Assessment, Order'
|
9
10
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.131'
|
10
11
|
field :qdmCategory, type: String, default: 'assessment'
|
11
12
|
field :qdmStatus, type: String, default: 'order'
|
@@ -10,7 +10,8 @@ module QDM
|
|
10
10
|
field :result
|
11
11
|
field :components, type: Array
|
12
12
|
embeds_many :relatedTo, class_name: 'QDM::Id'
|
13
|
-
field :
|
13
|
+
field :qdmTitle, type: String, default: 'Assessment, Performed'
|
14
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.117'
|
14
15
|
field :qdmCategory, type: String, default: 'assessment'
|
15
16
|
field :qdmStatus, type: String, default: 'performed'
|
16
17
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -6,7 +6,8 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
8
|
field :reason, type: QDM::Code
|
9
|
-
field :
|
9
|
+
field :qdmTitle, type: String, default: 'Assessment, Recommended'
|
10
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.118'
|
10
11
|
field :qdmCategory, type: String, default: 'assessment'
|
11
12
|
field :qdmStatus, type: String, default: 'recommended'
|
12
13
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module QDM
|
2
|
+
# Represents QDM attribute
|
3
|
+
class Attribute
|
4
|
+
include Mongoid::Document
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
super(options)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns the attribute requested on the datatype.
|
11
|
+
def get(attribute)
|
12
|
+
send(attribute) if has_attribute?(attribute)
|
13
|
+
end
|
14
|
+
|
15
|
+
def mongoize
|
16
|
+
json_representation = {}
|
17
|
+
attribute_names.each do |field|
|
18
|
+
json_representation[field] = send(field).mongoize
|
19
|
+
end
|
20
|
+
json_representation
|
21
|
+
end
|
22
|
+
|
23
|
+
# Include '_type' in any JSON output. This is necessary for deserialization.
|
24
|
+
def to_json(options = nil)
|
25
|
+
serializable_hash(methods: :_type).to_json(options)
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
# Get the object as it was stored in the database, and instantiate
|
30
|
+
# this custom class from it.
|
31
|
+
def demongoize(object)
|
32
|
+
return nil unless object
|
33
|
+
object = object.symbolize_keys
|
34
|
+
if object.is_a?(Hash)
|
35
|
+
# This will turn the object into the concrete type eg: facilityLocation
|
36
|
+
data_element = QDM.const_get(object[:_type]).new
|
37
|
+
data_element.attribute_names.each do |field|
|
38
|
+
data_element.send(field + '=', object[field.to_sym])
|
39
|
+
end
|
40
|
+
data_element
|
41
|
+
else object
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Takes any possible object and converts it to how it would be
|
46
|
+
# stored in the database.
|
47
|
+
def mongoize(object)
|
48
|
+
case object
|
49
|
+
when nil then nil
|
50
|
+
when QDM::Attribute then object.mongoize
|
51
|
+
when Hash
|
52
|
+
object = object.symbolize_keys
|
53
|
+
data_element = QDM.const_get(object[:_type]).new
|
54
|
+
data_element.attribute_names.each do |field|
|
55
|
+
data_element.send(field + '=', object[field.to_sym])
|
56
|
+
end
|
57
|
+
data_element.mongoize
|
58
|
+
else object
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -3,6 +3,7 @@ module QDM
|
|
3
3
|
class DataElement
|
4
4
|
include Mongoid::Document
|
5
5
|
embedded_in :patient
|
6
|
+
embedded_in :measure
|
6
7
|
|
7
8
|
# Codes that describe this datatype.
|
8
9
|
field :dataElementCodes, type: Array, default: []
|
@@ -10,6 +11,9 @@ module QDM
|
|
10
11
|
# Optional description.
|
11
12
|
field :description, type: String
|
12
13
|
|
14
|
+
# Valueset oid of the specific type.
|
15
|
+
field :codeListId, type: String
|
16
|
+
|
13
17
|
embeds_one :id, class_name: 'QDM::Id'
|
14
18
|
|
15
19
|
def initialize(options = {})
|
@@ -66,14 +70,25 @@ module QDM
|
|
66
70
|
end
|
67
71
|
|
68
72
|
# Special case for facility locations
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
+
if field == 'facilityLocations'
|
74
|
+
send(field).each do |facility_location|
|
75
|
+
shift_facility_location_dates(facility_location, seconds)
|
76
|
+
end
|
77
|
+
elsif field == 'facilityLocation'
|
78
|
+
facility_location = send(field)
|
79
|
+
unless facility_location.nil?
|
80
|
+
shift_facility_location_dates(facility_location, seconds)
|
81
|
+
send(field + '=', facility_location)
|
82
|
+
end
|
73
83
|
end
|
74
84
|
end
|
75
85
|
end
|
76
86
|
|
87
|
+
def shift_facility_location_dates(facility_location, seconds)
|
88
|
+
facility_location['locationPeriod'][:low] = (facility_location['locationPeriod'][:low].to_time + seconds).to_datetime
|
89
|
+
facility_location['locationPeriod'][:high] = (facility_location['locationPeriod'][:high].to_time + seconds).to_datetime
|
90
|
+
end
|
91
|
+
|
77
92
|
class << self
|
78
93
|
# Get the object as it was stored in the database, and instantiate
|
79
94
|
# this custom class from it.
|
@@ -82,7 +97,7 @@ module QDM
|
|
82
97
|
return nil unless object
|
83
98
|
object = object.symbolize_keys
|
84
99
|
if object.is_a?(Hash)
|
85
|
-
data_element = QDM
|
100
|
+
data_element = QDM.const_get(object[:_type])
|
86
101
|
data_element.attribute_names.each do |field|
|
87
102
|
data_element.send(field + '=', object[field.to_sym])
|
88
103
|
end
|
@@ -99,7 +114,7 @@ module QDM
|
|
99
114
|
when QDM::DataElement then object.mongoize
|
100
115
|
when Hash
|
101
116
|
object = object.symbolize_keys
|
102
|
-
data_element = QDM
|
117
|
+
data_element = QDM.const_get(object[:_type])
|
103
118
|
data_element.attribute_names.each do |field|
|
104
119
|
data_element.send(field + '=', object[field.to_sym])
|
105
120
|
end
|
@@ -6,7 +6,7 @@ module QDM
|
|
6
6
|
# Low and high are required (at minimum).
|
7
7
|
def initialize(low, high, lowClosed = true, highClosed = true)
|
8
8
|
@low = low
|
9
|
-
@high = high
|
9
|
+
@high = high.is_a?(DateTime) && (high.year > 9999) ? high.change(year: 9999) : high
|
10
10
|
@lowClosed = lowClosed
|
11
11
|
@highClosed = highClosed
|
12
12
|
end
|
@@ -27,6 +27,7 @@ module QDM
|
|
27
27
|
end
|
28
28
|
if (@high.is_a? DateTime) || (@high.is_a? Time)
|
29
29
|
@high = (@high.utc.to_time + seconds.seconds).to_datetime.new_offset(0)
|
30
|
+
@high = @high.year > 9999 ? @high.change(year: 9999) : @high
|
30
31
|
end
|
31
32
|
self
|
32
33
|
end
|
data/app/models/qdm/care_goal.rb
CHANGED
@@ -6,7 +6,8 @@ module QDM
|
|
6
6
|
field :relevantPeriod, type: QDM::Interval
|
7
7
|
embeds_many :relatedTo, class_name: 'QDM::Id'
|
8
8
|
field :targetOutcome
|
9
|
-
field :
|
9
|
+
field :qdmTitle, type: String, default: 'Care Goal'
|
10
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.7'
|
10
11
|
field :qdmCategory, type: String, default: 'care_goal'
|
11
12
|
field :qdmVersion, type: String, default: '5.4'
|
12
13
|
end
|
@@ -11,6 +11,7 @@ module QDM
|
|
11
11
|
embeds_many :relatedTo, class_name: 'QDM::Id'
|
12
12
|
field :relevantPeriod, type: QDM::Interval
|
13
13
|
field :negationRationale, type: QDM::Code
|
14
|
+
field :qdmTitle, type: String, default: 'Communication, Performed'
|
14
15
|
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.132'
|
15
16
|
field :qdmCategory, type: String, default: 'communication'
|
16
17
|
field :qdmStatus, type: String, default: 'performed'
|
@@ -8,7 +8,8 @@ module QDM
|
|
8
8
|
field :negationRationale, type: QDM::Code
|
9
9
|
field :reason, type: QDM::Code
|
10
10
|
field :anatomicalLocationSite, type: QDM::Code
|
11
|
-
field :
|
11
|
+
field :qdmTitle, type: String, default: 'Device, Applied'
|
12
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.13'
|
12
13
|
field :qdmCategory, type: String, default: 'device'
|
13
14
|
field :qdmStatus, type: String, default: 'applied'
|
14
15
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -6,7 +6,8 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
8
|
field :reason, type: QDM::Code
|
9
|
-
field :
|
9
|
+
field :qdmTitle, type: String, default: 'Device, Order'
|
10
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.15'
|
10
11
|
field :qdmCategory, type: String, default: 'device'
|
11
12
|
field :qdmStatus, type: String, default: 'order'
|
12
13
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -6,7 +6,8 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
8
|
field :reason, type: QDM::Code
|
9
|
-
field :
|
9
|
+
field :qdmTitle, type: String, default: 'Device, Recommended'
|
10
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.16'
|
10
11
|
field :qdmCategory, type: String, default: 'device'
|
11
12
|
field :qdmStatus, type: String, default: 'recommended'
|
12
13
|
field :qdmVersion, type: String, default: '5.4'
|
data/app/models/qdm/diagnosis.rb
CHANGED
@@ -7,7 +7,8 @@ module QDM
|
|
7
7
|
field :prevalencePeriod, type: QDM::Interval
|
8
8
|
field :anatomicalLocationSite, type: QDM::Code
|
9
9
|
field :severity, type: QDM::Code
|
10
|
-
field :
|
10
|
+
field :qdmTitle, type: String, default: 'Diagnosis'
|
11
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.110'
|
11
12
|
field :qrdaOid, type: String, default: '2.16.840.1.113883.10.20.24.3.135'
|
12
13
|
field :qdmCategory, type: String, default: 'condition'
|
13
14
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -6,7 +6,8 @@ module QDM
|
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :reason, type: QDM::Code
|
8
8
|
field :negationRationale, type: QDM::Code
|
9
|
-
field :
|
9
|
+
field :qdmTitle, type: String, default: 'Diagnostic Study, Order'
|
10
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.22'
|
10
11
|
field :qdmCategory, type: String, default: 'diagnostic_study'
|
11
12
|
field :qdmStatus, type: String, default: 'order'
|
12
13
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -10,10 +10,11 @@ module QDM
|
|
10
10
|
field :resultDatetime, type: DateTime
|
11
11
|
field :status, type: QDM::Code
|
12
12
|
field :method, type: QDM::Code
|
13
|
-
field :facilityLocation, type: QDM::
|
13
|
+
field :facilityLocation, type: QDM::FacilityLocation
|
14
14
|
field :negationRationale, type: QDM::Code
|
15
15
|
field :components, type: Array
|
16
|
-
field :
|
16
|
+
field :qdmTitle, type: String, default: 'Diagnostic Study, Performed'
|
17
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.23'
|
17
18
|
field :qdmCategory, type: String, default: 'diagnostic_study'
|
18
19
|
field :qdmStatus, type: String, default: 'performed'
|
19
20
|
field :qdmVersion, type: String, default: '5.4'
|
@@ -5,7 +5,8 @@ module QDM
|
|
5
5
|
embedded_in :patient
|
6
6
|
field :authorDatetime, type: DateTime
|
7
7
|
field :negationRationale, type: QDM::Code
|
8
|
-
field :
|
8
|
+
field :qdmTitle, type: String, default: 'Diagnostic Study, Recommended'
|
9
|
+
field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.24'
|
9
10
|
field :qrdaOid, type: String, default: '2.16.840.1.113883.10.20.24.3.19'
|
10
11
|
field :qdmCategory, type: String, default: 'diagnostic_study'
|
11
12
|
field :qdmStatus, type: String, default: 'recommended'
|