renalware-core 2.0.161 → 2.0.162

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bc096586b16fb31366d250f5e89808e021822a56fed19237530c6abd9cbf0dd
4
- data.tar.gz: 61359de738b4d48c4c4e301d8ff7e5a421aad80258e26387b86bbd525ee62f2d
3
+ metadata.gz: 7e885a02e30e38f6e267bfd16a39982e2df008d175f8d4c88c885f1fbd8514fc
4
+ data.tar.gz: 9ffca3aae6bafa903a4973b07c48496724254321aaa73d336655bcde8c4b6514
5
5
  SHA512:
6
- metadata.gz: cafb016f3c443c10cddc2b1db2fd469f60b98bd0ad266350758e9e94127e9e8c036dcba451b415bb3497eb7eed28d12f848c2b153d4c2d6c1c42cc0bc78135df
7
- data.tar.gz: 712f000b0e02727277097de9fa11f76966ca0163bcbf731e330dd4adee5a1d495044c2794a6a81defbdd44369e67c6ced3fc9b139bd920e3346017627ce59dcb
6
+ metadata.gz: aac008a83c72d83fb0c1c6029d1851686075537c58ebad5d74f1ccb2f6da1a413180f45697eb4ed1c635c36b358e7a5e7850c20917992a8eb93fac23bdb20fc9
7
+ data.tar.gz: a2cd067bcba52812a65d5f0f63a1a6dac985a1d093331a315e0152fe349bf1eb090eefd81f3018ae660937a62dabfa68aa0d860fdaaa87453d90d66368c46f7d
@@ -141,6 +141,7 @@ article.clinical-allergies {
141
141
  .patient-alerts {
142
142
  color: $white;
143
143
  background-color: transparent;
144
+ padding-top: .1rem;
144
145
 
145
146
  @media print {
146
147
  display: none;
@@ -199,6 +200,33 @@ article.clinical-allergies {
199
200
  }
200
201
  }
201
202
 
203
+ &.vaccination {
204
+ background-color: $nhs-aqua-green;
205
+
206
+ &:hover {
207
+ background-color: darken($nhs-aqua-green, 4);
208
+ }
209
+
210
+ .title a,
211
+ i:before {
212
+ color: $white;
213
+ }
214
+ }
215
+
216
+ &.event {
217
+ background-color: $nhs-yellow;
218
+
219
+ &:hover {
220
+ background-color: darken($nhs-yellow, 7);
221
+ }
222
+
223
+ .title a,
224
+ .date,
225
+ i:before {
226
+ color: $dark-grey;
227
+ }
228
+ }
229
+
202
230
  &.research-study-participant {
203
231
  background-color: darken($nhs-green, 3);
204
232
  color: $white;
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/events"
4
+
5
+ module Renalware
6
+ module Events
7
+ # Query object that returns, for a patient, the most recent matching event (if any) for each
8
+ # event_type_alert_trigger row in the databse. The results are used to display
9
+ # alerts in the UI.
10
+ # For example given a vaccination Event::Type and an EventTypeAlertTrigger
11
+ # which is configured to find any vaccination event with the word "covid" in
12
+ # anywhere in the document, this query will return the most matching event.
13
+ # It is possible to have mltiple triggers rows for the same event type, so for eample one
14
+ # could display triggers for the most recent covid vaccination, and the most recent HBV
15
+ # vaccination.
16
+ class AlertableEventsQuery
17
+ def self.call(patient:)
18
+ Event
19
+ .for_patient(patient)
20
+ .joins(event_type: :alert_triggers)
21
+ .select("DISTINCT ON (events.patient_id, event_type_alert_triggers.id) events.*")
22
+ .where("(events.document::text ilike '%' || when_event_document_contains || '%') or (events.description ilike '%' || when_event_description_contains || '%')")
23
+ .order("events.patient_id, event_type_alert_triggers.id, events.created_at desc")
24
+ end
25
+ end
26
+ end
27
+ end
@@ -45,6 +45,10 @@ module Renalware
45
45
  end
46
46
  alias :to_input_partial_path :to_partial_path
47
47
 
48
+ def to_alert_partial_path
49
+ partial_for "alert"
50
+ end
51
+
48
52
  def to_cell_partial_path
49
53
  partial_for "cell"
50
54
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/events"
4
+
5
+ module Renalware
6
+ module Events
7
+ # Used to defines conditions where, for a particular event type, if the there is e.g. a case-
8
+ # insensitive text match against the contents of the event document (eg 'COVID')
9
+ # then an alert will be displayed in the UI (for the most recent match is there are > 1).
10
+ class EventTypeAlertTrigger < ApplicationRecord
11
+ belongs_to :event_type, class_name: "Events::Type"
12
+ validates :event_type, presence: true
13
+ end
14
+ end
15
+ end
@@ -6,6 +6,13 @@ module Renalware
6
6
  module Events
7
7
  class Type < ApplicationRecord
8
8
  self.table_name = "event_types"
9
+ has_many(
10
+ :alert_triggers,
11
+ class_name: "EventTypeAlertTrigger",
12
+ foreign_key: :event_type_id,
13
+ dependent: :destroy
14
+ )
15
+
9
16
  DEFAULT_EVENT_CLASS_NAME = "Renalware::Events::Simple"
10
17
 
11
18
  acts_as_paranoid
@@ -40,7 +40,7 @@ module Renalware
40
40
  delegate :clear, to: :store
41
41
 
42
42
  def fetch(letter, **options)
43
- store.fetch(cache_key_for(letter, **options)) { yield }
43
+ store.fetch(cache_key_for(letter, **options), expires_in: 4.weeks) { yield }
44
44
  end
45
45
 
46
46
  # Note the letter must be a LetterPresenter which has a #to_html method
@@ -42,39 +42,3 @@
42
42
  method: :delete,
43
43
  data: { confirm: "Are you sure you want to clear the PDF letter cache?\n" },
44
44
  class: "button alert"
45
-
46
- <label class="block">
47
- <span class="text-gray-700">Name</span>
48
- <input class="form-input mt-1 block w-full" placeholder="Jane Doe">
49
- </label>
50
-
51
- <div class="mt-4">
52
- <span class="text-gray-700">Account Type</span>
53
- <div class="mt-2">
54
- <label class="inline-flex items-center">
55
- <input type="radio" class="form-radio" name="accountType" value="personal">
56
- <span class="ml-2">Personal</span>
57
- </label>
58
- <label class="inline-flex items-center ml-6">
59
- <input type="radio" class="form-radio" name="accountType" value="busines">
60
- <span class="ml-2">Business</span>
61
- </label>
62
- </div>
63
- </div>
64
-
65
- <label class="block mt-4">
66
- <span class="text-gray-700">Requested Limit</span>
67
- <select class="form-select mt-1 block w-full">
68
- <option>$1,000</option>
69
- <option>$5,000</option>
70
- <option>$10,000</option>
71
- <option>$25,000</option>
72
- </select>
73
- </label>
74
-
75
- <div class="flex mt-6">
76
- <label class="flex items-center">
77
- <input type="checkbox" class="form-checkbox">
78
- <span class="ml-2">I agree to the <span class="underline">privacy policy</span></span>
79
- </label>
80
- </div>
@@ -0,0 +1,3 @@
1
+ - events = Renalware::Events::AlertableEventsQuery.call(patient: patient)
2
+ - events.each do |event|
3
+ = render event.to_alert_partial_path, event: event
@@ -0,0 +1,5 @@
1
+ / The default markup for an alertable event
2
+ li.patient-alert.event
3
+ i.fas.fa-exclamation-triangle
4
+ span.title= link_to event.description&.truncate(12), patient_events_path
5
+ span.date= l(event.date_time.to_date)
@@ -1,6 +1,6 @@
1
1
  - document = event.document
2
2
  dl.dl-horizontal
3
3
  dt= attr_name(document, :location, suffix: ":")
4
- dd= document.location.present? ? document.location : t("unspecified")
4
+ dd= document.location.presence || t("unspecified")
5
5
  dt= attr_name(event, :notes, suffix: ":")
6
6
  dd== event.notes
@@ -1,7 +1,10 @@
1
1
  = link_to(patient_hd_mdm_path(patient), class: "button with-icon secondary") do
2
2
  i.fas.fa-users
3
3
  = t(".mdm")
4
- = link_to(patient_hd_protocol_path(patient), class: "button with-icon secondary", target: "_blank") do
4
+ = link_to(patient_hd_protocol_path(patient),
5
+ class: "button with-icon secondary",
6
+ target: "_blank",
7
+ rel: "noopener") do
5
8
  i.fas.fa-print
6
9
  = t(".protocol")
7
10
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  tr
6
6
  td.actions
7
- = link_to view_proc.call(patient), target: "_blank" do
7
+ = link_to view_proc.call(patient), target: "_blank", rel: "noopener" do
8
8
  i.fa.fa-external-link-square-alt
9
9
  | &nbsp;&nbsp;
10
10
  = t(".view")
@@ -30,7 +30,8 @@
30
30
  = link_to "...",
31
31
  hd_transmission_log_path(log, format: :xml),
32
32
  class: "button small_ellipsis_button",
33
- target: "_blank"
33
+ target: "_blank",
34
+ rel: "noopener"
34
35
  td
35
36
  span(title=log.filepath)
36
37
  - filename = log.filepath && Pathname(log.filepath).basename
@@ -17,6 +17,7 @@ nav.patient-side-nav.full-screenable
17
17
  ul
18
18
  = render "renalware/patients/alerts/list", patient: current_patient
19
19
  = render "renalware/research/alerts", patient: current_patient
20
+ = render "renalware/events/events/alerts", patient: current_patient
20
21
  = render "renalware/clinical/header", patient: current_patient
21
22
  .row.collapse
22
23
  - if local_assigns[:title].present?
@@ -4,14 +4,14 @@
4
4
  .percent_complete
5
5
  .modal__body
6
6
  .content
7
- .batch_results_container(data={"poll-url" => renalware.letters_batch_status_path(batch)})
7
+ .batch_results_container(data={ "poll-url" => renalware.letters_batch_status_path(batch) })
8
8
  .preparing
9
9
  = image_tag("renalware/loading-gears-animation.gif", height: "116")
10
10
 
11
-
12
11
  .generated-batch-print-pdf-container(style="display:none")
13
12
  = link_to letters_batch_path(batch, format: :pdf),
14
13
  target: "_blank",
14
+ rel: "noopener",
15
15
  class: "print-batch-letter",
16
16
  data: { "modal-url" => new_letters_batch_completion_path(batch) } do
17
17
  i.far.fa-check-circle
@@ -22,7 +22,7 @@
22
22
  - items.each do |item|
23
23
  .download
24
24
  .file
25
- = link_to(system_download_path(item), target: "_blank") do
25
+ = link_to(system_download_path(item), target: "_blank", rel: "noopener") do
26
26
  i.far.fa-file-alt
27
27
  .details
28
28
  h3= link_to(item.name, system_download_path(item), target: "_blank")
@@ -1,4 +1,4 @@
1
- - severities = Renalware::System::Message.severity.values.map{|val| [val&.humanize, val] }
1
+ - severities = Renalware::System::Message.severity.values.map{ |val| [val&.humanize, val] }
2
2
  = simple_form_for(message,
3
3
  as: :message,
4
4
  html: { autocomplete: "off" }) do |f|
@@ -0,0 +1,5 @@
1
+ li.patient-alert.vaccination
2
+ i.fas.fa-syringe
3
+ - title = Renalware::Virology::VaccinationType.find_by(code: event.document&.type)&.name
4
+ span.title= link_to title, patient_virology_dashboard_path
5
+ span.date= l(event.date_time.to_date)
@@ -0,0 +1,15 @@
1
+ class CreateEventTypeAlertTriggers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ within_renalware_schema do
4
+ create_table(
5
+ :event_type_alert_triggers,
6
+ comment: "Matching alerts are displayed on patient pages"
7
+ ) do |t|
8
+ t.references :event_type, foreign_key: true, null: false
9
+ t.text :when_event_document_contains
10
+ t.text :when_event_description_contains
11
+ t.timestamps null: false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -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.161"
8
+ VERSION = "2.0.162"
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.161
4
+ version: 2.0.162
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-06 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord-import
@@ -310,14 +310,14 @@ dependencies:
310
310
  requirements:
311
311
  - - "~>"
312
312
  - !ruby/object:Gem::Version
313
- version: 2.3.1
313
+ version: 2.4.0
314
314
  type: :runtime
315
315
  prerelease: false
316
316
  version_requirements: !ruby/object:Gem::Requirement
317
317
  requirements:
318
318
  - - "~>"
319
319
  - !ruby/object:Gem::Version
320
- version: 2.3.1
320
+ version: 2.4.0
321
321
  - !ruby/object:Gem::Dependency
322
322
  name: font-awesome-sass
323
323
  requirement: !ruby/object:Gem::Requirement
@@ -664,14 +664,14 @@ dependencies:
664
664
  name: puma
665
665
  requirement: !ruby/object:Gem::Requirement
666
666
  requirements:
667
- - - "~>"
667
+ - - ">="
668
668
  - !ruby/object:Gem::Version
669
669
  version: '4.3'
670
670
  type: :runtime
671
671
  prerelease: false
672
672
  version_requirements: !ruby/object:Gem::Requirement
673
673
  requirements:
674
- - - "~>"
674
+ - - ">="
675
675
  - !ruby/object:Gem::Version
676
676
  version: '4.3'
677
677
  - !ruby/object:Gem::Dependency
@@ -1677,12 +1677,14 @@ files:
1677
1677
  - app/models/renalware/drugs/type.rb
1678
1678
  - app/models/renalware/events.rb
1679
1679
  - app/models/renalware/events/advanced_care_plan.rb
1680
+ - app/models/renalware/events/alertable_events_query.rb
1680
1681
  - app/models/renalware/events/biopsy.rb
1681
1682
  - app/models/renalware/events/clinical_frailty_score.rb
1682
1683
  - app/models/renalware/events/create_event.rb
1683
1684
  - app/models/renalware/events/event.rb
1684
1685
  - app/models/renalware/events/event_list_query.rb
1685
1686
  - app/models/renalware/events/event_query.rb
1687
+ - app/models/renalware/events/event_type_alert_trigger.rb
1686
1688
  - app/models/renalware/events/investigation.rb
1687
1689
  - app/models/renalware/events/line_change_event_query.rb
1688
1690
  - app/models/renalware/events/lists/form.rb
@@ -2573,12 +2575,14 @@ files:
2573
2575
  - app/views/renalware/events/clinical_frailty_score/_cell.html.slim
2574
2576
  - app/views/renalware/events/clinical_frailty_score/_inputs.html.slim
2575
2577
  - app/views/renalware/events/clinical_frailty_score/_toggled_cell.html.slim
2578
+ - app/views/renalware/events/events/_alerts.html.slim
2576
2579
  - app/views/renalware/events/events/_event.html.slim
2577
2580
  - app/views/renalware/events/events/_filters.html.slim
2578
2581
  - app/views/renalware/events/events/_form.html.slim
2579
2582
  - app/views/renalware/events/events/_list.html.slim
2580
2583
  - app/views/renalware/events/events/_summary_part.html.slim
2581
2584
  - app/views/renalware/events/events/_table.html.slim
2585
+ - app/views/renalware/events/events/alert/_simple.html.slim
2582
2586
  - app/views/renalware/events/events/cell/_biopsy.html.slim
2583
2587
  - app/views/renalware/events/events/cell/_investigation.html.slim
2584
2588
  - app/views/renalware/events/events/cell/_simple.html.slim
@@ -3326,6 +3330,7 @@ files:
3326
3330
  - app/views/renalware/virology/dashboards/show.html.slim
3327
3331
  - app/views/renalware/virology/profiles/_summary.html.slim
3328
3332
  - app/views/renalware/virology/profiles/edit.html.slim
3333
+ - app/views/renalware/virology/vaccinations/_alert.html.slim
3329
3334
  - app/views/renalware/virology/vaccinations/_cell.html.slim
3330
3335
  - app/views/renalware/virology/vaccinations/_inputs.html.slim
3331
3336
  - app/views/renalware/virology/vaccinations/_list.html.slim
@@ -4078,6 +4083,7 @@ files:
4078
4083
  - db/migrate/20201105153422_update_medication_current_prescriptions_view.rb
4079
4084
  - db/migrate/20201112152752_update_pd_mdm_patients_view1.rb
4080
4085
  - db/migrate/20210105163944_create_virology_vaccination_types.rb
4086
+ - db/migrate/20210115181817_create_event_type_alert_triggers.rb
4081
4087
  - db/seeds.rb
4082
4088
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
4083
4089
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb