renalware-core 2.0.0.pre.rc6 → 2.0.0.pre.rc7

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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/app/controllers/renalware/events/investigations_controller.rb +10 -0
  4. data/app/controllers/renalware/transplants/donor_dashboards_controller.rb +1 -7
  5. data/app/controllers/renalware/transplants/recipient_dashboards_controller.rb +1 -21
  6. data/app/models/renalware/events/investigation.rb +31 -0
  7. data/app/models/renalware/feeds/hl7_message.rb +29 -34
  8. data/app/models/renalware/feeds/message_parser.rb +2 -1
  9. data/app/models/renalware/pathology/create_observation_requests.rb +25 -0
  10. data/app/models/renalware/pathology/message_listener.rb +7 -5
  11. data/app/models/renalware/pathology/{message_param_parser.rb → observation_requests_attributes_builder.rb} +31 -27
  12. data/app/models/renalware/patients/practice_search_query.rb +1 -1
  13. data/app/policies/renalware/events/investigation_policy.rb +8 -0
  14. data/app/presenters/renalware/pathology/observation_presenter.rb +1 -1
  15. data/app/presenters/renalware/transplants/consent_presenter.rb +1 -1
  16. data/app/presenters/renalware/transplants/donor_dashboard_presenter.rb +35 -0
  17. data/app/presenters/renalware/transplants/mdm_presenter.rb +2 -0
  18. data/app/presenters/renalware/transplants/patient_presenter.rb +2 -0
  19. data/app/presenters/renalware/transplants/recipient_dashboard_presenter.rb +39 -0
  20. data/app/presenters/renalware/transplants/wait_list_registration_presenter.rb +2 -0
  21. data/app/views/renalware/api/ukrdc/patients/_documents.xml.builder +12 -9
  22. data/app/views/renalware/api/ukrdc/patients/_sending_facility.xml.builder +4 -4
  23. data/app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder +1 -1
  24. data/app/views/renalware/api/ukrdc/patients/lab_orders/_result_item.xml.builder +1 -1
  25. data/app/views/renalware/api/ukrdc/patients/show.xml.builder +1 -5
  26. data/app/views/renalware/events/events/_event.html.slim +7 -1
  27. data/app/views/renalware/events/events/_table.html.slim +2 -1
  28. data/app/views/renalware/events/events/cell/_investigation.html.slim +9 -0
  29. data/app/views/renalware/events/events/inputs/_investigation.html.slim +4 -0
  30. data/app/views/renalware/events/events/toggled_cell/_investigation.html.slim +11 -0
  31. data/app/views/renalware/events/investigations/_list.html.slim +12 -0
  32. data/app/views/renalware/events/investigations/edit.html.slim +13 -0
  33. data/app/views/renalware/transplants/donor_dashboards/show.html.slim +27 -20
  34. data/app/views/renalware/transplants/recipient_dashboards/_page_actions.html.slim +4 -0
  35. data/app/views/renalware/transplants/recipient_dashboards/show.html.slim +22 -17
  36. data/config/locales/renalware/events/investigation.en.yml +58 -0
  37. data/config/locales/renalware/transplants/donor_dashboard.en.yml +1 -0
  38. data/config/locales/renalware/transplants/recipient_dashboards.en.yml +1 -0
  39. data/config/routes.rb +5 -0
  40. data/db/migrate/20180119121243_create_trigger_to_preprocess_hl7_msg.rb +5 -3
  41. data/db/migrate/20180125201356_make_obs_set_trigger_change_updated_at.rb +191 -0
  42. data/db/migrate/20180126142314_add_uuid_to_letters.rb +6 -0
  43. data/db/seeds/default/events/event_types.csv +1 -0
  44. data/lib/renalware/configuration.rb +1 -0
  45. data/lib/renalware/version.rb +1 -1
  46. data/lib/test_support/text_editor_helpers.rb +6 -0
  47. data/spec/factories/events/events.rb +24 -1
  48. data/spec/factories/events/events_types.rb +17 -2
  49. data/spec/support/database_functions_spec_helper.rb +6 -0
  50. metadata +18 -4
  51. data/app/models/renalware/pathology/create_observations.rb +0 -22
@@ -1,3 +1,5 @@
1
+ require_dependency "renalware/transplants"
2
+
1
3
  module Renalware
2
4
  module Transplants
3
5
  class MDMPresenter < Renalware::MDMPresenter
@@ -1,3 +1,5 @@
1
+ require_dependency "renalware/transplants"
2
+
1
3
  module Renalware
2
4
  module Transplants
3
5
  class PatientPresenter < SimpleDelegator
@@ -0,0 +1,39 @@
1
+ require_dependency "renalware/transplants"
2
+ require "attr_extras"
3
+
4
+ module Renalware
5
+ module Transplants
6
+ class RecipientDashboardPresenter
7
+ attr_reader_initialize :patient
8
+
9
+ def recipient_workup
10
+ @recipient_workup ||= RecipientWorkup.for_patient(patient).first_or_initialize
11
+ end
12
+
13
+ def registration
14
+ @registration ||= begin
15
+ WaitListRegistrationPresenter.new(
16
+ Registration.for_patient(patient).first_or_initialize
17
+ )
18
+ end
19
+ end
20
+
21
+ def recipient_operations
22
+ @recipient_operations ||= RecipientOperation.for_patient(patient).reversed
23
+ end
24
+
25
+ def donations
26
+ @donations ||= Donation.for_recipient(patient).reversed
27
+ end
28
+
29
+ def investigations
30
+ @investigations ||= begin
31
+ Events::Investigation
32
+ .for_patient(patient)
33
+ .transplant_recipients
34
+ .ordered
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,3 +1,5 @@
1
+ require_dependency "renalware/transplants"
2
+
1
3
  module Renalware
2
4
  module Transplants
3
5
  class WaitListRegistrationPresenter < SimpleDelegator
@@ -3,27 +3,30 @@ xml = builder
3
3
  xml.Documents do
4
4
  patient.letters.each do |letter|
5
5
  xml.Document do
6
- xml.DocumentTime letter.created_at.iso8601
7
- xml.DocumentName letter.title
6
+ xml.DocumentTime letter.issued_on.to_time.iso8601
8
7
  xml.Clinician do
9
- xml.Description
10
- end
11
- xml.Location do
12
- xml.Code letter.hospital_unit_code
8
+ xml.CodingStandard "LOCAL"
9
+ xml.Code letter.author.username
10
+ xml.Description letter.author.to_s
13
11
  end
12
+ xml.DocumentName letter.title
14
13
  xml.Status do
15
14
  xml.Code "ACTIVE"
16
15
  end
17
16
  xml.EnteredBy do
17
+ xml.CodingStandard "LOCAL"
18
+ xml.Code letter.updated_by&.username
18
19
  xml.Description letter.updated_by
19
20
  end
20
21
  xml.EnteredAt do
22
+ xml.CodingStandard "ODS"
21
23
  xml.Code letter.hospital_unit_code
24
+ xml.Description ""
22
25
  end
23
- xml.FileType do
24
- xml.Code "application/pdf"
25
- end
26
+ xml.FileType "application/pdf"
27
+ xml.FileName "tbc"
26
28
  xml.Stream Base64.encode64(Renalware::Letters::PdfRenderer.call(letter))
29
+ xml.DocumentURL
27
30
  end
28
31
  end
29
32
  end
@@ -1,7 +1,7 @@
1
1
  xml = builder
2
2
 
3
- xml.SendingFacility(
4
- channelName: "Renalware",
5
- time: Time.zone.now.to_datetime) do
6
- end
3
+ xml.SendingFacility Renalware.config.ukrdc_sending_facility_name,
4
+ channelName: "Renalware",
5
+ time: Time.zone.now.to_datetime
6
+
7
7
  xml.SendingExtract "UKRDC"
@@ -20,7 +20,7 @@ xml.LabOrder do
20
20
  xml.OrderCategory do
21
21
  xml.Code request.description.code
22
22
  end
23
- # xml.SpecimenCollectedTime "TODO"
23
+ xml.SpecimenCollectedTime request.requested_at.iso8601
24
24
  # xml.SpecimenReceivedTime "TODO"
25
25
  # xml.Priority do
26
26
  # xml.Code "TODO: Probably n/a"
@@ -8,7 +8,7 @@ xml.ResultItem do
8
8
  xml.PrePost observation.pre_post(patient_is_on_hd: patient.current_modality_hd?)
9
9
  xml.ServiceId do
10
10
  xml.CodingStandard "LOCAL"
11
- xml.Code observation.description_code
11
+ xml.Code(observation.description_loinc_code || observation.description_code)
12
12
  xml.Description observation.description_name
13
13
  end
14
14
  # xml.SubId
@@ -5,11 +5,7 @@ xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
5
5
 
6
6
  namespace_and_schema = {
7
7
  "xmlns:ukrdc" => "http://www.rixg.org.uk/",
8
- "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
9
- "xsi:schemaLocation" => [
10
- "http://www.rixg.org.uk/",
11
- "https://github.com/renalreg/ukrdc/blob/master/Schema/UKRDC.xsd"
12
- ].join(" ")
8
+ "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance"
13
9
  }
14
10
 
15
11
  # Start of <ukrdc:Patient>
@@ -1,7 +1,13 @@
1
1
  tr
2
- td= link_to("Toggle",
2
+ td
3
+ = link_to("Toggle",
3
4
  "##{toggle_prefix}-quick-preview-#{event.id}",
4
5
  data: { behaviour: "toggler" })
6
+
7
+ - if local_assigns[:edit_proc]
8
+ = pipe_separator
9
+ = link_to("Edit", edit_proc.call(event))
10
+
5
11
  td.nowrap= l event.created_at.to_date
6
12
  - unless local_assigns.fetch(:exclude_type_column, false)
7
13
  td= event.event_type
@@ -1,6 +1,6 @@
1
1
  - toggle_prefix ||= "event"
2
2
 
3
- table.has-togglable-rows
3
+ table.has-togglable-rows.events-table
4
4
  thead
5
5
  tr
6
6
  th.col-width-tiny
@@ -14,4 +14,5 @@ table.has-togglable-rows
14
14
  = render partial: "renalware/events/events/event",
15
15
  collection: events,
16
16
  locals: { exclude_type_column: local_assigns[:exclude_type_column],
17
+ edit_proc: local_assigns[:edit_proc],
17
18
  toggle_prefix: toggle_prefix }
@@ -0,0 +1,9 @@
1
+ - document = event.document
2
+
3
+ | Type:
4
+ |&nbsp;
5
+ = document.type&.text || t("unspecified")
6
+ |&nbsp;&nbsp;&nbsp;
7
+ | Result:
8
+ |&nbsp;
9
+ = document.result
@@ -0,0 +1,4 @@
1
+ = f.simple_fields_for :document, event.document do |fd|
2
+ = fd.input :modality, as: :inline_radio_buttons, wrapper: :horizontal_medium
3
+ = fd.input :type, wrapper: :horizontal_medium
4
+ = fd.input :result, wrapper: :horizontal_medium
@@ -0,0 +1,11 @@
1
+ - document = event.document
2
+
3
+ dl.dl-horizontal
4
+ dt= attr_name(document, :modality, suffix: ":")
5
+ dd= document.modality&.text || t("unspecified")
6
+ dt= attr_name(document, :type, suffix: ":")
7
+ dd= document.type&.text || t("unspecified")
8
+ dt= attr_name(document, :result, suffix: ":")
9
+ dd= document.result || t("unspecified")
10
+ dt= attr_name(event, :notes, suffix: ":")
11
+ dd= event.notes&.html_safe || t("unspecified")
@@ -0,0 +1,12 @@
1
+ - toggle_prefix ||= "investigation"
2
+
3
+ article.investigations
4
+ header
5
+ h2= t(".title")
6
+ = link_to t(".add"),
7
+ new_patient_investigation_path(patient),
8
+ class: "button right"
9
+ = render "renalware/events/events/table",
10
+ events: investigations,
11
+ edit_proc: ->(investigation) { edit_patient_investigation_path(patient, investigation) },
12
+ exclude_type_column: true
@@ -0,0 +1,13 @@
1
+ = within_patient_layout(title: "Investigations / Edit") do
2
+
3
+ = simple_form_for event,
4
+ url: patient_investigation_path(patient, event),
5
+ as: :events_event,
6
+ html: { autocomplete: "off" },
7
+ wrapper: "horizontal_form" do |f|
8
+
9
+ = render "renalware/events/events/form",
10
+ event: event,
11
+ patient: patient,
12
+ event_types: event_types,
13
+ f: f
@@ -8,38 +8,45 @@
8
8
 
9
9
  ul.f-dropdown#donor-options(data-dropdown-content aria-hidden="true")
10
10
  li
11
- - if donations.empty?
11
+ - if dashboard.donations.empty?
12
12
  = link_to t(".add_donation"),
13
- new_patient_transplants_donation_path(patient)
13
+ new_patient_transplants_donation_path(dashboard.patient)
14
14
  - else
15
15
  = link_to "Donor (identify a new recipient)",
16
- new_patient_transplants_donation_path(patient)
16
+ new_patient_transplants_donation_path(dashboard.patient)
17
17
 
18
- li(class="#{'disabled' unless donor_workup.new_record?}")
19
- = link_to_if donor_workup.new_record?,
18
+ li(class="#{'disabled' unless dashboard.donor_workup.new_record?}")
19
+ = link_to_if dashboard.donor_workup.new_record?,
20
20
  t(".add_workup"),
21
- edit_patient_transplants_donor_workup_path(patient)
21
+ edit_patient_transplants_donor_workup_path(dashboard.patient)
22
22
 
23
23
  li= link_to t(".add_status_update"),
24
- new_patient_transplants_donor_stage_path(patient)
24
+ new_patient_transplants_donor_stage_path(dashboard.patient)
25
25
 
26
26
  li= link_to t(".add_operation"),
27
- new_patient_transplants_donor_operation_path(patient)
27
+ new_patient_transplants_donor_operation_path(dashboard.patient)
28
+
29
+ li= link_to t(".add_investigation"),
30
+ new_patient_investigation_path(dashboard.patient)
28
31
 
29
32
  = within_patient_layout(title: "Transplant Donor Summary") do
30
- - unless donations.empty?
33
+ - unless dashboard.donations.empty?
31
34
  = render "renalware/transplants/donations/list",
32
- donations: donations,
33
- patient: patient
34
- - unless donor_workup.new_record?
35
+ donations: dashboard.donations,
36
+ patient: dashboard.patient
37
+ - unless dashboard.donor_workup.new_record?
35
38
  = render "renalware/transplants/donor_workups/summary",
36
- donor_workup: donor_workup,
37
- patient: patient
38
- - unless donor_stages.empty?
39
+ donor_workup: dashboard.donor_workup,
40
+ patient: dashboard.patient
41
+ - unless dashboard.donor_stages.empty?
39
42
  = render "renalware/transplants/donor_stages/list",
40
- donor_stages: donor_stages,
41
- patient: patient
42
- - unless donor_operations.empty?
43
+ donor_stages: dashboard.donor_stages,
44
+ patient: dashboard.patient
45
+ - unless dashboard.donor_operations.empty?
43
46
  = render "renalware/transplants/donor_operations/list",
44
- donor_operations: donor_operations,
45
- patient: patient
47
+ donor_operations: dashboard.donor_operations,
48
+ patient: dashboard.patient
49
+ - if dashboard.investigations.any?
50
+ = render "renalware/events/investigations/list",
51
+ patient: dashboard.patient,
52
+ investigations: dashboard.investigations
@@ -23,5 +23,9 @@ ul.f-dropdown#tx-recip-options(data-dropdown-content aria-hidden="true")
23
23
  title: t(".add_recipient_operation"),
24
24
  url: new_patient_transplants_recipient_operation_path(patient)
25
25
 
26
+ = dropdown_btn_item enabled: true,
27
+ title: t(".add_investigation"),
28
+ url: new_patient_investigation_path(patient)
29
+
26
30
  - unless patient.has_ever_been_a_recipient?
27
31
  = render "modality_missing_warning", message: t(".missing_modality_warning")
@@ -1,31 +1,36 @@
1
1
  = content_for(:actions) do
2
2
  = render "page_actions",
3
- patient: patient,
4
- recipient_workup: recipient_workup,
5
- registration: registration
3
+ patient: dashboard.patient,
4
+ recipient_workup: dashboard.recipient_workup,
5
+ registration: dashboard.registration
6
6
 
7
7
  = within_patient_layout(title: "Transplant Recipient Summary") do
8
8
 
9
- - unless recipient_workup.new_record?
9
+ - unless dashboard.recipient_workup.new_record?
10
10
  = render "renalware/transplants/recipient_workups/summary",
11
- patient: patient,
12
- recipient_workup: recipient_workup
11
+ patient: dashboard.patient,
12
+ recipient_workup: dashboard.recipient_workup
13
13
 
14
- - unless registration.new_record?
14
+ - unless dashboard.registration.new_record?
15
15
  = render "renalware/transplants/registrations/summary",
16
- patient: patient,
17
- registration: registration
16
+ patient: dashboard.patient,
17
+ registration: dashboard.registration
18
18
 
19
- - unless registration.new_record?
19
+ - unless dashboard.registration.new_record?
20
20
  = render "renalware/transplants/registration_statuses/list",
21
- patient: patient,
22
- registration: registration
21
+ patient: dashboard.patient,
22
+ registration: dashboard.registration
23
23
 
24
- - if donations.any?
24
+ - if dashboard.donations.any?
25
25
  = render "renalware/transplants/donations/recipient_list",
26
- donations: donations
26
+ donations: dashboard.donations
27
27
 
28
- - if recipient_operations.any?
28
+ - if dashboard.recipient_operations.any?
29
29
  = render "renalware/transplants/recipient_operations/list",
30
- patient: patient,
31
- recipient_operations: recipient_operations
30
+ patient: dashboard.patient,
31
+ recipient_operations: dashboard.recipient_operations
32
+
33
+ - if dashboard.investigations.any?
34
+ = render "renalware/events/investigations/list",
35
+ patient: dashboard.patient,
36
+ investigations: dashboard.investigations
@@ -0,0 +1,58 @@
1
+ en:
2
+ renalware:
3
+ events:
4
+ investigations:
5
+ list:
6
+ title: Investigations
7
+ add: Add
8
+ date_time: Date taken
9
+ type: Type
10
+ result: Result
11
+ notes: Notes
12
+ activemodel:
13
+ attributes:
14
+ renalware/events/investigation/document:
15
+ result1: "Rejection"
16
+ result2: "IFTA"
17
+ enumerize:
18
+ renalware/events/investigation/document:
19
+ type:
20
+ blood_group: "Blood Group"
21
+ cardiac_24_hour_abpm: "Cardiac - 24 hour ABPM"
22
+ cardiac_24_hour_ecg: "Cardiac - 24 hr ECG"
23
+ cardiac_coronary_angio: "Cardiac - Coronary Angio"
24
+ cardiac_cpet: "Cardiac - CPET"
25
+ cardiac_ecg: "Cardiac - ECG"
26
+ cardiac_echo: "Cardiac - Echo"
27
+ cardiac_exercise_ecg: "Cardiac - Exercise ECG"
28
+ cardiac_myoview_scan: "Cardiac - Myoview Scan"
29
+ cardiac_stress_echo: "Cardiac - Stress Echo"
30
+ cervical_smear: "Cervical Smear"
31
+ colonoscopy: "Colonoscopy"
32
+ gastroscopy: "Gastroscopy"
33
+ bowel_screening: "Bowel Screening"
34
+ cystoscopy: "Cystoscopy"
35
+ urodynamics: "Urodynamics"
36
+ 24_hr_urinary_stone_screen: "24 hr Urinary Stone Screen"
37
+ dental_check: "Dental Check"
38
+ psa: "PSA"
39
+ isotopic_gfr: "Isotopic GFR"
40
+ lung_function_tests: "Lung Function Tests"
41
+ imaging_bone Scan: "Imaging - Bone Scan"
42
+ imaging_ct_abdomen: "Imaging - CT Abdomen"
43
+ imaging_ct_chest: "Imaging - CT Chest"
44
+ imaging_ct_pulm_angio: "Imaging - CT Pulm Angio"
45
+ imaging_ct_renal_angio: "Imaging - CT Renal Angio"
46
+ imaging_cxr: "Imaging - CXR"
47
+ imaging_doppler_carotids: "Imaging - Doppler Carotids"
48
+ imaging_doppler_legs: "Imaging - Doppler Legs"
49
+ imaging_liver_us: "Imaging - Liver US"
50
+ imaging_mammography: "Imaging - Mammography"
51
+ imaging_post_mict_bladder_us: "Imaging - Post mict bladder US"
52
+ imaging_renal_us: "Imaging - Renal US"
53
+ imaging_static_dmsa: "Imaging - Static DMSA"
54
+ imaging_mag3_scan: "Imaging - MAG3 Scan"
55
+ opinion_cardiology: "Opinion - Cardiology"
56
+ opinion_haematology: "Opinion - Haematology"
57
+ opinion_specialist: "Opinion - Specialist"
58
+ other: "Other"
@@ -7,3 +7,4 @@ en:
7
7
  add_workup: Donor Workup
8
8
  add_operation: Donor Transplant Operation
9
9
  add_status_update: Update Donor Stage
10
+ add_investigation: Add Investigation
@@ -7,5 +7,6 @@ en:
7
7
  add_recipient_workup: Recipient Workup
8
8
  add_waitlist_registration: Wait List Registration
9
9
  add_recipient_operation: Recipient Operation
10
+ add_investigation: Add Investigation
10
11
  missing_modality_warning: >
11
12
  Some actions will be unavailable until you add the Transplant modality