renalware-core 2.0.137 → 2.0.138

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/renalware/icons/home.svg +1 -0
  3. data/app/assets/images/renalware/icons/settings.svg +1 -0
  4. data/app/assets/javascripts/renalware/components/hd.js +0 -109
  5. data/app/assets/javascripts/renalware/components/toggler.js +0 -29
  6. data/app/assets/javascripts/renalware/core.js.erb +5 -1
  7. data/app/assets/javascripts/renalware/rollup_compiled.js +3888 -0
  8. data/app/assets/stylesheets/renalware/modules/_hd.scss +40 -17
  9. data/app/assets/stylesheets/renalware/partials/_dashboards.scss +1 -1
  10. data/app/assets/stylesheets/renalware/partials/_modal_window.scss +1 -0
  11. data/app/assets/stylesheets/renalware/partials/_navigation.scss +45 -2
  12. data/app/assets/stylesheets/renalware/partials/_pagination.scss +21 -0
  13. data/app/assets/stylesheets/renalware/partials/_tables.scss +9 -0
  14. data/app/assets/stylesheets/renalware/protocol_pdf.scss +45 -6
  15. data/app/components/renalware/application_component.rb +1 -1
  16. data/app/components/renalware/hd/administer_prescription_dropdown_component.html.slim +22 -0
  17. data/app/components/renalware/hd/administer_prescription_dropdown_component.rb +22 -0
  18. data/app/components/renalware/hd/prescription_last_administration_component.html.slim +6 -0
  19. data/app/components/renalware/hd/prescription_last_administration_component.rb +19 -0
  20. data/app/components/renalware/letters/letters_in_progress_component.html.slim +1 -1
  21. data/app/components/renalware/system/admin_menu_component.html.slim +25 -0
  22. data/app/components/renalware/system/admin_menu_component.rb +56 -0
  23. data/app/components/renalware/system/users_awaiting_approval_component.html.slim +6 -0
  24. data/app/components/renalware/system/users_awaiting_approval_component.rb +25 -0
  25. data/app/controllers/renalware/admin/dashboards_controller.rb +9 -0
  26. data/app/controllers/renalware/hd/base_controller.rb +4 -0
  27. data/app/controllers/renalware/hd/prescription_administrations_controller.rb +87 -0
  28. data/app/controllers/renalware/hd/sessions_controller.rb +6 -44
  29. data/app/controllers/renalware/hd/transmission_logs_controller.rb +7 -6
  30. data/app/controllers/renalware/hd/witnesses_controller.rb +62 -0
  31. data/app/helpers/renalware/application_helper.rb +1 -0
  32. data/app/helpers/renalware/layout_helper.rb +12 -0
  33. data/app/helpers/renalware/toggle_helper.rb +13 -4
  34. data/app/javascript/renalware/controllers/another_test_controller.js +8 -0
  35. data/app/javascript/renalware/controllers/hd/prescription_administration_controller.js +22 -0
  36. data/app/javascript/renalware/controllers/test_controller.js +8 -0
  37. data/app/javascript/renalware/controllers/toggle_controller.js +36 -0
  38. data/app/javascript/renalware/index.js +25 -0
  39. data/app/models/renalware/hd/patient.rb +1 -0
  40. data/app/models/renalware/hd/prescription_administration.rb +57 -33
  41. data/app/models/renalware/hd/prescription_last_administration_query.rb +29 -0
  42. data/app/models/renalware/hd/sessions/save_session.rb +1 -25
  43. data/app/models/renalware/hd/witness_form.rb +31 -0
  44. data/app/policies/renalware/hd/prescription_administration_policy.rb +8 -0
  45. data/app/presenters/renalware/admin/users/{summary_part.rb → summary_part.rb.dead} +0 -0
  46. data/app/presenters/renalware/hd/dashboard_presenter.rb +16 -7
  47. data/app/views/renalware/accesses/plans/_details.html.slim +1 -1
  48. data/app/views/renalware/admin/cache/show.html.slim +1 -1
  49. data/app/views/renalware/admin/dashboards/show.html.slim +4 -0
  50. data/app/views/renalware/admin/users/{_summary_part.html.slim → _summary_part.html.slim.dead} +1 -1
  51. data/app/views/renalware/admin/users/edit.html.slim +1 -1
  52. data/app/views/renalware/admin/users/index.html.slim +1 -1
  53. data/app/views/renalware/admissions/_summary_part.html.slim +5 -4
  54. data/app/views/renalware/admissions/consults/_summary_part.html.slim +7 -7
  55. data/app/views/renalware/dashboard/dashboards/_content.html.slim +5 -5
  56. data/app/views/renalware/drugs/drugs/edit.html.slim +2 -2
  57. data/app/views/renalware/drugs/drugs/index.html.slim +1 -1
  58. data/app/views/renalware/drugs/drugs/new.html.slim +1 -1
  59. data/app/views/renalware/events/types/edit.html.slim +1 -1
  60. data/app/views/renalware/events/types/index.html.slim +1 -1
  61. data/app/views/renalware/events/types/new.html.slim +1 -1
  62. data/app/views/renalware/hd/cannulation_types/edit.html.slim +1 -1
  63. data/app/views/renalware/hd/cannulation_types/index.html.slim +5 -5
  64. data/app/views/renalware/hd/cannulation_types/new.html.slim +1 -1
  65. data/app/views/renalware/hd/dashboards/_page_actions.html.slim +4 -1
  66. data/app/views/renalware/hd/dashboards/show.html.slim +1 -0
  67. data/app/views/renalware/hd/dialysates/edit.html.slim +1 -1
  68. data/app/views/renalware/hd/dialysates/index.html.slim +1 -1
  69. data/app/views/renalware/hd/dialysates/new.html.slim +1 -1
  70. data/app/views/renalware/hd/dialysers/edit.html.slim +1 -1
  71. data/app/views/renalware/hd/dialysers/index.html.slim +4 -5
  72. data/app/views/renalware/hd/dialysers/new.html.slim +1 -1
  73. data/app/views/renalware/hd/prescription_administrations/_form.html.slim +96 -0
  74. data/app/views/renalware/hd/prescription_administrations/_row.html.slim +25 -0
  75. data/app/views/renalware/hd/prescription_administrations/_table.html.slim +8 -0
  76. data/app/views/renalware/hd/prescription_administrations/_thead.html.slim +11 -0
  77. data/app/views/renalware/hd/prescription_administrations/create.js.erb +4 -0
  78. data/app/views/renalware/hd/prescription_administrations/edit.html.slim +5 -0
  79. data/app/views/renalware/hd/prescription_administrations/edit.js.erb +11 -0
  80. data/app/views/renalware/hd/prescription_administrations/index.html.slim +3 -0
  81. data/app/views/renalware/hd/prescription_administrations/new.html.slim +3 -0
  82. data/app/views/renalware/hd/prescription_administrations/new.js.erb +5 -0
  83. data/app/views/renalware/hd/protocols/_allergies.html.slim +3 -0
  84. data/app/views/renalware/hd/protocols/_latest_dry_weight.html.slim +3 -2
  85. data/app/views/renalware/hd/protocols/_prescriptions.html.slim +15 -7
  86. data/app/views/renalware/hd/protocols/_profile.html.slim +12 -12
  87. data/app/views/renalware/hd/protocols/_protocol.pdf.slim +2 -3
  88. data/app/views/renalware/hd/sessions/_form.html.slim +2 -6
  89. data/app/views/renalware/hd/sessions/_index_tabs.html.slim +11 -0
  90. data/app/views/renalware/hd/sessions/_list.html.slim +21 -1
  91. data/app/views/renalware/hd/sessions/_table.html.slim +1 -18
  92. data/app/views/renalware/hd/sessions/closed/_form.html.slim +1 -2
  93. data/app/views/renalware/hd/sessions/edit.html.slim +1 -2
  94. data/app/views/renalware/hd/sessions/new.html.slim +1 -2
  95. data/app/views/renalware/hd/sessions/open/_form.html.slim +1 -2
  96. data/app/views/renalware/hd/transmission_logs/index.html.slim +2 -2
  97. data/app/views/renalware/hd/witnesses/_form.html.slim +49 -0
  98. data/app/views/renalware/hd/witnesses/edit.html.slim +1 -0
  99. data/app/views/renalware/hd/witnesses/edit.js.erb +3 -0
  100. data/app/views/renalware/hd/witnesses/update.js.erb +4 -0
  101. data/app/views/renalware/layouts/_admin.html.slim +28 -0
  102. data/app/views/renalware/layouts/_patient.html.slim +1 -1
  103. data/app/views/renalware/letters/batches/index.html.slim +1 -1
  104. data/app/views/renalware/letters/letters/_letter.html.slim +1 -1
  105. data/app/views/renalware/modalities/descriptions/edit.html.slim +1 -1
  106. data/app/views/renalware/modalities/descriptions/index.html.slim +1 -1
  107. data/app/views/renalware/modalities/descriptions/new.html.slim +1 -1
  108. data/app/views/renalware/navigation/_admin.html.slim +1 -1
  109. data/app/views/renalware/navigation/_menu.html.slim +7 -6
  110. data/app/views/renalware/navigation/_user.html.slim +3 -4
  111. data/app/views/renalware/pathology/observation_requests/_filters.html.slim +1 -1
  112. data/app/views/renalware/pathology/requests/requests/index.html.slim +1 -1
  113. data/app/views/renalware/pathology/requests/rules/index.html.slim +1 -1
  114. data/app/views/renalware/patients/_layout.html.slim +1 -1
  115. data/app/views/renalware/patients/_summary_part.html.slim +1 -1
  116. data/app/views/renalware/patients/primary_care_physicians/edit.html.slim +1 -1
  117. data/app/views/renalware/patients/primary_care_physicians/index.html.slim +3 -5
  118. data/app/views/renalware/patients/primary_care_physicians/new.html.slim +1 -1
  119. data/app/views/renalware/pd/bag_types/edit.html.slim +1 -1
  120. data/app/views/renalware/pd/bag_types/index.html.slim +1 -1
  121. data/app/views/renalware/pd/bag_types/new.html.slim +1 -1
  122. data/app/views/renalware/problems/problems/_summary_part.html.slim +1 -1
  123. data/app/views/renalware/research/study_participants/index.html.slim +2 -3
  124. data/app/views/renalware/surveys/_pos_s_summary_part.html.slim +2 -1
  125. data/app/views/renalware/system/email_templates/index.html.slim +5 -1
  126. data/app/views/renalware/system/messages/edit.html.slim +1 -1
  127. data/app/views/renalware/system/messages/index.html.slim +1 -1
  128. data/app/views/renalware/system/messages/new.html.slim +1 -1
  129. data/app/views/renalware/system/user_feedback/edit.html.slim +1 -1
  130. data/app/views/renalware/system/user_feedback/index.html.slim +1 -1
  131. data/app/views/renalware/transplants/mdm/_bottom.html.slim +1 -1
  132. data/config/initializers/pagy.rb +9 -0
  133. data/config/locales/renalware/hd/dashboards.en.yml +1 -0
  134. data/config/locales/renalware/hd/session.en.yml +2 -1
  135. data/config/routes/admin.rb +1 -0
  136. data/config/routes/hd.rb +9 -0
  137. data/db/migrate/20190627141751_add_tokens_to_hd_prescription_administrations.rb +0 -2
  138. data/db/migrate/20200204153231_alter_hd_prescription_administrations.rb +18 -0
  139. data/db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb +0 -1
  140. data/db/seeds/default/accesses/access_plan_types.rb +0 -1
  141. data/db/seeds/default/accesses/access_sites.rb +0 -1
  142. data/db/seeds/default/clinics/clinics.rb +0 -1
  143. data/db/seeds/default/events/event_types.rb +0 -1
  144. data/db/seeds/default/hd/cannulation_types.rb +0 -1
  145. data/db/seeds/default/hd/dialysers.rb +0 -1
  146. data/db/seeds/default/modalities/reasons.rb +19 -19
  147. data/db/seeds/default/pathology/measurement_units.rb +0 -1
  148. data/db/seeds/default/patients/patients_ethnicities.rb +0 -1
  149. data/db/seeds/default/patients/patients_languages.rb +1 -0
  150. data/db/seeds/default/patients/patients_religions.rb +0 -1
  151. data/db/seeds/default/pd/bag_types.rb +0 -1
  152. data/db/seeds/default/pd/organisms.rb +0 -1
  153. data/db/seeds/default/pd/systems.rb +0 -1
  154. data/db/seeds/default/pd/training_sites.rb +0 -1
  155. data/db/seeds/default/pd/training_types.rb +0 -1
  156. data/db/seeds/default/practices/practices.rb +2 -2
  157. data/db/seeds/default/practices/primary_care_physicians.rb +1 -2
  158. data/db/seeds/default/renal/prd_descriptions.rb +1 -0
  159. data/db/seeds/default/system/roles.rb +1 -1
  160. data/lib/renalware/engine.rb +1 -0
  161. data/lib/renalware/version.rb +1 -1
  162. data/spec/factories/hd/prescription_administrations.rb +17 -0
  163. data/spec/support/factory_bot.rb +2 -0
  164. data/spec/support/pages/hd/prescription_administration_dialog.rb +132 -0
  165. metadata +62 -12
  166. data/app/assets/javascripts/renalware/components/bla.es6 +0 -1
  167. data/app/controllers/renalware/hd/prescription_administration_authorisations_controller.rb +0 -27
  168. data/app/javascript/controllers/clipboard_controller.js.dead +0 -16
  169. data/app/views/renalware/hd/sessions/_administered_drugs_row.html.slim +0 -27
  170. data/app/views/renalware/hd/sessions/_administered_drugs_thead.html.slim +0 -11
  171. data/app/views/renalware/hd/sessions/_prescription_administrations.html.slim +0 -20
  172. data/app/views/renalware/hd/sessions/closed/_administered_drugs_row.html.slim +0 -3
  173. data/app/views/renalware/hd/sessions/form/_drugs_to_be_administered.html.slim +0 -84
@@ -7,8 +7,7 @@
7
7
  = content_for(:tabs) do
8
8
  = render "renalware/research/studies/tabs", study: study
9
9
 
10
- = within_admin_layout(\
11
- title: study.code,
12
- breadcrumbs: breadcrumb_for("Clinical Studies", research_studies_path)) do
10
+ = within_admin_layout(title: study.code,
11
+ breadcrumbs: breadcrumb_for("Clinical Studies", research_studies_path)) do
13
12
 
14
13
  = render "table", study: study, participants: participants, query: query
@@ -19,7 +19,7 @@
19
19
  br
20
20
  br
21
21
  .xsss
22
- table.table-header-rotated.toggleable
22
+ table.table-header-rotated.toggleable(data-controller="toggle")
23
23
  thead
24
24
  tr
25
25
  th.togglers= rows_toggler
@@ -49,6 +49,7 @@
49
49
  = value
50
50
  tr
51
51
  td
52
+ |  
52
53
  td
53
54
  td
54
55
  td(class="summary-part--pos_s-patient-question-text" colspan=(pos_s_summary_part.question_labels.count ))
@@ -1,4 +1,4 @@
1
- = within_admin_layout(title: "System Email Templates") do
1
+ = within_new_admin_layout(title: "System Email Templates") do
2
2
 
3
3
  .panel
4
4
  p Listed below are previews of the email templates sent by this application.
@@ -9,3 +9,7 @@
9
9
 
10
10
  dt= link_to "User Reactivated Email", "/rails/mailers/renalware/admin/user_mailer/unexpiry"
11
11
  dd Sent when an administrator reactivates a deactivated user.
12
+
13
+ / You can remove this
14
+ .xxx(data-controller="test")
15
+ .xxx(data-controller="another_test")
@@ -1,3 +1,3 @@
1
- = within_admin_layout(title: "Edit",
1
+ = within_new_admin_layout(title: "Edit",
2
2
  breadcrumbs: breadcrumb_for("System Messages", system_messages_path)) do
3
3
  = render "form", message: message
@@ -1,7 +1,7 @@
1
1
  = content_for(:actions) do
2
2
  = link_to "Add", new_system_message_path, class: :button
3
3
 
4
- = within_admin_layout(title: "System Messages") do
4
+ = within_new_admin_layout(title: "System Messages") do
5
5
  .system-messages
6
6
  table
7
7
  thead
@@ -1,3 +1,3 @@
1
- = within_admin_layout(title: "New",
1
+ = within_new_admin_layout(title: "New",
2
2
  breadcrumbs: breadcrumb_for("System Messages", system_messages_path)) do
3
3
  = render "form", message: message
@@ -1,4 +1,4 @@
1
- = within_admin_layout( \
1
+ = within_new_admin_layout( \
2
2
  title: "Edit",
3
3
  breadcrumbs: breadcrumb_for("User Feedback", system_user_feedback_index_path) \
4
4
  ) do
@@ -1,4 +1,4 @@
1
- = within_admin_layout(title: "User Feedback") do
1
+ = within_new_admin_layout(title: "User Feedback") do
2
2
  table.feedback
3
3
  thead
4
4
  th.col-width-tiny
@@ -9,4 +9,4 @@
9
9
  = render "measurements", mdm: mdm
10
10
 
11
11
  .columns.medium-12.large-4
12
- = render(Renalware::Events::BiopsiesComponent, patient: current_patient)
12
+ = render Renalware::Events::BiopsiesComponent.new(patient: current_patient)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # See here for all options: https://github.com/ddnexus/pagy/blob/master/lib/config/pagy.rb
5
+ #
6
+
7
+ # Foundation extra: Add nav, nav_js and combo_nav_js helpers and templates for Foundation pagination
8
+ # See https://ddnexus.github.io/pagy/extras/foundation
9
+ require "pagy/extras/foundation"
@@ -7,3 +7,4 @@ en:
7
7
  page_actions:
8
8
  protocol: Print HD Session Form
9
9
  mdm: MDM
10
+ record_hd_drugs: Record HD Drugs
@@ -196,7 +196,8 @@ en:
196
196
  add_dna_session: Add DNA Session
197
197
  add: Add Session
198
198
  add_dna: Add DNA Session
199
- view_all: View All
199
+ view_all: View All Sessions
200
+ view_all_drugs_given: View All Drugs Given
200
201
  missing_profile_message: |
201
202
  Please enter the HD Profile before creating sessions
202
203
  row:
@@ -2,6 +2,7 @@
2
2
 
3
3
  namespace :admin do
4
4
  resources :users
5
+ resource :dashboard, only: :show
5
6
  namespace :feeds do
6
7
  resources :files, only: [:index, :show, :new, :create]
7
8
  end
@@ -16,6 +16,7 @@ resources :patients, only: [] do
16
16
  only: [:index, :show],
17
17
  path: "/profiles/historical"
18
18
  resources :sessions
19
+ resources :prescription_administrations, only: :index
19
20
  end
20
21
  end
21
22
 
@@ -25,6 +26,14 @@ namespace :hd do
25
26
  get "patients_dialysing_at_hospital" => "patients#dialysing_at_hospital"
26
27
  end
27
28
 
29
+ resources :prescriptions, only: [] do
30
+ resources :administrations,
31
+ only: %i(new create edit update),
32
+ controller: "prescription_administrations"
33
+ end
34
+ resources :prescription_administration, only: [] do
35
+ resource :witness, only: [:edit, :update]
36
+ end
28
37
  resources :prescription_administration_authorisations, only: :create
29
38
  resources :transmission_logs, only: [:show, :index]
30
39
  resources :cannulation_types, except: :show
@@ -1,8 +1,6 @@
1
1
  class AddTokensToHDPrescriptionAdministrations < ActiveRecord::Migration[5.2]
2
2
  def change
3
3
  within_renalware_schema do
4
- # add_column :hd_prescription_administrations, :administrator_authorisation_token, :string
5
- # add_column :hd_prescription_administrations, :witness_authorisation_token, :string
6
4
  add_column(
7
5
  :hd_prescription_administrations,
8
6
  :administrator_authorised,
@@ -0,0 +1,18 @@
1
+ class AlterHDPrescriptionAdministrations < ActiveRecord::Migration[5.2]
2
+ def change
3
+ within_renalware_schema do
4
+ # Allow HD session if to be null, now that we are allowing HD drugs to be
5
+ # administered before the HD session is created, so there may be no
6
+ # associated session
7
+ change_column_null :hd_prescription_administrations, :hd_session_id, true
8
+ add_reference(
9
+ :hd_prescription_administrations,
10
+ :patient,
11
+ foreign_key: { to_table: :patients },
12
+ index: true,
13
+ null: true # old data will not have one
14
+ )
15
+ add_column :hd_prescription_administrations, :recorded_on, :date, null: true
16
+ end
17
+ end
18
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Access Catheter Insertion Techniques" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "access_pd_catheter_insertion_techniques.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Access Plan Types" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "access_plan_types.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Access Sites" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "access_sites.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Clinics" do
5
-
6
5
  [
7
6
  "Access",
8
7
  "AKI",
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Default Event Types e.g. Biopsy, Swabs" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "event_types.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding HD Cannulation Types" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "cannulation_types.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding HD Dialysers" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "dialysers.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -3,28 +3,28 @@
3
3
  module Renalware
4
4
  module Modalities
5
5
  log "Adding PD To Haemodialysis (Reasons for Change)" do
6
- PDToHaemodialysis.find_or_create_by!(rr_code: 201, description: "Patient/partner choice")
7
- PDToHaemodialysis.find_or_create_by!(rr_code: 202, description: "Loss of supporting partner")
8
- PDToHaemodialysis.find_or_create_by!(rr_code: 203, description: "Other change of personal circumstances")
9
- PDToHaemodialysis.find_or_create_by!(rr_code: 204, description: "Inability to perform PD")
10
- PDToHaemodialysis.find_or_create_by!(rr_code: 205, description: "Other reasons")
11
- PDToHaemodialysis.find_or_create_by!(rr_code: 211, description: "Frequent/Recurrent peritonitis with or without loss of UF")
12
- PDToHaemodialysis.find_or_create_by!(rr_code: 212, description: "Unresolving peritonitis")
13
- PDToHaemodialysis.find_or_create_by!(rr_code: 213, description: "Catheter loss through exit site infection")
14
- PDToHaemodialysis.find_or_create_by!(rr_code: 214, description: "Loss of UF")
15
- PDToHaemodialysis.find_or_create_by!(rr_code: 215, description: "Inadequate clearance")
16
- PDToHaemodialysis.find_or_create_by!(rr_code: 216, description: "Abdominal surgery or complications")
6
+ PDToHaemodialysis.find_or_create_by!(rr_code: 201, description: "Patient/partner choice")
7
+ PDToHaemodialysis.find_or_create_by!(rr_code: 202, description: "Loss of supporting partner")
8
+ PDToHaemodialysis.find_or_create_by!(rr_code: 203, description: "Other change of personal circumstances")
9
+ PDToHaemodialysis.find_or_create_by!(rr_code: 204, description: "Inability to perform PD")
10
+ PDToHaemodialysis.find_or_create_by!(rr_code: 205, description: "Other reasons")
11
+ PDToHaemodialysis.find_or_create_by!(rr_code: 211, description: "Frequent/Recurrent peritonitis with or without loss of UF")
12
+ PDToHaemodialysis.find_or_create_by!(rr_code: 212, description: "Unresolving peritonitis")
13
+ PDToHaemodialysis.find_or_create_by!(rr_code: 213, description: "Catheter loss through exit site infection")
14
+ PDToHaemodialysis.find_or_create_by!(rr_code: 214, description: "Loss of UF")
15
+ PDToHaemodialysis.find_or_create_by!(rr_code: 215, description: "Inadequate clearance")
16
+ PDToHaemodialysis.find_or_create_by!(rr_code: 216, description: "Abdominal surgery or complications")
17
17
  end
18
18
 
19
19
  log "Adding Haemodialysis To PD (Reasons for Change)" do
20
- HaemodialysisToPD.find_or_create_by!(rr_code: 221, description: "Patient/partner choice")
21
- HaemodialysisToPD.find_or_create_by!(rr_code: 222, description: "Loss of supporting partner")
22
- HaemodialysisToPD.find_or_create_by!(rr_code: 223, description: "Other change of personal circumstances")
23
- HaemodialysisToPD.find_or_create_by!(rr_code: 224, description: "Lack of HD facilities")
24
- HaemodialysisToPD.find_or_create_by!(rr_code: 225, description: "Other reasons")
25
- HaemodialysisToPD.find_or_create_by!(rr_code: 231, description: "Loss of vascular access")
26
- HaemodialysisToPD.find_or_create_by!(rr_code: 232, description: "Haemodynamic instability")
27
- HaemodialysisToPD.find_or_create_by!(rr_code: 233, description: "Elective after temporary HD")
20
+ HaemodialysisToPD.find_or_create_by!(rr_code: 221, description: "Patient/partner choice")
21
+ HaemodialysisToPD.find_or_create_by!(rr_code: 222, description: "Loss of supporting partner")
22
+ HaemodialysisToPD.find_or_create_by!(rr_code: 223, description: "Other change of personal circumstances")
23
+ HaemodialysisToPD.find_or_create_by!(rr_code: 224, description: "Lack of HD facilities")
24
+ HaemodialysisToPD.find_or_create_by!(rr_code: 225, description: "Other reasons")
25
+ HaemodialysisToPD.find_or_create_by!(rr_code: 231, description: "Loss of vascular access")
26
+ HaemodialysisToPD.find_or_create_by!(rr_code: 232, description: "Haemodynamic instability")
27
+ HaemodialysisToPD.find_or_create_by!(rr_code: 233, description: "Elective after temporary HD")
28
28
  end
29
29
  end
30
30
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Pathology Measurement Units" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "measurement_units.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Renal Registry Ethnicities" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "rr18_ethnicity_codes.csv")
7
6
  CSV.foreach(file_path, headers: true) do |row|
8
7
  Patients::Ethnicity.find_or_create_by!(rr18_code: row["code"]) do |code|
@@ -3,6 +3,7 @@
3
3
  module Renalware
4
4
  log "Adding Languages" do
5
5
  return if Patients::Language.count > 0
6
+
6
7
  file_path = File.join(File.dirname(__FILE__), "patients_languages.csv")
7
8
  languages = []
8
9
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Religions" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "patients_religions.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding PD Bag Types" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "bag_types.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Renal Reg Organisms" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "rr_organisms.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding PD Systems" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "systems.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding PD Training Sites" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "training_sites.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding PD Training Types" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "training_types.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -4,11 +4,11 @@ module Renalware
4
4
  log "Adding NHS Practices\n" do
5
5
  sample_status = "SAMPLE ONLY"
6
6
  Patients::Practice.transaction do
7
- #NOTE: use '_sample' file for demo/devel
7
+ # NOTE: use '_sample' file for demo/devel
8
8
  CSV.foreach(File.join(File.dirname(__FILE__), "nhs_practices_sample.csv"), headers: true) do |row|
9
9
  practice = Patients::Practice.find_or_initialize_by(code: row["code"])
10
10
  practice.name = row["name"]
11
- unless practice.address.present?
11
+ if practice.address.blank?
12
12
  practice.build_address(
13
13
  organisation_name: row["name"],
14
14
  postcode: row["postcode"],
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
-
5
4
  log "Adding Primary Care Physicians\n" do
6
5
  sample_status = "SAMPLE ONLY"
7
6
  file_path = File.join(File.dirname(__FILE__), "primary_care_physicians_sample.csv")
8
- #"id","practice_code","gp_code","name","practice_id"
7
+ # "id","practice_code","gp_code","name","practice_id"
9
8
 
10
9
  CSV.foreach(file_path, headers: true) do |row|
11
10
  practice_id = row["practice_id"].to_i
@@ -3,6 +3,7 @@
3
3
  module Renalware
4
4
  log "Adding Primary Renal Diagnosis (PRD) Codes" do
5
5
  return if Renal::PRDDescription.count > 0
6
+
6
7
  file_path = File.join(File.dirname(__FILE__), "prd_descriptions.csv")
7
8
  descriptions = []
8
9
  CSV.foreach(file_path, headers: true) do |row|
@@ -3,7 +3,7 @@
3
3
  module Renalware
4
4
  log "Adding Roles" do
5
5
  Role::ROLES.each do |role|
6
- hidden = ([:super_admin, :devops].include?(role))
6
+ hidden = [:super_admin, :devops].include?(role)
7
7
  Role.find_or_create_by!(name: role, hidden: hidden)
8
8
  end
9
9
  end
@@ -36,6 +36,7 @@ require "naught"
36
36
  require "nested_form"
37
37
  require "nokogiri"
38
38
  require "ox"
39
+ require "pagy"
39
40
  require "paper_trail"
40
41
  require "paranoia"
41
42
  require "pg"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.137"
4
+ VERSION = "2.0.138"
5
5
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :hd_prescription_administration, class: "Renalware::HD::PrescriptionAdministration" do
5
+ accountable
6
+ patient
7
+ prescription
8
+ association :administered_by, factory: :user
9
+ administrator_authorised { true }
10
+ association :witnessed_by, factory: :user
11
+ witness_authorised { true }
12
+ administered { true }
13
+ notes { "some notes" }
14
+ deleted_at { nil }
15
+ recorded_on { Time.zone.today }
16
+ end
17
+ end