renalware-core 2.0.158 → 2.0.159

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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/renalware/components/configuration.js +20 -0
  3. data/app/assets/javascripts/renalware/components/{dialogs.js.erb → dialogs.js} +2 -5
  4. data/app/assets/javascripts/renalware/components/{feed_only_inputs.js.erb → feed_only_inputs.js} +4 -4
  5. data/app/assets/javascripts/renalware/{core.js.erb → core.js} +0 -5
  6. data/app/assets/javascripts/renalware/rollup_compiled.css +42050 -42050
  7. data/app/assets/stylesheets/renalware/modules/_clinical.scss +13 -0
  8. data/app/components/renalware/admissions/active_consult_alert_component.html.slim +1 -1
  9. data/app/components/renalware/pd/pet_results_component.html.slim +1 -3
  10. data/app/controllers/renalware/pd/pet_results_controller.rb +1 -1
  11. data/app/presenters/renalware/user_session_presenter.rb +1 -3
  12. data/app/views/renalware/letters/mailshots/mailshots/_form.html.slim +25 -21
  13. data/app/views/renalware/system/view_metadata/_columns_table.html.slim +2 -2
  14. data/db/migrate/20201105153422_update_medication_current_prescriptions_view.rb +7 -0
  15. data/db/migrate/20201112152752_update_pd_mdm_patients_view1.rb +7 -0
  16. data/db/views/medication_current_prescriptions_v01.sql +2 -1
  17. data/db/views/medication_current_prescriptions_v02.sql +30 -0
  18. data/db/views/pd_mdm_patients_v03.sql +50 -0
  19. data/db/views/reporting_anaemia_audit_v01.sql +0 -2
  20. data/lib/renalware/configuration.rb +0 -5
  21. data/lib/renalware/version_number.rb +1 -1
  22. metadata +14 -11
  23. data/app/assets/javascripts/renalware/components/reporting.js.erb +0 -0
  24. data/app/assets/javascripts/renalware/components/session_timeout_redirect.js.erb +0 -37
@@ -186,6 +186,19 @@ article.clinical-allergies {
186
186
  }
187
187
  }
188
188
 
189
+ &.active-consult {
190
+ background-color: $nhs-pink;
191
+
192
+ &:hover {
193
+ background-color: darken($nhs-pink, 7);
194
+ }
195
+
196
+ .title a,
197
+ i:before {
198
+ color: $white;
199
+ }
200
+ }
201
+
189
202
  &.research-study-participant {
190
203
  background-color: darken($nhs-green, 3);
191
204
  color: $white;
@@ -1,4 +1,4 @@
1
- li.patient-alert.bg-pink-200.text-gray-700
1
+ li.patient-alert.active-consult
2
2
  i.fas.fa-exclamation-triangle
3
3
  span.title
4
4
  = link_to "Active Consult", renalware.edit_admissions_consult_path(id: consult_id)
@@ -4,9 +4,6 @@
4
4
  header
5
5
  h2= title
6
6
 
7
-
8
-
9
- /.flex.flex-row-reverse
10
7
  .flex.justify-end
11
8
 
12
9
  .inline-flex
@@ -22,6 +19,7 @@
22
19
 
23
20
  = link_to "Show all", renalware.patient_pd_pet_results_path(patient), remote: true, class: "float-none button flex-initial secondary"
24
21
  = link_to "Add", renalware.new_patient_pd_pet_result_path(patient), class: "float-none button flex-initial"
22
+
25
23
  div#pet-results-table data-target="tabs.panel"
26
24
 
27
25
  = render "renalware/pd/pet_results/table",
@@ -4,7 +4,7 @@ require_dependency "renalware/pd"
4
4
 
5
5
  module Renalware
6
6
  module PD
7
- class PETResultsController < BaseController
7
+ class PETResultsController < PD::BaseController
8
8
  def new
9
9
  pet = PETResult.new(
10
10
  patient: patient,
@@ -21,8 +21,6 @@ module Renalware
21
21
  # data-session-timeout="3600">
22
22
  # rubocop:disable Metrics/MethodLength
23
23
  def self.session_controller_data_attributes
24
- return {} if Renalware.config.session_expiry_use_previous_mechansim
25
-
26
24
  urls = Renalware::Engine.routes.url_helpers
27
25
  {
28
26
  data: {
@@ -39,6 +37,6 @@ module Renalware
39
37
  }
40
38
  }
41
39
  end
40
+ # rubocop:enable Metrics/MethodLength
42
41
  end
43
- # rubocop:enable Metrics/MethodLength
44
42
  end
@@ -38,24 +38,28 @@
38
38
  br
39
39
  .panel
40
40
  h2
41
- i.fas.fa-info-circle style="color: #00a499"
42
- span(style="padding-left: 5px") Tips
43
- p
44
- | The list of patients to include in a mailshot it determined by the SQL View chosen above.
45
- | &nbsp;It is intended that a systems or database administrator create this view for you in the
46
- | &nbsp;renalware database. The view should have one column called 'patient_id' and return the ids
47
- | &nbsp;of all the patients you want to send this letter to.
48
- | &nbsp;You should ideally create the view in the hospital's
49
- | &nbsp;own postgres schema eg 'renalware_kch' in the case of Kings College Hospital.
50
- p Here is a (somewhat pointless) example of a compatible SQL view definition:
51
- p
52
- code
53
- | CREATE OR REPLACE VIEW
54
- br
55
- | renalware_kch.letter_mailshot_patients_where_surname_starts_with_r AS
56
- br
57
- | SELECT id as patient_id
58
- br
59
- | FROM patients
60
- br
61
- | WHERE family_name like 'R%';
41
+ i.fas.fa-info-circle
42
+ span.pl-3 Help
43
+
44
+ markdown:
45
+ The list of patients to include in a mailshot it determined by the SQL View chosen above.
46
+ It is intended that a systems or database administrator create this view for you in the
47
+ renalware database. The view should have one column called 'patient_id' and return the ids
48
+ of all the patients you want to send this letter to.
49
+
50
+ You should ideally create the view in the hospital's
51
+ own postgres schema (eg 'renalware_kch' in the case of Kings College Hospital) in order to
52
+ indicate your view is hospital-specific.
53
+
54
+ **Note that in order for your view to appear in the dropdown above, its name must start
55
+ with `letter_mailshot_`**
56
+
57
+ Here is a (somewhat pointless) example of a compatible SQL view definition:
58
+
59
+ ```
60
+ CREATE OR REPLACE VIEW
61
+ renalware_kch.letter_mailshot_patients_where_surname_starts_with_r AS
62
+ SELECT id as patient_id
63
+ FROM patients
64
+ WHERE family_name like 'R%';
65
+ ```
@@ -28,9 +28,9 @@ table.sortables(style="list-style-type: none;")
28
28
  td.border-0
29
29
  code= col.code
30
30
  td.text-center.border-0
31
- input.m-0(type="checkbox" name="view_metadata[columns][][hidden]" checked=col.hidden)
31
+ input.m-0(type="checkbox" name="view_metadata[columns][][hidden]" checked=col.hidden style="margin:0")
32
32
  td.border-0
33
- input.m-0(type="text" name="view_metadata[columns][][name]" value=col.name)
33
+ input.m-0(type="text" name="view_metadata[columns][][name]" value=col.name style="margin:0")
34
34
  td.border-0
35
35
  select.m-0(name="view_metadata[columns][][width]")
36
36
  option(value="")
@@ -0,0 +1,7 @@
1
+ class UpdateMedicationCurrentPrescriptionsView < ActiveRecord::Migration[5.2]
2
+ def change
3
+ within_renalware_schema do
4
+ replace_view :medication_current_prescriptions, version: 2, revert_to_version: 1
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class UpdatePDMDMPatientsView1 < ActiveRecord::Migration[5.2]
2
+ def change
3
+ within_renalware_schema do
4
+ update_view :pd_mdm_patients, version: 3, revert_to_version: 2
5
+ end
6
+ end
7
+ end
@@ -1,4 +1,5 @@
1
- SELECT mp.id,
1
+ SELECT
2
+ mp.id,
2
3
  mp.patient_id,
3
4
  mp.drug_id,
4
5
  mp.treatable_type,
@@ -0,0 +1,30 @@
1
+ SELECT distinct on (mp.patient_id, mp.id)
2
+ mp.id,
3
+ mp.patient_id,
4
+ mp.drug_id,
5
+ mp.treatable_type,
6
+ mp.treatable_id,
7
+ mp.dose_amount,
8
+ mp.dose_unit,
9
+ mp.medication_route_id,
10
+ mp.route_description,
11
+ mp.frequency,
12
+ mp.notes,
13
+ mp.prescribed_on,
14
+ mp.provider,
15
+ mp.created_at,
16
+ mp.updated_at,
17
+ mp.created_by_id,
18
+ mp.updated_by_id,
19
+ mp.administer_on_hd,
20
+ mp.last_delivery_date,
21
+ drugs.name as drug_name,
22
+ drug_types.code AS drug_type_code,
23
+ drug_types.name AS drug_type_name
24
+ FROM medication_prescriptions mp
25
+ left outer join medication_prescription_terminations mpt ON mpt.prescription_id = mp.id
26
+ inner JOIN drugs ON drugs.id = mp.drug_id
27
+ left outer join drug_types_drugs ON drug_types_drugs.drug_id = drugs.id
28
+ left outer join drug_types ON drug_types_drugs.drug_type_id = drug_types.id
29
+ where (mpt.terminated_on IS NULL OR mpt.terminated_on > current_date)
30
+ order by mp.patient_id asc, mp.id asc;
@@ -0,0 +1,50 @@
1
+ select
2
+ distinct on (P.id)
3
+ P.id,
4
+ P.secure_id,
5
+ (upper(P.family_name) || ', ' || P.given_name) as "patient_name",
6
+ P.nhs_number,
7
+ P.local_patient_id as hospital_numbers,
8
+ P.sex,
9
+ P.born_on,
10
+ date_part('year', age(P.born_on)) as "age",
11
+ RPROF.esrf_on,
12
+ Mx.modality_name,
13
+ case
14
+ when pw.id > 0 then true
15
+ else false
16
+ end as on_worryboard,
17
+ TXRSD."name" tx_status,
18
+ case pr.type
19
+ when 'Renalware::PD::APDRegime' then 'APD'
20
+ when 'Renalware::PD::CAPDRegime' then 'CAPD'
21
+ end as pd_type,
22
+ (select
23
+ date(date_time)
24
+ from events e
25
+ inner join event_types et on et.id = e.event_type_id
26
+ where et.slug = 'pd_line_changes'
27
+ and e.patient_id = P.id
28
+ order by date_time desc limit 1) as last_line_change_date,
29
+ pesi.diagnosis_date as last_esi_date,
30
+ ppe.diagnosis_date as last_peritonitis_date,
31
+ (select bmi from clinic_visits cv2 where cv2.patient_id = P.id and bmi > 0 order by date desc limit 1) as bmi,
32
+ PA.values -> 'HGB' ->> 'result' as hgb,
33
+ (PA.values -> 'HGB' ->> 'observed_at')::date as hgb_date,
34
+ PA.values -> 'URE' ->> 'result' as ure,
35
+ (PA.values -> 'URE' ->> 'observed_at')::date as ure_date,
36
+ PA.values -> 'CRE' ->> 'result' as cre,
37
+ (PA.values -> 'CRE' ->> 'observed_at')::date as cre_date,
38
+ PA.values -> 'EGFR' ->> 'result' as egfr
39
+ from renalware.patients P
40
+ left outer join patient_worries pw on pw.patient_id = p.id
41
+ left outer join renalware.pathology_current_observation_sets PA on PA.patient_id = P.id
42
+ left outer join renalware.renal_profiles RPROF on RPROF.patient_id = P.id
43
+ left outer join renalware.transplant_registrations TXR on TXR.patient_id = P.id
44
+ left outer join renalware.transplant_registration_statuses TXRS on TXRS.registration_id = TXR.id AND TXRS.terminated_on IS NULL
45
+ left outer join renalware.transplant_registration_status_descriptions TXRSD on TXRSD.id = TXRS.description_id
46
+ left outer join renalware.pd_regimes pr on pr.patient_id = P.id and pr.start_date <= current_date and pr.end_date is null
47
+ left outer join renalware.pd_exit_site_infections pesi on pesi.patient_id = P.id
48
+ left outer join pd_peritonitis_episodes ppe on ppe.patient_id = P.id
49
+ inner join renalware.patient_current_modalities Mx on Mx.patient_id = P.id and Mx.modality_code = 'pd'
50
+ order by P.id, pr.start_date desc, pr.created_at desc, pesi.diagnosis_date desc, ppe.diagnosis_date desc;
@@ -1,5 +1,3 @@
1
-
2
- --explain analyze
3
1
  select
4
2
  modality_desc modality,
5
3
  count(e1.patient_id) patient_count,
@@ -14,7 +14,6 @@
14
14
  # To access configuration settings use e.g.
15
15
  # Renalware.config.x
16
16
  #
17
- # rubocop:disable Metrics/ClassLength
18
17
  module Renalware
19
18
  class Configuration
20
19
  include ActiveSupport::Configurable
@@ -37,9 +36,6 @@ module Renalware
37
36
  config_accessor(:patient_hospital_identifiers) { {} }
38
37
  config_accessor(:session_timeout_polling_frequency) { 1.minute }
39
38
  config_accessor(:session_register_user_user_activity_after) { 2.minutes }
40
- config_accessor(:session_expiry_use_previous_mechansim) {
41
- ENV["SESSION_EXPIRY_USE_PREVIOUS_MECHANSIM"] == "true"
42
- }
43
39
  config_accessor(:duration_of_last_url_memory_after_session_expiry) { 30.minutes }
44
40
  config_accessor(:broadcast_subscription_map) { {} }
45
41
  config_accessor(:include_sunday_on_hd_diaries) { false }
@@ -161,4 +157,3 @@ module Renalware
161
157
  yield config
162
158
  end
163
159
  end
164
- # rubocop:enable Metrics/ClassLength
@@ -5,6 +5,6 @@ module Renalware
5
5
  # to creat that class even though its not used. If we don't do this zeitwerk
6
6
  # complains that version.rb does export a constant called Version.
7
7
  class VersionNumber
8
- VERSION = "2.0.158"
8
+ VERSION = "2.0.159"
9
9
  end
10
10
  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.158
4
+ version: 2.0.159
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2020-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-import
@@ -854,14 +854,14 @@ dependencies:
854
854
  requirements:
855
855
  - - "~>"
856
856
  - !ruby/object:Gem::Version
857
- version: 2.0.5
857
+ version: '2.0'
858
858
  type: :runtime
859
859
  prerelease: false
860
860
  version_requirements: !ruby/object:Gem::Requirement
861
861
  requirements:
862
862
  - - "~>"
863
863
  - !ruby/object:Gem::Version
864
- version: 2.0.5
864
+ version: '2.0'
865
865
  - !ruby/object:Gem::Dependency
866
866
  name: slim-rails
867
867
  requirement: !ruby/object:Gem::Requirement
@@ -896,14 +896,14 @@ dependencies:
896
896
  requirements:
897
897
  - - '='
898
898
  - !ruby/object:Gem::Version
899
- version: 0.7.0
899
+ version: 0.8.0
900
900
  type: :runtime
901
901
  prerelease: false
902
902
  version_requirements: !ruby/object:Gem::Requirement
903
903
  requirements:
904
904
  - - '='
905
905
  - !ruby/object:Gem::Version
906
- version: 0.7.0
906
+ version: 0.8.0
907
907
  - !ruby/object:Gem::Dependency
908
908
  name: uglifier
909
909
  requirement: !ruby/object:Gem::Requirement
@@ -1105,11 +1105,12 @@ files:
1105
1105
  - app/assets/javascripts/renalware/components/behaviours.js
1106
1106
  - app/assets/javascripts/renalware/components/clipboard_setup.js
1107
1107
  - app/assets/javascripts/renalware/components/clockpicker.js
1108
+ - app/assets/javascripts/renalware/components/configuration.js
1108
1109
  - app/assets/javascripts/renalware/components/contacts.js
1109
- - app/assets/javascripts/renalware/components/dialogs.js.erb
1110
+ - app/assets/javascripts/renalware/components/dialogs.js
1110
1111
  - app/assets/javascripts/renalware/components/drugs.js
1111
1112
  - app/assets/javascripts/renalware/components/events.js
1112
- - app/assets/javascripts/renalware/components/feed_only_inputs.js.erb
1113
+ - app/assets/javascripts/renalware/components/feed_only_inputs.js
1113
1114
  - app/assets/javascripts/renalware/components/feeds.js
1114
1115
  - app/assets/javascripts/renalware/components/forms.js
1115
1116
  - app/assets/javascripts/renalware/components/full_screen.js
@@ -1132,16 +1133,14 @@ files:
1132
1133
  - app/assets/javascripts/renalware/components/primary_care_physicians.js
1133
1134
  - app/assets/javascripts/renalware/components/problems.js
1134
1135
  - app/assets/javascripts/renalware/components/renal.js
1135
- - app/assets/javascripts/renalware/components/reporting.js.erb
1136
1136
  - app/assets/javascripts/renalware/components/searchables.js
1137
1137
  - app/assets/javascripts/renalware/components/select2-ajax-search.js
1138
- - app/assets/javascripts/renalware/components/session_timeout_redirect.js.erb
1139
1138
  - app/assets/javascripts/renalware/components/sortable.js
1140
1139
  - app/assets/javascripts/renalware/components/table.js
1141
1140
  - app/assets/javascripts/renalware/components/tabs.js
1142
1141
  - app/assets/javascripts/renalware/components/toggler.js
1143
1142
  - app/assets/javascripts/renalware/components/transplants.js
1144
- - app/assets/javascripts/renalware/core.js.erb
1143
+ - app/assets/javascripts/renalware/core.js
1145
1144
  - app/assets/javascripts/renalware/rollup_compiled.css
1146
1145
  - app/assets/javascripts/renalware/rollup_compiled.js
1147
1146
  - app/assets/pdf/blank_page.pdf
@@ -4071,6 +4070,8 @@ files:
4071
4070
  - db/migrate/20201021153832_update_supportive_care_mdm_patients_view.rb
4072
4071
  - db/migrate/20201021154809_update_transplant_mdm_patients_view.rb
4073
4072
  - db/migrate/20201023092859_remove_unused_indexes.rb
4073
+ - db/migrate/20201105153422_update_medication_current_prescriptions_view.rb
4074
+ - db/migrate/20201112152752_update_pd_mdm_patients_view1.rb
4074
4075
  - db/seeds.rb
4075
4076
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
4076
4077
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
@@ -4176,6 +4177,7 @@ files:
4176
4177
  - db/views/low_clearance_mdm_patients_v01.sql
4177
4178
  - db/views/low_clearance_mdm_patients_v02.sql
4178
4179
  - db/views/medication_current_prescriptions_v01.sql
4180
+ - db/views/medication_current_prescriptions_v02.sql
4179
4181
  - db/views/pathology_current_key_observation_sets_v01.sql
4180
4182
  - db/views/pathology_current_key_observation_sets_v02.sql
4181
4183
  - db/views/pathology_current_observations_v01.sql
@@ -4190,6 +4192,7 @@ files:
4190
4192
  - db/views/patient_summaries_v06.sql
4191
4193
  - db/views/pd_mdm_patients_v01.sql
4192
4194
  - db/views/pd_mdm_patients_v02.sql
4195
+ - db/views/pd_mdm_patients_v03.sql
4193
4196
  - db/views/pd_regime_for_modalities_v01.sql
4194
4197
  - db/views/reporting_anaemia_audit_v01.sql
4195
4198
  - db/views/reporting_bone_audit_v01.sql
@@ -1,37 +0,0 @@
1
- // Create a timer that will poll to see if the user's session is still valid.
2
- // If it isn't, the server returns a 401 unauthorised causing a redirect the login page.
3
- // Note that we could in the future display a message letting them know their session
4
- // will expired in X seconds. The controller action we hit here could be expanded to
5
- // to render some js that would insert than into the page.
6
- // Note we don't want to poll if we are sat on the login page anyway. For one thing on Heroku it
7
- // would prevent a dyno sleeping, but its also a waste of resources.
8
- //
9
- // Note this mechanism has been superceded by the session_timeout.js stimulus controller.
10
- //
11
-
12
- <% if Renalware.config.session_expiry_use_previous_mechansim %>
13
- $(document).ready(function() {
14
- var login_path ="<%= Renalware::Engine.routes.url_helpers.new_user_session_path %>";
15
- var defaultPollFreq = <%= Renalware.config.session_timeout_polling_frequency.to_i %>;
16
- var frequency_s = defaultPollFreq;
17
-
18
- // This is a global window function so that we can call it directly from capybara tests to
19
- // bypass having to wait for the session polling interval to tick over.
20
- window.sessionTimeoutCheck = function(){
21
- if(window.location.pathname != login_path) {
22
- Rails.ajax({
23
- type: "GET",
24
- url: "<%= Renalware::Engine.routes.url_helpers.check_session_expired_path %>",
25
- dataType: "html",
26
- error: function(responseText, status, xhr) {
27
- if (xhr.status == 401) {
28
- window.location.reload()
29
- }
30
- }
31
- });
32
- }
33
- };
34
-
35
- setInterval(window.sessionTimeoutCheck, (frequency_s * 1000));
36
- });
37
- <% end %>