cqm-reports 2.0.0 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +1 -1
  3. data/README.md +8 -6
  4. data/lib/cqm_report.rb +1 -3
  5. data/lib/qrda-export/catI-r5/qrda_templates/allergy_intolerance.mustache +1 -6
  6. data/lib/qrda-export/catI-r5/qrda_templates/communication_performed.mustache +6 -4
  7. data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +4 -4
  8. data/lib/qrda-export/catI-r5/qrda_templates/device_recommended.mustache +4 -4
  9. data/lib/qrda-export/catI-r5/qrda_templates/diagnosis.mustache +1 -6
  10. data/lib/qrda-export/catI-r5/qrda_templates/encounter_order.mustache +4 -4
  11. data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +4 -4
  12. data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +4 -4
  13. data/lib/qrda-export/catI-r5/qrda_templates/immunization_administered.mustache +1 -1
  14. data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +0 -3
  15. data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +4 -4
  16. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +4 -0
  17. data/lib/qrda-export/catI-r5/qrda_templates/symptom.mustache +1 -6
  18. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_details.mustache +2 -2
  19. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_details.mustache +5 -1
  20. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache +1 -1
  21. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_results.mustache +0 -12
  22. data/lib/qrda-export/helper/aggregate_object_helper.rb +1 -1
  23. data/lib/qrda-export/helper/cat1_view_helper.rb +9 -0
  24. data/lib/qrda-import/base-importers/section_importer.rb +30 -26
  25. data/lib/qrda-import/data-element-importers/assessment_order_importer.rb +2 -0
  26. data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +2 -0
  27. data/lib/qrda-import/data-element-importers/assessment_recommended_importer.rb +2 -0
  28. data/lib/qrda-import/data-element-importers/communication_performed_importer.rb +1 -2
  29. data/lib/qrda-import/data-element-importers/device_applied_importer.rb +2 -0
  30. data/lib/qrda-import/data-element-importers/device_order_importer.rb +2 -0
  31. data/lib/qrda-import/data-element-importers/device_recommended_importer.rb +2 -0
  32. data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +2 -0
  33. data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +2 -0
  34. data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +2 -0
  35. data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +2 -0
  36. data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +2 -0
  37. data/lib/qrda-import/data-element-importers/immunization_order_importer.rb +2 -0
  38. data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +2 -0
  39. data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +2 -0
  40. data/lib/qrda-import/data-element-importers/intervention_recommended_importer.rb +2 -0
  41. data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +2 -0
  42. data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +2 -0
  43. data/lib/qrda-import/data-element-importers/laboratory_test_recommended_importer.rb +2 -0
  44. data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +2 -0
  45. data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +0 -1
  46. data/lib/qrda-import/data-element-importers/medication_order_importer.rb +2 -0
  47. data/lib/qrda-import/data-element-importers/patient_characteristic_clinical_trial_participant_importer.rb +2 -0
  48. data/lib/qrda-import/data-element-importers/physical_exam_order_importer.rb +2 -0
  49. data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +2 -0
  50. data/lib/qrda-import/data-element-importers/physical_exam_recommended_importer.rb +2 -0
  51. data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +2 -0
  52. data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +2 -0
  53. data/lib/qrda-import/data-element-importers/procedure_recommended_importer.rb +2 -0
  54. data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +0 -1
  55. data/lib/qrda-import/data-element-importers/substance_order_importer.rb +2 -0
  56. data/lib/qrda-import/data-element-importers/substance_recommended_importer.rb +2 -0
  57. data/lib/qrda-import/patient_importer.rb +28 -7
  58. metadata +16 -17
  59. data/lib/ext/code.rb +0 -11
  60. data/lib/ext/data_element.rb +0 -24
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::AssessmentOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  assessment_order = super
15
+ assessment_order.reason = extract_reason(entry_element)
14
16
  assessment_order
15
17
  end
16
18
 
@@ -9,6 +9,7 @@ module QRDA
9
9
  @result_xpath = "./cda:value"
10
10
  @method_xpath = './cda:methodCode'
11
11
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
12
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
12
13
  @entry_class = QDM::AssessmentPerformed
13
14
  end
14
15
 
@@ -16,6 +17,7 @@ module QRDA
16
17
  assessment_performed = super
17
18
  assessment_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
18
19
  assessment_performed.components = extract_components(entry_element)
20
+ assessment_performed.reason = extract_reason(entry_element)
19
21
  assessment_performed
20
22
  end
21
23
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::AssessmentRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  assessment_recommended = super
15
+ assessment_recommended.reason = extract_reason(entry_element)
14
16
  assessment_recommended
15
17
  end
16
18
 
@@ -3,9 +3,8 @@ module QRDA
3
3
  class CommunicationPerformedImporter < SectionImporter
4
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.156']"))
5
5
  super(entry_finder)
6
- @entry_does_not_have_reason = true
7
6
  @id_xpath = './cda:id'
8
- @code_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
7
+ @code_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
8
  @author_datetime_xpath = "./cda:author/cda:time"
10
9
  @relevant_period_xpath = "./cda:effectiveTime"
11
10
  @related_to_xpath = "./sdtc:inFulfillmentOf1/sdtc:actReference"
@@ -8,12 +8,14 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @relevant_period_xpath = "./cda:effectiveTime"
10
10
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::DeviceApplied
12
13
  end
13
14
 
14
15
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
15
16
  device_applied = super
16
17
  device_applied.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
18
+ device_applied.reason = extract_reason(entry_element)
17
19
  device_applied
18
20
  end
19
21
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:id"
7
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
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
+ @reason_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::DeviceOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  device_order = super
15
+ device_order.reason = extract_reason(entry_element)
14
16
  device_order
15
17
  end
16
18
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:id"
7
7
  @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:participant/cda:participantRole/cda:playingDevice/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::DeviceRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  device_recommended = super
15
+ device_recommended.reason = extract_reason(entry_element)
14
16
  device_recommended
15
17
  end
16
18
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::DiagnosticStudyOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  diagnostic_study_order = super
15
+ diagnostic_study_order.reason = extract_reason(entry_element)
14
16
  diagnostic_study_order
15
17
  end
16
18
 
@@ -13,6 +13,7 @@ module QRDA
13
13
  @method_xpath = './cda:methodCode'
14
14
  @facility_locations_xpath = "./cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
15
15
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
16
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
16
17
  @entry_class = QDM::DiagnosticStudyPerformed
17
18
  end
18
19
 
@@ -24,6 +25,7 @@ module QRDA
24
25
  diagnostic_study_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
25
26
  diagnostic_study_performed.facilityLocation = extract_facility_locations(entry_element)[0]
26
27
  diagnostic_study_performed.components = extract_components(entry_element)
28
+ diagnostic_study_performed.reason = extract_reason(entry_element)
27
29
  diagnostic_study_performed
28
30
  end
29
31
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:code"
8
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
9
  @facility_locations_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']"
10
+ @reason_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::EncounterOrder
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  encounter_order = super
15
16
  encounter_order.facilityLocation = extract_facility_locations(entry_element)[0]
17
+ encounter_order.reason = extract_reason(entry_element)
16
18
  encounter_order
17
19
  end
18
20
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:author/cda:time"
9
9
  @facility_locations_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
10
+ @reason_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::EncounterRecommended
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  encounter_recommended = super
15
16
  encounter_recommended.facilityLocation = extract_facility_locations(entry_element)[0]
17
+ encounter_recommended.reason = extract_reason(entry_element)
16
18
  encounter_recommended
17
19
  end
18
20
 
@@ -8,6 +8,7 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:effectiveTime"
9
9
  @dosage_xpath = "./cda:doseQuantity"
10
10
  @route_xpath = "./cda:routeCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::ImmunizationAdministered
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module QRDA
15
16
  immunization_administered = super
16
17
  immunization_administered.dosage = extract_scalar(entry_element, @dosage_xpath)
17
18
  immunization_administered.route = code_if_present(entry_element.at_xpath(@route_xpath))
19
+ immunization_administered.reason = extract_reason(entry_element)
18
20
  immunization_administered
19
21
  end
20
22
 
@@ -10,6 +10,7 @@ module QRDA
10
10
  @dosage_xpath = "./cda:doseQuantity"
11
11
  @supply_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.99']/cda:quantity"
12
12
  @route_xpath = "./cda:routeCode"
13
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
13
14
  @entry_class = QDM::ImmunizationOrder
14
15
  end
15
16
 
@@ -19,6 +20,7 @@ module QRDA
19
20
  immunization_order.dosage = extract_scalar(entry_element, @dosage_xpath)
20
21
  immunization_order.supply = extract_scalar(entry_element, @supply_xpath)
21
22
  immunization_order.route = code_if_present(entry_element.at_xpath(@route_xpath))
23
+ immunization_order.reason = extract_reason(entry_element)
22
24
  immunization_order
23
25
  end
24
26
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::InterventionOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  intervention_order = super
15
+ intervention_order.reason = extract_reason(entry_element)
14
16
  intervention_order
15
17
  end
16
18
 
@@ -9,12 +9,14 @@ module QRDA
9
9
  @author_datetime_xpath = "./cda:author/cda:time"
10
10
  @result_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:value"
11
11
  @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
12
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
12
13
  @entry_class = QDM::InterventionPerformed
13
14
  end
14
15
 
15
16
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
17
  intervention_performed = super
17
18
  intervention_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
19
+ intervention_performed.reason = extract_reason(entry_element)
18
20
  intervention_performed
19
21
  end
20
22
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::InterventionRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  intervention_recommended = super
15
+ intervention_recommended.reason = extract_reason(entry_element)
14
16
  intervention_recommended
15
17
  end
16
18
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::LaboratoryTestOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  laboratory_test_order = super
15
+ laboratory_test_order.reason = extract_reason(entry_element)
14
16
  laboratory_test_order
15
17
  end
16
18
 
@@ -12,6 +12,7 @@ module QRDA
12
12
  @result_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:value"
13
13
  @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
14
14
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
15
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
15
16
  @entry_class = QDM::LaboratoryTestPerformed
16
17
  end
17
18
 
@@ -21,6 +22,7 @@ module QRDA
21
22
  laboratory_test_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
22
23
  laboratory_test_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
23
24
  laboratory_test_performed.components = extract_components(entry_element)
25
+ laboratory_test_performed.reason = extract_reason(entry_element)
24
26
  laboratory_test_performed
25
27
  end
26
28
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::LaboratoryTestRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  laboratory_test_recommended = super
15
+ laboratory_test_recommended.reason = extract_reason(entry_element)
14
16
  laboratory_test_recommended
15
17
  end
16
18
 
@@ -10,6 +10,7 @@ module QRDA
10
10
  @dosage_xpath = "./cda:doseQuantity"
11
11
  @frequency_xpath = "./cda:effectiveTime[@operator='A']/cda:period"
12
12
  @route_xpath = "./cda:routeCode"
13
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
13
14
  @entry_class = QDM::MedicationAdministered
14
15
  end
15
16
 
@@ -18,6 +19,7 @@ module QRDA
18
19
  medication_administered.dosage = extract_scalar(entry_element, @dosage_xpath)
19
20
  medication_administered.frequency = frequency_as_coded_value(entry_element, @frequency_xpath)
20
21
  medication_administered.route = code_if_present(entry_element.at_xpath(@route_xpath))
22
+ medication_administered.reason = extract_reason(entry_element)
21
23
  medication_administered
22
24
  end
23
25
 
@@ -3,7 +3,6 @@ module QRDA
3
3
  class MedicationDispensedImporter < SectionImporter
4
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.139']"))
5
5
  super(entry_finder)
6
- @entry_does_not_have_reason = true
7
6
  @id_xpath = './cda:id'
8
7
  @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:product/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
9
8
  @relevant_period_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime"
@@ -15,6 +15,7 @@ module QRDA
15
15
  @setting_xpath = "./cda:participant/cda:participantRole/cda:code"
16
16
  @prescriber_id_xpath = "./cda:author/cda:assignedAuthor/cda:id"
17
17
  @days_supplied_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.157']/cda:quantity"
18
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
18
19
  @entry_class = QDM::MedicationOrder
19
20
  end
20
21
 
@@ -28,6 +29,7 @@ module QRDA
28
29
  medication_order.setting = code_if_present(entry_element.at_xpath(@setting_xpath))
29
30
  medication_order.prescriberId = extract_id(entry_element, @prescriber_id_xpath)
30
31
  medication_order.daysSupplied = extract_scalar(entry_element, @days_supplied_xpath)&.value
32
+ medication_order.reason = extract_reason(entry_element)
31
33
  medication_order
32
34
  end
33
35
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:value'
8
8
  @relevant_period_xpath = "./cda:effectiveTime"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::PatientCharacteristicClinicalTrialParticipant
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  patient_characteristic_clinical_trial_participant = super
15
+ patient_characteristic_clinical_trial_participant.reason = extract_reason(entry_element)
14
16
  patient_characteristic_clinical_trial_participant
15
17
  end
16
18
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:value"
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::PhysicalExamOrder
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  physical_exam_order = super
15
16
  physical_exam_order.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
+ physical_exam_order.reason = extract_reason(entry_element)
16
18
  physical_exam_order
17
19
  end
18
20
 
@@ -11,6 +11,7 @@ module QRDA
11
11
  @result_xpath = "./cda:value"
12
12
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
13
13
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
14
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
14
15
  @entry_class = QDM::PhysicalExamPerformed
15
16
  end
16
17
 
@@ -19,6 +20,7 @@ module QRDA
19
20
  physical_exam_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
20
21
  physical_exam_performed.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
21
22
  physical_exam_performed.components = extract_components(entry_element)
23
+ physical_exam_performed.reason = extract_reason(entry_element)
22
24
  physical_exam_performed
23
25
  end
24
26
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:value"
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::PhysicalExamRecommended
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  physical_exam_recommended = super
15
16
  physical_exam_recommended.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
+ physical_exam_recommended.reason = extract_reason(entry_element)
16
18
  physical_exam_recommended
17
19
  end
18
20
 
@@ -8,6 +8,7 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
10
  @ordinality_xpath = "./cda:priorityCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::ProcedureOrder
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module QRDA
15
16
  procedure_order = super
16
17
  procedure_order.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
18
  procedure_order.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
19
+ procedure_order.reason = extract_reason(entry_element)
18
20
  procedure_order
19
21
  end
20
22
 
@@ -14,6 +14,7 @@ module QRDA
14
14
  @ordinality_xpath = "./cda:priorityCode"
15
15
  @incision_datetime_xpath = "./cda:entryRelationship/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.89']/cda:effectiveTime"
16
16
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
17
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
17
18
  @entry_class = QDM::ProcedurePerformed
18
19
  end
19
20
 
@@ -25,6 +26,7 @@ module QRDA
25
26
  procedure_performed.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
26
27
  procedure_performed.incisionDatetime = extract_time(entry_element, @incision_datetime_xpath)
27
28
  procedure_performed.components = extract_components(entry_element)
29
+ procedure_performed.reason = extract_reason(entry_element)
28
30
  procedure_performed
29
31
  end
30
32
 
@@ -8,6 +8,7 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
10
  @ordinality_xpath = "./cda:priorityCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::ProcedureRecommended
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module QRDA
15
16
  procedure_recommended = super
16
17
  procedure_recommended.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
18
  procedure_recommended.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
19
+ procedure_recommended.reason = extract_reason(entry_element)
18
20
  procedure_recommended
19
21
  end
20
22
 
@@ -3,7 +3,6 @@ module QRDA
3
3
  class SubstanceAdministeredImporter < SectionImporter
4
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.42']"))
5
5
  super(entry_finder)
6
- @entry_does_not_have_reason = true
7
6
  @id_xpath = './cda:id'
8
7
  @code_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
9
8
  @author_datetime_xpath = "./cda:author/cda:time"