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
@@ -0,0 +1,13 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class ProcedureIntoleranceImporter < 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.62']/cda:entryRelationship/cda:procedure[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.64']"))
|
8
|
+
@entry_class = Allergy
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class ProcedureOrderImporter < CDA::SectionImporter
|
5
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.63']"))
|
6
|
+
super(entry_finder)
|
7
|
+
@entry_class = Procedure
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
11
|
+
procedure = super
|
12
|
+
procedure.status_code = {'HL7 ActStatus' => ['ordered']}
|
13
|
+
extract_performer(entry_element, procedure)
|
14
|
+
extract_site(entry_element, procedure)
|
15
|
+
extract_negation(entry_element, procedure)
|
16
|
+
procedure
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def extract_dates(parent_element, entry, element_name="author")
|
22
|
+
if parent_element.at_xpath("cda:#{element_name}/cda:time/@value")
|
23
|
+
entry.start_time = HL7Helper.timestamp_to_integer(parent_element.at_xpath("cda:#{element_name}/cda:time")['value'])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def extract_performer(parent_element, procedure)
|
28
|
+
performer_element = parent_element.at_xpath("./cda:performer")
|
29
|
+
procedure.performer = import_actor(performer_element) if performer_element
|
30
|
+
end
|
31
|
+
|
32
|
+
def extract_site(parent_element, procedure)
|
33
|
+
procedure.site = extract_code(parent_element, "./cda:targetSiteCode")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module Cat1
|
4
|
+
class TobaccoUseImporter < CDA::SectionImporter
|
5
|
+
def initialize(entry_finder=CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.85']"))
|
6
|
+
super(entry_finder)
|
7
|
+
@entry_class = Entry
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
11
|
+
history = super
|
12
|
+
codehash = extract_code(entry_element, "./cda:value")
|
13
|
+
history.add_code(codehash['code'], CodeSystemHelper.code_system_for(codehash['codeSystemOid']))
|
14
|
+
history
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,19 +1,13 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
|
-
class AllergyImporter <
|
5
|
-
|
6
|
-
|
4
|
+
class AllergyImporter < CDA::AllergyImporter
|
7
5
|
def initialize
|
8
|
-
|
9
|
-
@code_xpath = "./cda:participant/cda:participantRole/cda:playingEntity/cda:code"
|
10
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]"
|
11
|
-
@type_xpath = "./cda:code"
|
6
|
+
super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.7']"))
|
12
7
|
@reaction_xpath = "./cda:entryRelationship[@typeCode='MFST']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.9']/cda:value"
|
13
8
|
@severity_xpath = "./cda:entryRelationship[@typeCode='SUBJ']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.8']/cda:value"
|
14
9
|
@status_xpath = "./cda:entryRelationship[@typeCode='SUBJ']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.28']/cda:value"
|
15
10
|
end
|
16
|
-
|
17
11
|
end
|
18
12
|
end
|
19
13
|
end
|
@@ -4,7 +4,7 @@ module HealthDataStandards
|
|
4
4
|
class CareGoalImporter < C32::CareGoalImporter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
|
7
|
+
super(CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.10']/cda:entry/cda:*"))
|
8
8
|
end
|
9
9
|
|
10
10
|
end
|
@@ -4,10 +4,9 @@ module HealthDataStandards
|
|
4
4
|
class ConditionImporter < C32::ConditionImporter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
|
7
|
+
super
|
8
|
+
@entry_finder = CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.5' or cda:templateId/@root='2.16.840.1.113883.10.20.22.2.5.1']/cda:entry/cda:act/cda:entryRelationship/cda:observation")
|
8
9
|
@status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.6']/cda:value"
|
9
|
-
@description_xpath = "./cda:text/cda:reference[@value]"
|
10
|
-
@code_xpath = "./cda:value"
|
11
10
|
|
12
11
|
#optional
|
13
12
|
#health status
|
@@ -2,13 +2,10 @@ module HealthDataStandards
|
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
4
|
# TODO Extract Discharge Disposition
|
5
|
-
class EncounterImporter <
|
5
|
+
class EncounterImporter < CDA::EncounterImporter
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
|
9
|
-
@code_xpath = "./cda:code"
|
10
|
-
@status_xpath = "./cda:statusCode"
|
11
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value] "
|
8
|
+
super(CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.22' or cda:templateId/@root='2.16.840.1.113883.10.20.22.2.22.1']/cda:entry/cda:encounter"))
|
12
9
|
@reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation"
|
13
10
|
end
|
14
11
|
|
@@ -4,9 +4,7 @@ module HealthDataStandards
|
|
4
4
|
class ImmunizationImporter < C32::ImmunizationImporter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
|
8
|
-
@code_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
|
9
|
-
@description_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code/cda:originalText/cda:reference[@value]"
|
7
|
+
super(CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.2' or cda:templateId/@root='2.16.840.1.113883.10.20.22.2.2.1']/cda:entry/cda:substanceAdministration"))
|
10
8
|
@refusal_reason_xpath = "./cda:entryRelationship[@typeCode='MFST']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.9']/cda:value"
|
11
9
|
end
|
12
10
|
|
@@ -4,7 +4,7 @@ module HealthDataStandards
|
|
4
4
|
class InsuranceProviderImporter < C32::InsuranceProviderImporter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
|
7
|
+
super(CDA::EntryFinder.new("//cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.61']"))
|
8
8
|
end
|
9
9
|
|
10
10
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
|
-
class MedicalEquipmentImporter <
|
4
|
+
class MedicalEquipmentImporter < CDA::MedicalEquipmentImporter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
|
8
|
-
@code_xpath = "./cda:participant/cda:participantRole/cda:playingDevice/cda:code"
|
9
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]"
|
7
|
+
super(CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.23']/cda:entry/cda:supply"))
|
10
8
|
end
|
11
9
|
|
12
10
|
end
|
@@ -2,12 +2,10 @@ module HealthDataStandards
|
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
4
|
|
5
|
-
class MedicationImporter <
|
5
|
+
class MedicationImporter < CDA::MedicationImporter
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
|
9
|
-
@code_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
|
10
|
-
@description_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code/cda:originalText/cda:reference[@value]"
|
8
|
+
super(CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.1' or cda:templateId/@root='2.16.840.1.113883.10.20.22.2.1.1']/cda:entry/cda:substanceAdministration"))
|
11
9
|
@indication_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.19']/cda:code"
|
12
10
|
@vehicle_xpath = "./cda:participant/cda:participantRole[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.24']/cda:playingEntity/cda:code"
|
13
11
|
@fill_number_xpath = './cda:repeatNumber'
|
@@ -11,7 +11,7 @@ module HealthDataStandards
|
|
11
11
|
@section_importers[:vital_signs] = VitalSignImporter.new
|
12
12
|
@section_importers[:medications] = MedicationImporter.new
|
13
13
|
@section_importers[:conditions] = ConditionImporter.new
|
14
|
-
@section_importers[:social_history] =
|
14
|
+
@section_importers[:social_history] = CDA::SectionImporter.new(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.38' or cda:templateId/@root='2.16.840.1.113883.10.20.15.3.8']"))
|
15
15
|
@section_importers[:care_goals] = CareGoalImporter.new
|
16
16
|
@section_importers[:medical_equipment] = MedicalEquipmentImporter.new
|
17
17
|
@section_importers[:allergies] = AllergyImporter.new
|
@@ -1,14 +1,10 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
|
-
class ProcedureImporter <
|
4
|
+
class ProcedureImporter < CDA::ProcedureImporter
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
|
8
|
-
@code_xpath = "./cda:code"
|
9
|
-
@status_xpath = "./cda:statusCode"
|
10
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value] "
|
11
|
-
@check_for_usable = true # Pilot tools will set this to false
|
7
|
+
super(CDA::EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.10.20.22.2.7' or cda:templateId/@root='2.16.840.1.113883.10.20.22.2.7.1']/cda:entry/cda:*"))
|
12
8
|
end
|
13
9
|
|
14
10
|
end
|
@@ -1,12 +1,9 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
|
-
class ResultImporter <
|
4
|
+
class ResultImporter < CDA::ResultImporter
|
5
5
|
def initialize
|
6
|
-
|
7
|
-
@code_xpath = "./cda:code"
|
8
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value] "
|
9
|
-
@check_for_usable = true
|
6
|
+
super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.2']"))
|
10
7
|
end
|
11
8
|
end
|
12
9
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
3
|
module CCDA
|
4
|
-
class VitalSignImporter <
|
4
|
+
class VitalSignImporter < CDA::ResultImporter
|
5
5
|
def initialize
|
6
|
-
super
|
7
|
-
@entry_xpath = "//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.27']"
|
6
|
+
super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.27']"))
|
8
7
|
end
|
9
8
|
end
|
10
9
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module CDA
|
4
|
+
class AllergyImporter < SectionImporter
|
5
|
+
|
6
|
+
def initialize(entry_finder=EntryFinder.new("//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.18']"))
|
7
|
+
@entry_finder = entry_finder
|
8
|
+
@code_xpath = "./cda:participant/cda:participantRole/cda:playingEntity/cda:code"
|
9
|
+
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]"
|
10
|
+
@type_xpath = "./cda:code"
|
11
|
+
@free_text_xpath= "./cda:participant/cda:participantRole/cda:playingEntity/cda:name"
|
12
|
+
@reaction_xpath = "./cda:entryRelationship[@typeCode='MFST']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.54']/cda:value"
|
13
|
+
@severity_xpath = "./cda:entryRelationship[@typeCode='SUBJ']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.55']/cda:value"
|
14
|
+
@status_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.39']/cda:value"
|
15
|
+
@entry_class = Allergy
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
19
|
+
allergy = super
|
20
|
+
allergy.free_text = entry_element.at_xpath(@free_text_xpath).try(:text)
|
21
|
+
extract_negation(entry_element, allergy)
|
22
|
+
allergy.type = extract_code(entry_element, @type_xpath)
|
23
|
+
allergy.reaction = extract_code(entry_element, @reaction_xpath)
|
24
|
+
allergy.severity = extract_code(entry_element, @severity_xpath)
|
25
|
+
|
26
|
+
allergy
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module CDA
|
4
|
+
class ConditionImporter < SectionImporter
|
5
|
+
|
6
|
+
def initialize(entry_finder=EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.103']/cda:entry/cda:act/cda:entryRelationship/cda:observation"))
|
7
|
+
@entry_finder = entry_finder
|
8
|
+
@code_xpath = "./cda:value"
|
9
|
+
@status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.50']/cda:value"
|
10
|
+
@ordinality_xpath = "./cda:priorityCode"
|
11
|
+
@description_xpath = "./cda:text/cda:reference[@value]"
|
12
|
+
@provider_xpath = "./cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:performer"
|
13
|
+
@priority_xpath = "../cda:sequenceNumber"
|
14
|
+
@entry_class = Condition
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
18
|
+
condition = super
|
19
|
+
|
20
|
+
extract_ordinality(entry_element, condition)
|
21
|
+
extract_negation(entry_element, condition)
|
22
|
+
extract_priority(entry_element, condition)
|
23
|
+
|
24
|
+
if @provider_xpath
|
25
|
+
entry_element.xpath(@provider_xpath).each do |provider_element|
|
26
|
+
condition.treating_provider << import_actor(provider_element)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
condition
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def extract_ordinality(parent_element, entry)
|
36
|
+
ordinality_element = parent_element.at_xpath(@ordinality_xpath)
|
37
|
+
if ordinality_element
|
38
|
+
entry.ordinality = {CodeSystemHelper.code_system_for(ordinality_element['codeSystem']) => [ordinality_element['code']]}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def extract_priority(entry_element, condition)
|
43
|
+
priority_element = entry_element.at_xpath(@priority_xpath)
|
44
|
+
if priority_element
|
45
|
+
condition.priority = priority_element['value'].to_i
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,46 +1,20 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
|
-
module
|
3
|
+
module CDA
|
4
4
|
# TODO Extract Discharge Disposition
|
5
5
|
class EncounterImporter < SectionImporter
|
6
6
|
|
7
|
-
def initialize
|
8
|
-
|
9
|
-
@code_xpath = "./cda:code"
|
10
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]"
|
7
|
+
def initialize(entry_finder=EntryFinder.new("//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.127']/cda:entry/cda:encounter"))
|
8
|
+
super(entry_finder)
|
11
9
|
@reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:act"
|
12
|
-
@
|
13
|
-
@id_map = {}
|
14
|
-
end
|
15
|
-
|
16
|
-
# Traverses that HITSP C32 document passed in using XPath and creates an Array of Entry
|
17
|
-
# objects based on what it finds
|
18
|
-
# @param [Nokogiri::XML::Document] doc It is expected that the root node of this document
|
19
|
-
# will have the "cda" namespace registered to "urn:hl7-org:v3"
|
20
|
-
# measure definition
|
21
|
-
# @return [Array] will be a list of Entry objects
|
22
|
-
def create_entries(doc,id_map = {})
|
23
|
-
encounter_list = []
|
24
|
-
entry_elements = doc.xpath(@entry_xpath)
|
25
|
-
entry_elements.each do |entry_element|
|
26
|
-
encounter = create_entry(entry_element, id_map={})
|
27
|
-
if @check_for_usable
|
28
|
-
encounter_list << encounter if encounter.usable?
|
29
|
-
else
|
30
|
-
encounter_list << encounter
|
31
|
-
end
|
32
|
-
end
|
33
|
-
encounter_list
|
10
|
+
@entry_class = Encounter
|
34
11
|
end
|
35
12
|
|
36
|
-
def create_entry(entry_element,
|
37
|
-
encounter =
|
38
|
-
extract_codes(entry_element, encounter)
|
39
|
-
extract_dates(entry_element, encounter)
|
40
|
-
extract_description(entry_element, encounter, id_map)
|
13
|
+
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
14
|
+
encounter = super
|
41
15
|
extract_performer(entry_element, encounter)
|
42
16
|
extract_facility(entry_element, encounter)
|
43
|
-
extract_reason(entry_element, encounter,
|
17
|
+
extract_reason(entry_element, encounter, nrh)
|
44
18
|
extract_negation(entry_element, encounter)
|
45
19
|
extract_admission(entry_element, encounter)
|
46
20
|
encounter
|
@@ -65,12 +39,12 @@ module HealthDataStandards
|
|
65
39
|
end
|
66
40
|
end
|
67
41
|
|
68
|
-
def extract_reason(parent_element, encounter,
|
42
|
+
def extract_reason(parent_element, encounter, nrh)
|
69
43
|
reason_element = parent_element.at_xpath(@reason_xpath)
|
70
44
|
if reason_element
|
71
45
|
reason = Entry.new
|
72
46
|
extract_codes(reason_element, reason)
|
73
|
-
extract_description(reason_element, reason,
|
47
|
+
extract_description(reason_element, reason, nrh)
|
74
48
|
extract_status(reason_element, reason)
|
75
49
|
extract_dates(reason_element, reason)
|
76
50
|
encounter.reason = reason
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module HealthDataStandards
|
2
|
+
module Import
|
3
|
+
module CDA
|
4
|
+
class EntryFinder
|
5
|
+
def initialize(entry_xpath)
|
6
|
+
@entry_xpath = entry_xpath
|
7
|
+
end
|
8
|
+
|
9
|
+
def entries(doc)
|
10
|
+
entry_elements = doc.xpath(@entry_xpath)
|
11
|
+
if block_given?
|
12
|
+
entry_elements.each do |entry_element|
|
13
|
+
yield entry_element
|
14
|
+
end
|
15
|
+
else
|
16
|
+
entry_elements
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module HealthDataStandards
|
2
2
|
module Import
|
3
|
-
module
|
3
|
+
module CDA
|
4
4
|
# Helpers for importing C32 addresses and telecoms
|
5
5
|
module LocatableImportUtils
|
6
6
|
def import_address(address_element)
|
@@ -23,5 +23,4 @@ module HealthDataStandards
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
end
|
27
|
-
|
26
|
+
end
|