renalware-core 2.0.72 → 2.0.73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/renalware/partials/_errors.scss +2 -1
  3. data/app/assets/stylesheets/renalware/partials/_tables.scss +10 -0
  4. data/app/controllers/renalware/clinics/clinic_visits_controller.rb +2 -1
  5. data/app/controllers/renalware/clinics/visits_controller.rb +1 -1
  6. data/app/helpers/renalware/definition_list_helper.rb +2 -2
  7. data/app/models/renalware/pathology/lab.rb +4 -0
  8. data/app/models/renalware/pathology/observation_requests_attributes_builder.rb +5 -2
  9. data/app/models/renalware/patient.rb +7 -1
  10. data/app/presenters/renalware/clinics/clinic_visit_presenter.rb +14 -0
  11. data/app/views/renalware/admissions/requests/destroy.js.erb +1 -1
  12. data/app/views/renalware/patients/patients/_form.html.slim +7 -6
  13. data/app/views/renalware/patients/patients/edit.html.slim +2 -5
  14. data/app/views/renalware/patients/patients/new.html.slim +2 -4
  15. data/config/initializers/routing_draw.rb +9 -0
  16. data/config/routes.rb +29 -512
  17. data/config/routes/accesses.rb +11 -0
  18. data/config/routes/admin.rb +9 -0
  19. data/config/routes/admissions.rb +13 -0
  20. data/config/routes/api.rb +22 -0
  21. data/config/routes/clinical.rb +11 -0
  22. data/config/routes/clinics.rb +8 -0
  23. data/config/routes/directory.rb +9 -0
  24. data/config/routes/drugs.rb +11 -0
  25. data/config/routes/events.rb +29 -0
  26. data/config/routes/fallbacks.rb +12 -0
  27. data/config/routes/hd.rb +53 -0
  28. data/config/routes/hospitals.rb +10 -0
  29. data/config/routes/letters.rb +45 -0
  30. data/config/routes/low_clearance.rb +16 -0
  31. data/config/routes/medications.rb +24 -0
  32. data/config/routes/messaging.rb +16 -0
  33. data/config/routes/modalities.rb +10 -0
  34. data/config/routes/pathology.rb +30 -0
  35. data/config/routes/patients.rb +40 -0
  36. data/config/routes/pd.rb +31 -0
  37. data/config/routes/renal.rb +22 -0
  38. data/config/routes/reporting.rb +6 -0
  39. data/config/routes/research.rb +7 -0
  40. data/config/routes/snippets.rb +11 -0
  41. data/config/routes/system.rb +40 -0
  42. data/config/routes/transplants.rb +45 -0
  43. data/config/routes/virology.rb +12 -0
  44. data/db/migrate/20190315125638_add_timestamps_to_pathology_description_tables.rb +10 -0
  45. data/db/seeds/default/system/countries.rb +5 -2
  46. data/lib/renalware/version.rb +1 -1
  47. metadata +60 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e283c0fb737a52927b551762ea2204f875ef28cd5673206fc9e8c8d5d85500f
4
- data.tar.gz: fbb0521235f06ac34c8a53c145bd11bb66e4bc64418c3b876733ce380397b987
3
+ metadata.gz: fa22b53287a50bfb41fc8de7c46fe936fe87387b2b209b46e34caee3e330ef5a
4
+ data.tar.gz: dfd75e90ef80382dccc2118e1c7983d1ac04f0dfcb94dbca78c89d12b85ad2ba
5
5
  SHA512:
6
- metadata.gz: bf8c3050912034740b3909f03f4282e3c195361a25d84db3a0989184ef812e318be6d2bfd8a444674f402656827260512539fade7d56f764753edb902d358fdb
7
- data.tar.gz: cc6d16506b95182555b76cb4432ef8ac4945080543a0ba994798ea75d3fb72b951b3ce39b51313129df74261f4f597fc748c386c22113fc7469bee7ca572c9cc
6
+ metadata.gz: 71693a8d39c32435d5b2175341c9377bc472bcec42249e1fe8eb34f76f7144c02258af99c47c3cab2e47885e9af5e23777a8385508c7008b4d3b97d05d93b656
7
+ data.tar.gz: a5056e47da3cd879f1e6ec4836d7846448f76aee72c38881d9500876e06252bd2f561dec5efc84d60232f5ae079a7664bea493874f49513de3f2525ca24bcdc1
@@ -59,7 +59,8 @@
59
59
  }
60
60
  }
61
61
 
62
- ul.error-messages {
62
+ ul.error-messages,
63
+ .non-patient-page ul.error-messages {
63
64
  background-color: $error-background;
64
65
  color: $nhs-red;
65
66
  margin: 0;
@@ -108,6 +108,16 @@ table {
108
108
  color: $monsoon;
109
109
  text-align: right;
110
110
  }
111
+
112
+ dd {
113
+ * {
114
+ font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
115
+ font-size: 1rem;
116
+ border: 0;
117
+ margin: 0;
118
+ padding: 0;
119
+ }
120
+ }
111
121
  }
112
122
  }
113
123
 
@@ -7,9 +7,10 @@ module Renalware
7
7
  before_action :load_clinic_visit, only: [:edit, :update, :destroy]
8
8
 
9
9
  def index
10
+ visits = patient.clinic_visits.includes([:clinic, :created_by]).ordered
10
11
  render locals: {
11
12
  patient: patient,
12
- clinic_visits: patient.clinic_visits.includes([:clinic, :created_by]).ordered
13
+ clinic_visits: CollectionPresenter.new(visits, ClinicVisitPresenter)
13
14
  }
14
15
  end
15
16
 
@@ -12,7 +12,7 @@ module Renalware
12
12
  authorize visits
13
13
 
14
14
  render locals: {
15
- visits: visits,
15
+ visits: CollectionPresenter.new(visits, ClinicVisitPresenter),
16
16
  query: visits_query.search,
17
17
  clinics: Clinic.ordered,
18
18
  users: User.ordered
@@ -12,8 +12,8 @@ module Renalware
12
12
  super(model)
13
13
  end
14
14
 
15
- def definition(attribute)
16
- text = @model_klass.human_attribute_name(attribute)
15
+ def definition(attribute, label = nil)
16
+ text = label || @model_klass.human_attribute_name(attribute)
17
17
  value = public_send(attribute)
18
18
  value = yield(value) if value.present? && block_given?
19
19
  capture do
@@ -10,6 +10,10 @@ module Renalware
10
10
  scope :ordered, -> { order(name: :asc) }
11
11
 
12
12
  validates :name, presence: true
13
+
14
+ def self.unknown
15
+ find_by!(name: "Lab: Unknown")
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -87,13 +87,16 @@ module Renalware
87
87
  end
88
88
 
89
89
  def find_request_description(code)
90
- RequestDescription.find_by!(code: code)
90
+ RequestDescription.find_or_create_by!(code: code) do |desc|
91
+ desc.name = code
92
+ desc.lab = Lab.unknown
93
+ end
91
94
  rescue ActiveRecord::RecordNotFound
92
95
  raise MissingRequestDescriptionError, code
93
96
  end
94
97
 
95
98
  def find_observation_description(code)
96
- ObservationDescription.find_by!(code: code)
99
+ ObservationDescription.find_or_create_by!(code: code) { |desc| desc.name = code }
97
100
  rescue ActiveRecord::RecordNotFound
98
101
  raise MissingObservationDescriptionError, code
99
102
  end
@@ -170,7 +170,13 @@ module Renalware
170
170
  end
171
171
 
172
172
  def validate_sex
173
- errors.add(:sex, "is invalid option (#{sex.code})") unless sex.valid?
173
+ unless sex.valid?
174
+ if sex.code.present?
175
+ errors.add(:sex, "has an invalid option (#{sex.code})")
176
+ else
177
+ errors.add(:sex, "is required")
178
+ end
179
+ end
174
180
  end
175
181
 
176
182
  def must_have_at_least_one_identifier
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/clinics"
4
+ require_dependency "collection_presenter"
5
+
6
+ module Renalware
7
+ module Clinics
8
+ class ClinicVisitPresenter < DumbDelegator
9
+ def sanitized_notes
10
+ ::Rails::Html::WhiteListSanitizer.new.sanitize(notes, tags: %w(p br ol li ul span div))
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  // Remove the just-deleted admissions request from the
2
2
  <%= refresh(".flash-message", partial: "renalware/shared/flash_messages", locals: local_assigns) %>
3
- $("#admissions_request_<%=request_id %>").fadeOut(300, function(){ $(this).remove();})
3
+ $("#admissions_request_<%=request_id %>").remove();
@@ -15,15 +15,13 @@
15
15
  = f.input :family_name, wrapper: :horizontal_small
16
16
  = f.input :given_name, wrapper: :horizontal_small
17
17
  = f.input :suffix, wrapper: :horizontal_small
18
- = f.input :email, wrapper: :horizontal_small
19
- = f.input :telephone1, wrapper: :horizontal_small
20
- = f.input :telephone2, wrapper: :horizontal_small
18
+ = f.input :born_on, as: :date_picker, label: "DoB", wrapper: :horizontal_datepicker
21
19
  = f.input :sex,
22
20
  selected: patient.sex.code,
23
- placeholder: "Please select gender",
24
21
  collection: Renalware::Gender.all,
25
22
  label_method: :name, value_method: :code,
26
- include_blank: "Please select gender",
23
+ include_blank: "Please select",
24
+ required: true,
27
25
  wrapper: :horizontal_small
28
26
  = f.association :ethnicity,
29
27
  label_method: :name, value_method: :id,
@@ -43,12 +41,15 @@
43
41
  = f.input :marital_status,
44
42
  include_blank: "Please select marital status",
45
43
  wrapper: :horizontal_small
46
- = f.input :born_on, as: :date_picker, label: "DoB", wrapper: :horizontal_datepicker
47
44
  = f.input :paediatric_patient_indicator,
48
45
  as: :inline_radio_buttons,
49
46
  label: "If under 18 years, is the recipient being treated in a paediatric unit?",
50
47
  wrapper: :horizontal_small
51
48
 
49
+ = f.input :telephone1, wrapper: :horizontal_small
50
+ = f.input :telephone2, wrapper: :horizontal_small
51
+ = f.input :email, wrapper: :horizontal_small
52
+
52
53
  - if patient.persisted?
53
54
  .row
54
55
  .section-underliner
@@ -6,9 +6,6 @@
6
6
  wrapper: "horizontal_form",
7
7
  html: { autocomplete: "off" } do |f|
8
8
 
9
+ .columns= save_or_cancel(form: f, back_path: patient_path(patient))
9
10
  = render "form", f: f, patient: patient
10
-
11
- .columns.large-12
12
- = submit_tag "Update", class: "button"
13
- span= " or "
14
- = link_to "Cancel", patient_path(patient)
11
+ .columns= save_or_cancel(form: f, back_path: patient_path(patient))
@@ -20,8 +20,6 @@
20
20
  html: { autocomplete: "off" },
21
21
  wrapper: "horizontal_form" do |f|
22
22
 
23
+ .columns= save_or_cancel(form: f, back_path: patients_path)
23
24
  = render "form", f: f, patient: patient
24
-
25
- = submit_tag "Save", class: "button"
26
- span= " or "
27
- = link_to "cancel", patients_path
25
+ .columns= save_or_cancel(form: f, back_path: patients_path)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Adds draw method into Rails routing.
4
+ # It allows us to keep routes split into files, one per module.
5
+ class ActionDispatch::Routing::Mapper
6
+ def draw(routes_name)
7
+ instance_eval(File.read(Renalware::Engine.root.join("config/routes/#{routes_name}.rb")))
8
+ end
9
+ end
@@ -1,517 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Renalware::Engine.routes.draw do
4
- match "/404", to: "system/errors#not_found", via: :all
5
- match "/500", to: "system/errors#internal_server_error", via: :all
6
- match "/generate_test_internal_server_error",
7
- to: "system/errors#generate_test_internal_server_error",
8
- via: :get
9
-
10
- devise_for :users,
11
- class_name: "Renalware::User",
12
- controllers: {
13
- registrations: "renalware/devise/registrations",
14
- sessions: "renalware/devise/sessions",
15
- passwords: "renalware/devise/passwords"
16
- },
17
- module: :devise
18
-
19
- # An ajax-polled route which will cause the users browser to redirect to the login page
20
- # when their session expires
21
- get "/session_timed_out" => "session_timeout#has_user_timed_out", as: "session_timed_out"
22
-
23
- super_admin_constraint = lambda do |request|
24
- current_user = request.env["warden"].user || Renalware::NullUser.new
25
- current_user.has_role?(:super_admin)
26
- end
27
-
28
- constraints super_admin_constraint do
29
- match "/delayed_job" => DelayedJobWeb, :anchor => false, via: [:get, :post]
30
- end
31
-
32
- # enable mail previews in all environments
33
- get "/rails/mailers" => "rails/mailers#index"
34
- get "/rails/mailers/*path" => "rails/mailers#preview"
35
-
36
4
  root to: "dashboard/dashboards#show"
37
-
38
- resources :mock_errors, only: [:index], controller: "system/mock_errors"
39
-
40
- namespace :reporting do
41
- resources :audits, except: [:destroy, :create, :new]
42
- resources :audit_refreshments, only: [:create]
43
- end
44
-
45
- namespace :admissions do
46
- resources :requests, except: :show do
47
- post :sort, on: :collection
48
- end
49
- resources :consults, except: :show
50
- resources :admissions, except: :show
51
- end
52
-
53
- namespace :messaging do
54
- namespace :internal do
55
- resources :messages, only: [:new, :create] do
56
- resources :receipts, only: [] do
57
- patch :mark_as_read, on: :member
58
- end
59
- end
60
- scope :messages do
61
- get "inbox", to: "receipts#unread", as: :inbox
62
- get "read", to: "receipts#read", as: :read_receipts
63
- get "sent", to: "receipts#sent", as: :sent_messages
64
- end
65
- end
66
- end
67
-
68
- namespace :admin do
69
- resources :users
70
- namespace :feeds do
71
- resources :files, only: [:index, :show, :new, :create]
72
- end
73
- resource :cache, only: [:show, :destroy]
74
- end
75
-
76
- namespace :api do
77
- # The UKRDC XML API
78
- namespace :ukrdc, defaults: { format: :xml } do
79
- resources :patients,
80
- only: :show,
81
- constraints: { format: :xml }
82
- end
83
- # The JSON API
84
- namespace :v1, constraints: { format: :json }, defaults: { format: :json } do
85
- resources :patients, only: [:show, :index], controller: "patients/patients" do
86
- resources :prescriptions, controller: "medications/prescriptions", only: [:index]
87
- namespace :hd do
88
- resource :current_profile,
89
- only: :show,
90
- path: "/profiles/current",
91
- controller: "current_profile"
92
- end
93
- end
94
- end
95
- end
96
-
97
- namespace :research do
98
- resources :studies do
99
- resources :participants, controller: :study_participants
100
- end
101
- end
102
-
103
- resources :snippets, controller: "snippets/snippets", except: :show do
104
- resources :snippet_clones,
105
- controller: "snippets/snippet_clones",
106
- only: :create, as: :clones
107
- resources :snippet_invocations,
108
- controller: "snippets/snippet_invocations",
109
- only: :create,
110
- as: :invocations
111
- end
112
-
113
- resources :bookmarks, controller: "patients/bookmarks", only: [:destroy, :index]
114
- resource :dashboard, only: :show, controller: "dashboard/dashboards"
115
- resource :worryboard, only: :show, controller: "patients/worryboard"
116
-
117
- # Clinics
118
- resources :appointments, controller: "clinics/appointments", only: [:new, :create, :index]
119
- resources :clinic_visits, only: :index, controller: "clinics/visits"
120
-
121
- resources :deaths, only: :index, as: :patient_deaths
122
-
123
- namespace :directory do
124
- resources :people, except: [:delete] do
125
- collection do
126
- get :search
127
- end
128
- end
129
- end
130
-
131
- namespace :drugs do
132
- resources :drugs, except: :show do
133
- collection do
134
- scope format: true, constraints: { format: :json } do
135
- get :selected_drugs
136
- end
137
- end
138
- end
139
- end
140
-
141
- namespace :medications do
142
- # medications_esa_prescriptions => /medications/esa_prescriptions
143
- resources :esa_prescriptions,
144
- only: :index,
145
- drug_type_name: :esa,
146
- controller: "drug_types/prescriptions"
147
- end
148
-
149
- namespace :events do
150
- resources :types, except: :show
151
- end
152
-
153
- namespace :hd do
154
- scope format: true, constraints: { format: :json } do
155
- get "patients_dialysing_at_unit" => "patients#dialysing_at_unit"
156
- get "patients_dialysing_at_hospital" => "patients#dialysing_at_hospital"
157
- end
158
-
159
- resources :transmission_logs, only: [:show, :index]
160
- resources :cannulation_types, except: :show
161
- resources :dialysers, except: :show
162
- resources :dialysates, except: :show
163
- resource :ongoing_sessions, only: :show
164
- resources :mdm_patients, only: :index
165
- resources :mdm_patients, only: :index
166
- constraints(named_filter: /(on_worryboard)/) do
167
- get "mdm_patients/:named_filter", to: "mdm_patients#index", as: :filtered_mdm_patients
168
- end
169
- resources :unmet_preferences, only: :index
170
- resources :units, only: [] do
171
- resources :stations do
172
- post :sort, on: :collection
173
- end
174
- resources :diaries, only: [:index, :show]
175
- get "diaries/:year/:week_number/edit", to: "diaries#edit", as: :edit_diary
176
- end
177
- resources :diaries, only: [] do
178
- resources :slots, except: :show, controller: :diary_slots
179
- get "slots/day/:day_of_week/period/:diurnal_period_code_id/station/:station_id",
180
- to: "diary_slots#show",
181
- as: :refresh_slot
182
- end
183
- end
184
-
185
- namespace :hospitals do
186
- resources :units, except: :show do
187
- resources :wards
188
- scope format: true, constraints: { format: :json } do
189
- resources :wards, only: :index
190
- end
191
- end
192
- end
193
-
194
- namespace :modalities do
195
- resources :descriptions, except: [:show]
196
- resources :reasons, only: [:index]
197
- end
198
-
199
- namespace :letters do
200
- resource :pdf_letter_cache, only: [:destroy], controller: "pdf_letter_cache"
201
- resources :descriptions, only: :search do
202
- collection do
203
- get :search
204
- end
205
- end
206
- resource :list, only: :show
207
- resources :letters, only: [] do
208
- resources :electronic_receipts, only: [] do
209
- patch :mark_as_read, on: :member
210
- end
211
- end
212
- resources :electronic_receipts, only: [] do
213
- collection do
214
- get :unread
215
- get :read
216
- get :sent
217
- end
218
- end
219
- end
220
- get "authors/:author_id/letters", to: "letters/letters#author", as: "author_letters"
221
-
222
- namespace :pathology do
223
- namespace :requests do
224
- # NOTE: This needs to be POST since the params may exceed url char limit in GET
225
- post "requests/new", to: "requests#new", as: "new_request"
226
- resources :requests, only: [:create, :index, :show]
227
- resources :rules, only: :index
228
- end
229
- end
230
-
231
- namespace :patients do
232
- resources :primary_care_physicians
233
- resources :practices, only: [] do
234
- collection do
235
- get :search
236
- end
237
- resources :primary_care_physicians,
238
- only: :index,
239
- controller: "practices/primary_care_physicians"
240
- end
241
- end
242
-
243
- namespace :pd do
244
- resources :bag_types, except: [:show]
245
- resources :infection_organisms
246
- resources :mdm_patients, only: :index
247
- constraints(named_filter: /(on_worryboard)/) do
248
- get "mdm_patients/:named_filter", to: "mdm_patients#index", as: :filtered_mdm_patients
249
- end
250
- end
251
-
252
- namespace :renal do
253
- resources :prd_descriptions, only: [:search] do
254
- collection do
255
- get :search
256
- end
257
- end
258
- resources :aki_alerts, only: [:edit, :update, :index]
259
- resources :registry_preflight_checks, only: [] do
260
- collection do
261
- get :patients
262
- get :deaths
263
- end
264
- end
265
- end
266
-
267
- namespace :low_clearance do
268
- resources :mdm_patients, only: :index
269
- constraints(named_filter: /#{Renalware::LowClearance::MDM_FILTERS.join("|")}/) do
270
- get "mdm_patients/:named_filter", to: "mdm_patients#index", as: :filtered_mdm_patients
271
- end
272
- end
273
-
274
- namespace :system do
275
- resources :email_templates, only: :index
276
- resources :user_feedback, except: :destroy, controller: "user_feedback"
277
- resources :messages
278
- end
279
-
280
- namespace :transplants do
281
- constraints(named_filter: /#{Renalware::Transplants::WAITLIST_FILTERS.join("|")}/) do
282
- get "wait_list/:named_filter", to: "wait_lists#show", as: :wait_list
283
- end
284
- resources :live_donors, only: :index
285
- resources :mdm_patients, only: :index
286
- constraints(named_filter: /(recent|on_worryboard|past_year)/) do
287
- get "mdm_patients/:named_filter", to: "mdm_patients#index", as: :filtered_mdm_patients
288
- end
289
- end
290
-
291
- # Patient-scoped Routes
292
- #
293
- # Please add all non patient-scoped routes above
294
- #
295
- resources :patients, except: [:destroy], controller: "patients/patients" do
296
- collection do
297
- get :search
298
- end
299
-
300
- resource :clinical_summary, only: :show, controller: "patients/clinical_summaries"
301
- resource :death, only: [:edit, :update]
302
- resource :primary_care_physician,
303
- controller: "patients/primary_care_physician",
304
- only: [:edit, :update]
305
-
306
- resources :admissions, only: [:index], controller: "admissions/patient_admissions"
307
-
308
- namespace :clinical do
309
- resources :allergies, only: [:create, :destroy]
310
- resource :allergy_status, only: [:update]
311
- resource :profile, only: [:show, :edit, :update]
312
- resources :dry_weights, only: [:new, :create, :index]
313
- resources :body_compositions, except: :destroy
314
- end
315
-
316
- resources :bookmarks, only: :create, controller: "patients/bookmarks"
317
- resources :alerts, only: [:new, :create, :destroy], controller: "patients/alerts"
318
- resource :worry, only: [:create, :destroy], controller: "patients/worry"
319
-
320
- namespace :accesses do
321
- resource :dashboard, only: :show
322
- resources :assessments, except: [:index, :destroy]
323
- resources :procedures, except: [:index, :destroy]
324
- resources :profiles, except: [:index, :destroy]
325
- resources :plans, except: [:index, :destroy]
326
- end
327
-
328
- # Clinics
329
- resources :clinic_visits, controller: "clinics/clinic_visits"
330
-
331
- # Events
332
- resources :events, only: [:new, :create, :index], controller: "events/events"
333
- constraints(format: /(pdf)/) do
334
- resources :events, only: :show, controller: "events/events"
335
- end
336
-
337
- resources :swabs,
338
- only: [:new, :create, :edit, :update],
339
- controller: "events/swabs",
340
- defaults: { slug: :swabs }
341
-
342
- resources :investigations,
343
- only: [:new, :create, :edit, :update],
344
- controller: "events/investigations",
345
- defaults: { slug: :investigations }
346
-
347
- # Here we could enable new event by any other slug
348
- # eg patient_new_specific_event(slug: "transplant_biopsies")
349
- # get "events/:slug/new",
350
- # to: "events/events#new",
351
- # as: :new_specific_event
352
- # or we could hardwire routes as we do for swabs.
353
-
354
- namespace :hd do
355
- resource :mdm, only: :show, controller: "mdm"
356
- resource :dashboard, only: :show
357
- resource :protocol,
358
- only: :show,
359
- constraints: { format: /(pdf)/ },
360
- defaults: { format: :pdf }
361
- resource :preference_set, only: [:edit, :update]
362
- resource :current_profile,
363
- only: [:show, :edit, :update],
364
- path: "/profiles/current",
365
- controller: "current_profile"
366
- resources :historical_profiles,
367
- only: [:index, :show],
368
- path: "/profiles/historical"
369
- resources :sessions
370
- end
371
-
372
- # Medications
373
- resources :prescriptions, controller: "medications/prescriptions", except: [:destroy]
374
- namespace :medications do
375
- namespace :home_delivery do
376
- resources :prescriptions,
377
- only: [:index],
378
- constraints: { format: /(pdf)/ },
379
- defaults: { format: :pdf }
380
- end
381
- resources :prescriptions, only: [] do
382
- resource :termination, only: [:new, :create]
383
- end
384
- end
385
-
386
- namespace :letters do
387
- resources :contacts, only: [:index, :new, :create, :edit, :update]
388
- resources :letters do
389
- resource :pending_review, controller: "pending_review_letters", only: :create
390
- resource :rejected, controller: "rejected_letters", only: :create
391
- resource :approved, controller: "approved_letters", only: :create
392
- resource :completed, controller: "completed_letters", only: [:new, :create]
393
- resource :formatted, controller: "formatted_letters", only: :show
394
- resource :printable,
395
- controller: "printable_letters",
396
- only: :show,
397
- constraints: { format: /(pdf)/ },
398
- defaults: { format: :pdf }
399
- collection do
400
- get :contact_added
401
- end
402
- end
403
- end
404
-
405
- namespace :renal do
406
- resource :profile, only: [:show, :edit, :update]
407
- end
408
-
409
- # Modalities
410
- resources :modalities, only: [:new, :create, :index], controller: "modalities/modalities"
411
-
412
- namespace :pd do
413
- resource :dashboard, only: :show
414
- resources :apd_regimes,
415
- controller: "regimes",
416
- type: "PD::APDRegime",
417
- only: [:new, :create, :edit, :update, :show]
418
- resources :capd_regimes,
419
- controller: "regimes",
420
- type: "PD::CAPDRegime",
421
- only: [:new, :create, :edit, :update, :show]
422
- resources :regimes, only: [:new, :create, :edit, :update, :show]
423
- resources :peritonitis_episodes, only: [:new, :create, :show, :edit, :update]
424
- resources :exit_site_infections, only: [:new, :create, :show, :edit, :update]
425
- resources :pet_adequacy_results, except: [:destroy]
426
- resources :assessments, except: [:index, :destroy]
427
- resources :training_sessions, except: [:index, :destroy]
428
- resource :mdm, only: :show, controller: "mdm"
429
- end
430
-
431
- namespace :low_clearance do
432
- resource :dashboard, only: :show
433
- resource :profile, only: [:edit, :update]
434
- resource :mdm, only: :show, controller: "mdm"
435
- end
436
-
437
- member do
438
- get :capd_regime
439
- get :apd_regime
440
- end
441
-
442
- namespace :pathology do
443
- get "observations/current",
444
- to: "current_observation_results#index",
445
- as: "current_observations"
446
- get "observations/recent",
447
- to: "recent_observation_results#index",
448
- as: "recent_observations"
449
- get "observations/historical",
450
- to: "historical_observation_results#index",
451
- as: "historical_observations"
452
- resources :observation_requests, only: [:index, :show]
453
- resources :patient_rules
454
- get "descriptions/:description_id/observations",
455
- to: "observations#index",
456
- as: "observations"
457
- resources :required_observations, only: :index
458
- end
459
-
460
- namespace :virology do
461
- resource :dashboard, only: :show, path: "/dashboard"
462
- resource :profile, except: :destroy
463
-
464
- resources :vaccinations,
465
- only: [:new, :create, :edit, :update],
466
- defaults: { slug: :vaccinations }
467
- end
468
-
469
- # Problems
470
- resources :problems, controller: "problems/problems" do
471
- post :sort, on: :collection
472
- resources :notes, only: [:index, :new, :create], controller: "problems/notes"
473
- end
474
-
475
- namespace :transplants do
476
- resource :mdm, only: :show, controller: "mdm"
477
-
478
- scope "/donor" do
479
- resource :donor_dashboard, only: :show, path: "/dashboard"
480
- resource :donor_workup, only: [:show, :edit, :update], path: "/workup"
481
- resources :donor_operations, except: [:index, :destroy], path: "/operations" do
482
- resource :followup,
483
- except: :destroy,
484
- controller: "donor_followups",
485
- path: "/follow_up"
486
- end
487
- resources :donations, except: [:index, :destroy]
488
- resource :donor_stage, only: [:new, :create], path: "/stage"
489
- end
490
-
491
- scope "/recipient" do
492
- resource :recipient_dashboard, only: :show, path: "/dashboard"
493
- resource :recipient_workup, only: [:show, :edit, :update], path: "/workup"
494
- resources :recipient_operations, except: [:index, :destroy], path: "/operations" do
495
- resource :followup,
496
- except: :destroy,
497
- controller: "recipient_followups",
498
- path: "/follow_up"
499
- end
500
- resource :registration, only: [:show, :edit, :update] do
501
- resources :statuses, except: [:index, :show], controller: "registration_statuses"
502
- end
503
- end
504
- end
505
- end
506
-
507
- # Some safety-net routes in case we happen to fall through the above routed without a match.
508
- # For example, redirect to the HD dashboard if they hit just /hd/
509
- # In theory we should only ever hit these routes if the user manually edits/enters the URL.
510
- get "/patients/:id/hd", to: redirect("/patients/%{id}/hd/dashboard")
511
- get "/patients/:id/pd", to: redirect("/patients/%{id}/pd/dashboard")
512
- get "/patients/:id/transplants", to: redirect("/patients/%{id}")
513
- get "/patients/:id/transplants/donor",
514
- to: redirect("/patients/%{id}/transplants/donor/dashboard")
515
- get "/patients/:id/transplants/recipient",
516
- to: redirect("/patients/%{id}/transplants/recipient/dashboard")
5
+ draw :accesses
6
+ draw :admin
7
+ draw :admissions
8
+ draw :api
9
+ draw :clinical
10
+ draw :clinics
11
+ draw :directory
12
+ draw :drugs
13
+ draw :events
14
+ draw :hd
15
+ draw :hospitals
16
+ draw :letters
17
+ draw :low_clearance
18
+ draw :medications
19
+ draw :messaging
20
+ draw :modalities
21
+ draw :pathology
22
+ draw :patients
23
+ draw :pd
24
+ draw :renal
25
+ draw :reporting
26
+ draw :research
27
+ draw :snippets
28
+ draw :system
29
+ draw :transplants
30
+ draw :virology
31
+
32
+ # Last
33
+ draw :fallbacks
517
34
  end