cqm-parsers 0.2.2 → 3.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +7 -3
  3. data/README.md +57 -5
  4. data/Rakefile +1 -0
  5. data/lib/{hqmf-parser.rb → cqm-parsers.rb} +13 -45
  6. data/lib/ext/data_element.rb +1 -1
  7. data/lib/hqmf-parser/2.0/document.rb +1 -1
  8. data/lib/hqmf-parser/2.0/population_criteria.rb +1 -1
  9. data/lib/hqmf-parser/cql/document_helpers/doc_population_helper.rb +11 -6
  10. data/lib/measure-loader/cql_loader.rb +165 -0
  11. data/lib/measure-loader/elm_dependency_finder.rb +72 -0
  12. data/lib/measure-loader/elm_parser.rb +67 -0
  13. data/lib/measure-loader/exceptions.rb +10 -0
  14. data/lib/measure-loader/helpers.rb +11 -0
  15. data/lib/measure-loader/hqmf_measure_loader.rb +170 -0
  16. data/lib/measure-loader/mat_measure_files.rb +138 -0
  17. data/lib/measure-loader/source_data_criteria_loader.rb +75 -0
  18. data/lib/measure-loader/value_set_helpers.rb +68 -0
  19. data/lib/measure-loader/vsac_value_set_loader.rb +97 -0
  20. data/lib/tasks/hqmf.rake +1 -1
  21. data/lib/util/util.rb +23 -0
  22. data/lib/util/vsac_api.rb +166 -103
  23. metadata +49 -116
  24. data/lib/ext/code.rb +0 -10
  25. data/lib/qrda-export/catI-r5/_code.mustache +0 -1
  26. data/lib/qrda-export/catI-r5/_codes.mustache +0 -10
  27. data/lib/qrda-export/catI-r5/_header.mustache +0 -28
  28. data/lib/qrda-export/catI-r5/_measure_section.mustache +0 -59
  29. data/lib/qrda-export/catI-r5/_reporting_period.mustache +0 -23
  30. data/lib/qrda-export/catI-r5/_values.mustache +0 -10
  31. data/lib/qrda-export/catI-r5/qrda1_r5.mustache +0 -137
  32. data/lib/qrda-export/catI-r5/qrda1_r5.rb +0 -125
  33. data/lib/qrda-export/catI-r5/qrda_header/_author.mustache +0 -24
  34. data/lib/qrda-export/catI-r5/qrda_header/_custodian.mustache +0 -43
  35. data/lib/qrda-export/catI-r5/qrda_header/_documentation_of_service_event.mustache +0 -82
  36. data/lib/qrda-export/catI-r5/qrda_header/_information_recipient.mustache +0 -7
  37. data/lib/qrda-export/catI-r5/qrda_header/_legal_authenticator.mustache +0 -25
  38. data/lib/qrda-export/catI-r5/qrda_header/_participant.mustache +0 -7
  39. data/lib/qrda-export/catI-r5/qrda_header/_record_target.mustache +0 -28
  40. data/lib/qrda-export/catI-r5/qrda_templates/adverse_event.mustache +0 -28
  41. data/lib/qrda-export/catI-r5/qrda_templates/allergy_intolerance.mustache +0 -28
  42. data/lib/qrda-export/catI-r5/qrda_templates/assessment_performed.mustache +0 -25
  43. data/lib/qrda-export/catI-r5/qrda_templates/communication_from_patient_to_provider.mustache +0 -29
  44. data/lib/qrda-export/catI-r5/qrda_templates/communication_from_provider_to_patient.mustache +0 -24
  45. data/lib/qrda-export/catI-r5/qrda_templates/communication_from_provider_to_provider.mustache +0 -31
  46. data/lib/qrda-export/catI-r5/qrda_templates/device_applied.mustache +0 -32
  47. data/lib/qrda-export/catI-r5/qrda_templates/device_ordered.mustache +0 -31
  48. data/lib/qrda-export/catI-r5/qrda_templates/diagnosis.mustache +0 -38
  49. data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_ordered.mustache +0 -19
  50. data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_performed.mustache +0 -29
  51. data/lib/qrda-export/catI-r5/qrda_templates/encounter_ordered.mustache +0 -24
  52. data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +0 -40
  53. data/lib/qrda-export/catI-r5/qrda_templates/immunization_administered.mustache +0 -29
  54. data/lib/qrda-export/catI-r5/qrda_templates/insurance_provider.mustache +0 -11
  55. data/lib/qrda-export/catI-r5/qrda_templates/intervention_ordered.mustache +0 -18
  56. data/lib/qrda-export/catI-r5/qrda_templates/intervention_performed.mustache +0 -25
  57. data/lib/qrda-export/catI-r5/qrda_templates/lab_test_ordered.mustache +0 -18
  58. data/lib/qrda-export/catI-r5/qrda_templates/lab_test_performed.mustache +0 -22
  59. data/lib/qrda-export/catI-r5/qrda_templates/medication_active.mustache +0 -35
  60. data/lib/qrda-export/catI-r5/qrda_templates/medication_administered.mustache +0 -31
  61. data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +0 -55
  62. data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +0 -39
  63. data/lib/qrda-export/catI-r5/qrda_templates/medication_ordered.mustache +0 -38
  64. data/lib/qrda-export/catI-r5/qrda_templates/patient_characteristic_expired.mustache +0 -16
  65. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +0 -25
  66. data/lib/qrda-export/catI-r5/qrda_templates/procedure_ordered.mustache +0 -19
  67. data/lib/qrda-export/catI-r5/qrda_templates/procedure_performed.mustache +0 -44
  68. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_admission_source.mustache +0 -6
  69. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_anatomical_location_site.mustache +0 -1
  70. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_author.mustache +0 -7
  71. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_author_participation.mustache +0 -7
  72. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_component.mustache +0 -11
  73. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_encounter_diagnosis.mustache +0 -19
  74. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_encounter_facility_location.mustache +0 -16
  75. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_mediation_frequency.mustache +0 -3
  76. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_details.mustache +0 -11
  77. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_ordinality.mustache +0 -1
  78. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_principal_diagnosis.mustache +0 -8
  79. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_reason.mustache +0 -12
  80. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_related_to.mustache +0 -6
  81. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_results.mustache +0 -21
  82. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_severity.mustache +0 -8
  83. data/lib/qrda-export/helper/cat_1_view_helper.rb +0 -142
  84. data/lib/qrda-export/helper/code_system_helper.rb +0 -77
  85. data/lib/qrda-export/helper/date_helper.rb +0 -85
  86. data/lib/qrda-import/base-importers/demographics_importer.rb +0 -43
  87. data/lib/qrda-import/base-importers/medication_importer.rb +0 -23
  88. data/lib/qrda-import/base-importers/section_importer.rb +0 -196
  89. data/lib/qrda-import/cda_identifier.rb +0 -19
  90. data/lib/qrda-import/data-element-importers/adverse_event_importer.rb +0 -24
  91. data/lib/qrda-import/data-element-importers/allergy_intolerance_importer.rb +0 -22
  92. data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +0 -24
  93. data/lib/qrda-import/data-element-importers/communication_from_patient_to_provider_importer.rb +0 -19
  94. data/lib/qrda-import/data-element-importers/communication_from_provider_to_patient_importer.rb +0 -19
  95. data/lib/qrda-import/data-element-importers/communication_from_provider_to_provider_importer.rb +0 -21
  96. data/lib/qrda-import/data-element-importers/device_applied_importer.rb +0 -24
  97. data/lib/qrda-import/data-element-importers/device_order_importer.rb +0 -19
  98. data/lib/qrda-import/data-element-importers/diagnosis_importer.rb +0 -24
  99. data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +0 -21
  100. data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +0 -31
  101. data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +0 -21
  102. data/lib/qrda-import/data-element-importers/encounter_performed_importer.rb +0 -42
  103. data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +0 -18
  104. data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +0 -19
  105. data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +0 -23
  106. data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +0 -21
  107. data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +0 -29
  108. data/lib/qrda-import/data-element-importers/medication_active_importer.rb +0 -17
  109. data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +0 -17
  110. data/lib/qrda-import/data-element-importers/medication_discharge_importer.rb +0 -19
  111. data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +0 -19
  112. data/lib/qrda-import/data-element-importers/medication_order_importer.rb +0 -16
  113. data/lib/qrda-import/data-element-importers/patient_characteristic_expired.rb +0 -22
  114. data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +0 -27
  115. data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +0 -27
  116. data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +0 -35
  117. data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +0 -16
  118. data/lib/qrda-import/entry_finder.rb +0 -20
  119. data/lib/qrda-import/entry_package.rb +0 -16
  120. data/lib/qrda-import/narrative_reference_handler.rb +0 -33
  121. data/lib/qrda-import/patient_importer.rb +0 -111
@@ -1,24 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class AdverseEventImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.146']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:entryRelationship/cda:observation/cda:value'
8
- @author_datetime_xpath = './cda:author/cda:time'
9
- @relevant_period_xpath = './cda:effectiveTime'
10
- @severity_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.8']/cda:value"
11
- @facility_xpath = "./cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
12
- @entry_class = QDM::AdverseEvent
13
- end
14
-
15
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
- adverse_event = super
17
- adverse_event.severity = code_if_present(entry_element.at_xpath(@severity_xpath))
18
- extract_facility(entry_element, adverse_event)
19
- adverse_event
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,22 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class AllergyIntoleranceImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.147']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:participant/cda:participantRole/cda:playingEntity/cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @prevalence_period_xpath = "./cda:effectiveTime"
10
- @severity_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.8']/cda:value"
11
- @entry_class = QDM::AllergyIntolerance
12
- end
13
-
14
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
15
- allergy_intolerance = super
16
- allergy_intolerance.severity = code_if_present(entry_element.at_xpath(@severity_xpath))
17
- allergy_intolerance
18
- end
19
-
20
- end
21
- end
22
- end
@@ -1,24 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class AssessmentPerformedImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.144']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @result_xpath = "./cda:value"
10
- @method_xpath = './cda:methodCode'
11
- @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
12
- @entry_class = QDM::AssessmentPerformed
13
- end
14
-
15
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
- assessment_performed = super
17
- assessment_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
18
- assessment_performed.components = extract_components(entry_element)
19
- assessment_performed
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,19 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class CommunicationFromPatientToProviderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.2']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @entry_class = QDM::CommunicationFromPatientToProvider
10
- end
11
-
12
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
- communication_from_patient_to_provider = super
14
- communication_from_patient_to_provider
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class CommunicationFromProviderToPatientImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.3']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @entry_class = QDM::CommunicationFromProviderToPatient
10
- end
11
-
12
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
- communication_from_provider_to_patient = super
14
- communication_from_provider_to_patient
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,21 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class CommunicationFromProviderToProviderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.4']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @related_to_xpath = "./sdtc:inFulfillmentOf1/sdtc:actReference"
10
- @entry_class = QDM::CommunicationFromProviderToProvider
11
- end
12
-
13
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
- communication_from_provider_to_provider = super
15
- communication_from_provider_to_provider.relatedTo = extract_related_to(entry_element)
16
- communication_from_provider_to_provider
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,24 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class DeviceAppliedImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.7']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:participant/cda:participantRole/cda:playingDevice/cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @relevant_period_xpath = "./cda:effectiveTime"
10
- @anatomical_location_site_xpath = "./cda:targetSiteCode"
11
- @anatomical_approach_site_xpath = "./cda:approachSiteCode"
12
- @entry_class = QDM::DeviceApplied
13
- end
14
-
15
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
- device_applied = super
17
- device_applied.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
18
- device_applied.anatomicalApproachSite = code_if_present(entry_element.at_xpath(@anatomical_approach_site_xpath))
19
- device_applied
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,19 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class DeviceOrderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.130']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:entryRelationship/cda:supply/cda:id'
7
- @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:participant/cda:participantRole/cda:playingDevice/cda:code"
8
- @author_datetime_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:author/cda:time"
9
- @entry_class = QDM::DeviceOrder
10
- end
11
-
12
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
- device_order = super
14
- device_order
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,24 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class DiagnosisImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.137']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:entryRelationship/cda:observation/cda:id'
7
- @code_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:value"
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @prevalence_period_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:effectiveTime"
10
- @anatomical_location_site_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:targetSiteCode"
11
- @severity_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.8']/cda:value"
12
- @entry_class = QDM::Diagnosis
13
- end
14
-
15
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
- diagnosis = super
17
- diagnosis.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
18
- diagnosis.severity = code_if_present(entry_element.at_xpath(@severity_xpath))
19
- diagnosis
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,21 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class DiagnosticStudyOrderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.17']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @method_xpath = './cda:methodCode'
10
- @entry_class = QDM::DiagnosticStudyOrder
11
- end
12
-
13
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
- diagnostic_study_order = super
15
- diagnostic_study_order.method = code_if_present(entry_element.at_xpath(@method_xpath))
16
- diagnostic_study_order
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,31 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class DiagnosticStudyPerformedImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.18']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @relevant_period_xpath = "./cda:effectiveTime"
9
- @author_datetime_xpath = "./cda:author/cda:time"
10
- @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
11
- @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
12
- @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
13
- @method_xpath = './cda:methodCode'
14
- @facility_location_xpath = "./cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']/cda:participantRole[@classCode='SDLOC']/cda:code"
15
- @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
16
- @entry_class = QDM::DiagnosticStudyPerformed
17
- end
18
-
19
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
20
- diagnostic_study_performed = super
21
- diagnostic_study_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
22
- diagnostic_study_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
23
- diagnostic_study_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
24
- diagnostic_study_performed.facilityLocation = code_if_present(entry_element.at_xpath(@facility_location_xpath))
25
- diagnostic_study_performed.components = extract_components(entry_element)
26
- diagnostic_study_performed
27
- end
28
-
29
- end
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class EncounterOrderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.132']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:entryRelationship/cda:encounter/cda:id'
7
- @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:code"
8
- @author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:author/cda:time"
9
- @facility_location_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']/cda:participantRole[@classCode='SDLOC']/cda:code"
10
- @entry_class = QDM::EncounterOrder
11
- end
12
-
13
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
- encounter_order = super
15
- encounter_order.facilityLocation = code_if_present(entry_element.at_xpath(@facility_location_xpath))
16
- encounter_order
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,42 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class EncounterPerformedImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.133']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:entryRelationship/cda:encounter/cda:id'
7
- @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:code"
8
- @relevant_period_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:effectiveTime"
9
- @author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:author/cda:time"
10
- @admission_source_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:participant/cda:participantRole[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.151']/cda:code"
11
- @discharge_disposition_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/sdtc:dischargeDispositionCode"
12
- @facility_xpath = "./cda:entryRelationship/cda:encounter/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
13
- @principal_diagnosis_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:entryRelationship/cda:observation[cda:code/@code='8319008']/cda:value"
14
- @diagnosis_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:entryRelationship/cda:act/cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.4']"
15
- @entry_class = QDM::EncounterPerformed
16
- end
17
-
18
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
19
- encounter_performed = super
20
- encounter_performed.admissionSource = code_if_present(entry_element.at_xpath(@admission_source_xpath))
21
- encounter_performed.dischargeDisposition = code_if_present(entry_element.at_xpath(@discharge_disposition_xpath))
22
- extract_facility(entry_element, encounter_performed)
23
- encounter_performed.principalDiagnosis = code_if_present(entry_element.at_xpath(@principal_diagnosis_xpath))
24
- encounter_performed.diagnoses = extract_diagnoses(entry_element)
25
- encounter_performed
26
- end
27
-
28
- private
29
-
30
- def extract_diagnoses(parent_element)
31
- diagnosis_elements = parent_element.xpath(@diagnosis_xpath)
32
- diagnosis_list = []
33
- diagnosis_elements.each do |diagnosis_element|
34
- diagnosis_value = diagnosis_element.at_xpath("./cda:value")
35
- diagnosis_list << code_if_present(diagnosis_value)
36
- end
37
- diagnosis_list.empty? ? nil : diagnosis_list
38
- end
39
-
40
- end
41
- end
42
- end
@@ -1,18 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class ImmunizationAdministeredImporter < MedicationImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.140']"))
5
- super(entry_finder)
6
- @relevant_period_xpath = nil
7
- @author_datetime_xpath = "./cda:effectiveTime"
8
- @entry_class = QDM::ImmunizationAdministered
9
- end
10
-
11
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
12
- immunization_administered = super
13
- immunization_administered
14
- end
15
-
16
- end
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class InterventionOrderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.31']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @entry_class = QDM::InterventionOrder
10
- end
11
-
12
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
- intervention_order = super
14
- intervention_order
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,23 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class InterventionPerformedImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.32']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @relevant_period_xpath = "./cda:effectiveTime"
9
- @author_datetime_xpath = "./cda:author/cda:time"
10
- @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
11
- @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
12
- @entry_class = QDM::InterventionPerformed
13
- end
14
-
15
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
- intervention_performed = super
17
- intervention_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
18
- intervention_performed
19
- end
20
-
21
- end
22
- end
23
- end
@@ -1,21 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class LaboratoryTestOrderImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.37']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @author_datetime_xpath = "./cda:author/cda:time"
9
- @method_xpath = './cda:methodCode'
10
- @entry_class = QDM::LaboratoryTestOrder
11
- end
12
-
13
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
- laboratory_test_order = super
15
- laboratory_test_order.method = code_if_present(entry_element.at_xpath(@method_xpath))
16
- laboratory_test_order
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,29 +0,0 @@
1
- module QRDA
2
- module Cat1
3
- class LaboratoryTestPerformedImporter < SectionImporter
4
- def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.38']"))
5
- super(entry_finder)
6
- @id_xpath = './cda:id'
7
- @code_xpath = './cda:code'
8
- @relevant_period_xpath = "./cda:effectiveTime"
9
- @author_datetime_xpath = "./cda:author/cda:time"
10
- @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
11
- @method_xpath = './cda:methodCode'
12
- @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
13
- @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
14
- @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
15
- @entry_class = QDM::LaboratoryTestPerformed
16
- end
17
-
18
- def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
19
- laboratory_test_performed = super
20
- laboratory_test_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
21
- laboratory_test_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
22
- laboratory_test_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
23
- laboratory_test_performed.components = extract_components(entry_element)
24
- laboratory_test_performed
25
- end
26
-
27
- end
28
- end
29
- end