cqm-parsers 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +29 -0
- data/README.md +21 -0
- data/Rakefile +19 -0
- data/lib/ext/code.rb +10 -0
- data/lib/ext/data_element.rb +24 -0
- data/lib/hqmf-model/attribute.rb +63 -0
- data/lib/hqmf-model/data_criteria.rb +467 -0
- data/lib/hqmf-model/document.rb +253 -0
- data/lib/hqmf-model/population_criteria.rb +102 -0
- data/lib/hqmf-model/precondition.rb +94 -0
- data/lib/hqmf-model/types.rb +457 -0
- data/lib/hqmf-model/utilities.rb +52 -0
- data/lib/hqmf-parser.rb +116 -0
- data/lib/hqmf-parser/1.0/attribute.rb +121 -0
- data/lib/hqmf-parser/1.0/comparison.rb +34 -0
- data/lib/hqmf-parser/1.0/data_criteria.rb +92 -0
- data/lib/hqmf-parser/1.0/document.rb +195 -0
- data/lib/hqmf-parser/1.0/expression.rb +60 -0
- data/lib/hqmf-parser/1.0/observation.rb +61 -0
- data/lib/hqmf-parser/1.0/population_criteria.rb +75 -0
- data/lib/hqmf-parser/1.0/precondition.rb +90 -0
- data/lib/hqmf-parser/1.0/range.rb +76 -0
- data/lib/hqmf-parser/1.0/restriction.rb +162 -0
- data/lib/hqmf-parser/1.0/utilities.rb +55 -0
- data/lib/hqmf-parser/2.0/data_criteria.rb +372 -0
- data/lib/hqmf-parser/2.0/data_criteria_helpers/dc_base_extract.rb +80 -0
- data/lib/hqmf-parser/2.0/data_criteria_helpers/dc_definition_from_template_or_type_extract.rb +201 -0
- data/lib/hqmf-parser/2.0/data_criteria_helpers/dc_post_processing.rb +85 -0
- data/lib/hqmf-parser/2.0/data_criteria_helpers/dc_specific_occurrences_and_source_data_criteria_extract.rb +117 -0
- data/lib/hqmf-parser/2.0/document.rb +304 -0
- data/lib/hqmf-parser/2.0/document_helpers/doc_population_helper.rb +173 -0
- data/lib/hqmf-parser/2.0/document_helpers/doc_utilities.rb +131 -0
- data/lib/hqmf-parser/2.0/field_value_helper.rb +251 -0
- data/lib/hqmf-parser/2.0/population_criteria.rb +134 -0
- data/lib/hqmf-parser/2.0/precondition.rb +73 -0
- data/lib/hqmf-parser/2.0/source_data_criteria_helper.rb +112 -0
- data/lib/hqmf-parser/2.0/types.rb +448 -0
- data/lib/hqmf-parser/2.0/utilities.rb +45 -0
- data/lib/hqmf-parser/2.0/value_set_helper.rb +104 -0
- data/lib/hqmf-parser/converter/pass1/data_criteria_converter.rb +257 -0
- data/lib/hqmf-parser/converter/pass1/document_converter.rb +133 -0
- data/lib/hqmf-parser/converter/pass1/population_criteria_converter.rb +185 -0
- data/lib/hqmf-parser/converter/pass1/precondition_converter.rb +173 -0
- data/lib/hqmf-parser/converter/pass1/precondition_extractor.rb +201 -0
- data/lib/hqmf-parser/converter/pass1/simple_data_criteria.rb +26 -0
- data/lib/hqmf-parser/converter/pass1/simple_operator.rb +89 -0
- data/lib/hqmf-parser/converter/pass1/simple_population_criteria.rb +10 -0
- data/lib/hqmf-parser/converter/pass1/simple_precondition.rb +51 -0
- data/lib/hqmf-parser/converter/pass1/simple_restriction.rb +64 -0
- data/lib/hqmf-parser/converter/pass2/comparison_converter.rb +112 -0
- data/lib/hqmf-parser/converter/pass2/operator_converter.rb +102 -0
- data/lib/hqmf-parser/cql/data_criteria.rb +57 -0
- data/lib/hqmf-parser/cql/data_criteria_helpers/dc_definition_from_template_or_type_extract.rb +79 -0
- data/lib/hqmf-parser/cql/data_criteria_helpers/dc_post_processing.rb +43 -0
- data/lib/hqmf-parser/cql/document.rb +78 -0
- data/lib/hqmf-parser/cql/document_helpers/doc_population_helper.rb +124 -0
- data/lib/hqmf-parser/cql/value_set_helper.rb +103 -0
- data/lib/hqmf-parser/parser.rb +100 -0
- data/lib/qrda-export/catI-r5/qrda1_r5.rb +125 -0
- data/lib/qrda-export/helper/cat_1_view_helper.rb +142 -0
- data/lib/qrda-export/helper/code_system_helper.rb +77 -0
- data/lib/qrda-export/helper/date_helper.rb +81 -0
- data/lib/qrda-import/base-importers/demographics_importer.rb +47 -0
- data/lib/qrda-import/base-importers/medication_importer.rb +22 -0
- data/lib/qrda-import/base-importers/section_importer.rb +196 -0
- data/lib/qrda-import/cda_identifier.rb +19 -0
- data/lib/qrda-import/data-element-importers/adverse_event_importer.rb +23 -0
- data/lib/qrda-import/data-element-importers/allergy_intolerance_importer.rb +21 -0
- data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +23 -0
- data/lib/qrda-import/data-element-importers/communication_from_patient_to_provider_importer.rb +18 -0
- data/lib/qrda-import/data-element-importers/communication_from_provider_to_patient_importer.rb +18 -0
- data/lib/qrda-import/data-element-importers/communication_from_provider_to_provider_importer.rb +20 -0
- data/lib/qrda-import/data-element-importers/device_applied_importer.rb +23 -0
- data/lib/qrda-import/data-element-importers/device_order_importer.rb +18 -0
- data/lib/qrda-import/data-element-importers/diagnosis_importer.rb +23 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +20 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +30 -0
- data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +20 -0
- data/lib/qrda-import/data-element-importers/encounter_performed_importer.rb +41 -0
- data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +18 -0
- data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +18 -0
- data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +22 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +20 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +28 -0
- data/lib/qrda-import/data-element-importers/medication_active_importer.rb +17 -0
- data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +17 -0
- data/lib/qrda-import/data-element-importers/medication_discharge_importer.rb +19 -0
- data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +19 -0
- data/lib/qrda-import/data-element-importers/medication_order_importer.rb +16 -0
- data/lib/qrda-import/data-element-importers/patient_characteristic_expired.rb +21 -0
- data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +26 -0
- data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +26 -0
- data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +34 -0
- data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +16 -0
- data/lib/qrda-import/entry_finder.rb +20 -0
- data/lib/qrda-import/entry_package.rb +16 -0
- data/lib/qrda-import/narrative_reference_handler.rb +33 -0
- data/lib/qrda-import/patient_importer.rb +105 -0
- data/lib/util/code_system_helper.rb +76 -0
- data/lib/util/counter.rb +20 -0
- data/lib/util/hqmf_template_helper.rb +39 -0
- metadata +340 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class DiagnosisImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.137']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:value"
|
7
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
8
|
+
@prevalence_period_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:effectiveTime"
|
9
|
+
@anatomical_location_site_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:targetSiteCode"
|
10
|
+
@severity_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.8']/cda:value"
|
11
|
+
@entry_class = QDM::Diagnosis
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
15
|
+
diagnosis = super
|
16
|
+
diagnosis.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
|
17
|
+
diagnosis.severity = code_if_present(entry_element.at_xpath(@severity_xpath))
|
18
|
+
diagnosis
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class DiagnosticStudyOrderImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.17']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
8
|
+
@method_xpath = './cda:methodCode'
|
9
|
+
@entry_class = QDM::DiagnosticStudyOrder
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
13
|
+
diagnostic_study_order = super
|
14
|
+
diagnostic_study_order.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
15
|
+
diagnostic_study_order
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class DiagnosticStudyPerformedImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.18']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@relevant_period_xpath = "./cda:effectiveTime"
|
8
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
9
|
+
@result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
|
10
|
+
@result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
|
11
|
+
@status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
|
12
|
+
@method_xpath = './cda:methodCode'
|
13
|
+
@facility_location_xpath = "./cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']/cda:participantRole[@classCode='SDLOC']/cda:code"
|
14
|
+
@components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
|
15
|
+
@entry_class = QDM::DiagnosticStudyPerformed
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
19
|
+
diagnostic_study_performed = super
|
20
|
+
diagnostic_study_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
|
21
|
+
diagnostic_study_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
|
22
|
+
diagnostic_study_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
23
|
+
diagnostic_study_performed.facilityLocation = code_if_present(entry_element.at_xpath(@facility_location_xpath))
|
24
|
+
diagnostic_study_performed.components = extract_components(entry_element)
|
25
|
+
diagnostic_study_performed
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class EncounterOrderImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.132']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:code"
|
7
|
+
@author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:author/cda:time"
|
8
|
+
@facility_location_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']/cda:participantRole[@classCode='SDLOC']/cda:code"
|
9
|
+
@entry_class = QDM::EncounterOrder
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
13
|
+
encounter_order = super
|
14
|
+
encounter_order.facilityLocation = code_if_present(entry_element.at_xpath(@facility_location_xpath))
|
15
|
+
encounter_order
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class EncounterPerformedImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.133']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:code"
|
7
|
+
@relevant_period_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:effectiveTime"
|
8
|
+
@author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:author/cda:time"
|
9
|
+
@admission_source_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:participant/cda:participantRole[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.151']/cda:code"
|
10
|
+
@discharge_disposition_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/sdtc:dischargeDispositionCode"
|
11
|
+
@facility_xpath = "./cda:entryRelationship/cda:encounter/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
|
12
|
+
@principal_diagnosis_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:entryRelationship/cda:observation[cda:code/@code='8319008']/cda:value"
|
13
|
+
@diagnosis_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:entryRelationship/cda:act/cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.4']"
|
14
|
+
@entry_class = QDM::EncounterPerformed
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
18
|
+
encounter_performed = super
|
19
|
+
encounter_performed.admissionSource = code_if_present(entry_element.at_xpath(@admission_source_xpath))
|
20
|
+
encounter_performed.dischargeDisposition = code_if_present(entry_element.at_xpath(@discharge_disposition_xpath))
|
21
|
+
extract_facility(entry_element, encounter_performed)
|
22
|
+
encounter_performed.principalDiagnosis = code_if_present(entry_element.at_xpath(@principal_diagnosis_xpath))
|
23
|
+
encounter_performed.diagnoses = extract_diagnoses(entry_element)
|
24
|
+
encounter_performed
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def extract_diagnoses(parent_element)
|
30
|
+
diagnosis_elements = parent_element.xpath(@diagnosis_xpath)
|
31
|
+
diagnosis_list = []
|
32
|
+
diagnosis_elements.each do |diagnosis_element|
|
33
|
+
diagnosis_value = diagnosis_element.at_xpath("./cda:value")
|
34
|
+
diagnosis_list << code_if_present(diagnosis_value)
|
35
|
+
end
|
36
|
+
diagnosis_list.empty? ? nil : diagnosis_list
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class ImmunizationAdministeredImporter < MedicationImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.140']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@relevant_period_xpath = nil
|
7
|
+
@author_datetime_xpath = "./cda:effectiveTime"
|
8
|
+
@entry_class = QDM::ImmunizationAdministered
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
12
|
+
immunization_administered = super
|
13
|
+
immunization_administered
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class InterventionOrderImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.31']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
8
|
+
@entry_class = QDM::InterventionOrder
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
12
|
+
intervention_order = super
|
13
|
+
intervention_order
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class InterventionPerformedImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.32']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@relevant_period_xpath = "./cda:effectiveTime"
|
8
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
9
|
+
@result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
|
10
|
+
@status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
|
11
|
+
@entry_class = QDM::InterventionPerformed
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
15
|
+
intervention_performed = super
|
16
|
+
intervention_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
|
17
|
+
intervention_performed
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class LaboratoryTestOrderImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.37']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
8
|
+
@method_xpath = './cda:methodCode'
|
9
|
+
@entry_class = QDM::LaboratoryTestOrder
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
13
|
+
laboratory_test_order = super
|
14
|
+
laboratory_test_order.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
15
|
+
laboratory_test_order
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class LaboratoryTestPerformedImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.38']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@relevant_period_xpath = "./cda:effectiveTime"
|
8
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
9
|
+
@status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
|
10
|
+
@method_xpath = './cda:methodCode'
|
11
|
+
@result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
|
12
|
+
@result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
|
13
|
+
@components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
|
14
|
+
@entry_class = QDM::LaboratoryTestPerformed
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
18
|
+
laboratory_test_performed = super
|
19
|
+
laboratory_test_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
|
20
|
+
laboratory_test_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
21
|
+
laboratory_test_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
|
22
|
+
laboratory_test_performed.components = extract_components(entry_element)
|
23
|
+
laboratory_test_performed
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class MedicationActiveImporter < MedicationImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.41']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@author_datetime_xpath = nil
|
7
|
+
@entry_class = QDM::MedicationActive
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
11
|
+
medication_active = super
|
12
|
+
medication_active
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class MedicationAdministeredImporter < MedicationImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.42']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@route_xpath = "./cda:routeCode"
|
7
|
+
@entry_class = QDM::MedicationAdministered
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
11
|
+
medication_administered = super
|
12
|
+
medication_administered
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class MedicationDischargeImporter < MedicationImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.105']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = "./cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.16']/cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
|
7
|
+
@relevant_period_xpath = nil
|
8
|
+
@author_datetime_xpath = "./cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.16']/cda:author/cda:time"
|
9
|
+
@entry_class = QDM::MedicationDischarge
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
13
|
+
medication_discharge = super
|
14
|
+
medication_discharge
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class MedicationDispensedImporter < MedicationImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.139']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@relevant_period_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime"
|
7
|
+
@author_datetime_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:author/cda:time"
|
8
|
+
@code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:product/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
|
9
|
+
@entry_class = QDM::MedicationDispensed
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
13
|
+
medication_dispensed = super
|
14
|
+
medication_dispensed
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class MedicationOrderImporter < MedicationImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.47']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@entry_class = QDM::MedicationOrder
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
10
|
+
medication_order = super
|
11
|
+
medication_order
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class PatientCharacteristicExpired < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.54']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:value'
|
7
|
+
@expired_datetime_xpath = './cda:effectiveTime/cda:low'
|
8
|
+
@cause = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.4']/cda:value"
|
9
|
+
@entry_class = QDM::PatientCharacteristicExpired
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
13
|
+
patient_characteristic_expired = super
|
14
|
+
patient_characteristic_expired.expiredDatetime = extract_time(entry_element, @expired_datetime_xpath)
|
15
|
+
patient_characteristic_expired.cause = code_if_present(entry_element.at_xpath(@cause))
|
16
|
+
patient_characteristic_expired
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class PhysicalExamPerformedImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.59']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = "./cda:code"
|
7
|
+
@relevant_period_xpath = "./cda:effectiveTime"
|
8
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
9
|
+
@method_xpath = './cda:methodCode'
|
10
|
+
@result_xpath = "./cda:value"
|
11
|
+
@anatomical_location_site_xpath = "./cda:targetSiteCode"
|
12
|
+
@components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
|
13
|
+
@entry_class = QDM::PhysicalExamPerformed
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
17
|
+
physical_exam_performed = super
|
18
|
+
physical_exam_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
19
|
+
physical_exam_performed.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
|
20
|
+
physical_exam_performed.components = extract_components(entry_element)
|
21
|
+
physical_exam_performed
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class ProcedureOrderImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.63']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = './cda:code'
|
7
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
8
|
+
@method_xpath = './cda:methodCode'
|
9
|
+
@anatomical_approach_site_xpath = "./cda:approachSiteCode"
|
10
|
+
@anatomical_location_site_xpath = "./cda:targetSiteCode"
|
11
|
+
@ordinality_xpath = "./cda:priorityCode"
|
12
|
+
@entry_class = QDM::ProcedureOrder
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
16
|
+
procedure_order = super
|
17
|
+
procedure_order.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
18
|
+
procedure_order.anatomicalApproachSite = code_if_present(entry_element.at_xpath(@anatomical_approach_site_xpath))
|
19
|
+
procedure_order.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
|
20
|
+
procedure_order.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
|
21
|
+
procedure_order
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module QRDA
|
2
|
+
module Cat1
|
3
|
+
class ProcedurePerformedImporter < SectionImporter
|
4
|
+
def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.64']"))
|
5
|
+
super(entry_finder)
|
6
|
+
@code_xpath = "./cda:code"
|
7
|
+
@relevant_period_xpath = "./cda:effectiveTime"
|
8
|
+
@author_datetime_xpath = "./cda:author/cda:time"
|
9
|
+
@method_xpath = './cda:methodCode'
|
10
|
+
@result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
|
11
|
+
@status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
|
12
|
+
@anatomical_approach_site_xpath = "./cda:approachSiteCode"
|
13
|
+
@anatomical_location_site_xpath = "./cda:targetSiteCode"
|
14
|
+
@ordinality_xpath = "./cda:priorityCode"
|
15
|
+
@incision_datetime_xpath = "./cda:entryRelationship/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.89']/cda:effectiveTime"
|
16
|
+
@components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
|
17
|
+
@entry_class = QDM::ProcedurePerformed
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
21
|
+
procedure_performed = super
|
22
|
+
procedure_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
|
23
|
+
procedure_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
|
24
|
+
procedure_performed.anatomicalApproachSite = code_if_present(entry_element.at_xpath(@anatomical_approach_site_xpath))
|
25
|
+
procedure_performed.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
|
26
|
+
procedure_performed.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
|
27
|
+
procedure_performed.incisionDatetime = extract_time(entry_element, @incision_datetime_xpath)
|
28
|
+
procedure_performed.components = extract_components(entry_element)
|
29
|
+
procedure_performed
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|