health-data-standards 3.5.3 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -3
- data/README.md +10 -2
- data/lib/health-data-standards.rb +5 -28
- data/lib/health-data-standards/export/cat_1.rb +3 -2
- data/lib/health-data-standards/export/cat_1_r2.rb +11 -0
- data/lib/health-data-standards/ext/node.rb +1 -2
- data/lib/health-data-standards/import/bulk_record_importer.rb +4 -4
- data/lib/health-data-standards/import/bundle/importer.rb +62 -0
- data/lib/health-data-standards/import/c32/insurance_provider_importer.rb +10 -8
- data/lib/health-data-standards/import/cat1/patient_importer.rb +3 -3
- data/lib/health-data-standards/import/cat1/procedure_importer.rb +42 -0
- data/lib/health-data-standards/import/cda/medication_importer.rb +11 -11
- data/lib/health-data-standards/import/cda/section_importer.rb +13 -7
- data/lib/health-data-standards/models/cqm/aggregate_objects.rb +5 -1
- data/lib/health-data-standards/models/cqm/bundle.rb +5 -3
- data/lib/health-data-standards/models/cqm/measure.rb +1 -1
- data/lib/health-data-standards/models/entry.rb +5 -1
- data/lib/health-data-standards/models/record.rb +10 -0
- data/lib/health-data-standards/models/reference.rb +23 -0
- data/lib/health-data-standards/models/svs/value_set.rb +4 -3
- data/lib/health-data-standards/railtie.rb +1 -1
- data/lib/health-data-standards/tasks.rb +1 -0
- data/lib/health-data-standards/tasks/bundle.rake +84 -2
- data/lib/health-data-standards/util/vs_api.rb +40 -7
- data/lib/health-data-standards/validate/base_validator.rb +23 -0
- data/lib/health-data-standards/validate/data_validator.rb +85 -0
- data/lib/health-data-standards/validate/measure_validator.rb +127 -0
- data/lib/health-data-standards/validate/performance_rate_validator.rb +94 -0
- data/lib/health-data-standards/validate/reported_result_extractor.rb +170 -0
- data/lib/health-data-standards/validate/schema_validator.rb +24 -0
- data/lib/health-data-standards/validate/schematron/c_processor.rb +28 -0
- data/lib/health-data-standards/validate/schematron/java_processor.rb +93 -0
- data/lib/health-data-standards/validate/schematron_validator.rb +34 -0
- data/lib/health-data-standards/validate/validation_error.rb +10 -0
- data/lib/health-data-standards/validate/validators.rb +80 -0
- data/lib/hqmf-generator/fulfills.xml.erb +7 -0
- data/lib/hqmf-generator/hqmf-generator.rb +8 -3
- data/lib/hqmf-model/data_criteria.rb +3 -0
- data/lib/hqmf-model/types.rb +29 -0
- data/lib/hqmf-parser/2.0/data_criteria.rb +7 -0
- data/lib/hqmf-parser/2.0/types.rb +24 -0
- data/resources/schema/infrastructure/cda/CDA_SDTC.xsd +44 -0
- data/resources/schema/infrastructure/cda/POCD_MT000040_SDTC.xsd +1500 -0
- data/resources/schema/infrastructure/cda/SDTC.xsd +210 -0
- data/resources/schema/processable/coreschemas/NarrativeBlock.xsd +557 -0
- data/resources/schema/processable/coreschemas/datatypes-base_SDTC.xsd +1850 -0
- data/resources/schema/processable/coreschemas/datatypes.xsd +1375 -0
- data/resources/schema/processable/coreschemas/infrastructureRoot.xsd +27 -0
- data/resources/schema/processable/coreschemas/voc.xsd +2124 -0
- data/resources/schematron/iso-schematron-xslt1/ExtractSchFromRNG.xsl +75 -0
- data/resources/schematron/iso-schematron-xslt1/ExtractSchFromXSD.xsl +77 -0
- data/resources/schematron/iso-schematron-xslt1/iso_abstract_expand.xsl +297 -0
- data/resources/schematron/iso-schematron-xslt1/iso_dsdl_include.xsl +1509 -0
- data/resources/schematron/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
- data/resources/schematron/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1844 -0
- data/resources/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +605 -0
- data/resources/schematron/iso-schematron-xslt1/readme.txt +101 -0
- data/resources/schematron/iso-schematron-xslt1/schematron-skeleton-api.htm +723 -0
- data/resources/schematron/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl +75 -0
- data/resources/schematron/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl +77 -0
- data/resources/schematron/iso-schematron-xslt2/iso_abstract_expand.xsl +297 -0
- data/resources/schematron/iso-schematron-xslt2/iso_dsdl_include.xsl +1508 -0
- data/resources/schematron/iso-schematron-xslt2/iso_schematron_message_xslt2.xsl +55 -0
- data/resources/schematron/iso-schematron-xslt2/iso_schematron_skeleton_for_saxon.xsl +2299 -0
- data/resources/schematron/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl +684 -0
- data/resources/schematron/iso-schematron-xslt2/readme.txt +100 -0
- data/resources/schematron/iso-schematron-xslt2/sch-messages-cs.xhtml +56 -0
- data/resources/schematron/iso-schematron-xslt2/sch-messages-de.xhtml +57 -0
- data/resources/schematron/iso-schematron-xslt2/sch-messages-en.xhtml +57 -0
- data/resources/schematron/iso-schematron-xslt2/sch-messages-fr.xhtml +54 -0
- data/resources/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml +58 -0
- data/resources/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm +723 -0
- data/resources/schematron/qrda/cat_1/CDAR2_QRDA_I_R1_D3_2015MAY_Schematron.sch +4676 -0
- data/resources/schematron/qrda/cat_1/voc.xml +1177 -0
- data/resources/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch +4069 -0
- data/resources/schematron/qrda/cat_1_r2/voc.xml +1065 -0
- data/resources/schematron/qrda/cat_3/QRDA Category III.sch +675 -0
- data/resources/schematron/qrda/cat_3/voc.xml +21 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.26.cat1.erb +18 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +4 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +5 -1
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +1 -0
- data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +20 -0
- data/templates/cat1/_fulfills.cat1.erb +14 -0
- data/templates/cat1/_organization.cat1.erb +2 -1
- data/templates/cat1/_patient_data.cat1.erb +1 -1
- data/templates/cat1/show.cat1.erb +5 -4
- data/templates/cat3/_performance_rate.cat3.erb +5 -1
- data/templates/cat3/show.cat3.erb +1 -1
- metadata +128 -109
- data/lib/health-data-standards/export/ccr.rb +0 -417
- data/lib/health-data-standards/export/green_c32/entry.rb +0 -18
- data/lib/health-data-standards/export/green_c32/export_generator.rb +0 -23
- data/lib/health-data-standards/export/green_c32/record.rb +0 -18
- data/lib/health-data-standards/export/helper/gc32_view_helper.rb +0 -39
- data/lib/health-data-standards/import/ccr/patient_importer.rb +0 -238
- data/lib/health-data-standards/import/ccr/product_importer.rb +0 -60
- data/lib/health-data-standards/import/ccr/provider_importer.rb +0 -49
- data/lib/health-data-standards/import/ccr/result_importer.rb +0 -49
- data/lib/health-data-standards/import/ccr/section_importer.rb +0 -135
- data/lib/health-data-standards/import/ccr/simple_importer.rb +0 -30
- data/lib/health-data-standards/import/green_c32/advance_directive_importer.rb +0 -14
- data/lib/health-data-standards/import/green_c32/allergy_importer.rb +0 -20
- data/lib/health-data-standards/import/green_c32/care_goal_importer.rb +0 -26
- data/lib/health-data-standards/import/green_c32/condition_importer.rb +0 -38
- data/lib/health-data-standards/import/green_c32/encounter_importer.rb +0 -33
- data/lib/health-data-standards/import/green_c32/immunization_importer.rb +0 -23
- data/lib/health-data-standards/import/green_c32/medical_equipment_importer.rb +0 -24
- data/lib/health-data-standards/import/green_c32/medication_importer.rb +0 -68
- data/lib/health-data-standards/import/green_c32/patient_importer.rb +0 -14
- data/lib/health-data-standards/import/green_c32/procedure_importer.rb +0 -27
- data/lib/health-data-standards/import/green_c32/result_importer.rb +0 -43
- data/lib/health-data-standards/import/green_c32/section_importer.rb +0 -186
- data/lib/health-data-standards/import/green_c32/social_history_importer.rb +0 -13
- data/lib/health-data-standards/import/green_c32/support_importer.rb +0 -22
- data/lib/health-data-standards/import/green_c32/vital_sign_importer.rb +0 -21
- data/templates/gc32/_address.gc32.erb +0 -9
- data/templates/gc32/_advance_directive.gc32.erb +0 -5
- data/templates/gc32/_allergy.gc32.erb +0 -12
- data/templates/gc32/_care_goal.gc32.erb +0 -8
- data/templates/gc32/_condition.gc32.erb +0 -10
- data/templates/gc32/_encounter.gc32.erb +0 -28
- data/templates/gc32/_entry.gc32.erb +0 -3
- data/templates/gc32/_entry_attributes.gc32.erb +0 -10
- data/templates/gc32/_immunization.gc32.erb +0 -9
- data/templates/gc32/_insurance_provider.gc32.erb +0 -28
- data/templates/gc32/_medical_equipment.gc32.erb +0 -6
- data/templates/gc32/_medication.gc32.erb +0 -91
- data/templates/gc32/_name.gc32.erb +0 -11
- data/templates/gc32/_organization.gc32.erb +0 -10
- data/templates/gc32/_person_attributes.gc32.erb +0 -7
- data/templates/gc32/_procedure.gc32.erb +0 -9
- data/templates/gc32/_provider.gc32.erb +0 -9
- data/templates/gc32/_result.gc32.erb +0 -12
- data/templates/gc32/_social_history.gc32.erb +0 -6
- data/templates/gc32/_support.gc32.erb +0 -15
- data/templates/gc32/_telecom.gc32.erb +0 -1
- data/templates/gc32/_vital_sign.gc32.erb +0 -4
- data/templates/gc32/record.gc32.erb +0 -97
@@ -1,135 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module CCR
|
4
|
-
# Class that can be used to create an importer for a section of a ASTM CCR document. It usually
|
5
|
-
# operates by selecting all CCR entries in a section and then creates entries for them.
|
6
|
-
class SectionImporter
|
7
|
-
|
8
|
-
CODE_SYSTEM_MAP = {
|
9
|
-
"lnc" => "LOINC",
|
10
|
-
"loinc" => "LOINC",
|
11
|
-
"cpt" => "CPT",
|
12
|
-
"cpt-4" => "CPT",
|
13
|
-
"sct" => "SNOMED-CT",
|
14
|
-
"snomedct" => "SNOMED-CT",
|
15
|
-
"snomed-ct" => "SNOMED-CT",
|
16
|
-
"rxnorm" => "RxNorm",
|
17
|
-
"i9cdx" => "ICD-9-CM",
|
18
|
-
"icd-9-cm" => "ICD-9-CM",
|
19
|
-
"icd9-cm" => "ICD-9-CM",
|
20
|
-
"icd9" => "ICD-9-CM",
|
21
|
-
"icd10-cm" => "ICD-9-CM",
|
22
|
-
"icd10" => "ICD-9-CM",
|
23
|
-
"cvx" => "CVX",
|
24
|
-
"hcpcs" => "HCPCS",
|
25
|
-
"cdc" => "CDC-RE",
|
26
|
-
"CDC" => "CDC-RE",
|
27
|
-
"cdc-re" => "CDC-RE"
|
28
|
-
|
29
|
-
}
|
30
|
-
attr_accessor :check_for_usable
|
31
|
-
# Creates a new SectionImporter
|
32
|
-
# @param [String] entry_xpath An XPath expression that can be used to find the desired entries
|
33
|
-
# @param [String] section_name name of the section. There is some section-dependent processing
|
34
|
-
def initialize(entry_xpath, section_name)
|
35
|
-
@entry_xpath = entry_xpath
|
36
|
-
@section_name = section_name
|
37
|
-
@check_for_usable = true # Pilot tools will set this to false
|
38
|
-
end
|
39
|
-
|
40
|
-
# normalize_coding_system attempts to simplify analysis of the XML doc by
|
41
|
-
# normalizing the names of the coding systems. Input is a single "Code" node
|
42
|
-
# in the tree, and the side effect is to edit the CodingSystem subnode.
|
43
|
-
# @param [String] code - Input is a single "Code" node
|
44
|
-
def normalize_coding_system(code)
|
45
|
-
coding_system = code.xpath('./ccr:CodingSystem')[0].content.downcase
|
46
|
-
coding_system_value = CODE_SYSTEM_MAP[coding_system]
|
47
|
-
if(coding_system_value)
|
48
|
-
code.xpath('./ccr:CodingSystem')[0].content = coding_system_value
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def extract_status(parent_element, entry)
|
53
|
-
status_element = parent_element.at_xpath('./ccr:Status')
|
54
|
-
if status_element
|
55
|
-
status_text = parent_element.at_xpath('./ccr:Status/ccr:Text')
|
56
|
-
return unless status_text
|
57
|
-
status = status_text.content.downcase
|
58
|
-
if %w(active inactive resolved).include?(status)
|
59
|
-
entry.status = status.to_sym
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
# Add the codes from a <Code> block to an Entry
|
66
|
-
def extract_codes(parent_element, entry)
|
67
|
-
codes = parent_element.xpath("./ccr:Description/ccr:Code")
|
68
|
-
entry.description = ""
|
69
|
-
if (parent_element.at_xpath("./ccr:Description/ccr:Text") )
|
70
|
-
entry.description = parent_element.at_xpath("./ccr:Description/ccr:Text").content
|
71
|
-
end
|
72
|
-
if codes.size > 0
|
73
|
-
found_code = true
|
74
|
-
codes.each do |code|
|
75
|
-
normalize_coding_system(code)
|
76
|
-
entry.add_code(code.at_xpath("./ccr:Value").content, code.at_xpath("./ccr:CodingSystem").content)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# Time is supposed to be in iso8601, but seems like we need to handle simple YYYY-MM-DD as well
|
82
|
-
def extract_time(datetime)
|
83
|
-
return unless datetime
|
84
|
-
Time.parse(datetime).to_i rescue nil
|
85
|
-
end
|
86
|
-
|
87
|
-
def extract_dates(parent_element, entry)
|
88
|
-
datetime = parent_element.at_xpath('./ccr:DateTime')
|
89
|
-
if !datetime
|
90
|
-
return
|
91
|
-
end
|
92
|
-
if datetime.at_xpath('./ccr:ExactDateTime')
|
93
|
-
entry.time = extract_time(datetime.at_xpath('./ccr:ExactDateTime').content)
|
94
|
-
end
|
95
|
-
if datetime.at_xpath('./ccr:ApproximateDateTime')
|
96
|
-
entry.time = extract_time(datetime.at_xpath('./ccr:ApproximateDateTime').content)
|
97
|
-
end
|
98
|
-
if datetime.at_xpath('./ccr:DateTimeRange/ccr:BeginRange')
|
99
|
-
entry.start_time = extract_time(datetime.at_xpath('./ccr:DateTimeRange/ccr:BeginRange').content)
|
100
|
-
end
|
101
|
-
if datetime.at_xpath('./ccr:DateTimeRange/ccr:EndRange')
|
102
|
-
entry.end_time = extract_time(datetime.at_xpath('./ccr:DateTimeRange/ccr:EndRange').content)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def extract_value(parent_element, entry)
|
107
|
-
result_element = parent_element.at_xpath('./ccr:TestResult')
|
108
|
-
if result_element
|
109
|
-
value_element = result_element.at_xpath('./ccr:Value')
|
110
|
-
value = value_element ? value_element.content : nil
|
111
|
-
unit_element = result_element.at_xpath('./ccr:Units/ccr:Unit')
|
112
|
-
unit = unit_element ? unit_element.content : nil
|
113
|
-
if value
|
114
|
-
entry.set_value(value, unit)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end # extract_value
|
118
|
-
|
119
|
-
# Traverses that ASTM CCR document passed in using XPath and creates an Array of Entry
|
120
|
-
# objects based on what it finds
|
121
|
-
# @param [Nokogiri::XML::Document] doc It is expected that the root node of this document
|
122
|
-
# will have the "ccr" namespace registered to "urn:astm-org:CCR"
|
123
|
-
# measure definition
|
124
|
-
# @return [Array] will be a list of Entry objects
|
125
|
-
def create_entries(doc)
|
126
|
-
return nil
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
end # Importer
|
132
|
-
end
|
133
|
-
end # QME
|
134
|
-
|
135
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module CCR
|
4
|
-
class SimpleImporter < SectionImporter
|
5
|
-
# Traverses that ASTM CCR document passed in using XPath and creates an Array of Entry
|
6
|
-
# objects based on what it finds
|
7
|
-
# @param [Nokogiri::XML::Document] doc It is expected that the root node of this document
|
8
|
-
# will have the "ccr" namespace registered to "urn:astm-org:CCR"
|
9
|
-
# measure definition
|
10
|
-
# @return [Array] will be a list of Entry objects
|
11
|
-
def create_entries(doc)
|
12
|
-
entry_list = []
|
13
|
-
entry_elements = doc.xpath(@entry_xpath)
|
14
|
-
entry_elements.each do |entry_element|
|
15
|
-
entry = Entry.new
|
16
|
-
extract_codes(entry_element, entry)
|
17
|
-
extract_dates(entry_element, entry)
|
18
|
-
extract_status(entry_element, entry)
|
19
|
-
if @check_for_usable
|
20
|
-
entry_list << entry if entry.usable?
|
21
|
-
else
|
22
|
-
entry_list << entry
|
23
|
-
end
|
24
|
-
end
|
25
|
-
entry_list
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class AllergyImporter < SectionImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def import(allergy_xml)
|
8
|
-
allergy_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
9
|
-
allergy_element = allergy_xml.xpath("./gc32:allergy")
|
10
|
-
allergy = Allergy.new
|
11
|
-
extract_entry(allergy_element, allergy)
|
12
|
-
extract_code(allergy_element, allergy, "./gc32:type", :type)
|
13
|
-
extract_code(allergy_element, allergy, "./gc32:reaction", :reaction)
|
14
|
-
extract_code(allergy_element, allergy, "./gc32:severity", :severity)
|
15
|
-
allergy
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class CareGoalImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
end
|
9
|
-
|
10
|
-
def import(care_goal_xml)
|
11
|
-
importer = case care_goal_xml.at_xpath("/*").try(:name)
|
12
|
-
when "medication" then MedicationImporter.instance
|
13
|
-
when "immunization" then ImmunizationImporter.instance
|
14
|
-
when "procedure" then ProcedureImporter.instance
|
15
|
-
when "encounter" then EncounterImporter.instance
|
16
|
-
when "medicalEquipment" then MedicalEquipmentImporter.instance
|
17
|
-
else SectionImporter.new
|
18
|
-
end
|
19
|
-
|
20
|
-
return importer.import(care_goal_xml)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class ConditionImporter < SectionImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
def import(condition_xml)
|
12
|
-
condition_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
13
|
-
condition_element = condition_xml.xpath("./gc32:condition")
|
14
|
-
|
15
|
-
condition = Condition.new
|
16
|
-
|
17
|
-
extract_entry(condition_element, condition)
|
18
|
-
extract_cause_of_death(condition_element, condition)
|
19
|
-
extract_type(condition_element, condition)
|
20
|
-
|
21
|
-
condition
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def extract_type(condition_xml, condition)
|
27
|
-
type = condition_xml.xpath("./gc32:type").first
|
28
|
-
condition.type = extract_node_text(type)
|
29
|
-
end
|
30
|
-
|
31
|
-
def extract_cause_of_death(condition_xml, condition)
|
32
|
-
condition.cause_of_death = extract_node_attribute(condition_xml, "causeOfDeath")
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class EncounterImporter < SectionImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
end
|
10
|
-
|
11
|
-
def import(encounter_xml)
|
12
|
-
encounter = Encounter.new
|
13
|
-
encounter_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
14
|
-
encounter_element = encounter_xml.xpath("/gc32:encounter")
|
15
|
-
extract_entry(encounter_element, encounter)
|
16
|
-
extract_code(encounter_element, encounter, "./gc32:dischargeDisposition", :discharge_disposition)
|
17
|
-
extract_code(encounter_element, encounter, "./gc32:admissionType", :admit_type)
|
18
|
-
extract_code(encounter_element, encounter, "./gc32:reasonForVisit", :reason)
|
19
|
-
extract_code(encounter_element, encounter)
|
20
|
-
|
21
|
-
facility_element = encounter_element.at_xpath("./gc32:facility")
|
22
|
-
if facility_element
|
23
|
-
facility = extract_facility(facility_element)
|
24
|
-
encounter.facility = facility
|
25
|
-
end
|
26
|
-
|
27
|
-
encounter
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class ImmunizationImporter < SectionImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def import(immunization_xml)
|
8
|
-
immunization_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
9
|
-
immunization_element = immunization_xml.at_xpath("./gc32:immunization")
|
10
|
-
immunization = Immunization.new
|
11
|
-
extract_entry(immunization_element, immunization)
|
12
|
-
extract_time(immunization_element, immunization, "./gc32:effectiveTime")
|
13
|
-
extract_code(immunization_element, immunization, "./gc32:refusalReason")
|
14
|
-
series_number = extract_node_text(immunization_element.at_xpath("./gc32:seriesNumber"))
|
15
|
-
immunization.series_number = series_number.to_i if series_number
|
16
|
-
immunization.refusal_ind = extract_node_attribute(immunization_element, :refused, true)
|
17
|
-
immunization
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class MedicalEquipmentImporter < SectionImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
@value = "./gc32:quantity"
|
10
|
-
end
|
11
|
-
|
12
|
-
def import(me_xml)
|
13
|
-
me_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
14
|
-
me_element = me_xml.at_xpath("./gc32:medicalEquipment")
|
15
|
-
me = MedicalEquipment.new
|
16
|
-
extract_entry(me_element, me)
|
17
|
-
me.manufacturer = extract_node_text(me_element.at_xpath("./gc32:manufacturer")).try(:strip)
|
18
|
-
me
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class MedicationImporter < SectionImporter
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
def import(med_xml)
|
8
|
-
med_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
9
|
-
med_element = med_xml.at_xpath("./gc32:medication")
|
10
|
-
medication = Medication.new
|
11
|
-
extract_entry(med_element, medication)
|
12
|
-
extract_interval(med_element, medication, "administrationTiming")
|
13
|
-
extract_administration_timing(med_element, medication)
|
14
|
-
medication.dose = extract_quantity(med_element, "./gc32:dose")
|
15
|
-
extract_med_code_attribute(med_element, medication, :type, :typeOfMedication)
|
16
|
-
extract_med_code_attribute(med_element, medication, :statusOfMedication)
|
17
|
-
extract_med_code_attribute(med_element, medication, :route)
|
18
|
-
extract_med_code_attribute(med_element, medication, :site)
|
19
|
-
extract_dose_restriction(med_element, medication)
|
20
|
-
extract_med_code_attribute(med_element, medication, :indication)
|
21
|
-
extract_med_code_attribute(med_element, medication, :productForm)
|
22
|
-
extract_med_code_attribute(med_element, medication, :vehicle)
|
23
|
-
extract_med_code_attribute(med_element, medication, :reaction)
|
24
|
-
extract_med_code_attribute(med_element, medication, :deliveryMethod)
|
25
|
-
medication.fulfillment_instructions = extract_node_text(med_element.at_xpath("./gc32:patientInstructions"))
|
26
|
-
medication.dose_indicator = extract_node_text(med_element.at_xpath("./gc32:doseIndicator"))
|
27
|
-
medication.fulfillment_history = extract_fulfillment_history(med_element)
|
28
|
-
medication.order_information = extract_order_information(med_element)
|
29
|
-
medication
|
30
|
-
end
|
31
|
-
|
32
|
-
def extract_administration_timing(element,entry)
|
33
|
-
entry.administration_timing = {"period" => extract_quantity(element, "./gc32:administrationTiming/gc32:period"),
|
34
|
-
"institutionSpecified" => extract_node_attribute(element.at_xpath("./gc32:administrationTiming"), :institutionSpecified)}
|
35
|
-
end
|
36
|
-
|
37
|
-
def extract_dose_restriction(element, entry)
|
38
|
-
dose_element = element.at_xpath("./gc32:doseRestriction")
|
39
|
-
entry.dose_restriction = {"numerator" => extract_quantity(dose_element, "./gc32:numerator"), "denominator" => extract_quantity(dose_element,"./gc32:denominator")}
|
40
|
-
end
|
41
|
-
|
42
|
-
def extract_fulfillment_history(med_element)
|
43
|
-
med_element.xpath("./gc32:fulfillmentHistory").map do |fh_doc|
|
44
|
-
fh = FulfillmentHistory.new(quantityDispensed: extract_quantity(fh_doc, "./gc32:quantityDispensed"))
|
45
|
-
fh.prescription_number = extract_node_text(fh_doc.at_xpath("./gc32:prescriptionUmber"))
|
46
|
-
extract_time(fh_doc, fh, "./gc32:dispenseDate", :dispense_date)
|
47
|
-
fh
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def extract_order_information(med_element)
|
52
|
-
med_element.xpath("./gc32:orderInformation").map do |oi_doc|
|
53
|
-
oi = OrderInformation.new(fills: extract_node_attribute(oi_doc, :fills, true), orderNumber: extract_node_attribute(oi_doc, :orderNumber))
|
54
|
-
extract_time(oi_doc, oi, "./gc32:orderDateTime", :order_date_time)
|
55
|
-
extract_time(oi_doc, oi, "./gc32:expiresDateTime", :order_expiration_date_time)
|
56
|
-
oi
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def extract_med_code_attribute(doc, med, attribute, mongo_attribute_name=nil)
|
61
|
-
mongo_attribute_name ||= attribute
|
62
|
-
extract_code(doc, med, "./gc32:#{attribute}", mongo_attribute_name)
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module HealthDataStandards
|
2
|
-
module Import
|
3
|
-
module GreenC32
|
4
|
-
class ProcedureImporter < SectionImporter
|
5
|
-
|
6
|
-
include Singleton
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
|
-
def import(procedure_xml)
|
13
|
-
procedure_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
|
14
|
-
|
15
|
-
procedure_element = procedure_xml.xpath("./gc32:procedure")
|
16
|
-
|
17
|
-
procedure = Procedure.new
|
18
|
-
|
19
|
-
extract_entry(procedure_element, procedure)
|
20
|
-
extract_code(procedure_element, procedure, xpath="./gc32:site", attribute=:site)
|
21
|
-
procedure
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|