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,47 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module C32
|
4
|
-
class AllergyImporter < SectionImporter
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@entry_xpath = "//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.18']"
|
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
|
-
@reaction_xpath = "./cda:entryRelationship[@typeCode='MFST']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.54']/cda:value"
|
12
|
-
@severity_xpath = "./cda:entryRelationship[@typeCode='SUBJ']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.55']/cda:value"
|
13
|
-
@status_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.39']/cda:value"
|
14
|
-
@id_map = {}
|
15
|
-
end
|
16
|
-
|
17
|
-
# Traverses that HITSP C32 document passed in using XPath and creates an Array of Entry
|
18
|
-
# objects based on what it finds
|
19
|
-
# @param [Nokogiri::XML::Document] doc It is expected that the root node of this document
|
20
|
-
# will have the "cda" namespace registered to "urn:hl7-org:v3"
|
21
|
-
# measure definition
|
22
|
-
# @return [Array] will be a list of Entry objects
|
23
|
-
def create_entries(doc,id_map = {})
|
24
|
-
@id_map = id_map
|
25
|
-
allergy_list = []
|
26
|
-
entry_elements = doc.xpath(@entry_xpath)
|
27
|
-
entry_elements.each do |entry_element|
|
28
|
-
allergy = Allergy.new
|
29
|
-
extract_codes(entry_element, allergy)
|
30
|
-
extract_dates(entry_element, allergy)
|
31
|
-
extract_description(entry_element, allergy, id_map)
|
32
|
-
extract_negation(entry_element, allergy)
|
33
|
-
|
34
|
-
extract_status(entry_element, allergy)
|
35
|
-
allergy.type = extract_code(entry_element, @type_xpath)
|
36
|
-
allergy.reaction = extract_code(entry_element, @reaction_xpath)
|
37
|
-
allergy.severity = extract_code(entry_element, @severity_xpath)
|
38
|
-
|
39
|
-
allergy_list << allergy
|
40
|
-
end
|
41
|
-
allergy_list
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module C32
|
4
|
-
class MedicalEquipmentImporter < SectionImporter
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@entry_xpath = "//cda:section[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.128']/cda:entry/cda:supply"
|
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]"
|
10
|
-
@check_for_usable = true
|
11
|
-
end
|
12
|
-
|
13
|
-
def create_entries(doc,id_map = {})
|
14
|
-
entry_list = []
|
15
|
-
entry_elements = doc.xpath(@entry_xpath)
|
16
|
-
entry_elements.each do |entry_element|
|
17
|
-
entry = create_entry(entry_element, id_map)
|
18
|
-
if @check_for_usable
|
19
|
-
entry_list << entry if entry.usable?
|
20
|
-
else
|
21
|
-
entry_list << entry
|
22
|
-
end
|
23
|
-
end
|
24
|
-
entry_list
|
25
|
-
end
|
26
|
-
|
27
|
-
def create_entry(entry_element, id_map={})
|
28
|
-
entry = MedicalEquipment.new
|
29
|
-
extract_codes(entry_element, entry)
|
30
|
-
extract_dates(entry_element, entry)
|
31
|
-
extract_value(entry_element, entry)
|
32
|
-
|
33
|
-
extract_description(entry_element, entry, id_map)
|
34
|
-
extract_manufacturer(entry_element, entry)
|
35
|
-
entry
|
36
|
-
end
|
37
|
-
|
38
|
-
def extract_manufacturer(entry_element, entry)
|
39
|
-
manufacturer = entry_element.at_xpath("./cda:participant/cda:participantRole/cda:scopingEntity/cda:desc").try(:inner_text)
|
40
|
-
entry.manufacturer = manufacturer.strip if manufacturer
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module C32
|
4
|
-
|
5
|
-
# TODO Extract Discharge Disposition
|
6
|
-
class ProcedureImporter < SectionImporter
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
#scoped to not look in the plan of care section so planned procedures do not end up mixed with
|
10
|
-
#past procedures
|
11
|
-
@entry_xpath = "//cda:section[cda:templateId/@root!='2.16.840.1.113883.3.88.11.83.124']//cda:procedure"
|
12
|
-
@code_xpath = "./cda:code"
|
13
|
-
@description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value] "
|
14
|
-
@check_for_usable = true # Pilot tools will set this to false
|
15
|
-
end
|
16
|
-
|
17
|
-
# Traverses that HITSP C32 document passed in using XPath and creates an Array of Entry
|
18
|
-
# objects based on what it finds
|
19
|
-
# @param [Nokogiri::XML::Document] doc It is expected that the root node of this document
|
20
|
-
# will have the "cda" namespace registered to "urn:hl7-org:v3"
|
21
|
-
# measure definition
|
22
|
-
# @return [Array] will be a list of Entry objects
|
23
|
-
def create_entries(doc,id_map = {})
|
24
|
-
procedure_list = []
|
25
|
-
entry_elements = doc.xpath(@entry_xpath)
|
26
|
-
entry_elements.each do |entry_element|
|
27
|
-
procedure = create_entry(entry_element, id_map)
|
28
|
-
if @check_for_usable
|
29
|
-
procedure_list << procedure if procedure.usable?
|
30
|
-
else
|
31
|
-
procedure_list << procedure
|
32
|
-
end
|
33
|
-
end
|
34
|
-
procedure_list
|
35
|
-
end
|
36
|
-
|
37
|
-
def create_entry(entry_element, id_map={})
|
38
|
-
procedure = Procedure.new
|
39
|
-
extract_codes(entry_element, procedure)
|
40
|
-
extract_dates(entry_element, procedure)
|
41
|
-
extract_description(entry_element, procedure, id_map)
|
42
|
-
extract_performer(entry_element, procedure)
|
43
|
-
extract_site(entry_element, procedure)
|
44
|
-
extract_negation(entry_element, procedure)
|
45
|
-
procedure
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def extract_performer(parent_element, procedure)
|
51
|
-
performer_element = parent_element.at_xpath("./cda:performer")
|
52
|
-
procedure.performer = import_actor(performer_element) if performer_element
|
53
|
-
end
|
54
|
-
|
55
|
-
def extract_site(parent_element, procedure)
|
56
|
-
procedure.site = extract_code(parent_element, "./cda:targetSiteCode")
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module C32
|
4
|
-
class ResultImporter < SectionImporter
|
5
|
-
def initialize
|
6
|
-
@entry_xpath = "//cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15.1'] | //cda:observation[cda:templateId/@root='2.16.840.1.113883.3.88.11.83.15']"
|
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 # Pilot tools will set this to false
|
10
|
-
end
|
11
|
-
|
12
|
-
# Traverses that HITSP C32 document passed in using XPath and creates an Array of Entry
|
13
|
-
# objects based on what it finds
|
14
|
-
# @param [Nokogiri::XML::Document] doc It is expected that the root node of this document
|
15
|
-
# will have the "cda" namespace registered to "urn:hl7-org:v3"
|
16
|
-
# measure definition
|
17
|
-
# @return [Array] will be a list of Entry objects
|
18
|
-
def create_entries(doc,id_map = {})
|
19
|
-
result_list = []
|
20
|
-
entry_elements = doc.xpath(@entry_xpath)
|
21
|
-
entry_elements.each do |entry_element|
|
22
|
-
result = create_entry(entry_element, id_map)
|
23
|
-
if @check_for_usable
|
24
|
-
result_list << result if result.usable?
|
25
|
-
else
|
26
|
-
result_list << result
|
27
|
-
end
|
28
|
-
end
|
29
|
-
result_list
|
30
|
-
end
|
31
|
-
|
32
|
-
def create_entry(entry_element, id_map={})
|
33
|
-
result = LabResult.new
|
34
|
-
extract_codes(entry_element, result)
|
35
|
-
extract_dates(entry_element, result)
|
36
|
-
extract_value(entry_element, result)
|
37
|
-
extract_description(entry_element, result, id_map)
|
38
|
-
extract_interpretation(entry_element, result)
|
39
|
-
extract_negation(entry_element, result)
|
40
|
-
result
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
def extract_interpretation(parent_element, result)
|
45
|
-
interpretation_element = parent_element.at_xpath("./cda:interpretationCode")
|
46
|
-
if interpretation_element
|
47
|
-
code = interpretation_element['code']
|
48
|
-
code_system = CodeSystemHelper.code_system_for(interpretation_element['codeSystem'])
|
49
|
-
result.interpretation = {'code' => code, 'codeSystem' => code_system}
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<advanceDirective xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<%== code_display advance_directive, 'preferred_code_sets' => ['SNOMED-CT'] %>
|
3
|
-
<effectiveTime>
|
4
|
-
<start><%= time_if_not_nil(advance_directive.start_time, advance_directive.time) %></start>
|
5
|
-
<end><%= time_if_not_nil(advance_directive.end_time) %></end>
|
6
|
-
</effectiveTime>
|
7
|
-
<freeText><%= advance_directive.free_text %></freeText>
|
8
|
-
</advanceDirective>
|
data/templates/_allergy.gc32.erb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
<allergy xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= allergy.id%></id>
|
3
|
-
<%== code_display allergy, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT', "RxNorm", "FDA"] %>
|
4
|
-
<status><%= allergy.status%></status>
|
5
|
-
<freeText><%= allergy.free_text %></freeText>
|
6
|
-
<effectiveTime>
|
7
|
-
<% if allergy.start_time || allergy.end_time %>
|
8
|
-
<start><%= time_if_not_nil(allergy.start_time) %></start>
|
9
|
-
<end><%= time_if_not_nil(allergy.end_time) %></end>
|
10
|
-
<% else %>
|
11
|
-
<%= time_if_not_nil(allergy.time) %>
|
12
|
-
<% end %>
|
13
|
-
</effectiveTime>
|
14
|
-
<% if allergy.type %>
|
15
|
-
<%== code_display allergy, "tag_name" => "type", "attribute" => "type", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
|
16
|
-
<% end %>
|
17
|
-
<% if allergy.reaction %>
|
18
|
-
<%== code_display allergy, "tag_name" => "reaction", "attribute" => "reaction", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
|
19
|
-
<% end %>
|
20
|
-
<% if allergy.severity%>
|
21
|
-
<%== code_display allergy, "tag_name" => "severity", "attribute" => "severity", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
|
22
|
-
<% end %>
|
23
|
-
</allergy>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<condition <% unless condition.cause_of_death.nil? %>causeOfDeath="<%= condition.cause_of_death %>"<% end %> xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= condition.id %></id>
|
3
|
-
<%== code_display condition, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
|
4
|
-
<%== gc32_effective_time(condition)%>
|
5
|
-
<% if condition.priority %>
|
6
|
-
<priority><%= condition.priority %></priority>
|
7
|
-
<% end %>
|
8
|
-
<type><%= condition.type %></type>
|
9
|
-
</condition>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<encounter xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= encounter.id %></id>
|
3
|
-
<%== code_display encounter, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
|
4
|
-
<% if encounter.status %>
|
5
|
-
<status code="completed"/>
|
6
|
-
<% end %>
|
7
|
-
<%== gc32_effective_time(encounter)%>
|
8
|
-
<%== code_display encounter, "tag_name" => "dishcargeDisposition", 'attribute' => "discharge_disposition" %>
|
9
|
-
<%== code_display encounter, "tag_name" => "admissionType", 'attribute' => "admit_type" %>
|
10
|
-
<% if provider %>
|
11
|
-
<%= render partial: 'provider', locals: {provider: encounter.performer, tag_name: 'performer'}%>
|
12
|
-
<% end %>
|
13
|
-
<% facility = encounter.facility %>
|
14
|
-
<% if facility %>
|
15
|
-
<facility>
|
16
|
-
<id><%= facility.id%></id>
|
17
|
-
<name><%= facility.name%></name>
|
18
|
-
<% facility.addresses.each do |addr| %>
|
19
|
-
<%= render :partial => "address", locals: {address: addr} %>
|
20
|
-
<% end %>
|
21
|
-
<% facility.telecoms.each do |tele| %>
|
22
|
-
<%= render :partial => "telecom", locals: {telecom: tele} %>
|
23
|
-
<% end %>
|
24
|
-
<% end %>
|
25
|
-
</facility>
|
26
|
-
</encounter>
|
data/templates/_entry.gc32.erb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<entry xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= entry.id %></id>
|
3
|
-
<%== code_display entry, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT', "LOINC"] %>
|
4
|
-
<status><%= entry.status%></status>
|
5
|
-
<freeText><%=entry.free_text %></freeText>
|
6
|
-
<effectiveTime>
|
7
|
-
<% if entry.start_time || entry.end_time %>
|
8
|
-
<start><%= time_if_not_nil(entry.start_time) %></start>
|
9
|
-
<end><%= time_if_not_nil(entry.end_time) %></end>
|
10
|
-
<% else %>
|
11
|
-
<%= time_if_not_nil(entry.time) %>
|
12
|
-
<% end %>
|
13
|
-
</effectiveTime>
|
14
|
-
</entry>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<immunization <% if refused %> refused="true" <% end %> xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= immunization.id %></id>
|
3
|
-
<%== code_display immunization, "preferred_code_sets" => ["RxNorm", "CVX"] %>
|
4
|
-
<%== gc32_effective_time(immunization)%>
|
5
|
-
<% if immunization.series_number %>
|
6
|
-
<seriesNumber><%= immunization.series_number %></seriesNumber>
|
7
|
-
<% end %>
|
8
|
-
<% if immunization.refusal_reason %>
|
9
|
-
<%== code_display immunization, "tag_name" => "refusalReason", "attribute" => "refusal_reason", "preferred_code_sets" => ["SNOMED-CT"] %>
|
10
|
-
<% end %>
|
11
|
-
</immunization>
|
File without changes
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<medicalEquipment xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= medical_equipment.id %></id>
|
3
|
-
<%== code_display medical_equipment, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT', "LOINC"] %>
|
4
|
-
<status><%= medical_equipment.status%></status>
|
5
|
-
<freeText><%=medical_equipment.free_text %></freeText>
|
6
|
-
<%== gc32_effective_time(medical_equipment)%>
|
7
|
-
</medicalEquipment>
|
@@ -1,72 +0,0 @@
|
|
1
|
-
<medication>
|
2
|
-
<id><%= medication.id%></id>
|
3
|
-
<%== code_display medication, "preferred_code_sets" => ["RxNorm", "CVX"] %>
|
4
|
-
<freeText><%= medication.free_text%></freeText>
|
5
|
-
<%== gc32_effective_time(medication)%>
|
6
|
-
<% if medication.administration_timing %>
|
7
|
-
<administrationTiming institutionSpecified="<%= medication.administration_timing[:insitution_specified] %>">
|
8
|
-
<%== quantity_display medication.administration_timing["period"], :period %>
|
9
|
-
</administrationTiming>
|
10
|
-
<% end %>
|
11
|
-
<% if medication.route %>
|
12
|
-
<%== code_display medication, "tag_name" => "route", "attribute" => "route", "preferred_code_sets" => ["NCI Thesaurus"] %>
|
13
|
-
<% end %>
|
14
|
-
<% if medication.site %>
|
15
|
-
<%== code_display medication, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
|
16
|
-
<% end %>
|
17
|
-
<%== quantity_display medication.dose, :dose %>
|
18
|
-
<% if medication.dose_indicator %>
|
19
|
-
<doseIndication><%medication.dose_indicator%></doseIndication>
|
20
|
-
<% end %>
|
21
|
-
<% if medication.dose_restriction %>
|
22
|
-
<doseRestriction>
|
23
|
-
<numerator><%= medication.dose_restriction["numerator"]%></numerator>
|
24
|
-
<denominator><%= medication.dose_restriction["denominator"]%></denominator>
|
25
|
-
</doseRestriction>
|
26
|
-
<% end %>
|
27
|
-
<% if medication.product_form %>
|
28
|
-
<%== code_display medication, "tag_name" => "productForm", "attribute" => "product_form", "preferred_code_sets" => ["NCI Thesaurus"] %>
|
29
|
-
<% end %>
|
30
|
-
<% if medication.delivery_method %>
|
31
|
-
<%== code_display medication, "tag_name" => "deliveryMethod", "attribute" => "delivery_method", "preferred_code_sets" => medication.delivery_method.keys %>
|
32
|
-
<% end %>
|
33
|
-
<% if medication.type_of_medication%>
|
34
|
-
<%== code_display medication, "tag_name" => "type", "attribute" => "type_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
|
35
|
-
<% end %>
|
36
|
-
<% if medication.status_of_medication%>
|
37
|
-
<%== code_display medication, "tag_name" => "statusOfMedication", "attribute" => "status_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
|
38
|
-
<% end %>
|
39
|
-
<%if medication.indication%>
|
40
|
-
<%== code_display medication, "tag_name" => "indication", "attribute" => "indication", "preferred_code_sets" => ["SNOMED-CT"] %>
|
41
|
-
<% end %>
|
42
|
-
<% if medication.vehicle %>
|
43
|
-
<%== code_display medication, "tag_name" => "vehicle", "attribute" => "vehicle", "preferred_code_sets" => ["SNOMED-CT"] %>
|
44
|
-
<% end%>
|
45
|
-
|
46
|
-
<% if medication.dose_indicator %>
|
47
|
-
<doseIndicator><%= medication.dose_indicator %></doseIndicator>
|
48
|
-
<% end %>
|
49
|
-
|
50
|
-
<% if medication.patient_instructions %>
|
51
|
-
<patientInstructions><%=medication.patient_instructions%></patientInstructions>
|
52
|
-
<% end %>
|
53
|
-
|
54
|
-
<% if medication.fulfillment_instructions %>
|
55
|
-
<fulfillmentInstructions><%=medication.fulfillment_instructions%></fulfillmentInstructions>
|
56
|
-
<% end %>
|
57
|
-
<% medication.fulfillment_history.each do |fh| %>
|
58
|
-
<fulfillmentHistory <%if (fh.fill_status) %> fillStatus="<%=fh.fill_status%>" <% end %>
|
59
|
-
<% if fh.fill_number %> fillNumber="<%=fh.fill_number%>" <% end %>>
|
60
|
-
<prescriptionNumber><%=fh.prescription_number%></prescriptionNumber>
|
61
|
-
<dispenseDate><%= Time.at(fh.dispense_date).utc%></dispenseDate>
|
62
|
-
<%== quantity_display fh.quantity_dispensed, :quantityDispensed %>
|
63
|
-
</fulfillmentHistory>
|
64
|
-
<% end %>
|
65
|
-
<% medication.order_information.each do |oi| %>
|
66
|
-
<orderInformation <% if oi.order_number %><%= "orderNumber=\"#{oi.order_number}\"" %> <% end %> <% if oi.fills %> <%= "fills=\"#{oi.fills}\"" %> <% end %>>
|
67
|
-
<%== quantity_display oi.quantity_ordered, "quantityOrdered" %>
|
68
|
-
<orderDateTime><%= Time.at(oi.order_date_time).utc%></orderDateTime>
|
69
|
-
<expirationDateTime><%= Time.at(oi.order_expiration_date_time).utc%></expirationDateTime>
|
70
|
-
</orderInformation>
|
71
|
-
<% end %>
|
72
|
-
</medication>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<organization>
|
2
|
-
<id><%= organization.id%></id>
|
3
|
-
<name><%= organization.name%></name>
|
4
|
-
<% organization.addresses.each do |addr| %>
|
5
|
-
<%= render :partial => "address", locals: {address: addr} %>
|
6
|
-
<% end %>
|
7
|
-
<% organization.telecoms.each do |tele| %>
|
8
|
-
<%= render :partial => "telecom", locals: {telecom: tele} %>
|
9
|
-
<% end %>
|
10
|
-
</organization>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<procedure xmlns="urn:hl7-org:greencda:c32">
|
2
|
-
<id><%= procedure.id %></id>
|
3
|
-
<%== code_display procedure, "tag_name" => "code", 'preferred_code_sets' => ['SNOMED-CT'] %>
|
4
|
-
<status><%= procedure.status%></status>
|
5
|
-
<freeText><%=procedure.free_text %></freeText>
|
6
|
-
<%== gc32_effective_time(procedure)%>
|
7
|
-
<% if procedure.site %>
|
8
|
-
<%== code_display procedure, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
|
9
|
-
<% end %>
|
10
|
-
</procedure>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<% tag_name ||= "provider" %>
|
2
|
-
<<%=tag_name%>>
|
3
|
-
<id><%=provider.id%></id>
|
4
|
-
<name>
|
5
|
-
<title><%=provider.title%></title>
|
6
|
-
<givenName><%= provider.given_name%></givenName>
|
7
|
-
<familyName><%= provider.family_name%></familyName>
|
8
|
-
</name>
|
9
|
-
<npi>1234567890</npi>
|
10
|
-
<specialty></specialty>
|
11
|
-
<% provider.addresses.each do |addr| %>
|
12
|
-
<%= render :partial => "address", locals: {address: addr} %>
|
13
|
-
<% end %>
|
14
|
-
<% provider.telecoms.each do |tele| %>
|
15
|
-
<%= render :partial => "telecom", locals: {telecom: tele} %>
|
16
|
-
<% end %>
|
17
|
-
<%= render :partial => "organization", locals: { organization: provider.organization } %>
|
18
|
-
|
19
|
-
</<%=tag_name%>>
|