renalware-core 2.0.5 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/renalware/primary_care_physician_search.js +7 -3
  3. data/app/assets/stylesheets/renalware/modules/_letters.scss +5 -0
  4. data/app/assets/stylesheets/renalware/modules/_patients.scss +11 -0
  5. data/app/assets/stylesheets/renalware/modules/_snippets.scss +45 -1
  6. data/app/assets/stylesheets/renalware/partials/_errors.scss +1 -0
  7. data/app/assets/stylesheets/renalware/partials/_tables.scss +14 -0
  8. data/app/controllers/renalware/admissions/consults_controller.rb +5 -1
  9. data/app/controllers/renalware/clinics/clinic_visits_controller.rb +1 -1
  10. data/app/controllers/renalware/hd/current_profile_controller.rb +1 -1
  11. data/app/controllers/renalware/hd/preference_sets_controller.rb +1 -1
  12. data/app/controllers/renalware/medications/prescriptions_controller.rb +0 -1
  13. data/app/controllers/renalware/patients/practices_controller.rb +21 -1
  14. data/app/controllers/renalware/patients/worry_controller.rb +1 -1
  15. data/app/controllers/renalware/renal/aki_alerts_controller.rb +1 -1
  16. data/app/controllers/renalware/renal/profiles_controller.rb +1 -1
  17. data/app/controllers/renalware/transplants/donor_workups_controller.rb +1 -1
  18. data/app/controllers/renalware/transplants/recipient_workups_controller.rb +1 -1
  19. data/app/helpers/renalware/layout_helper.rb +2 -2
  20. data/app/models/concerns/renalware/patients_ransack_helper.rb +0 -1
  21. data/app/models/renalware/admissions/consult.rb +1 -1
  22. data/app/models/renalware/admissions/consult_query.rb +19 -3
  23. data/app/models/renalware/feeds/files/practices/convert_xml_to_csv.rb +6 -2
  24. data/app/models/renalware/letters/letter_factory.rb +3 -1
  25. data/app/models/renalware/letters/recipient.rb +34 -9
  26. data/app/models/renalware/patients/patient_hospital_identifiers.rb +4 -0
  27. data/app/models/renalware/patients/practice_search_query.rb +5 -2
  28. data/app/models/renalware/transplants/registration_status.rb +1 -1
  29. data/app/presenters/renalware/hd/session_presenter.rb +2 -1
  30. data/app/presenters/renalware/summary_part.rb +1 -1
  31. data/app/views/renalware/addresses/_address.html.slim +2 -2
  32. data/app/views/renalware/addresses/_form.html.slim +3 -3
  33. data/app/views/renalware/admissions/admissions/_form.html.slim +1 -1
  34. data/app/views/renalware/admissions/admissions/_table.html.slim +6 -7
  35. data/app/views/renalware/admissions/consults/_filters.html.slim +12 -9
  36. data/app/views/renalware/admissions/consults/_form.html.slim +2 -2
  37. data/app/views/renalware/admissions/consults/_table.html.slim +45 -25
  38. data/app/views/renalware/api/ukrdc/patients/_lab_orders.xml.builder +1 -1
  39. data/app/views/renalware/api/ukrdc/patients/_observations.xml.builder +1 -1
  40. data/app/views/renalware/directory/people/_address_form.html.slim +3 -3
  41. data/app/views/renalware/letters/contacts/_new.html.slim +10 -8
  42. data/app/views/renalware/letters/contacts/_new_person.html.slim +15 -19
  43. data/app/views/renalware/letters/contacts/_person_form.html.slim +48 -25
  44. data/app/views/renalware/letters/formatted_letters/_letter.html.slim +14 -3
  45. data/app/views/renalware/letters/letters/_cc_recipient_form.html.slim +1 -1
  46. data/app/views/renalware/letters/letters/_form.html.slim +1 -1
  47. data/app/views/renalware/letters/letters/_main_recipient.html.slim +5 -5
  48. data/app/views/renalware/letters/letters/contact_added.js.erb +4 -2
  49. data/app/views/renalware/patients/alerts/_list.html.slim +1 -1
  50. data/app/views/renalware/problems/problems/edit.html.slim +2 -3
  51. data/app/views/renalware/problems/problems/new.html.slim +2 -3
  52. data/app/views/renalware/snippets/snippets/_list.html.slim +3 -8
  53. data/app/views/renalware/snippets/snippets/_row.html.slim +5 -4
  54. data/app/views/renalware/snippets/snippets/_table.html.slim +24 -23
  55. data/app/views/renalware/snippets/snippets/edit.html.slim +2 -3
  56. data/app/views/renalware/snippets/snippets/index.html.slim +3 -2
  57. data/app/views/renalware/snippets/snippets/new.html.slim +2 -5
  58. data/lib/renalware/version.rb +1 -1
  59. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81e21d5cabf3ae2ba1262453b826728f6f073183d3eaee442f8b2cee24621913
4
- data.tar.gz: 0fef8595387d5105b4e5b4e5b3dbf920caab7aa2875ee9912be18648f5f61021
3
+ metadata.gz: 35f1da96bf99bc1165eafb40df5d2061d5840831ef9d061373448bb6fc0d8dad
4
+ data.tar.gz: cf73511f92c66f3a6192b26daefd7ed7a1bd69265edee4a283fa17d6e138e38b
5
5
  SHA512:
6
- metadata.gz: b89e19bd60da8177ad89186370fe7aec2130b60199033de61c512381f24bb46fb187aa173d56dd167a2f2528520a31712ae543049ab42beb8dffa15feb4a2259
7
- data.tar.gz: 50d8d2ca192f7e92163d089f5c83905828c6b53a708d76596d48f6f9200c80567791f6917d73413722b57d665a0593f4f6f6c39c7e9a3b3a6b55c4135cc7145e
6
+ metadata.gz: 571bf241c4d5c4249267c2a948b46d3e1455f6bdd453891f13df6e66b45774eae011971a37a96280b6c0a5e1a60e8faeef22e9342ca0770ea99427ff116d626d
7
+ data.tar.gz: f9700de2153b34d22684d45f79350bc4b996d5deb7b95faeb8d57adf0af85a24e6dd061cd423fd26f47aff4f6a2d13ba77351a6f89befc14e096fba68dd6a5d1
@@ -3,11 +3,15 @@ var Renalware = typeof Renalware === 'undefined' ? {} : Renalware;
3
3
  Renalware.PrimaryCarePhysicianSearch = (function() {
4
4
 
5
5
  var formatPractice = function(practice) {
6
- return practice.name;
6
+ if (practice.name != undefined) {
7
+ return "<b>" + practice.name + "</b>&nbsp;" + practice.address;
8
+ }
7
9
  };
8
10
 
9
11
  var formatPracticeSelection = function(practice) {
10
- return practice.name;
12
+ if (practice.name != undefined) {
13
+ return practice.name;
14
+ }
11
15
  };
12
16
 
13
17
  var initPracticeAutocomplete = function(){
@@ -41,7 +45,7 @@ Renalware.PrimaryCarePhysicianSearch = (function() {
41
45
  }).select2('open');
42
46
 
43
47
  // When a Practice is selected from the autocomplete list,
44
- // Do an ajax replace on the <form> in this modal by sendin a .js request
48
+ // Do an ajax replace on the <form> in this modal by sending a .js request
45
49
  // to the url the modal was loaded from (this is in a data attribute on the pratice-search
46
50
  // select). This will load in just the form under the practice-search select, bringing
47
51
  // with it a list of pcps associated with this practice.
@@ -50,6 +50,11 @@ table.contacts tbody td{
50
50
  #add-patient-contact-as-cc-modal {
51
51
  max-height: $max-modal-height;
52
52
  overflow-y: auto;
53
+
54
+ .columns {
55
+ padding-left: .2rem;
56
+ padding-right: .2rem;
57
+ }
53
58
  }
54
59
 
55
60
  textarea.letter-body {
@@ -346,3 +346,14 @@ form {
346
346
  }
347
347
  }
348
348
  }
349
+
350
+
351
+ #select2-practice-search-results {
352
+ li {
353
+ font-size: 0.9rem;
354
+ b {
355
+ font-size: 1rem;
356
+ display: block;
357
+ }
358
+ }
359
+ }
@@ -5,6 +5,7 @@
5
5
  }
6
6
 
7
7
  &.modal {
8
+ overflow-y: initial !important;
8
9
 
9
10
  .modal-header {
10
11
  border-bottom: solid 1px #ccc;
@@ -26,6 +27,12 @@
26
27
  }
27
28
  }
28
29
  }
30
+
31
+ .scrollable {
32
+ height: 300px;
33
+ overflow-y: auto;
34
+ clear: both;
35
+ }
29
36
  }
30
37
 
31
38
  #snippet-search-form {
@@ -44,7 +51,11 @@
44
51
  vertical-align: top;
45
52
 
46
53
  &:first-child {
47
- padding-top: 0;
54
+ //padding-top: 0;
55
+ }
56
+
57
+ &.title {
58
+ vertical-align: middle;
48
59
  }
49
60
  }
50
61
 
@@ -57,6 +68,39 @@
57
68
  }
58
69
  }
59
70
 
71
+ td.body {
72
+ position: relative;
73
+ height: 1rem;
74
+
75
+ &:after {
76
+ content: '';
77
+ width: 100%;
78
+ //height: 2rem;
79
+ position: absolute;
80
+ left: 0;
81
+ bottom: 0;
82
+ box-shadow: 0 0 .5em 0.5em #fff;
83
+ height: 0;
84
+ //background:linear-gradient(rgba(255,255,255,0) 0, white);
85
+ }
86
+
87
+ &.expanded {
88
+ height: 100%;
89
+
90
+ .body-content {
91
+ height: 100%;
92
+ }
93
+
94
+ &:after {
95
+ background: none;
96
+ }
97
+ }
98
+
99
+ .body-content {
100
+ height: 1rem;
101
+ }
102
+ }
103
+
60
104
  @media #{$medium-up} {
61
105
  td, th {
62
106
  &.author {
@@ -22,6 +22,7 @@
22
22
  .error-content {
23
23
  padding: 50px;
24
24
  text-align: center;
25
+ height: 100%;
25
26
  }
26
27
 
27
28
  .heading {
@@ -4,9 +4,17 @@ table td.actions-dropdown {
4
4
  padding-bottom: 0.3rem;
5
5
  padding-right: 0;
6
6
 
7
+ > div {
8
+ display: inline-block;
9
+ }
10
+
7
11
  .button.dropdown {
8
12
  padding: .2rem 2.3rem .2rem .4rem;
9
13
  margin: 0;
14
+
15
+ &:after {
16
+ right: 0.5rem;
17
+ }
10
18
  }
11
19
 
12
20
  .f-dropdown {
@@ -17,6 +25,12 @@ table td.actions-dropdown {
17
25
  left: 160px;
18
26
  }
19
27
  }
28
+
29
+ &.going-right {
30
+ .f-dropdown {
31
+ margin-left: 0px;
32
+ }
33
+ }
20
34
  }
21
35
 
22
36
  table {
@@ -6,7 +6,9 @@ module Renalware
6
6
  class ConsultsController < BaseController
7
7
  include Renalware::Concerns::Pageable
8
8
 
9
+ # rubocop:disable Metrics/AbcSize
9
10
  def index
11
+ session[:consults_results] = nil if params.key?(:reset)
10
12
  query = ConsultQuery.new(params[:q])
11
13
  consults = query.call.page(page).per(per_page)
12
14
  authorize consults
@@ -15,6 +17,7 @@ module Renalware
15
17
  query: query.search
16
18
  }
17
19
  end
20
+ # rubocop:enable Metrics/AbcSize
18
21
 
19
22
  def new
20
23
  consult = Consult.new(started_on: Time.zone.today)
@@ -40,7 +43,8 @@ module Renalware
40
43
  def update
41
44
  consult = find_and_authorize_consult
42
45
  if consult.update_by(current_user, consult_params)
43
- redirect_to admissions_consults_path, notice: success_msg_for("consult")
46
+ url = session[:consults_results] || admissions_consults_path
47
+ redirect_to url, notice: success_msg_for("consult")
44
48
  else
45
49
  render_edit(consult)
46
50
  end
@@ -42,7 +42,7 @@ module Renalware
42
42
  end
43
43
 
44
44
  def update
45
- if @clinic_visit.update_attributes(visit_params)
45
+ if @clinic_visit.update(visit_params)
46
46
  redirect_to patient_clinic_visits_path(@patient),
47
47
  notice: t(".success", model_name: "clinic visit")
48
48
  else
@@ -36,7 +36,7 @@ module Renalware
36
36
  if profile.persisted?
37
37
  ReviseHDProfile.new(profile).call(profile_params)
38
38
  else
39
- profile.update_attributes(profile_params.merge(active: true))
39
+ profile.update(profile_params.merge(active: true))
40
40
  end
41
41
  end
42
42
 
@@ -13,7 +13,7 @@ module Renalware
13
13
  def update
14
14
  preference_set = PreferenceSet.for_patient(patient).first_or_initialize
15
15
 
16
- if preference_set.update_attributes(preference_set_params)
16
+ if preference_set.update(preference_set_params)
17
17
  redirect_to patient_hd_dashboard_path(patient),
18
18
  notice: t(".success", model_name: "HD preferences")
19
19
  else
@@ -87,7 +87,6 @@ module Renalware
87
87
  )
88
88
  end
89
89
  # rubocop:enable Metrics/LineLength
90
- # rubocop:enable Metrics/MethodLength
91
90
 
92
91
  def pdf_filename
93
92
  "#{patient.family_name}_#{patient.hospital_identifier&.id}" \
@@ -16,7 +16,27 @@ module Renalware
16
16
  private
17
17
 
18
18
  def practices_matching_search_term
19
- PracticeSearchQuery.new(search_term: params[:q]).call
19
+ PracticeSearchQuery.new(search_term: params[:q])
20
+ .call
21
+ .map { |practice| format_practice_into_hash_for_json(practice) }
22
+ end
23
+
24
+ def null_address
25
+ Address.new
26
+ end
27
+
28
+ def format_practice_into_hash_for_json(practice)
29
+ address = practice.address || null_address
30
+ {
31
+ id: practice.id,
32
+ name: practice.name,
33
+ address: [
34
+ address.street_1,
35
+ address.town,
36
+ address.county,
37
+ address.postcode
38
+ ].reject(&:blank?).join(", ")
39
+ }
20
40
  end
21
41
  end
22
42
  end
@@ -29,7 +29,7 @@ module Renalware
29
29
 
30
30
  def update_worry_notes_if_supplied(worry)
31
31
  if worry_params[:notes].present?
32
- worry.update_attributes(worry_params.merge!(by: current_user))
32
+ worry.update(worry_params.merge!(by: current_user))
33
33
  end
34
34
  end
35
35
 
@@ -23,7 +23,7 @@ module Renalware
23
23
 
24
24
  def update
25
25
  authorize alert
26
- if alert.update_attributes(aki_alert_params.merge(by: current_user))
26
+ if alert.update(aki_alert_params.merge(by: current_user))
27
27
  redirect_to renal_aki_alerts_path
28
28
  else
29
29
  render_edit(alert)
@@ -23,7 +23,7 @@ module Renalware
23
23
  def update
24
24
  profile = find_profile
25
25
 
26
- if profile.update_attributes(profile_params)
26
+ if profile.update(profile_params)
27
27
  redirect_to patient_renal_profile_path(patient),
28
28
  notice: t(".success", model_name: "profile")
29
29
  else
@@ -22,7 +22,7 @@ module Renalware
22
22
  def update
23
23
  workup = DonorWorkup.for_patient(patient).first_or_initialize
24
24
 
25
- if workup.update_attributes(workup_params)
25
+ if workup.update(workup_params)
26
26
  redirect_to patient_transplants_donor_workup_path(patient),
27
27
  notice: t(".success", model_name: "donor work up")
28
28
  else
@@ -27,7 +27,7 @@ module Renalware
27
27
  def update
28
28
  workup = RecipientWorkup.for_patient(patient).first_or_initialize
29
29
 
30
- if workup.update_attributes workup_params
30
+ if workup.update workup_params
31
31
  redirect_to patient_transplants_recipient_workup_path(patient),
32
32
  notice: t(".success", model_name: "recipient work up")
33
33
  else
@@ -63,11 +63,11 @@ module Renalware
63
63
  #
64
64
  # See http://stackoverflow.com/questions/339130/how-do-i-render-a-partial-of-a-\
65
65
  # different-format-in-rails/3427634#3427634
66
- def with_format(format, &block)
66
+ def with_format(format)
67
67
  old_formats = formats
68
68
  begin
69
69
  self.formats = [format]
70
- return block.call
70
+ return yield
71
71
  ensure
72
72
  self.formats = old_formats
73
73
  end
@@ -66,7 +66,6 @@ module Renalware
66
66
  sql += " OR patients.ukrdc_external_id = :exact_term" if query_is_a_uuid?(query)
67
67
  sql
68
68
  end
69
- # rubocop:enable Metrics/MethodLength
70
69
 
71
70
  def query_is_a_uuid?(query)
72
71
  query.match(UUID_REGEXP)
@@ -5,6 +5,7 @@ module Renalware
5
5
  class Consult < ApplicationRecord
6
6
  include Accountable
7
7
  extend Enumerize
8
+ include PatientsRansackHelper
8
9
  validates :patient_id, presence: true
9
10
  validates :started_on, presence: true
10
11
  validates :description, presence: true
@@ -22,7 +23,6 @@ module Renalware
22
23
  enumerize :aki_risk, in: %i(yes no unknown)
23
24
 
24
25
  scope :active, ->{ where(ended_on: nil) }
25
-
26
26
  end
27
27
  end
28
28
  end
@@ -5,16 +5,32 @@ module Renalware
5
5
  class ConsultQuery
6
6
  attr_reader :query
7
7
 
8
- def initialize(query = {})
9
- @query = query
8
+ def initialize(query = nil)
9
+ @query = query || {}
10
+ @query[:ended_on_null] ||= true
10
11
  end
11
12
 
12
13
  def call
13
14
  search.result
14
15
  end
15
16
 
17
+ # Note we *MUST* join onto patients for PatientsRansackHelper.identity_match to work.
18
+ # It might be better to refactor PatientsRansackHelper so we can include where required
19
+ # eg below using .extending(PatientsRansackHelper) rather than relying on it being in
20
+ # included in the model file.
16
21
  def search
17
- @search ||= Consult.active.order(created_at: :desc).ransack(query)
22
+ @search ||= begin
23
+ Consult
24
+ .joins(:patient)
25
+ .includes(
26
+ :created_by,
27
+ :consult_site,
28
+ :hospital_ward,
29
+ patient: { current_modality: :description }
30
+ )
31
+ .order(created_at: :desc)
32
+ .ransack(query)
33
+ end
18
34
  end
19
35
  end
20
36
  end
@@ -5,6 +5,8 @@ module Renalware
5
5
  module Files
6
6
  module Practices
7
7
  class ConvertXmlToCsv
8
+ PRACTICE_ROLES = %w(RO177 RO76).freeze
9
+
8
10
  def self.call(xml_path)
9
11
  new.call(xml_path)
10
12
  end
@@ -100,10 +102,12 @@ module Renalware
100
102
  for_element "PostCode" do org.postcode = inner_xml end
101
103
  for_element "Country" do
102
104
  country_name = inner_xml
105
+
103
106
  CountryMap.new.map(country_name).tap do |mapped|
104
107
  org.region = mapped.region
105
108
  found_country = countries.find_by(name: mapped.country)
106
109
  if found_country.blank?
110
+ Rails.logger.warn("#{country_name} not mapped")
107
111
  org.skip = true
108
112
  org.region = country_name
109
113
  # raise(CountryNotFoundError, country_name)
@@ -119,12 +123,12 @@ module Renalware
119
123
  end
120
124
  end
121
125
 
122
- if org.roles.include?("RO76")
126
+ if (PRACTICE_ROLES & org.roles).any?
123
127
  fail unless org.code&.length == 6
124
128
  practices_count += 1
125
129
  if org.skip
126
130
  Rails.logger.warn(
127
- "Not importing practice, probably because country #{country_name} not found. "\
131
+ "Not importing practice, probably because country country_name not found. "\
128
132
  "#{org}"
129
133
  )
130
134
  else