renalware-core 2.0.11 → 2.0.12

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/renalware/modules/_admissions.scss +8 -0
  3. data/app/assets/stylesheets/renalware/modules/_clinical.scss +8 -0
  4. data/app/assets/stylesheets/renalware/modules/_pathology.scss +1 -0
  5. data/app/assets/stylesheets/renalware/modules/_patients.scss +13 -0
  6. data/app/assets/stylesheets/renalware/partials/_button.scss +4 -0
  7. data/app/assets/stylesheets/renalware/partials/_forms.scss +3 -0
  8. data/app/assets/stylesheets/renalware/partials/_navigation.scss +4 -0
  9. data/app/assets/stylesheets/renalware/partials/_tables.scss +10 -0
  10. data/app/controllers/renalware/admissions/consults_controller.rb +5 -1
  11. data/app/controllers/renalware/api/token_authenticated_api_controller.rb +2 -0
  12. data/app/controllers/renalware/api/ukrdc/patients_controller.rb +2 -0
  13. data/app/controllers/renalware/medications/drug_types/prescriptions_controller.rb +1 -0
  14. data/app/controllers/renalware/messaging/internal/receipts_controller.rb +20 -5
  15. data/app/models/renalware/hd/sessions/auditable_session_collection.rb +1 -0
  16. data/app/models/renalware/hd/sessions/save_session.rb +1 -1
  17. data/app/models/renalware/letters/part/recent_pathology_results.rb +45 -27
  18. data/app/models/renalware/letters/pathology_layout.rb +22 -0
  19. data/app/presenters/renalware/address_presenter/block.rb +3 -1
  20. data/app/presenters/renalware/admissions/consult_presenter.rb +1 -1
  21. data/app/presenters/renalware/mdm_presenter.rb +1 -7
  22. data/app/views/renalware/admissions/consults/_filters.html.slim +7 -2
  23. data/app/views/renalware/admissions/consults/_form.html.slim +1 -0
  24. data/app/views/renalware/admissions/consults/_table.html.slim +22 -18
  25. data/app/views/renalware/admissions/consults/index.html.slim +2 -0
  26. data/app/views/renalware/clinical/profiles/show.html.slim +1 -1
  27. data/app/views/renalware/letters/formatted_letters/_letter.html.slim +4 -0
  28. data/app/views/renalware/medications/drug_types/prescriptions/_filters.html.slim +21 -10
  29. data/app/views/renalware/medications/drug_types/prescriptions/_table.html.slim +32 -31
  30. data/app/views/renalware/messaging/internal/receipts/_receipt.html.slim +1 -2
  31. data/app/views/renalware/pathology/current_observation_results/index.html.slim +7 -8
  32. data/config/locales/renalware/admissions/consults.en.yml +1 -0
  33. data/config/locales/renalware/medications/drug_types/esa_prescriptions.en.yml +1 -1
  34. data/config/locales/renalware/transplants/recipient_operation.yml +1 -1
  35. data/db/migrate/20180323150241_update_path_obs_descs_for_letter_groupings.rb +27 -0
  36. data/db/migrate/20180327100423_add_constraints_to_recipient_operations.rb +5 -0
  37. data/db/migrate/20180328210434_add_rrt_to_admission_consults.rb +5 -0
  38. data/lib/renalware/version.rb +1 -1
  39. data/lib/tasks/db.rake +11 -0
  40. data/spec/support/devise_spec_helper.rb +1 -1
  41. data/spec/support/travel.rb +1 -1
  42. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aaf95664c515c88272128f354f13acdee13fc37b35108a59c0a8717bedafa60b
4
- data.tar.gz: 5a6a3748e17a2b5b47e0c130d3959b1d03eeb47be6f00698e3692ac5581668d2
3
+ metadata.gz: c7c6d5676c20af6cae4347f70aab29e6f156d4280ab6d650c6e13633178cb128
4
+ data.tar.gz: ffaebb9b45c7820ae5a711ab2e203093a05d179268ca7240c50605db69fc96e3
5
5
  SHA512:
6
- metadata.gz: f2cf400155b462ecc8884cd3746ab505e240d4e1b4d8593745b194675a802969e38d20e42d0b7de45bd3c24280ac6cacdeae9f857accbc0231a7f7fd8734719d
7
- data.tar.gz: b9b2881a5e49a90d69d130b2facaa77b8eed767a64f06ed3e00f71723110be2c928daba4c084574265898d5ff93afa6f5336503c483875a0d2af7d0edb71ea9e
6
+ metadata.gz: 58f4bda8f4695d56e1c63be933ee5c7a0fa9cb70a177ea539ae6d6256a6191482687a18303eee0c85cf56eb44e688ed3ff1e45e43c4ae7d7b409eac8fe1933f4
7
+ data.tar.gz: 121933949b237cdbfc7b3c3b9ea4e9f516f8d55394353d15a8e119a3202189b9c4130e4cb9e086b69628b109c43afe7fcb20c3c0b95ed4e636610a1f696fc9a5
@@ -59,3 +59,11 @@
59
59
  }
60
60
  }
61
61
 
62
+ .consults-list {
63
+ @media print {
64
+ .panel {
65
+ display: none;
66
+ }
67
+ }
68
+ }
69
+
@@ -54,6 +54,10 @@ article.clinical-allergies {
54
54
  background-color: $table-border-colour;
55
55
  padding: 0em .2em .2em .6em;
56
56
 
57
+ @media print {
58
+ display: none;
59
+ }
60
+
57
61
  &.lozenge {
58
62
  background-color: $white;
59
63
  padding: 0 .3rem .2em .3rem;
@@ -133,6 +137,10 @@ article.clinical-allergies {
133
137
  }
134
138
 
135
139
  .patient-alerts {
140
+ @media pring {
141
+ display: none;
142
+ }
143
+
136
144
  &.lozenge {
137
145
  ul {
138
146
  margin: 0;
@@ -37,6 +37,7 @@ table#observations {
37
37
  .current-observations {
38
38
  float: left;
39
39
  margin-right: 1em;
40
+ width: auto;
40
41
 
41
42
  tbody {
42
43
  td, th {
@@ -1,5 +1,9 @@
1
1
  // Patient summary contains renal mini profile and allergy summary
2
2
  .patient-summary {
3
+ @media print {
4
+ display: none;
5
+ }
6
+
3
7
  background-color: $mini-profile-backgound-colour;
4
8
  font-size: 0.9rem;
5
9
  margin: 0;
@@ -131,6 +135,11 @@ ul.provider {
131
135
  }
132
136
 
133
137
  .patient-header {
138
+ @media print {
139
+ font-weight: bold;
140
+ margin-bottom: 1rem;
141
+ }
142
+
134
143
  background-color: $nhs-blue;
135
144
  dl {
136
145
  font-size: 1.1rem;
@@ -187,6 +196,10 @@ ul.provider {
187
196
  font-size: 0.9em;
188
197
  font-weight: normal;
189
198
  color: lighten($nhs-blue, 35%);
199
+
200
+ @media print {
201
+ display: none;
202
+ }
190
203
  }
191
204
  }
192
205
  }
@@ -8,6 +8,10 @@
8
8
  margin-right: 0.8rem;
9
9
  margin-bottom: 0.4rem;
10
10
  }
11
+
12
+ @media print {
13
+ display: none;
14
+ }
11
15
  }
12
16
 
13
17
  .button {
@@ -14,6 +14,9 @@ textarea.monospace {
14
14
  .actions {
15
15
  margin-top: 0.7rem;
16
16
  }
17
+ @media print {
18
+ display: none;
19
+ }
17
20
  }
18
21
 
19
22
  .chosen-container-multi {
@@ -63,6 +63,10 @@ dd.patient-name {
63
63
  }
64
64
 
65
65
  .patient-side-nav {
66
+ @media print {
67
+ display: none;
68
+ }
69
+
66
70
  background-color: $patient-menu-background-colour;
67
71
  padding: 0.6rem 0 2rem 0.6rem;
68
72
  width: $patient-side-nav-width;
@@ -373,3 +373,13 @@ td {
373
373
  }
374
374
  }
375
375
  }
376
+
377
+ table {
378
+ @media print {
379
+ th {
380
+ a {
381
+ text-decoration: none;
382
+ }
383
+ }
384
+ }
385
+ }
@@ -78,9 +78,13 @@ module Renalware
78
78
  :consult_site_id, :hospital_ward_id, :patient_id, :q, :other_site_or_ward,
79
79
  :decided_on, :transferred_on, :started_on, :ended_on, :decided_on,
80
80
  :aki_risk, :transfer_priority, :seen_by_id, :consult_type,
81
- :requires_aki_nurse, :description, :contact_number
81
+ :requires_aki_nurse, :description, :contact_number, :rrt
82
82
  )
83
83
  end
84
+
85
+ def per_page
86
+ params[:per_page] || 30
87
+ end
84
88
  end
85
89
  end
86
90
  end
@@ -1,3 +1,5 @@
1
+ require_dependency "renalware"
2
+ require "devise"
1
3
  #
2
4
  # From https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
3
5
  #
@@ -1,3 +1,5 @@
1
+ require_dependency "renalware"
2
+
1
3
  module Renalware
2
4
  module API
3
5
  module UKRDC
@@ -1,5 +1,6 @@
1
1
  #
2
2
  # E.g. medications/esa_prescriptions
3
+ # See routes.rb for how drug type name is set.
3
4
  #
4
5
  module Renalware
5
6
  module Medications
@@ -11,14 +11,15 @@ module Renalware
11
11
 
12
12
  # GET aka inbox
13
13
  def unread
14
- render_receipts(receipts.unread)
14
+ render_receipts(unread_receipts)
15
15
  end
16
16
 
17
17
  # GET all read messages
18
18
  def read
19
- render_receipts(receipts.read)
19
+ render_receipts(read_receipts)
20
20
  end
21
21
 
22
+ # GET all sent messages
22
23
  def sent
23
24
  render_receipts(sent_receipts)
24
25
  end
@@ -35,9 +36,11 @@ module Renalware
35
36
  private
36
37
 
37
38
  def render_receipts(receipts)
38
- patient_filter = Patients::SearchFilter.new(search_term, request)
39
39
  receipts = receipts.joins(message: [:patient])
40
- receipts = patient_filter.call(receipts).ordered.page(page).per(per_page)
40
+ if search_term.present?
41
+ receipts = patient_filter.call(receipts)
42
+ end
43
+ receipts = receipts.page(page).per(per_page)
41
44
  authorize receipts
42
45
 
43
46
  render locals: {
@@ -65,8 +68,20 @@ module Renalware
65
68
  params.fetch(:patient_search, {}).fetch(:term, nil)
66
69
  end
67
70
 
71
+ def unread_receipts
72
+ receipts.unread.order("messaging_messages.sent_at asc")
73
+ end
74
+
68
75
  def sent_receipts
69
- Receipt.sent_by(current_user.id)
76
+ Receipt.sent_by(current_user.id).ordered
77
+ end
78
+
79
+ def read_receipts
80
+ receipts.read.ordered
81
+ end
82
+
83
+ def patient_filter
84
+ @patient_filter ||= Patients::SearchFilter.new(search_term, request)
70
85
  end
71
86
  end
72
87
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # rubocop:disable Metrics/ClassLength
3
4
  #
4
5
  # Decorates an array of session objects, adding methods that provide e.g. a mean measured value
@@ -84,7 +84,7 @@ module Renalware
84
84
  end
85
85
 
86
86
  def lookup_access_type_abbreviation(session)
87
- return unless session.document && session.document.respond_to?(:info)
87
+ return unless session.document&.respond_to?(:info)
88
88
  access_type = Accesses::Type.find_by(name: session.document.info.access_type)
89
89
  return unless access_type
90
90
  session.document.info.access_type_abbreviation = access_type.abbreviation
@@ -15,49 +15,67 @@ module Renalware
15
15
  end
16
16
 
17
17
  def results
18
- @recent_pathology_results ||= begin
19
- snapshot = letter.pathology_snapshot
18
+ @results ||= begin
19
+ snapshot = letter.pathology_snapshot.dup
20
20
  return if snapshot.blank?
21
- group_snapshot_by_code_and_date(snapshot)
21
+ groups = group_snapshot_by_code_and_date(snapshot)
22
+ format_groups_into_string(groups)
22
23
  end
23
24
  end
24
25
 
25
26
  private
26
27
 
28
+ # Note that observation#letter_group determines the group each code falls into,
29
+ # and #letter_order the order codes are displayed within that group., h.g. HGB WBC and PLT
30
+ # are grouped together because they share letter group (1) and within that group the order
31
+ # is determined by letter_order (HGB=1 WBC=2 PLT=3).
32
+ # Results (OBX results) within a groups normally share an observed_at date - ie there is a
33
+ # 1 to 1 relationship between a group and d date output on the letter; most of the time
34
+ # they will arrive in the HL7 feed as part of the same OBR and therefore have the same date.
35
+ # However if, within a group, a code has come in separately with another date, we trigger
36
+ # a new sub group so it gets its own date.
27
37
  def group_snapshot_by_code_and_date(snapshot)
28
- snapshot = snapshot_ordered_by_obx_codes_relevant_to_letters(snapshot)
29
- snapshot_grouped_by_date = group_snapshot_by_date(snapshot)
30
- format_pathology_string(snapshot_grouped_by_date)
38
+ groups = []
39
+ PathologyLayout.new.each_group do |_group_number, obs_desc_group|
40
+ groups << build_hash_of_snapshot_results_keyed_by_date(obs_desc_group, snapshot)
41
+ end
42
+ groups
31
43
  end
32
44
 
33
- def snapshot_ordered_by_obx_codes_relevant_to_letters(snapshot)
34
- RelevantObservationDescription.codes.each_with_object({}) do |code, hash|
35
- hash[code.to_sym] = snapshot[code.to_sym]
45
+ def build_hash_of_snapshot_results_keyed_by_date(obs_desc_group, snapshot)
46
+ obs_desc_group.each_with_object({}) do |obs_desc, dates|
47
+ match = snapshot[obs_desc.code.to_sym]
48
+ next if match.nil?
49
+ next if match[:observed_at].nil?
50
+ date = I18n.l(Date.parse(match[:observed_at]))
51
+ dates[date] ||= {}
52
+ dates[date][obs_desc.code] = match[:result]
36
53
  end
37
54
  end
38
55
 
39
- def group_snapshot_by_date(snapshot)
40
- current_date = NullObject.instance
41
- snapshot.each_with_object({}) do |observation, h|
42
- code, obs = observation
43
- next if obs.nil?
44
- date = Time.zone.parse(obs[:observed_at])
45
-
46
- if date != current_date
47
- current_date = date
48
- h[date] = []
56
+ # {"07-Jun-2017"=>{"HGB"=>"10.4", "WBC"=>"3.40", "PLT"=>"435"}
57
+ # rubocop:disable Rails/OutputSafety
58
+ def format_groups_into_string(groups)
59
+ str = ""
60
+ groups.each do |group|
61
+ group.each do |date, observations|
62
+ str += " <span>#{date}</span>: #{observations_as_string(observations)};"
49
63
  end
50
-
51
- h[date] << "#{code} #{obs[:result]}"
64
+ str = str.strip
52
65
  end
66
+ str.html_safe
53
67
  end
68
+ # rubocop:enable Rails/OutputSafety
54
69
 
55
- def format_pathology_string(grouped_snapshot)
56
- str = ""
57
- grouped_snapshot.each do |date, observations|
58
- str += "#{I18n.l(date&.to_date)}: #{observations.join(', ')}; "
59
- end
60
- str.strip
70
+ def observations_as_string(observations)
71
+ observations.map do |code, result|
72
+ format_code_and_result_string(code, result)
73
+ end.join(", ")
74
+ end
75
+
76
+ def format_code_and_result_string(code, result)
77
+ return "(#{code} #{result})" if code.casecmp?("EGFR")
78
+ "#{code} #{result}"
61
79
  end
62
80
  end
63
81
  end
@@ -0,0 +1,22 @@
1
+ require_dependency "renalware/letters"
2
+
3
+ module Renalware
4
+ module Letters
5
+ class PathologyLayout
6
+ # This method helps us iterate over the pathology required in a letter.
7
+ # Path in letters should be grouped and ordered within that group.
8
+ # We might display a date only once a group for instance.
9
+ def each_group
10
+ Pathology::ObservationDescription
11
+ .select(:id, :code, :letter_group, :letter_order)
12
+ .where("letter_group is not null")
13
+ .order("letter_group asc, letter_order asc")
14
+ .group_by(&:letter_group)
15
+ .each do |group_number, descriptions|
16
+
17
+ yield(group_number, descriptions) if block_given?
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -21,7 +21,9 @@ module Renalware
21
21
  street_1,
22
22
  street_2,
23
23
  street_3,
24
- [town, county, postcode].reject(&:blank?).join(", "),
24
+ town,
25
+ county,
26
+ postcode,
25
27
  country
26
28
  ]
27
29
  end
@@ -23,7 +23,7 @@ module Renalware
23
23
  consult_site&.name,
24
24
  hospital_ward&.name,
25
25
  other_site_or_ward
26
- ].compact.join(", ")
26
+ ].reject(&:blank?).join(", ")
27
27
  end
28
28
 
29
29
  def patient_name
@@ -50,14 +50,9 @@ module Renalware
50
50
  @historical_prescriptions ||= execute_prescriptions_query(patient.prescriptions)
51
51
  end
52
52
 
53
- # Note we sort prescriptions by prescribed_on desc here manually because the
54
- # prescriptions query is currently too complex to add another sql sort into (defaults)
55
- # to sorting by drug name
56
53
  def current_prescriptions
57
54
  @current_prescriptions ||= begin
58
- # TODO: maybe use #sort_by(:prescribed_on) here
59
55
  execute_prescriptions_query(patient.prescriptions.current)
60
- .sort{ |presc1, presc2| presc2.prescribed_on <=> presc1.prescribed_on }
61
56
  end
62
57
  end
63
58
 
@@ -82,10 +77,9 @@ module Renalware
82
77
  # to sorting by drug name
83
78
  def esa_prescriptions
84
79
  @esa_prescriptions ||= begin
85
- # TODO: maybe use #sort_by(:prescribed_on) here
86
80
  execute_prescriptions_query(
87
81
  patient.prescriptions.having_drug_of_type("esa")
88
- ).sort{ |presc1, presc2| presc2.prescribed_on <=> presc1.prescribed_on }
82
+ ).sort_by(&:prescribed_on).reverse!
89
83
  end
90
84
  end
91
85
 
@@ -4,8 +4,8 @@
4
4
  url: admissions_consults_path,
5
5
  method: :get do |f|
6
6
  .row
7
- .columns.medium-3.large-2
8
- = f.input :identity_match, label: "Hosp/NHS no. or name"
7
+ .columns.medium-2.large-2
8
+ = f.input :identity_match, label: "Hosp/NHS no or name"
9
9
 
10
10
  .columns.medium-2.large-2
11
11
  = f.input :consult_site_id_eq,
@@ -30,6 +30,11 @@
30
30
  include_blank: true,
31
31
  collection: [["Yes", true], ["No", false]],
32
32
  label: "Active"
33
+ .columns.medium-1.large-1
34
+ = f.input :rrt_eq,
35
+ include_blank: true,
36
+ collection: [["Yes", true], ["No", false]],
37
+ label: "RRT"
33
38
  .columns.medium-2.large-2.actions.end
34
39
  = f.submit "Filter", class: "button"
35
40
  span= " or "
@@ -45,6 +45,7 @@
45
45
 
46
46
  = f.input :aki_risk, include_blank: "Please select", wrapper: :horizontal_small
47
47
  = f.input :requires_aki_nurse, as: :inline_radio_buttons, wrapper: :horizontal_small
48
+ = f.input :rrt, as: :inline_radio_buttons, wrapper: :horizontal_small
48
49
  = f.input :description, wrapper: :horizontal_large, input_html: { rows: 10 }
49
50
 
50
51
  = f.submit class: :button
@@ -2,22 +2,24 @@
2
2
  table
3
3
  thead
4
4
  tr
5
- th.col-width-medium
5
+ th.col-width-medium.noprint
6
+ th.col-width-large
7
+ = sort_link(query, :patient, ["patient_family_name", "patient_given_name asc"], "Patient")
8
+ th.col-width-nhs-no.noprint NHS No.
9
+ th.col-width-reference-no Hosp Nos.
6
10
  th.col-width-medium= sort_link(query,
7
11
  :location,
8
12
  [:consult_site_name, :hospital_ward_name],
9
13
  "Location")
10
- th.col-width-large
11
- = sort_link(query, :patient, ["patient_family_name", "patient_given_name asc"], "Patient")
12
- th.col-width-nhs-no NHS No.
13
- th.col-width-reference-no Hosp Nos.
14
- th.col-width-date= sort_link(query, :started_on, "Started")
15
- th.col-width-date= sort_link(query, :ended_on, "Ended")
14
+ th.col-width-date.noprint= sort_link(query, :started_on, "Started")
15
+ th.col-width-date.noprint= sort_link(query, :ended_on, "Ended")
16
16
  th.col-width-small.show-for-large-up Modality
17
17
  th.col-width-tiny.show-for-large-up Sex
18
- th.col-width-tiny.show-for-large-up Age
19
- th.col-width-tiny= sort_link(query, :aki_risk, "AKI Risk")
20
- th.col-width-tiny= sort_link(query, :requires_aki_nurse, " AKI Nurse?")
18
+ th.col-width-date.show-for-large-up= sort_link(query, :patient_born_on, "DOB")
19
+ th.col-width-tiny.show-for-large-up.noprint Age
20
+ th.col-width-tiny RRT?
21
+ th.col-width-tiny.noprint= sort_link(query, :aki_risk, "AKI Risk")
22
+ th.col-width-tiny.noprint= sort_link(query, :requires_aki_nurse, " AKI Nurse?")
21
23
  /th.show-for-large-up Author
22
24
  /th.col-width-medium.show-for-xlarge-up Description
23
25
 
@@ -25,7 +27,7 @@
25
27
  - consults.each do |consult|
26
28
  - uid = "consult-#{consult.id}"
27
29
  tr
28
- td.actions-dropdown.going-right
30
+ td.actions-dropdown.going-right.noprint
29
31
  / As we have lots of possible actions, group them in a button group.
30
32
  / A wrapping div is required for now in order for the button group display correctly
31
33
  / (though we could style the td like a div I guess).
@@ -57,17 +59,19 @@
57
59
  = link_to("Toggle",
58
60
  "#consult-quick-preview-#{consult.id}",
59
61
  data: { behaviour: "toggler" })
60
- td= consult.location
61
62
  td= default_patient_link(consult.patient)
62
- td= consult.patient_nhs_number
63
+ td.noprint= consult.patient_nhs_number
63
64
  td= consult.patient_hospital_identifiers&.to_s_multiline
64
- td= l(consult.started_on)
65
- td= l(consult.ended_on)
65
+ td= consult.location
66
+ td.noprint= l(consult.started_on)
67
+ td.noprint= l(consult.ended_on)
66
68
  td.show-for-large-up= consult.patient_current_modality
67
69
  td.show-for-large-up= consult.patient_sex
68
- td.show-for-large-up= consult.patient_age
69
- td= consult.aki_risk&.text
70
- td= yes_no(consult.requires_aki_nurse)
70
+ td.show-for-large-up= l(consult.patient.born_on)
71
+ td.show-for-large-up.noprint= consult.patient_age
72
+ td= yes_no(consult.rrt)
73
+ td.noprint= consult.aki_risk&.text
74
+ td.noprint= yes_no(consult.requires_aki_nurse)
71
75
  /td.show-for-xlarge-up.consult-author.col-width-medium-with-ellipsis(title=consult.created_by)= consult.created_by
72
76
  /td.col-width-medium-with-ellipsis(title=consult.description)= consult.description
73
77
  = content_tag(:tr, id: "consult-quick-preview-#{consult.id}", style: "display: none")
@@ -1,3 +1,5 @@
1
+ - content_for(:body_class) { "consults-list" }
2
+
1
3
  = content_for(:actions) do
2
4
  = link_to("Add", new_admissions_consult_path, class: :button)
3
5
 
@@ -40,7 +40,7 @@
40
40
  dd= l(patient.died_on)
41
41
 
42
42
  dt 1st Death cause:
43
- dd= patient.first_cause.description
43
+ dd= patient.first_cause&.description
44
44
 
45
45
  dt 2nd Death cause:
46
46
  dd= default_for_associated(patient.second_cause, :description, "N/A")
@@ -200,6 +200,10 @@ scss:
200
200
 
201
201
  .investigations {
202
202
  clear: both;
203
+
204
+ span {
205
+ white-space: nowrap;
206
+ }
203
207
  }
204
208
 
205
209
  ul.inline {
@@ -4,13 +4,24 @@
4
4
  / Note also we should really extend this so it searches all local_patient_ids
5
5
  - search_scope = :patient_given_name_or_patient_family_name_or_drug_name_or_patient_local_patient_id_cont
6
6
  - searching = search.send(search_scope).present?
7
- .filters
8
- .row
9
- = search_form_for(search, url: medications_esa_prescriptions_path) do |f|
10
- .small-7.medium-7.large-5.columns
11
- = f.search_field search_scope, placeholder: t(".search_prompt")
12
- .small-5.medium-5.columns.end
13
- = f.submit "Search", class: "button"
14
- = link_to t(".clear-search"),
15
- medications_esa_prescriptions_path,
16
- class: "cancel-link #{'disabled' unless searching}"
7
+ .search-form.filters
8
+ = simple_form_for search,
9
+ url: medications_esa_prescriptions_path,
10
+ method: :get do |f|
11
+ /= search_form_for(search, url: medications_esa_prescriptions_path) do |f|
12
+ .small-6.columns
13
+ /= f.search_field search_scope, placeholder: t(".search_prompt")
14
+ = f.input :patient_given_name_or_patient_family_name_or_drug_name_or_patient_local_patient_id_cont,
15
+ label: t(".search_prompt")
16
+ .small-3.columns
17
+ = f.input :provider_eq,
18
+ include_blank: true,
19
+ collection: Renalware::Medications::Provider.codes.each_with_index.map{ |x, i| [x.to_s.humanize, i] },
20
+ label: "Provider"
21
+ .small-3.columns.actions.end
22
+ = f.submit "Search", class: "button"
23
+ | &nbsp;
24
+ span or
25
+ | &nbsp;
26
+ = link_to "Reset", medications_esa_prescriptions_path
27
+ /class: "cancel-link #{'disabled' unless searching}"
@@ -1,33 +1,34 @@
1
- table#drug-type-prescriptions
2
- thead
3
- tr
4
- th.hosp_no= sort_link([:renalware, search], :patient_local_patient_id, t(".patient_local_patient_id"))
5
- th.patient_name= sort_link([:renalware, search], "patient_family_name", t(".patient_name"))
6
- th.patient_age= sort_link([:renalware, search], "patient_born_on", t(".patient_age"))
7
- th.patient_sex= t(".patient_sex")
8
- th.modality= t(".modality")
9
- th.col-width-date= sort_link([:renalware, search], "prescribed_on", t(".prescribed_on"))
10
- th.col-width-date.hide-for-small-only
11
- = sort_link([:renalware, search], "terminated_on", t(".terminated_on"))
12
- th.drug_name= sort_link([:renalware, search], "drug_name", t(".drug_name"))
13
- th.dose= t(".dose")
14
- th.route_code= t(".route_code")
15
- th.frequency= t(".frequency")
16
- th.weekly_units= t(".weekly_units")
17
- tbody
18
- - prescriptions.each do |prescription|
1
+ div
2
+ table#drug-type-prescriptions
3
+ thead
19
4
  tr
20
- td= prescription.patient_local_patient_id
21
- td= default_patient_link(prescription.patient)
22
- td= prescription.patient_age
23
- td= prescription.patient_sex
24
- td= prescription.patient_current_modality_name
25
- td= l(prescription.prescribed_on)
26
- td= prescription.terminated_on && l(prescription.terminated_on)
27
- td= prescription.drug_name
28
- td= prescription.dose
29
- td= prescription.route_code
30
- td= prescription.frequency
31
- td=
5
+ th.hosp_no= sort_link([:renalware, search], :patient_local_patient_id, t(".patient_local_patient_id"))
6
+ th.col-width-medium= sort_link([:renalware, search], "patient_family_name", t(".patient_name"))
7
+ th.patient_age= sort_link([:renalware, search], "patient_born_on", t(".patient_age"))
8
+ th.patient_sex= t(".patient_sex")
9
+ th.col-width-medium= t(".modality")
10
+ th.col-width-date= sort_link([:renalware, search], "prescribed_on", t(".prescribed_on"))
11
+ th.col-width-date.hide-for-small-only
12
+ = sort_link([:renalware, search], "terminated_on", t(".terminated_on"))
13
+ th.drug_name= sort_link([:renalware, search], "drug_name", t(".drug_name"))
14
+ th.col-width-small= t(".dose")
15
+ th.col-width-tiny= t(".route_code")
16
+ th.frequency= t(".frequency")
17
+ th.col-width-tiny= t(".weekly_units")
18
+ tbody
19
+ - prescriptions.each do |prescription|
20
+ tr
21
+ td= prescription.patient_local_patient_id
22
+ td= default_patient_link(prescription.patient)
23
+ td= prescription.patient_age
24
+ td= prescription.patient_sex
25
+ td= prescription.patient_current_modality_name
26
+ td= l(prescription.prescribed_on)
27
+ td= prescription.terminated_on && l(prescription.terminated_on)
28
+ td= prescription.drug_name
29
+ td= prescription.dose
30
+ td= prescription.route_code
31
+ td= prescription.frequency
32
+ td=
32
33
 
33
- = paginate prescriptions
34
+ = paginate prescriptions
@@ -2,8 +2,7 @@
2
2
  - patient = Renalware::PatientPresenter.new(message.patient)
3
3
 
4
4
  tr(class="#{ "urgent" if message.urgent?}" id=message.html_identifier)
5
- td
6
- = pluralize(message.age_in_days, "day")
5
+ td= "#{message.age_in_days} #{'day'.pluralize(message.age_in_days)}"
7
6
  td= message.author
8
7
  td= l(message.sent_at)
9
8
  td= l(receipt.read_at)
@@ -1,11 +1,10 @@
1
1
  = within_patient_layout title: "Current Pathology Results",
2
2
  navigation_partial: "renalware/pathology/navigation" do
3
3
  - observation_set.each_display_group do |observations, group_number|
4
- .small-3.columns.end
5
- table.current-observations.columns.auto-layout.last
6
- tbody
7
- - observations.each do |observation|
8
- tr
9
- th= observation.description
10
- td= observation.result
11
- td= l(observation.observed_at&.to_date)
4
+ table.current-observations.auto-layout
5
+ tbody
6
+ - observations.each do |observation|
7
+ tr
8
+ th= observation.description
9
+ td= observation.result
10
+ td= l(observation.observed_at&.to_date)
@@ -11,6 +11,7 @@ en:
11
11
  consult_type: Type
12
12
  contact_number: Bleep/Ext
13
13
  other_site_or_ward: Other site or ward
14
+ rrt: RRT?
14
15
  errors:
15
16
  models:
16
17
  renalware/admissions/consult:
@@ -20,4 +20,4 @@ en:
20
20
  prescribed_on: Started
21
21
  terminated_on: Terminated
22
22
  drug_name: Drug
23
- weekly_units: "Units/Week"
23
+ weekly_units: "Units/Wk"
@@ -135,7 +135,7 @@ en:
135
135
  liver_failure: "Liver failure (not self-poisoning)"
136
136
  meningitis: "Meningitis"
137
137
  multi_organ_failure: "Multi-organ failure"
138
- noycardial_infarction: "Myocardial infarction"
138
+ myocardial_infarction: "Myocardial infarction"
139
139
  other: "Other, please specify"
140
140
  other_drug_overdose: "Other drug overdose, please specify"
141
141
  other_trauma_accident: "Other trauma - accident"
@@ -0,0 +1,27 @@
1
+ class UpdatePathObsDescsForLetterGroupings < ActiveRecord::Migration[5.1]
2
+ def change
3
+ sql = <<-SQL.squish
4
+ UPDATE renalware.pathology_observation_descriptions set letter_group = NULL, letter_order = NULL;
5
+ UPDATE renalware.pathology_observation_descriptions set letter_group=1, letter_order=1 where code = 'HGB';
6
+ UPDATE renalware.pathology_observation_descriptions set letter_group=1, letter_order=2 where code = 'WBC';
7
+ UPDATE renalware.pathology_observation_descriptions set letter_group=1, letter_order=3 where code = 'PLT';
8
+ UPDATE renalware.pathology_observation_descriptions set letter_group=2, letter_order=1 where code = 'URE';
9
+ UPDATE renalware.pathology_observation_descriptions set letter_group=3, letter_order=1 where code = 'CRE';
10
+ UPDATE renalware.pathology_observation_descriptions set letter_group=3, letter_order=2 where code = 'EGFR';
11
+ UPDATE renalware.pathology_observation_descriptions set letter_group=4, letter_order=1 where code = 'NA';
12
+ UPDATE renalware.pathology_observation_descriptions set letter_group=4, letter_order=2 where code = 'POT';
13
+ UPDATE renalware.pathology_observation_descriptions set letter_group=5, letter_order=1 where code = 'BIC';
14
+ UPDATE renalware.pathology_observation_descriptions set letter_group=6, letter_order=1 where code = 'CCA';
15
+ UPDATE renalware.pathology_observation_descriptions set letter_group=6, letter_order=2 where code = 'PHOS';
16
+ UPDATE renalware.pathology_observation_descriptions set letter_group=7, letter_order=1 where code = 'PTHI';
17
+ UPDATE renalware.pathology_observation_descriptions set letter_group=8, letter_order=1 where code = 'ALB';
18
+ UPDATE renalware.pathology_observation_descriptions set letter_group=9, letter_order=1 where code = 'BIL';
19
+ UPDATE renalware.pathology_observation_descriptions set letter_group=9, letter_order=2 where code = 'AST';
20
+ UPDATE renalware.pathology_observation_descriptions set letter_group=9, letter_order=3 where code = 'ALP';
21
+ UPDATE renalware.pathology_observation_descriptions set letter_group=9, letter_order=4 where code = 'GGT';
22
+ UPDATE renalware.pathology_observation_descriptions set letter_group=10, letter_order=1 where code = 'HBA';
23
+ UPDATE renalware.pathology_observation_descriptions set letter_group=11, letter_order=1 where code = 'CHOL';
24
+ SQL
25
+ connection.execute(sql)
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ class AddConstraintsToRecipientOperations < ActiveRecord::Migration[5.1]
2
+ def change
3
+ change_column_null(:transplant_recipient_operations, :patient_id, false)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddRrtToAdmissionConsults < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :admission_consults, :rrt, :boolean, default: false, null: false
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Renalware
2
- VERSION = "2.0.11".freeze
2
+ VERSION = "2.0.12".freeze
3
3
  end
data/lib/tasks/db.rake ADDED
@@ -0,0 +1,11 @@
1
+ require "benchmark"
2
+
3
+ namespace :db do
4
+ desc "Refreshes all materialized views e.g. audits. May take a while so only run overnight."
5
+ task refresh_all_materialized_views: :environment do
6
+ ms = Benchmark.ms do
7
+ ActiveRecord::Base.connection.execute("SELECT refresh_all_matierialized_views();")
8
+ end
9
+ puts "Refreshing materialized views took #{ms}"
10
+ end
11
+ end
@@ -25,7 +25,7 @@ RSpec.configure do |config|
25
25
  Warden.test_mode!
26
26
  end
27
27
 
28
- config.after :each do
28
+ config.after do
29
29
  Warden.test_reset!
30
30
  end
31
31
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.configure do |config|
4
- config.after(:each) do
4
+ config.after do
5
5
  travel_back
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.11
4
+ version: 2.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1480,6 +1480,7 @@ files:
1480
1480
  - app/models/renalware/letters/part/prescriptions.rb
1481
1481
  - app/models/renalware/letters/part/problems.rb
1482
1482
  - app/models/renalware/letters/part/recent_pathology_results.rb
1483
+ - app/models/renalware/letters/pathology_layout.rb
1483
1484
  - app/models/renalware/letters/patient.rb
1484
1485
  - app/models/renalware/letters/patient_listener.rb
1485
1486
  - app/models/renalware/letters/pdf_letter_cache.rb
@@ -3200,6 +3201,9 @@ files:
3200
3201
  - db/migrate/20180313114927_remove_deleted_at_from_admission_consults.rb
3201
3202
  - db/migrate/20180313124819_remove_tx_operation_constraints.rb
3202
3203
  - db/migrate/20180319191942_create_function_to_sort_without_failing_on_nonnumerics.rb
3204
+ - db/migrate/20180323150241_update_path_obs_descs_for_letter_groupings.rb
3205
+ - db/migrate/20180327100423_add_constraints_to_recipient_operations.rb
3206
+ - db/migrate/20180328210434_add_rrt_to_admission_consults.rb
3203
3207
  - db/seeds.rb
3204
3208
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
3205
3209
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
@@ -3350,6 +3354,7 @@ files:
3350
3354
  - lib/tasks/bundler_audit.rake
3351
3355
  - lib/tasks/cucumber.rake
3352
3356
  - lib/tasks/cucumber_web.rake
3357
+ - lib/tasks/db.rake
3353
3358
  - lib/tasks/feeds/files.rake
3354
3359
  - lib/tasks/ukrdc.rake
3355
3360
  - lib/templates/slim/scaffold/_form.html.slim