health-data-standards 2.2.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -0
- data/lib/health-data-standards.rb +55 -12
- data/lib/health-data-standards/export/c32.rb +7 -6
- data/lib/health-data-standards/export/cat_1.rb +18 -0
- data/lib/health-data-standards/export/ccda.rb +8 -8
- data/lib/health-data-standards/export/green_c32/entry.rb +8 -5
- data/lib/health-data-standards/export/green_c32/export_generator.rb +1 -1
- data/lib/health-data-standards/export/green_c32/record.rb +10 -7
- data/lib/health-data-standards/export/hdata/metadata.rb +7 -6
- data/lib/health-data-standards/export/helper/cat1_view_helper.rb +133 -0
- data/lib/health-data-standards/export/helper/gc32_view_helper.rb +39 -0
- data/lib/health-data-standards/export/helper/html_view_helper.rb +23 -0
- data/lib/health-data-standards/export/html.rb +22 -10
- data/lib/health-data-standards/export/qrda/entry_template_resolver.rb +31 -0
- data/lib/health-data-standards/export/qrda/hqmf-qrda-oids.json +638 -0
- data/lib/health-data-standards/export/rendering_context.rb +37 -3
- data/lib/health-data-standards/export/template_helper.rb +20 -23
- data/lib/health-data-standards/export/view_helper.rb +8 -42
- data/lib/health-data-standards/import/bundle/importer.rb +148 -0
- data/lib/health-data-standards/import/c32/care_goal_importer.rb +14 -26
- data/lib/health-data-standards/import/c32/condition_importer.rb +12 -51
- data/lib/health-data-standards/import/c32/immunization_importer.rb +9 -27
- data/lib/health-data-standards/import/c32/insurance_provider_importer.rb +24 -21
- data/lib/health-data-standards/import/c32/patient_importer.rb +27 -34
- data/lib/health-data-standards/import/cat1/diagnosis_active_importer.rb +19 -0
- data/lib/health-data-standards/import/cat1/diagnosis_inactive_importer.rb +19 -0
- data/lib/health-data-standards/import/cat1/diagnostic_study_order_importer.rb +24 -0
- data/lib/health-data-standards/import/cat1/encounter_order_importer.rb +24 -0
- data/lib/health-data-standards/import/cat1/entry_package.rb +25 -0
- data/lib/health-data-standards/import/cat1/gestational_age_importer.rb +42 -0
- data/lib/health-data-standards/import/cat1/lab_order_importer.rb +24 -0
- data/lib/health-data-standards/import/cat1/medication_dispensed_importer.rb +13 -0
- data/lib/health-data-standards/import/cat1/patient_importer.rb +104 -0
- data/lib/health-data-standards/import/cat1/procedure_intolerance_importer.rb +13 -0
- data/lib/health-data-standards/import/cat1/procedure_order_importer.rb +38 -0
- data/lib/health-data-standards/import/cat1/tobacco_use_importer.rb +19 -0
- data/lib/health-data-standards/import/ccda/allergy_importer.rb +2 -8
- data/lib/health-data-standards/import/ccda/care_goal_importer.rb +1 -1
- data/lib/health-data-standards/import/ccda/condition_importer.rb +2 -3
- data/lib/health-data-standards/import/ccda/encounter_importer.rb +2 -5
- data/lib/health-data-standards/import/ccda/immunization_importer.rb +1 -3
- data/lib/health-data-standards/import/ccda/insurance_provider_importer.rb +1 -1
- data/lib/health-data-standards/import/ccda/medical_equipment_importer.rb +2 -4
- data/lib/health-data-standards/import/ccda/medication_importer.rb +2 -4
- data/lib/health-data-standards/import/ccda/patient_importer.rb +1 -1
- data/lib/health-data-standards/import/ccda/procedure_importer.rb +2 -6
- data/lib/health-data-standards/import/ccda/result_importer.rb +2 -5
- data/lib/health-data-standards/import/ccda/vital_sign_importer.rb +2 -3
- data/lib/health-data-standards/import/cda/allergy_importer.rb +32 -0
- data/lib/health-data-standards/import/cda/condition_importer.rb +51 -0
- data/lib/health-data-standards/import/{c32 → cda}/encounter_importer.rb +9 -35
- data/lib/health-data-standards/import/cda/entry_finder.rb +22 -0
- data/lib/health-data-standards/import/{c32 → cda}/locatable_import_utils.rb +2 -3
- data/lib/health-data-standards/import/cda/medical_equipment_importer.rb +24 -0
- data/lib/health-data-standards/import/{c32 → cda}/medication_importer.rb +13 -15
- data/lib/health-data-standards/import/cda/narrative_reference_handler.rb +35 -0
- data/lib/health-data-standards/import/{c32 → cda}/organization_importer.rb +1 -1
- data/lib/health-data-standards/import/cda/procedure_importer.rb +35 -0
- data/lib/health-data-standards/import/{c32 → cda}/provider_importer.rb +4 -8
- data/lib/health-data-standards/import/cda/result_importer.rb +31 -0
- data/lib/health-data-standards/import/{c32 → cda}/section_importer.rb +26 -48
- data/lib/health-data-standards/import/{c32 → cda}/vital_sign_importer.rb +2 -3
- data/lib/health-data-standards/import/green_c32/section_importer.rb +8 -6
- data/lib/health-data-standards/import/provider_import_utils.rb +2 -2
- data/lib/health-data-standards/models/address.rb +1 -1
- data/lib/health-data-standards/models/condition.rb +7 -6
- data/lib/health-data-standards/models/cqm/bundle.rb +45 -0
- data/lib/health-data-standards/models/cqm/measure.rb +36 -0
- data/lib/health-data-standards/models/guarantor.rb +1 -0
- data/lib/health-data-standards/models/insurance_provider.rb +2 -0
- data/lib/health-data-standards/models/order_information.rb +2 -0
- data/lib/health-data-standards/models/record.rb +6 -5
- data/lib/health-data-standards/models/svs/value_set.rb +1 -1
- data/lib/health-data-standards/railtie.rb +11 -0
- data/lib/health-data-standards/tasks/bundle.rake +107 -0
- data/lib/health-data-standards/util/code_system_helper.rb +9 -1
- data/lib/hqmf-generator/attribute.xml.erb +11 -0
- data/lib/hqmf-generator/characteristic_criteria.xml.erb +21 -0
- data/lib/hqmf-generator/code.xml.erb +13 -0
- data/lib/hqmf-generator/condition_criteria.xml.erb +22 -0
- data/lib/hqmf-generator/derivation.xml.erb +6 -0
- data/lib/hqmf-generator/description.xml.erb +1 -0
- data/lib/hqmf-generator/document.xml.erb +63 -0
- data/lib/hqmf-generator/effective_time.xml.erb +4 -0
- data/lib/hqmf-generator/encounter_criteria.xml.erb +21 -0
- data/lib/hqmf-generator/field.xml.erb +28 -0
- data/lib/hqmf-generator/hqmf-generator.rb +292 -0
- data/lib/hqmf-generator/observation_criteria.xml.erb +25 -0
- data/lib/hqmf-generator/population_criteria.xml.erb +23 -0
- data/lib/hqmf-generator/precondition.xml.erb +14 -0
- data/lib/hqmf-generator/procedure_criteria.xml.erb +22 -0
- data/lib/hqmf-generator/reason.xml.erb +3 -0
- data/lib/hqmf-generator/reference.xml.erb +3 -0
- data/lib/hqmf-generator/source.xml.erb +6 -0
- data/lib/hqmf-generator/specific_occurrence.xml.erb +7 -0
- data/lib/hqmf-generator/subset.xml.erb +8 -0
- data/lib/hqmf-generator/substance_criteria.xml.erb +26 -0
- data/lib/hqmf-generator/supply_criteria.xml.erb +26 -0
- data/lib/hqmf-generator/template_id.xml.erb +5 -0
- data/lib/hqmf-generator/temporal_relationship.xml.erb +6 -0
- data/lib/hqmf-generator/value.xml.erb +24 -0
- data/lib/hqmf-generator/variable_criteria.xml.erb +12 -0
- data/lib/hqmf-model/attribute.rb +35 -0
- data/lib/hqmf-model/data_criteria.json +1123 -0
- data/lib/hqmf-model/data_criteria.rb +344 -0
- data/lib/hqmf-model/document.rb +178 -0
- data/lib/hqmf-model/population_criteria.rb +96 -0
- data/lib/hqmf-model/precondition.rb +91 -0
- data/lib/hqmf-model/types.rb +319 -0
- data/lib/hqmf-model/utilities.rb +52 -0
- data/lib/hqmf-parser.rb +56 -0
- data/lib/hqmf-parser/1.0/attribute.rb +68 -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/data_criteria_oid_xpath.json +91 -0
- data/lib/hqmf-parser/1.0/document.rb +203 -0
- data/lib/hqmf-parser/1.0/expression.rb +58 -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 +89 -0
- data/lib/hqmf-parser/1.0/range.rb +65 -0
- data/lib/hqmf-parser/1.0/restriction.rb +160 -0
- data/lib/hqmf-parser/1.0/utilities.rb +41 -0
- data/lib/hqmf-parser/2.0/data_criteria.rb +319 -0
- data/lib/hqmf-parser/2.0/document.rb +165 -0
- data/lib/hqmf-parser/2.0/population_criteria.rb +53 -0
- data/lib/hqmf-parser/2.0/precondition.rb +44 -0
- data/lib/hqmf-parser/2.0/types.rb +223 -0
- data/lib/hqmf-parser/2.0/utilities.rb +30 -0
- data/lib/hqmf-parser/converter/pass1/data_criteria_converter.rb +252 -0
- data/lib/hqmf-parser/converter/pass1/document_converter.rb +185 -0
- data/lib/hqmf-parser/converter/pass1/population_criteria_converter.rb +165 -0
- data/lib/hqmf-parser/converter/pass1/precondition_converter.rb +173 -0
- data/lib/hqmf-parser/converter/pass1/precondition_extractor.rb +188 -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/parser.rb +54 -0
- data/lib/hqmf-parser/value_sets/value_set_parser.rb +241 -0
- data/lib/util/counter.rb +20 -0
- data/templates/{_allergies.c32.erb → c32/_allergies.c32.erb} +0 -0
- data/templates/{_allergies_no_current.c32.erb → c32/_allergies_no_current.c32.erb} +0 -0
- data/templates/{_care_goals.c32.erb → c32/_care_goals.c32.erb} +0 -0
- data/templates/{_code_with_reference.c32.erb → c32/_code_with_reference.c32.erb} +0 -0
- data/templates/{_conditions.c32.erb → c32/_conditions.c32.erb} +0 -0
- data/templates/{_conditions_no_current.c32.erb → c32/_conditions_no_current.c32.erb} +0 -0
- data/templates/{_encounters.c32.erb → c32/_encounters.c32.erb} +0 -0
- data/templates/{_immunizations.c32.erb → c32/_immunizations.c32.erb} +0 -0
- data/templates/{_medical_equipment.c32.erb → c32/_medical_equipment.c32.erb} +0 -0
- data/templates/{_medications.c32.erb → c32/_medications.c32.erb} +0 -0
- data/templates/{_medications_no_current.c32.erb → c32/_medications_no_current.c32.erb} +0 -0
- data/templates/{_narrative_block.c32.erb → c32/_narrative_block.c32.erb} +0 -0
- data/templates/{_procedures.c32.erb → c32/_procedures.c32.erb} +0 -0
- data/templates/{_results.c32.erb → c32/_results.c32.erb} +0 -0
- data/templates/{_social_history.c32.erb → c32/_social_history.c32.erb} +0 -0
- data/templates/{_vital_signs.c32.erb → c32/_vital_signs.c32.erb} +0 -0
- data/templates/{show.c32.erb → c32/show.c32.erb} +0 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.22.4.85.cat1.erb +18 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.1.cat1.erb +14 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.101.cat1.erb +25 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.103.cat1.erb +12 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +60 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.11.cat1.erb +41 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.12.cat1.erb +50 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.13.cat1.erb +37 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.14.cat1.erb +35 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.17.cat1.erb +22 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +21 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.2.cat1.erb +28 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.20.cat1.erb +20 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.22.cat1.erb +21 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +71 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.28.cat1.erb +20 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +24 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.31.cat1.erb +20 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +15 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.34.cat1.erb +58 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.37.cat1.erb +20 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +16 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +27 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.40.cat1.erb +17 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +38 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +38 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.43.cat1.erb +24 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.44.cat1.erb +24 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.45.cat1.erb +26 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.46.cat1.erb +30 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +26 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.51.cat1.erb +13 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.54.cat1.erb +16 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.55.cat1.erb +10 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +19 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +17 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.62.cat1.erb +36 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +23 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +29 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.66.cat1.erb +34 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.69.cat1.erb +23 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +30 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.76.cat1.erb +32 -0
- data/templates/cat1/_measures.cat1.erb +66 -0
- data/templates/cat1/_medication_details.cat1.erb +9 -0
- data/templates/cat1/_ordinality.cat1.erb +4 -0
- data/templates/cat1/_patient_data.cat1.erb +14 -0
- data/templates/cat1/_reason.cat1.erb +16 -0
- data/templates/cat1/_record_target.cat1.erb +39 -0
- data/templates/cat1/_reporting_parameters.cat1.erb +24 -0
- data/templates/cat1/_result_value.cat1.erb +16 -0
- data/templates/cat1/show.cat1.erb +125 -0
- data/templates/{_address.gc32.erb → gc32/_address.gc32.erb} +1 -1
- data/templates/gc32/_advance_directive.gc32.erb +5 -0
- data/templates/gc32/_allergy.gc32.erb +12 -0
- data/templates/{_care_goal.gc32.erb → gc32/_care_goal.gc32.erb} +1 -1
- data/templates/gc32/_condition.gc32.erb +10 -0
- data/templates/gc32/_encounter.gc32.erb +28 -0
- data/templates/gc32/_entry.gc32.erb +3 -0
- data/templates/gc32/_entry_attributes.gc32.erb +10 -0
- data/templates/gc32/_immunization.gc32.erb +9 -0
- data/templates/gc32/_insurance_provider.gc32.erb +28 -0
- data/templates/gc32/_medical_equipment.gc32.erb +6 -0
- data/templates/gc32/_medication.gc32.erb +91 -0
- data/templates/{_name.gc32.erb → gc32/_name.gc32.erb} +0 -0
- data/templates/gc32/_organization.gc32.erb +10 -0
- data/templates/gc32/_person_attributes.gc32.erb +7 -0
- data/templates/gc32/_procedure.gc32.erb +9 -0
- data/templates/gc32/_provider.gc32.erb +9 -0
- data/templates/gc32/_result.gc32.erb +12 -0
- data/templates/gc32/_social_history.gc32.erb +6 -0
- data/templates/{_support.gc32.erb → gc32/_support.gc32.erb} +4 -3
- data/templates/gc32/_telecom.gc32.erb +1 -0
- data/templates/gc32/_vital_sign.gc32.erb +4 -0
- data/templates/{record.gc32.erb → gc32/record.gc32.erb} +26 -10
- data/templates/html/_entries_by_encounter.html.erb +2 -2
- data/templates/html/_entries_by_section.html.erb +1 -1
- data/templates/html/_entry.html.erb +16 -21
- data/templates/html/_header.html.erb +1 -1
- data/templates/html/_section.html.erb +1 -1
- data/templates/html/show.html.erb +23 -2
- data/templates/metadata.hdata.erb +3 -3
- metadata +282 -54
- data/lib/health-data-standards/import/c32/allergy_importer.rb +0 -47
- data/lib/health-data-standards/import/c32/medical_equipment_importer.rb +0 -45
- data/lib/health-data-standards/import/c32/procedure_importer.rb +0 -62
- data/lib/health-data-standards/import/c32/result_importer.rb +0 -56
- data/templates/_advance_directive.gc32.erb +0 -8
- data/templates/_allergy.gc32.erb +0 -23
- data/templates/_condition.gc32.erb +0 -9
- data/templates/_encounter.gc32.erb +0 -26
- data/templates/_entry.gc32.erb +0 -14
- data/templates/_immunization.gc32.erb +0 -11
- data/templates/_insurance_provider.gc32.erb +0 -0
- data/templates/_medical_equipment.gc32.erb +0 -7
- data/templates/_medication.gc32.erb +0 -72
- data/templates/_organization.gc32.erb +0 -10
- data/templates/_procedure.gc32.erb +0 -10
- data/templates/_provider.gc32.erb +0 -19
- data/templates/_result.gc32.erb +0 -16
- data/templates/_social_history.gc32.erb +0 -8
- data/templates/_telecom.gc32.erb +0 -1
- data/templates/_vital_sign.gc32.erb +0 -7
@@ -1,38 +1,20 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module C32
|
4
|
-
class ImmunizationImporter < SectionImporter
|
4
|
+
class ImmunizationImporter < CDA::SectionImporter
|
5
5
|
|
6
|
-
def initialize
|
7
|
-
|
6
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.117']/cda:entry/cda:substanceAdministration"))
|
7
|
+
super(entry_finder)
|
8
8
|
@code_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
|
9
9
|
@description_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code/cda:originalText/cda:reference[@value]"
|
10
|
-
@
|
10
|
+
@entry_class = Immunization
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# @return [Array] will be a list of Entry objects
|
19
|
-
def create_entries(doc,id_map = {})
|
20
|
-
immunization_list = []
|
21
|
-
entry_elements = doc.xpath(@entry_xpath)
|
22
|
-
entry_elements.each do |entry_element|
|
23
|
-
immunization = Immunization.new
|
24
|
-
extract_codes(entry_element, immunization)
|
25
|
-
extract_dates(entry_element, immunization)
|
26
|
-
extract_description(entry_element, immunization, id_map)
|
27
|
-
extract_negation(entry_element, immunization)
|
28
|
-
extract_performer(entry_element, immunization)
|
29
|
-
if @check_for_usable
|
30
|
-
immunization_list << immunization if immunization.usable?
|
31
|
-
else
|
32
|
-
immunization_list << immunization
|
33
|
-
end
|
34
|
-
end
|
35
|
-
immunization_list
|
13
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
14
|
+
immunization = super
|
15
|
+
extract_negation(entry_element, immunization)
|
16
|
+
extract_performer(entry_element, immunization)
|
17
|
+
immunization
|
36
18
|
end
|
37
19
|
|
38
20
|
private
|
@@ -1,36 +1,39 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module C32
|
4
|
-
class InsuranceProviderImporter < SectionImporter
|
4
|
+
class InsuranceProviderImporter < CDA::SectionImporter
|
5
5
|
|
6
|
-
def initialize
|
7
|
-
|
6
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.26']"))
|
7
|
+
super(entry_finder)
|
8
|
+
@check_for_usable = false # needs to be this way becase InsuranceProvider does not respond
|
9
|
+
# to usable?
|
8
10
|
end
|
9
11
|
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
def create_entry(payer_element, nrh = CDA::NarrativeReferenceHandler.new)
|
13
|
+
ip = InsuranceProvider.new
|
14
|
+
type = extract_code(payer_element, "./cda:code")
|
15
|
+
ip.type = type['code'] if type
|
16
|
+
ip.payer = import_organization(payer_element.at_xpath("./cda:performer/cda:assignedEntity[cda:code[@code='PAYOR']]"))
|
17
|
+
ip.guarantors = extract_guarantors(payer_element.xpath("./cda:performer[cda:assignedEntity[cda:code[@code='GUAR']]]"))
|
18
|
+
ip.subscriber = import_person(payer_element.at_xpath("./cda:participant[@typeCode='HLD']/cda:participantRole"))
|
19
|
+
member_info_element = payer_element.at_xpath("cda:participant[@typeCode='COV']")
|
20
|
+
extract_dates(member_info_element, ip, "time")
|
21
|
+
name = payer_element.at_xpath("./cda:entryRelationship[@typeCode='REFR']/cda:act[@classCode='ACT' and @moodCode='DEF']/cda:text")
|
22
|
+
ip.name = name.try(:text)
|
23
|
+
patient_element = member_info_element.at_xpath("./cda:participantRole[@classCode='PAT']")
|
24
|
+
ip.member_id = patient_element.at_xpath("./cda:id")
|
25
|
+
ip.relationship = extract_code(patient_element, "./cda:code")
|
26
|
+
ip.financial_responsibility_type = extract_code(payer_element, "./cda:performer/cda:assignedEntity/cda:code")
|
27
|
+
ip
|
26
28
|
end
|
27
29
|
|
28
30
|
def extract_guarantors(guarantor_elements)
|
29
31
|
guarantor_elements.map do |guarantor_element|
|
30
32
|
guarantor = Guarantor.new
|
31
|
-
guarantor.person = import_person(guarantor_element.at_xpath("./cda:assignedPerson"))
|
32
|
-
guarantor.organization = import_organization(guarantor_element.at_xpath("./cda:representedOrganization"))
|
33
33
|
extract_dates(guarantor_element, guarantor, element_name="time")
|
34
|
+
guarantor_entity = guarantor_element.at_xpath("./cda:assignedEntity")
|
35
|
+
guarantor.person = import_person(guarantor_entity.at_xpath("./cda:assignedPerson"))
|
36
|
+
guarantor.organization = import_organization(guarantor_entity.at_xpath("./cda:representedOrganization"))
|
34
37
|
guarantor
|
35
38
|
end
|
36
39
|
end
|
@@ -11,7 +11,7 @@ module HealthDataStandards
|
|
11
11
|
|
12
12
|
include Singleton
|
13
13
|
include HealthDataStandards::Util
|
14
|
-
include HealthDataStandards::Import::
|
14
|
+
include HealthDataStandards::Import::CDA::LocatableImportUtils
|
15
15
|
|
16
16
|
# Creates a new PatientImporter with the following XPath expressions used to find content in
|
17
17
|
# a HITSP C32:
|
@@ -55,33 +55,20 @@ module HealthDataStandards
|
|
55
55
|
# ./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code
|
56
56
|
def initialize(check_usable = true)
|
57
57
|
@section_importers = {}
|
58
|
-
@section_importers[:encounters] = EncounterImporter.new
|
59
|
-
@section_importers[:procedures] = ProcedureImporter.new
|
60
|
-
@section_importers[:results] = ResultImporter.new
|
61
|
-
@section_importers[:vital_signs] = VitalSignImporter.new
|
62
|
-
@section_importers[:medications] = MedicationImporter.new
|
58
|
+
@section_importers[:encounters] = CDA::EncounterImporter.new
|
59
|
+
@section_importers[:procedures] = CDA::ProcedureImporter.new
|
60
|
+
@section_importers[:results] = CDA::ResultImporter.new
|
61
|
+
@section_importers[:vital_signs] = CDA::VitalSignImporter.new
|
62
|
+
@section_importers[:medications] = CDA::MedicationImporter.new
|
63
63
|
@section_importers[:conditions] = ConditionImporter.new
|
64
|
-
@section_importers[:social_history] = SectionImporter.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.19']")
|
64
|
+
@section_importers[:social_history] = CDA::SectionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.19']"))
|
65
65
|
@section_importers[:care_goals] = CareGoalImporter.new
|
66
|
-
@section_importers[:medical_equipment] = MedicalEquipmentImporter.new
|
67
|
-
@section_importers[:allergies] = AllergyImporter.new
|
66
|
+
@section_importers[:medical_equipment] = CDA::MedicalEquipmentImporter.new
|
67
|
+
@section_importers[:allergies] = CDA::AllergyImporter.new
|
68
68
|
@section_importers[:immunizations] = ImmunizationImporter.new
|
69
69
|
@section_importers[:insurance_providers] = InsuranceProviderImporter.new
|
70
70
|
end
|
71
71
|
|
72
|
-
def build_id_map(doc)
|
73
|
-
id_map = {}
|
74
|
-
path = "//*[@ID]"
|
75
|
-
ids = doc.xpath(path)
|
76
|
-
ids.each do |id|
|
77
|
-
tag = id['ID']
|
78
|
-
value = id.content
|
79
|
-
id_map[tag] = value
|
80
|
-
end
|
81
|
-
|
82
|
-
id_map
|
83
|
-
end
|
84
|
-
|
85
72
|
# @param [boolean] value for check_usable_entries...importer uses true, stats uses false
|
86
73
|
def check_usable(check_usable_entries)
|
87
74
|
@section_importers.each_pair do |section, importer|
|
@@ -110,8 +97,10 @@ module HealthDataStandards
|
|
110
97
|
# @param [Record] c32_patient to check the conditions on and set the expired
|
111
98
|
# property if applicable
|
112
99
|
def check_for_cause_of_death(c32_patient)
|
113
|
-
|
100
|
+
cause_of_death = c32_patient.conditions.detect {|condition| condition.cause_of_death }
|
101
|
+
if cause_of_death
|
114
102
|
c32_patient.expired = true
|
103
|
+
c32_patient.deathdate = cause_of_death.time_of_death
|
115
104
|
end
|
116
105
|
end
|
117
106
|
|
@@ -121,9 +110,10 @@ module HealthDataStandards
|
|
121
110
|
# will have the "cda" namespace registered to "urn:hl7-org:v3"
|
122
111
|
# @return [Hash] a represnetation of the patient with symbols as keys for each section
|
123
112
|
def create_c32_hash(record, doc)
|
124
|
-
|
113
|
+
nrh = CDA::NarrativeReferenceHandler.new
|
114
|
+
nrh.build_id_map(doc)
|
125
115
|
@section_importers.each_pair do |section, importer|
|
126
|
-
record.send(section.to_setter, importer.create_entries(doc,
|
116
|
+
record.send(section.to_setter, importer.create_entries(doc, nrh))
|
127
117
|
end
|
128
118
|
end
|
129
119
|
|
@@ -135,15 +125,18 @@ module HealthDataStandards
|
|
135
125
|
def get_demographics(patient, doc)
|
136
126
|
effective_date = doc.at_xpath('/cda:ClinicalDocument/cda:effectiveTime')['value']
|
137
127
|
patient.effective_time = HL7Helper.timestamp_to_integer(effective_date)
|
138
|
-
|
128
|
+
patient_role_element = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole')
|
129
|
+
patient_element = patient_role_element.at_xpath('./cda:patient')
|
130
|
+
patient.title = patient_element.at_xpath('cda:name/cda:title').try(:text)
|
139
131
|
patient.first = patient_element.at_xpath('cda:name/cda:given').text
|
140
132
|
patient.last = patient_element.at_xpath('cda:name/cda:family').text
|
141
133
|
birthdate_in_hl7ts_node = patient_element.at_xpath('cda:birthTime')
|
142
134
|
birthdate_in_hl7ts = birthdate_in_hl7ts_node['value']
|
143
135
|
patient.birthdate = HL7Helper.timestamp_to_integer(birthdate_in_hl7ts)
|
136
|
+
|
144
137
|
gender_node = patient_element.at_xpath('cda:administrativeGenderCode')
|
145
138
|
patient.gender = gender_node['code']
|
146
|
-
id_node =
|
139
|
+
id_node = patient_role_element.at_xpath('./cda:id')
|
147
140
|
patient.medical_record_number = id_node['extension']
|
148
141
|
|
149
142
|
# parse race, ethnicity, and spoken language
|
@@ -151,16 +144,16 @@ module HealthDataStandards
|
|
151
144
|
patient.race = { code: race_node['code'], code_set: 'CDC-RE' } if race_node
|
152
145
|
ethnicity_node = patient_element.at_xpath('cda:ethnicGroupCode')
|
153
146
|
patient.ethnicity = {code: ethnicity_node['code'], code_set: 'CDC-RE'} if ethnicity_node
|
147
|
+
marital_status_node = patient_element.at_xpath("./cda:maritalStatusCode")
|
148
|
+
patient.marital_status = {code: marital_status_node['code'], code_set: "HL7 Marital Status"} if marital_status_node
|
149
|
+
ra_node = patient_element.at_xpath("./cda:religiousAffiliationCode")
|
150
|
+
patient.religious_affiliation = {code: ra_node['code'], code_set: "Religious Affiliation"} if ra_node
|
154
151
|
languages = patient_element.search('languageCommunication').map {|lc| lc.at_xpath('cda:languageCode')['code'] }
|
155
152
|
patient.languages = languages unless languages.empty?
|
156
153
|
|
157
|
-
|
158
|
-
patient.
|
159
|
-
|
160
|
-
end
|
161
|
-
patient.telecoms = doc.xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole/cda:telecom').map do |tele|
|
162
|
-
import_telecom(tele)
|
163
|
-
end
|
154
|
+
patient.addresses = patient_role_element.xpath("./cda:addr").map { |addr| import_address(addr) }
|
155
|
+
patient.telecoms = patient_role_element.xpath("./cda:telecom").map { |tele| import_telecom(tele) }
|
156
|
+
|
164
157
|
end
|
165
158
|
end
|
166
159
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class DiagnosisActiveImporter < CDA::ConditionImporter
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.11']"))
|
8
|
+
@status_xpath = nil # We'll hardcode this to active in create entry because this is from the
|
9
|
+
# diagnosis active template
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
13
|
+
condition = super
|
14
|
+
condition
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class DiagnosisInactiveImporter < CDA::ConditionImporter
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.13']"))
|
8
|
+
@status_xpath = nil # We'll hardcode this to active in create entry because this is from the
|
9
|
+
# diagnosis active template
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
13
|
+
condition = super
|
14
|
+
condition
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class DiagnosticStudyOrderImporter < CDA::SectionImporter
|
5
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.17']"))
|
6
|
+
super(entry_finder)
|
7
|
+
@entry_class = Procedure
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def extract_dates(parent_element, entry, element_name="author")
|
17
|
+
if parent_element.at_xpath("cda:#{element_name}/cda:time/@value")
|
18
|
+
entry.start_time = HL7Helper.timestamp_to_integer(parent_element.at_xpath("cda:#{element_name}/cda:time")['value'])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class EncounterOrderImporter < CDA::EncounterImporter
|
5
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']"))
|
6
|
+
super(entry_finder)
|
7
|
+
@entry_class = Encounter
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def extract_dates(parent_element, entry, element_name="author")
|
17
|
+
if parent_element.at_xpath("cda:#{element_name}/cda:time/@value")
|
18
|
+
entry.start_time = HL7Helper.timestamp_to_integer(parent_element.at_xpath("cda:#{element_name}/cda:time")['value'])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class EntryPackage
|
5
|
+
|
6
|
+
attr_accessor :importer_type, :hqmf_oid, :status
|
7
|
+
|
8
|
+
def initialize (type, oid, stat = nil)
|
9
|
+
self.importer_type = type
|
10
|
+
self.hqmf_oid = oid
|
11
|
+
self.status = stat
|
12
|
+
end
|
13
|
+
|
14
|
+
def package_entries (doc, nrh)
|
15
|
+
entries = self.importer_type.create_entries(doc, nrh)
|
16
|
+
entries.each do |entry|
|
17
|
+
entry.oid = self.hqmf_oid
|
18
|
+
entry.status = self.status
|
19
|
+
end
|
20
|
+
entries
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class GestationalAgeImporter < CDA::SectionImporter
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.101']"))
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
12
|
+
ga_entry = super
|
13
|
+
swap_code_based_on_value(ga_entry)
|
14
|
+
ga_entry
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# QRDA Cat 1 represents gestational age by using the SNOMED code for length
|
20
|
+
# of gestation and then providing the length in weeks in a value element.
|
21
|
+
# The measure value sets use the SNOMED codes that correspond to an actual
|
22
|
+
# gestational length. This method uses the value to replace the SNOMED code
|
23
|
+
# in the entry.
|
24
|
+
def swap_code_based_on_value(ga_entry)
|
25
|
+
value = ga_entry.values.first
|
26
|
+
if value.present?
|
27
|
+
case value.scalar
|
28
|
+
when "39"
|
29
|
+
ga_entry.codes = {'SNOMED-CT' => ['80487005']}
|
30
|
+
when "38"
|
31
|
+
ga_entry.codes = {'SNOMED-CT' => ['13798002']}
|
32
|
+
when "37"
|
33
|
+
ga_entry.codes = {'SNOMED-CT' => ['43697006']}
|
34
|
+
when "36"
|
35
|
+
ga_entry.codes = {'SNOMED-CT' => ['931004']}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class LabOrderImporter < CDA::SectionImporter
|
5
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.37']"))
|
6
|
+
super(entry_finder)
|
7
|
+
@entry_class = LabResult
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def extract_dates(parent_element, entry, element_name="author")
|
17
|
+
if parent_element.at_xpath("cda:#{element_name}/cda:time/@value")
|
18
|
+
entry.start_time = HL7Helper.timestamp_to_integer(parent_element.at_xpath("cda:#{element_name}/cda:time")['value'])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class MedicationDispensedImporter < CDA::SectionImporter
|
5
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:supply[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.45']"))
|
6
|
+
super(entry_finder)
|
7
|
+
@code_xpath = "./cda:product/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
|
8
|
+
@entry_class = Medication
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
|
5
|
+
# This class is the central location for taking a QRDA Cat 1 XML document and converting it
|
6
|
+
# into the processed form we store in MongoDB. The class does this by running each measure
|
7
|
+
# independently on the XML document
|
8
|
+
#
|
9
|
+
# This class is a Singleton. It should be accessed by calling PatientImporter.instance
|
10
|
+
class PatientImporter
|
11
|
+
include Singleton
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
# This differs from other HDS patient importers in that sections can have multiple importers
|
15
|
+
@section_importers = {}
|
16
|
+
@section_importers[:care_goals] = [EntryPackage.new(CDA::SectionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.1']")), '2.16.840.1.113883.3.560.1.9')].compact #care goal
|
17
|
+
|
18
|
+
ecog_status_importer = CDA::SectionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.103']"))
|
19
|
+
ecog_status_importer.code_xpath = './cda:value'
|
20
|
+
symptom_active_importer = CDA::SectionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.76']"))
|
21
|
+
symptom_active_importer.code_xpath = './cda:value'
|
22
|
+
|
23
|
+
@section_importers[:conditions] = [EntryPackage.new(GestationalAgeImporter.new, '2.16.840.1.113883.3.560.1.1001'),
|
24
|
+
EntryPackage.new(ecog_status_importer, '2.16.840.1.113883.3.560.1.1001'),
|
25
|
+
EntryPackage.new(symptom_active_importer, '2.16.840.1.113883.3.560.1.69', 'active'),
|
26
|
+
EntryPackage.new(DiagnosisActiveImporter.new, '2.16.840.1.113883.3.560.1.2', 'active'),
|
27
|
+
EntryPackage.new(CDA::ConditionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.54']")), '2.16.840.1.113883.3.560.1.404'), # patient characteristic age
|
28
|
+
EntryPackage.new(CDA::ConditionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.14']")), '2.16.840.1.113883.3.560.1.24', 'resolved'), #diagnosis resolved
|
29
|
+
EntryPackage.new(DiagnosisInactiveImporter.new, '2.16.840.1.113883.3.560.1.23', 'inactive')].compact #diagnosis inactive
|
30
|
+
|
31
|
+
|
32
|
+
@section_importers[:medications] = [EntryPackage.new(CDA::MedicationImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.105']/cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.41']")), '2.16.840.1.113883.3.560.1.199', 'discharge'), #discharge medication active
|
33
|
+
EntryPackage.new(CDA::MedicationImporter.new(CDA::EntryFinder.new("//cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.41']")), '2.16.840.1.113883.3.560.1.13', 'active'), #medication active
|
34
|
+
EntryPackage.new(CDA::MedicationImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.42']/cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.16']")), '2.16.840.1.113883.3.560.1.14', 'administered'), #medication administered
|
35
|
+
EntryPackage.new(CDA::MedicationImporter.new(CDA::EntryFinder.new("//cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.47']")), '2.16.840.1.113883.3.560.1.17', 'ordered'), #medication order TODO: ADD NEGATON REASON HANDLING SOMEHOW
|
36
|
+
EntryPackage.new(MedicationDispensedImporter.new, '2.16.840.1.113883.3.560.1.8', 'dispensed')].compact
|
37
|
+
|
38
|
+
@section_importers[:procedures] = [EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.59']")), '2.16.840.1.113883.3.560.1.57', 'performed'), #physical exam performed
|
39
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.3']")), '2.16.840.1.113883.3.560.1.131'), #comm from provider to patient
|
40
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.31']")), '2.16.840.1.113883.3.560.1.45', 'ordered'), #intervention ordered
|
41
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.32']")), '2.16.840.1.113883.3.560.1.46', 'performed'), #intervention performed
|
42
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.34']")), '2.16.840.1.113883.3.560.1.47'), #intervention result
|
43
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.4']")), '2.16.840.1.113883.3.560.1.129'), #comm from provider to provider
|
44
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.2']")), '2.16.840.1.113883.3.560.1.30'), #comm from patient to provider
|
45
|
+
EntryPackage.new(ProcedureOrderImporter.new, '2.16.840.1.113883.3.560.1.62', 'ordered'),
|
46
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.64']")), '2.16.840.1.113883.3.560.1.6'),
|
47
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.66']")), '2.16.840.1.113883.3.560.1.63'),
|
48
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.69']")), '2.16.840.1.113883.3.560.1.21'),
|
49
|
+
EntryPackage.new(CDA::ProcedureImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.18']")), '2.16.840.1.113883.3.560.1.103', 'performed'), #diagnostic study performed
|
50
|
+
EntryPackage.new(DiagnosticStudyOrderImporter.new, '2.16.840.1.113883.3.560.1.40', 'ordered')].compact
|
51
|
+
|
52
|
+
@section_importers[:allergies] = [EntryPackage.new(ProcedureIntoleranceImporter.new, '2.16.840.1.113883.3.560.1.61'),
|
53
|
+
EntryPackage.new(CDA::AllergyImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.46']")), '2.16.840.1.113883.3.560.1.67'), #medication intolerance
|
54
|
+
EntryPackage.new(CDA::AllergyImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.43']")), '2.16.840.1.113883.3.560.1.7'), #medication adverse effect
|
55
|
+
EntryPackage.new(CDA::AllergyImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.44']")), '2.16.840.1.113883.3.560.1.1')].compact #medication allergy
|
56
|
+
|
57
|
+
@section_importers[:medical_equipment] = [EntryPackage.new(CDA::MedicalEquipmentImporter.new(CDA::EntryFinder.new("//cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.7']")), '2.16.840.1.113883.3.560.1.110', 'applied')].compact
|
58
|
+
|
59
|
+
@section_importers[:results] = [EntryPackage.new(LabOrderImporter.new, '2.16.840.1.113883.3.560.1.50', 'ordered'), #lab ordered
|
60
|
+
EntryPackage.new(CDA::ResultImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.38']")), '2.16.840.1.113883.3.560.1.5', 'performed'), #lab performed
|
61
|
+
EntryPackage.new(CDA::ResultImporter.new(CDA::EntryFinder.new("//cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.34']")), '2.16.840.1.113883.3.560.1.47'), #intervention result
|
62
|
+
EntryPackage.new(CDA::ResultImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.57']")), '2.16.840.1.113883.3.560.1.18'), #physical exam finding
|
63
|
+
EntryPackage.new(CDA::ResultImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.28']")), '2.16.840.1.113883.3.560.1.88'), #functional status result
|
64
|
+
EntryPackage.new(CDA::ResultImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.20']")), '2.16.840.1.113883.3.560.1.111')].compact #diagnostic study result not done
|
65
|
+
|
66
|
+
@section_importers[:encounters] = [EntryPackage.new(CDA::EncounterImporter.new(CDA::EntryFinder.new("//cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']")), '2.16.840.1.113883.3.560.1.79', 'performed'), #encounter performed
|
67
|
+
EntryPackage.new(EncounterOrderImporter.new, '2.16.840.1.113883.3.560.1.83', 'ordered')].compact
|
68
|
+
|
69
|
+
@section_importers[:social_history] = [EntryPackage.new(TobaccoUseImporter.new, '2.16.840.1.113883.3.560.1.1001', 'completed')].compact
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
def parse_cat1(doc)
|
74
|
+
record = Record.new
|
75
|
+
HealthDataStandards::Import::C32::PatientImporter.instance.get_demographics(record, doc)
|
76
|
+
import_sections(record, doc)
|
77
|
+
get_clinical_trial_participant(record, doc)
|
78
|
+
get_patient_expired(record, doc)
|
79
|
+
record
|
80
|
+
end
|
81
|
+
|
82
|
+
def import_sections(record, doc)
|
83
|
+
nrh = CDA::NarrativeReferenceHandler.new
|
84
|
+
nrh.build_id_map(doc)
|
85
|
+
@section_importers.each do |section, entry_packages|
|
86
|
+
entry_packages.each do |entry_package|
|
87
|
+
record.send(section) << entry_package.package_entries(doc, nrh)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_clinical_trial_participant(record, doc)
|
93
|
+
entry_elements = doc.xpath("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.51']")
|
94
|
+
record.clinicalTrialParticipant = true unless entry_elements.nil?
|
95
|
+
end
|
96
|
+
|
97
|
+
def get_patient_expired(record, doc)
|
98
|
+
entry_elements = doc.xpath("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.54']")
|
99
|
+
record.expired = true unless entry_elements.nil?
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|