health-data-standards 3.5.3 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 59b91fc289603c22a9152c776bebee15f193f70e
|
|
4
|
+
data.tar.gz: cde5d51f408a2eb237bd1ed632a2383936bc5631
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 031ae5473fe9cdb09819c2ee91ca3570fc7e2aa06e720abc3e61cd34bc96b8f32a03279f715eb3ecbd292ff935cdded1fef4b6399dcbcd10e1f9627192c8705a
|
|
7
|
+
data.tar.gz: 9df5f732d24fc1f85232e13debff907f2afb82d41850301d865279b3a185bd984cc0806b1673005e4a0fd16705b3d96b2080921c4dadcd4bb3ecf3443c0268b1
|
data/Gemfile
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
source "
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
|
|
3
3
|
gemspec :development_group => :test
|
|
4
4
|
|
|
5
5
|
group :development do
|
|
6
6
|
gem 'rake'
|
|
7
7
|
gem 'pry', '~> 0.9.10'
|
|
8
|
-
gem 'pry-nav', '~> 0.2.2'
|
|
9
|
-
|
|
8
|
+
gem 'pry-nav', '~> 0.2.2', platforms: [:ruby_21, :ruby_22]
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
group :test do
|
data/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
This is a project to generate and consume HITSP C32,
|
|
1
|
+
This is a project to generate and consume HITSP C32, QRDA Category I, and QRDA Category III.
|
|
2
2
|
|
|
3
3
|
In addition this project also contains libraries for parsing HQMF documents and for dealing with NLM valuesets.
|
|
4
4
|
|
|
5
5
|
Environment
|
|
6
6
|
===========
|
|
7
7
|
|
|
8
|
-
This project currently uses Ruby
|
|
8
|
+
This project currently uses Ruby 2.0.0, Ruby 2.1.1, Ruby 2.2.1, and JRuby 1.7.11 and is built using [Bundler](http://gembundler.com/). To get all of the dependencies for the project, first install bundler:
|
|
9
9
|
|
|
10
10
|
gem install bundler
|
|
11
11
|
|
|
@@ -29,6 +29,14 @@ Change Log
|
|
|
29
29
|
|
|
30
30
|
* Upgrading to mongoid 4
|
|
31
31
|
|
|
32
|
+
* 3.6.0
|
|
33
|
+
|
|
34
|
+
* Support for QRDA Cat I R3
|
|
35
|
+
* Additional validators for QRDA Cat I/III
|
|
36
|
+
* Removed GC32 & CCR code
|
|
37
|
+
* Support latest QDM changes
|
|
38
|
+
* Additional support for running in JRuby
|
|
39
|
+
|
|
32
40
|
3.5.3 - January 20, 2015
|
|
33
41
|
|
|
34
42
|
* Support for 2014 QRDA Errata Release
|
|
@@ -26,15 +26,9 @@ require_relative 'health-data-standards/export/view_helper'
|
|
|
26
26
|
require_relative 'health-data-standards/export/rendering_context'
|
|
27
27
|
require_relative 'health-data-standards/export/c32'
|
|
28
28
|
require_relative 'health-data-standards/export/ccda'
|
|
29
|
-
require_relative 'health-data-standards/export/ccr'
|
|
30
29
|
require_relative 'health-data-standards/export/csv'
|
|
31
30
|
require_relative 'health-data-standards/export/hdata/metadata'
|
|
32
31
|
|
|
33
|
-
require_relative 'health-data-standards/export/helper/gc32_view_helper'
|
|
34
|
-
require_relative 'health-data-standards/export/green_c32/record'
|
|
35
|
-
require_relative 'health-data-standards/export/green_c32/entry'
|
|
36
|
-
require_relative 'health-data-standards/export/green_c32/export_generator'
|
|
37
|
-
|
|
38
32
|
require_relative 'health-data-standards/import/provider_import_utils'
|
|
39
33
|
require_relative 'health-data-standards/import/hdata/metadata_importer'
|
|
40
34
|
|
|
@@ -43,6 +37,7 @@ require_relative 'health-data-standards/models/result_value'
|
|
|
43
37
|
require_relative 'health-data-standards/models/coded_result_value'
|
|
44
38
|
require_relative 'health-data-standards/models/physical_quantity_result_value'
|
|
45
39
|
require_relative 'health-data-standards/models/cda_identifier'
|
|
40
|
+
require_relative 'health-data-standards/models/reference'
|
|
46
41
|
require_relative 'health-data-standards/models/entry'
|
|
47
42
|
require_relative 'health-data-standards/models/allergy'
|
|
48
43
|
require_relative 'health-data-standards/models/encounter'
|
|
@@ -99,6 +94,7 @@ require_relative 'health-data-standards/export/helper/html_view_helper'
|
|
|
99
94
|
require_relative 'health-data-standards/export/html'
|
|
100
95
|
require_relative 'health-data-standards/export/helper/cat1_view_helper'
|
|
101
96
|
require_relative 'health-data-standards/export/cat_1'
|
|
97
|
+
require_relative 'health-data-standards/export/cat_1_r2'
|
|
102
98
|
require_relative 'health-data-standards/export/cat_3'
|
|
103
99
|
|
|
104
100
|
require_relative 'health-data-standards/import/cda/narrative_reference_handler'
|
|
@@ -122,13 +118,6 @@ require_relative 'health-data-standards/import/c32/patient_importer'
|
|
|
122
118
|
require_relative 'health-data-standards/import/c32/insurance_provider_importer'
|
|
123
119
|
require_relative 'health-data-standards/import/c32/care_goal_importer'
|
|
124
120
|
|
|
125
|
-
require_relative 'health-data-standards/import/ccr/patient_importer'
|
|
126
|
-
require_relative 'health-data-standards/import/ccr/provider_importer'
|
|
127
|
-
require_relative 'health-data-standards/import/ccr/section_importer'
|
|
128
|
-
require_relative 'health-data-standards/import/ccr/result_importer'
|
|
129
|
-
require_relative 'health-data-standards/import/ccr/simple_importer'
|
|
130
|
-
require_relative 'health-data-standards/import/ccr/product_importer'
|
|
131
|
-
|
|
132
121
|
require_relative 'health-data-standards/import/ccda/patient_importer'
|
|
133
122
|
require_relative 'health-data-standards/import/ccda/allergy_importer'
|
|
134
123
|
require_relative 'health-data-standards/import/ccda/condition_importer'
|
|
@@ -142,21 +131,6 @@ require_relative 'health-data-standards/import/ccda/care_goal_importer'
|
|
|
142
131
|
require_relative 'health-data-standards/import/ccda/medical_equipment_importer'
|
|
143
132
|
require_relative 'health-data-standards/import/ccda/insurance_provider_importer'
|
|
144
133
|
|
|
145
|
-
require_relative 'health-data-standards/import/green_c32/section_importer'
|
|
146
|
-
require_relative 'health-data-standards/import/green_c32/result_importer'
|
|
147
|
-
require_relative 'health-data-standards/import/green_c32/condition_importer'
|
|
148
|
-
require_relative 'health-data-standards/import/green_c32/vital_sign_importer'
|
|
149
|
-
require_relative 'health-data-standards/import/green_c32/procedure_importer'
|
|
150
|
-
require_relative 'health-data-standards/import/green_c32/encounter_importer'
|
|
151
|
-
require_relative 'health-data-standards/import/green_c32/medication_importer'
|
|
152
|
-
require_relative 'health-data-standards/import/green_c32/allergy_importer'
|
|
153
|
-
require_relative 'health-data-standards/import/green_c32/social_history_importer'
|
|
154
|
-
require_relative 'health-data-standards/import/green_c32/immunization_importer'
|
|
155
|
-
require_relative 'health-data-standards/import/green_c32/support_importer'
|
|
156
|
-
require_relative 'health-data-standards/import/green_c32/advance_directive_importer'
|
|
157
|
-
require_relative 'health-data-standards/import/green_c32/medical_equipment_importer'
|
|
158
|
-
require_relative 'health-data-standards/import/green_c32/care_goal_importer'
|
|
159
|
-
|
|
160
134
|
require_relative 'health-data-standards/import/cat1/gestational_age_importer'
|
|
161
135
|
require_relative 'health-data-standards/import/cat1/procedure_intolerance_importer'
|
|
162
136
|
require_relative 'health-data-standards/import/cat1/procedure_performed_importer'
|
|
@@ -176,11 +150,14 @@ require_relative 'health-data-standards/import/cat1/lab_result_importer'
|
|
|
176
150
|
require_relative 'health-data-standards/import/cat1/ecog_status_importer'
|
|
177
151
|
require_relative 'health-data-standards/import/cat1/symptom_active_importer'
|
|
178
152
|
require_relative 'health-data-standards/import/cat1/insurance_provider_importer'
|
|
153
|
+
require_relative 'health-data-standards/import/cat1/procedure_importer'
|
|
179
154
|
|
|
180
155
|
require_relative 'health-data-standards/import/bundle/importer'
|
|
181
156
|
|
|
182
157
|
require_relative 'health-data-standards/import/bulk_record_importer'
|
|
183
158
|
|
|
159
|
+
require_relative 'health-data-standards/validate/validators'
|
|
160
|
+
|
|
184
161
|
module HealthDataStandards
|
|
185
162
|
class << self
|
|
186
163
|
attr_accessor :logger
|
|
@@ -9,9 +9,10 @@ module HealthDataStandards
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
@@vs_map = nil
|
|
12
|
-
def export(patient, measures, start_date, end_date, header=nil)
|
|
12
|
+
def export(patient, measures, start_date, end_date, header=nil, r2_compatibility=false)
|
|
13
13
|
@rendering_context.render(:template => 'show', :locals => {:patient => patient, :measures => measures,
|
|
14
|
-
|
|
14
|
+
:start_date => start_date, :end_date => end_date, :header => header,
|
|
15
|
+
:r2_compatibility => r2_compatibility})
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# require_relative 'cat_1'
|
|
2
|
+
|
|
3
|
+
module HealthDataStandards
|
|
4
|
+
module Export
|
|
5
|
+
class Cat1R2 < Cat1
|
|
6
|
+
def export(patient, measures, start_date, end_date, header=nil, r2_compatibiliy=true)
|
|
7
|
+
super(patient, measures, start_date, end_date, header, r2_compatibiliy)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -10,7 +10,6 @@ if RUBY_PLATFORM.include?('java')
|
|
|
10
10
|
NAMESPACES = {'cda' => 'urn:hl7-org:v3',
|
|
11
11
|
'sdtc' => 'urn:hl7-org:sdtc',
|
|
12
12
|
'gc32' => 'urn:hl7-org:greencda:c32',
|
|
13
|
-
'ccr' => 'urn:astm-org:CCR',
|
|
14
13
|
'vs' => 'urn:ihe:iti:svs:2008',
|
|
15
14
|
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
|
16
15
|
'hrf-md' => 'http://www.hl7.org/schemas/hdata/2009/11/metadata',
|
|
@@ -43,4 +42,4 @@ if RUBY_PLATFORM.include?('java')
|
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
44
|
end
|
|
46
|
-
end
|
|
45
|
+
end
|
|
@@ -7,7 +7,7 @@ module HealthDataStandards
|
|
|
7
7
|
failed_dir ||= File.join(source_dir, '../', 'failed_imports')
|
|
8
8
|
files = Dir.glob(File.join(source_dir, '*.*'))
|
|
9
9
|
files.each do |file|
|
|
10
|
-
|
|
10
|
+
self.import_file(file,File.new(file).read,failed_dir)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -27,7 +27,7 @@ module HealthDataStandards
|
|
|
27
27
|
end
|
|
28
28
|
next if entry.directory?
|
|
29
29
|
data = zipfile.read(entry.name)
|
|
30
|
-
|
|
30
|
+
self.import_file(entry.name,data,failed_dir)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -60,9 +60,9 @@ module HealthDataStandards
|
|
|
60
60
|
begin
|
|
61
61
|
ext = File.extname(name)
|
|
62
62
|
if ext == ".json"
|
|
63
|
-
|
|
63
|
+
self.import_json(data)
|
|
64
64
|
else
|
|
65
|
-
|
|
65
|
+
self.import(data)
|
|
66
66
|
end
|
|
67
67
|
rescue
|
|
68
68
|
FileUtils.mkdir_p(File.dirname(File.join(failed_dir,name)))
|
|
@@ -132,12 +132,74 @@ module HealthDataStandards
|
|
|
132
132
|
entries.each_with_index do |entry, index|
|
|
133
133
|
patient = Record.new(unpack_json(entry))
|
|
134
134
|
patient['bundle_id'] = bundle.id
|
|
135
|
+
|
|
136
|
+
#index
|
|
137
|
+
source_data_with_references = Array.new
|
|
138
|
+
source_data_reference_id_hash = Hash.new
|
|
139
|
+
source_data_id_hash = Hash.new
|
|
140
|
+
index = 0
|
|
141
|
+
#loops through source data criteria, if there are references adds ids to hash
|
|
142
|
+
patient['source_data_criteria'].each do |data_criteria|
|
|
143
|
+
source_data_id_hash[data_criteria['criteria_id']] = index
|
|
144
|
+
if data_criteria['references'] != nil
|
|
145
|
+
source_data_with_references.push(index)
|
|
146
|
+
reference_ids = Array.new
|
|
147
|
+
data_criteria['references'].each do |reference|
|
|
148
|
+
reference_ids.push(reference['reference_id'])
|
|
149
|
+
end
|
|
150
|
+
source_data_reference_id_hash[data_criteria['criteria_id']] = reference_ids
|
|
151
|
+
end
|
|
152
|
+
index = index + 1
|
|
153
|
+
end
|
|
154
|
+
#if there are references, id references are reestablished
|
|
155
|
+
if source_data_with_references.size > 0
|
|
156
|
+
reconnect_references(patient, source_data_with_references, source_data_reference_id_hash, source_data_id_hash)
|
|
157
|
+
end
|
|
135
158
|
patient.save
|
|
136
159
|
report_progress('patients', (index*100/entries.length)) if index%10 == 0
|
|
137
160
|
end
|
|
138
161
|
puts "\rLoading: Patients Complete "
|
|
139
162
|
end
|
|
140
163
|
|
|
164
|
+
#bit of a hack here, equality is made by date and codes
|
|
165
|
+
def self.compare_and_update_entries(patient, reference_id, start_date, end_date, codes)
|
|
166
|
+
patient.entries.each do |entry|
|
|
167
|
+
# if dates and codes match then replace id with original
|
|
168
|
+
if compare_dates(entry, start_date, end_date)
|
|
169
|
+
if entry.codes == codes
|
|
170
|
+
entry._id = BSON::ObjectId.from_string(reference_id)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def self.compare_dates(entry, start_date, end_date)
|
|
177
|
+
if entry.start_time * 1000 == start_date
|
|
178
|
+
if entry.end_time == nil
|
|
179
|
+
if end_date == nil
|
|
180
|
+
return true
|
|
181
|
+
else
|
|
182
|
+
return false
|
|
183
|
+
end
|
|
184
|
+
else entry.end_time * 1000 == end_date
|
|
185
|
+
return true
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
return false
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def self.reconnect_references(patient, source_data_with_references, source_data_reference_id_hash, source_data_id_hash)
|
|
192
|
+
|
|
193
|
+
source_data_with_references.each do |source_data_with_reference|
|
|
194
|
+
#only do this with the references
|
|
195
|
+
sdc = patient['source_data_criteria'][source_data_with_reference]
|
|
196
|
+
source_data_reference_id_hash[sdc['criteria_id']].each do |ref_criteria_id|
|
|
197
|
+
ref_sdc = patient['source_data_criteria'][source_data_id_hash[ref_criteria_id]]
|
|
198
|
+
compare_and_update_entries(patient, ref_sdc['coded_entry_id'],ref_sdc['start_date'],ref_sdc['end_date'],ref_sdc['codes'])
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
141
203
|
def self.unpack_and_store_valuesets(zip, bundle)
|
|
142
204
|
entries = zip.glob(SOURCE_ROOTS[:valuesets])
|
|
143
205
|
entries.each_with_index do |entry, index|
|
|
@@ -2,13 +2,13 @@ module HealthDataStandards
|
|
|
2
2
|
module Import
|
|
3
3
|
module C32
|
|
4
4
|
class InsuranceProviderImporter < CDA::SectionImporter
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
def initialize(entry_finder=CDA::EntryFinder.new("//cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.26']"))
|
|
7
7
|
super(entry_finder)
|
|
8
8
|
@check_for_usable = false # needs to be this way becase InsuranceProvider does not respond
|
|
9
9
|
# to usable?
|
|
10
10
|
end
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def create_entry(payer_element, nrh = CDA::NarrativeReferenceHandler.new)
|
|
13
13
|
ip = InsuranceProvider.new
|
|
14
14
|
type = extract_code(payer_element, "./cda:code")
|
|
@@ -21,25 +21,27 @@ module HealthDataStandards
|
|
|
21
21
|
name = payer_element.at_xpath("./cda:entryRelationship[@typeCode='REFR']/cda:act[@classCode='ACT' and @moodCode='DEF']/cda:text")
|
|
22
22
|
ip.name = name.try(:text)
|
|
23
23
|
patient_element = member_info_element.at_xpath("./cda:participantRole[@classCode='PAT']")
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if patient_element
|
|
25
|
+
ip.member_id = patient_element.at_xpath("./cda:id")
|
|
26
|
+
ip.relationship = extract_code(patient_element, "./cda:code")
|
|
27
|
+
end
|
|
26
28
|
ip.financial_responsibility_type = extract_code(payer_element, "./cda:performer/cda:assignedEntity/cda:code")
|
|
27
29
|
ip
|
|
28
30
|
end
|
|
29
|
-
|
|
31
|
+
|
|
30
32
|
def extract_guarantors(guarantor_elements)
|
|
31
33
|
guarantor_elements.map do |guarantor_element|
|
|
32
34
|
guarantor = Guarantor.new
|
|
33
|
-
extract_dates(guarantor_element, guarantor,
|
|
35
|
+
extract_dates(guarantor_element, guarantor, "time")
|
|
34
36
|
guarantor_entity = guarantor_element.at_xpath("./cda:assignedEntity")
|
|
35
37
|
guarantor.person = import_person(guarantor_entity.at_xpath("./cda:assignedPerson"))
|
|
36
38
|
guarantor.organization = import_organization(guarantor_entity.at_xpath("./cda:representedOrganization"))
|
|
37
39
|
guarantor
|
|
38
40
|
end
|
|
39
41
|
end
|
|
40
|
-
|
|
42
|
+
|
|
41
43
|
end
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
|
-
|
|
46
|
+
|
|
45
47
|
end
|
|
@@ -35,7 +35,7 @@ module HealthDataStandards
|
|
|
35
35
|
generate_importer(CDA::ProcedureImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.31']", '2.16.840.1.113883.3.560.1.45', 'ordered'), #intervention ordered
|
|
36
36
|
generate_importer(CDA::ProcedureImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.32']", '2.16.840.1.113883.3.560.1.46', 'performed'), #intervention performed
|
|
37
37
|
generate_importer(CDA::ProcedureImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.34']", '2.16.840.1.113883.3.560.1.47'), #intervention result
|
|
38
|
-
generate_importer(
|
|
38
|
+
generate_importer(Cat1::ProcedureImporter, nil, '2.16.840.1.113883.3.560.1.129'), #comm from provider to provider
|
|
39
39
|
generate_importer(CDA::ProcedureImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.2']", '2.16.840.1.113883.3.560.1.30'), #comm from patient to provider
|
|
40
40
|
generate_importer(ProcedureOrderImporter, nil, '2.16.840.1.113883.3.560.1.62', 'ordered'),
|
|
41
41
|
generate_importer(ProcedurePerformedImporter, "./cda:entry/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.64']", '2.16.840.1.113883.3.560.1.6'),
|
|
@@ -56,7 +56,8 @@ module HealthDataStandards
|
|
|
56
56
|
generate_importer(CDA::ResultImporter, "./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.38']", '2.16.840.1.113883.3.560.1.5', 'performed'), #lab performed
|
|
57
57
|
generate_importer(CDA::ResultImporter, "./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.34']", '2.16.840.1.113883.3.560.1.47'), #intervention result
|
|
58
58
|
generate_importer(CDA::ResultImporter, "./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.57']", '2.16.840.1.113883.3.560.1.18'), #physical exam finding
|
|
59
|
-
generate_importer(CDA::ResultImporter, "./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.28']", '2.16.840.1.113883.3.560.1.88'), #functional status result
|
|
59
|
+
generate_importer(CDA::ResultImporter, "./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.28']", '2.16.840.1.113883.3.560.1.88'), #functional status result
|
|
60
|
+
generate_importer(CDA::ResultImporter, "./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.26']", '2.16.840.1.113883.3.560.1.85'), #functional status, performed
|
|
60
61
|
generate_importer(LabResultImporter, nil, '2.16.840.1.113883.3.560.1.12')] #lab result
|
|
61
62
|
|
|
62
63
|
@section_importers[:encounters] = [generate_importer(EncounterPerformedImporter, "./cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']", '2.16.840.1.113883.3.560.1.79', 'performed'), #encounter performed
|
|
@@ -85,7 +86,6 @@ module HealthDataStandards
|
|
|
85
86
|
nrh.build_id_map(doc)
|
|
86
87
|
@section_importers.each do |section, entry_packages|
|
|
87
88
|
entry_packages.each do |entry_package|
|
|
88
|
-
# binding.pry if section == :results
|
|
89
89
|
record.send(section) << entry_package.package_entries(context, nrh)
|
|
90
90
|
end
|
|
91
91
|
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module HealthDataStandards
|
|
2
|
+
module Import
|
|
3
|
+
module Cat1
|
|
4
|
+
class ProcedureImporter < CDA::ProcedureImporter
|
|
5
|
+
|
|
6
|
+
def initialize(entry_finder=CDA::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.4']"))
|
|
7
|
+
super(entry_finder)
|
|
8
|
+
@reference_xpath = "./sdtc:inFulfillmentOf1"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create_entry(entry_element, nrh = CDA::NarrativeReferenceHandler.new)
|
|
12
|
+
procedure = super
|
|
13
|
+
extract_references(entry_element, procedure)
|
|
14
|
+
procedure
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def extract_references(parent_element, entry)
|
|
20
|
+
parent_element.xpath(@reference_xpath).each do |ref_xml|
|
|
21
|
+
ref = Reference.new
|
|
22
|
+
ref.type = case ref_xml.at_xpath("./@typeCode").value
|
|
23
|
+
when "FLFS"
|
|
24
|
+
"fulfills"
|
|
25
|
+
end
|
|
26
|
+
ref.referenced_type = case ref_xml.at_xpath("./sdtc:actReference/@classCode").value
|
|
27
|
+
when "ACT"
|
|
28
|
+
"Procedure"
|
|
29
|
+
end
|
|
30
|
+
id_element = ref_xml.at_xpath("./sdtc:actReference/sdtc:id")
|
|
31
|
+
identifier = CDAIdentifier.new
|
|
32
|
+
identifier.root = id_element['root']
|
|
33
|
+
identifier.extension = id_element['extension']
|
|
34
|
+
ref.referenced_id = identifier
|
|
35
|
+
entry.references << ref
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module HealthDataStandards
|
|
2
2
|
module Import
|
|
3
3
|
module CDA
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
# TODO: Coded Product Name, Free Text Product Name, Coded Brand Name and Free Text Brand name need to be pulled out separatelty
|
|
6
6
|
# This would mean overriding extract_codes
|
|
7
7
|
# TODO: Patient Instructions needs to be implemented. Will likely be a reference to the narrative section
|
|
@@ -24,26 +24,26 @@ module HealthDataStandards
|
|
|
24
24
|
|
|
25
25
|
def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
|
|
26
26
|
medication = super
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
extract_administration_timing(entry_element, medication)
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
medication.route = extract_code(entry_element, "./cda:routeCode")
|
|
31
31
|
medication.dose = extract_scalar(entry_element, "./cda:doseQuantity")
|
|
32
32
|
medication.site = extract_code(entry_element, "./cda:approachSiteCode", 'SNOMED-CT')
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
extract_dose_restriction(entry_element, medication)
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
medication.product_form = extract_code(entry_element, "./cda:administrationUnitCode", 'NCI Thesaurus')
|
|
37
37
|
medication.delivery_method = extract_code(entry_element, "./cda:code", 'SNOMED-CT')
|
|
38
38
|
medication.type_of_medication = extract_code(entry_element, @type_of_med_xpath, 'SNOMED-CT') if @type_of_med_xpath
|
|
39
39
|
medication.indication = extract_code(entry_element, @indication_xpath, 'SNOMED-CT')
|
|
40
40
|
medication.vehicle = extract_code(entry_element, @vehicle_xpath, 'SNOMED-CT')
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
extract_order_information(entry_element, medication)
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
extract_fulfillment_history(entry_element, medication)
|
|
45
45
|
extract_negation(entry_element, medication)
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
medication
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -68,20 +68,20 @@ module HealthDataStandards
|
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
def extract_order_information(parent_element, medication)
|
|
73
73
|
order_elements = parent_element.xpath("./cda:entryRelationship[@typeCode='REFR']/cda:supply[@moodCode='INT']")
|
|
74
74
|
if order_elements
|
|
75
75
|
order_elements.each do |order_element|
|
|
76
76
|
order_information = OrderInformation.new
|
|
77
77
|
actor_element = order_element.at_xpath('./cda:author')
|
|
78
|
-
if actor_element
|
|
78
|
+
if actor_element && Mongoid.configured? # Also make sure we can look up providers
|
|
79
79
|
order_information.provider = ProviderImporter.instance.extract_provider(actor_element, "assignedAuthor")
|
|
80
80
|
end
|
|
81
81
|
order_information.order_number = order_element.at_xpath('./cda:id').try(:[], 'root')
|
|
82
82
|
order_information.fills = order_element.at_xpath('./cda:repeatNumber').try(:[], 'value').try(:to_i)
|
|
83
83
|
order_information.quantity_ordered = extract_scalar(order_element, "./cda:quantity")
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
medication.orderInformation << order_information
|
|
86
86
|
end
|
|
87
87
|
end
|