renalware-core 2.0.87 → 2.0.88

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/renalware/modules/_patients.scss +42 -1
  3. data/app/assets/stylesheets/renalware/partials/_forms.scss +14 -0
  4. data/app/controllers/renalware/patients/primary_care_physician_controller.rb +2 -0
  5. data/app/helpers/renalware/clipboard_helper.rb +1 -1
  6. data/app/models/renalware/renal/registry/preflight_checks/patients_query.rb +1 -3
  7. data/app/models/renalware/system/api_log.rb +0 -1
  8. data/app/policies/renalware/base_policy.rb +2 -2
  9. data/app/policies/renalware/drugs/drug_policy.rb +1 -1
  10. data/app/policies/renalware/letters/letter_policy.rb +1 -1
  11. data/app/presenters/renalware/pathology/observation_set_presenter.rb +0 -1
  12. data/app/presenters/renalware/patients/summary_part.rb +51 -0
  13. data/app/presenters/renalware/renal/clinical_summary_presenter.rb +7 -2
  14. data/app/presenters/renalware/summary_part.rb +1 -1
  15. data/app/views/renalware/api/ukrdc/patients/procedures/_transplant_operation.xml.builder +2 -0
  16. data/app/views/renalware/dashboard/dashboards/_content.html.slim +1 -1
  17. data/app/views/renalware/patients/_summary_part.html.slim +32 -0
  18. data/app/views/renalware/patients/bookmarks/_new.html.slim +1 -1
  19. data/app/views/renalware/patients/clinical_summaries/show.html.slim +1 -2
  20. data/app/views/renalware/shared/_fieldset.html.slim +4 -1
  21. data/app/views/renalware/transplants/recipient_followups/_form.html.slim +19 -9
  22. data/config/initializers/devise_security.rb +44 -0
  23. data/config/initializers/simple_form_clock_picker.rb +0 -1
  24. data/config/initializers/simple_form_datepicker.rb +0 -3
  25. data/config/initializers/simple_form_foundation.rb +0 -1
  26. data/config/initializers/simple_form_wrappers.rb +2 -1
  27. data/config/locales/devise.security_extension.en.yml +20 -7
  28. data/db/migrate/20190104095254_create_active_storage_tables.active_storage.rb +19 -17
  29. data/db/migrate/20190612124015_create_transplant_rejection_episodes.rb +14 -10
  30. data/db/migrate/20190617121528_create_transplant_rejection_treatments.rb +14 -12
  31. data/lib/core_extensions/active_support/duration.rb +1 -1
  32. data/lib/renalware/configuration.rb +1 -0
  33. data/lib/renalware/engine.rb +1 -0
  34. data/lib/renalware/version.rb +1 -1
  35. metadata +19 -4
  36. data/app/models/concerns/renalware/clinics/most_recent_measurement_scopes.rb.dead +0 -43
  37. data/app/views/renalware/patients/side_menu/_options.html.slim.redundant +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6862e9a5b2b690ebc9b8a96c8202b0b08227d0f2bc0aea9633e9405301da3d62
4
- data.tar.gz: e2537d376ecacc0a4905382a8abe12fbf79af6dff901479a51aadf004cc71114
3
+ metadata.gz: 6b307ab9e2206ff86c1d62380d3b6dfc77839512a51f5ad7957f8e98e2c7e29a
4
+ data.tar.gz: c722f3506055163495fabcf33d586d83597be269f5b40998cec8605236e6400a
5
5
  SHA512:
6
- metadata.gz: 4d07603534caca499ceed69353afe2a694f39c8768286680e1773ba5ab0bd7b5f2e1122f9a91ee260f31521a94a01370cdd353e7d348c610862bad829d1af7e4
7
- data.tar.gz: ffbb71aafaeda1f69c821f3ca00d5eb3ef7b22931b484fe7bcac80f33c6e082a393f1e35d7b7695854ddc8d41edf70ab4044115e6c660307b865f5ee1cfbb82e
6
+ metadata.gz: 68c6187d34c761393b070b05bbdb8fed13485739f3deab2cc5feb397a6a4c2a6a86d0c2d67a7f1681dcb7d0e8e36fa181f416c6c7ec9655a55c870dcf88034ed
7
+ data.tar.gz: 8f954eeaebce032662556e9b2bb2b4984479f7b13c27ee814e63b17a154836a5c91f596107cbc2e0961c2c32daf3849045f29caea5f39805483ae9ffff3a9d77
@@ -376,8 +376,49 @@ form {
376
376
  @include grid-column(6);
377
377
  }
378
378
  }
379
- }
380
379
 
380
+ .summary-part--bookmark-notes,
381
+ .summary-part--worryboard-notes {
382
+ @include grid-column(12);
383
+
384
+ @media #{$medium-up} {
385
+ @include grid-column(6);
386
+ }
387
+
388
+ p {
389
+ padding: .2rem 0 0 0;
390
+ }
391
+
392
+ .urgent {
393
+ background-color: $nhs-yellow;
394
+ padding: .05rem .6rem;
395
+ display: inline-block;
396
+ border-radius: 0.3rem;
397
+ margin-right: .4rem;
398
+ }
399
+
400
+ .lozenge {
401
+ margin: 0;
402
+ padding: 0;
403
+ font-size: .9rem;
404
+ display: inline-block;
405
+
406
+ ul {
407
+ margin: 0;
408
+ padding: 0;
409
+ display: inline-block;
410
+
411
+ li {
412
+ padding: 0 .4rem;
413
+ background-color: $nhs-green;
414
+ line-height: 1.4rem;
415
+ color: $white;
416
+ margin-right: .3rem;
417
+ }
418
+ }
419
+ }
420
+ }
421
+ }
381
422
 
382
423
  #select2-practice-search-results {
383
424
  li {
@@ -461,3 +461,17 @@ fieldset {
461
461
  }
462
462
  }
463
463
  }
464
+
465
+ label.label-emphasis {
466
+ font-weight: bold;
467
+ }
468
+
469
+ legend .legend-note {
470
+ right: 0;
471
+ top: 0;
472
+ position: absolute;
473
+ margin: .5rem 1rem;
474
+ font-weight: normal;
475
+ font-size: .9rem;
476
+ color: $steel;
477
+ }
@@ -86,10 +86,12 @@ module Renalware
86
86
  end
87
87
  end
88
88
 
89
+ # TODO: move to a query object
89
90
  def find_practice_memberships_for(practice_id)
90
91
  PracticeMembership
91
92
  .eager_load(:primary_care_physician)
92
93
  .where(practice_id: practice_id)
94
+ .where("#{PrimaryCarePhysician.table_name}.deleted_at is NULL")
93
95
  .order(
94
96
  "#{PracticeMembership.table_name}.left_on desc,"\
95
97
  "#{PrimaryCarePhysician.table_name}.name asc"
@@ -3,7 +3,7 @@
3
3
  module Renalware
4
4
  module ClipboardHelper
5
5
  # A helper to create a clipboard.js button https://clipboardjs.com/
6
- def clipboard_button_for(target, width: "13rem", text: "")
6
+ def clipboard_button_for(target, width: "13rem")
7
7
  content_tag :button,
8
8
  data: { "clipboard-action" => "copy", "clipboard-target" => target },
9
9
  class: "button compact low-key clipboard-btn" do
@@ -11,13 +11,11 @@ module Renalware
11
11
  MODALITY_NAMES = %w(HD PD Transplant).freeze
12
12
  attr_reader :relation, :query_params
13
13
 
14
- # rubocop:disable Lint/UnusedMethodArgument
15
14
  def initialize(relation: nil, query_params: {})
16
- @relation ||= default_relation
15
+ @relation = relation || default_relation
17
16
  @query_params = query_params
18
17
  @query_params[:s] = "modality_descriptions_name ASC" if @query_params[:s].blank?
19
18
  end
20
- # rubocop:enable Lint/UnusedMethodArgument
21
19
 
22
20
  # The way I understand Ransack is that if you use a query like profile_esrf_gt
23
21
  # (that's the RenalProfile in this case as we are dealing with a Renal::Patient)
@@ -16,7 +16,6 @@ module Renalware
16
16
  yield(log) if block_given?
17
17
  log.update!(status: STATUS_DONE)
18
18
  log
19
-
20
19
  rescue StandardError => e
21
20
  log.update(
22
21
  status: STATUS_ERROR,
@@ -29,7 +29,7 @@ module Renalware
29
29
  return true if user_is_devops? || user_is_super_admin?
30
30
  return permission_for_restricted? if restricted?
31
31
 
32
- has_write_privileges?
32
+ write_privileges?
33
33
  end
34
34
 
35
35
  def update?
@@ -73,7 +73,7 @@ module Renalware
73
73
  permission_configuration.has_permission?(user)
74
74
  end
75
75
 
76
- def has_write_privileges?
76
+ def write_privileges?
77
77
  user_is_super_admin? || user_is_admin? || user_is_clinical?
78
78
  end
79
79
 
@@ -6,7 +6,7 @@ module Renalware
6
6
  module Drugs
7
7
  class DrugPolicy < BasePolicy
8
8
  def selected_drugs?
9
- has_write_privileges?
9
+ write_privileges?
10
10
  end
11
11
  end
12
12
  end
@@ -8,7 +8,7 @@ module Renalware
8
8
  alias_attribute :letter, :record
9
9
 
10
10
  def author?
11
- has_write_privileges?
11
+ write_privileges?
12
12
  end
13
13
 
14
14
  def update?
@@ -29,7 +29,6 @@ module Renalware
29
29
  .to_a
30
30
  .group_by(&:display_group)
31
31
  .each do |group_number, array_of_obs_desc|
32
-
33
32
  group = array_of_obs_desc.map do |obs_desc|
34
33
  observation_hash = send(obs_desc.code.to_sym) || {}
35
34
  observed_at = observation_hash["observed_at"]
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Renalware
4
+ module Patients
5
+ class SummaryPart < Renalware::SummaryPart
6
+ delegate :worry, to: :patient
7
+
8
+ def to_partial_path
9
+ "renalware/patients/summary_part"
10
+ end
11
+
12
+ def on_worryboard?
13
+ worry.present?
14
+ end
15
+
16
+ def worryboard_notes
17
+ worry&.notes
18
+ end
19
+
20
+ def bookmarked?
21
+ bookmark.present?
22
+ end
23
+
24
+ def bookmark_notes
25
+ bookmark&.notes
26
+ end
27
+
28
+ def bookmark
29
+ return if current_user.blank?
30
+
31
+ patients_user.bookmark_for_patient(patient)
32
+ end
33
+
34
+ def patients_user
35
+ Patients.cast_user(current_user)
36
+ end
37
+
38
+ def bookmark_tags
39
+ return [] if bookmark.blank?
40
+ return [] if bookmark.tags.blank?
41
+
42
+ bookmark
43
+ .tags
44
+ .split(",")
45
+ .reject(&:blank?)
46
+ .map(&:strip)
47
+ .uniq
48
+ end
49
+ end
50
+ end
51
+ end
@@ -9,8 +9,13 @@ module Renalware
9
9
  rattr_initialize :patient
10
10
 
11
11
  # Host application may override the order or add other summary presenters
12
- def summary_parts
13
- Renalware.config.page_layouts[:clinical_summary].map(&:constantize)
12
+ def summary_parts(current_user)
13
+ Renalware
14
+ .config
15
+ .page_layouts[:clinical_summary]
16
+ .map(&:constantize)
17
+ .map { |klass| klass.new(patient, current_user) }
18
+ .select(&:render?)
14
19
  end
15
20
  end
16
21
  end
@@ -8,7 +8,7 @@ module Renalware
8
8
  # of various SummaryParts
9
9
  class SummaryPart
10
10
  DATE_FORMAT = "%Y%m%d%H%M%S%L"
11
- rattr_initialize :patient
11
+ rattr_initialize :patient, :current_user
12
12
  attr_implement :to_partial_path
13
13
 
14
14
  # If the subclass defines a cache_key Rails will cache the partial
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  xml = builder
2
4
 
3
5
  xml.Transplant do
@@ -42,4 +42,4 @@
42
42
  p.empty-section= t(".electronic_ccs.none")
43
43
 
44
44
  - if current_user_is_admin?
45
- = render Renalware::Admin::Users::SummaryPart.new(nil)
45
+ = render Renalware::Admin::Users::SummaryPart.new(nil, current_user)
@@ -0,0 +1,32 @@
1
+ - if summary_part.bookmarked?
2
+ - bookmark = summary_part.bookmark
3
+ .summary-part--bookmark-notes
4
+ article
5
+ header
6
+ h2 Bookmark
7
+ = link_to("Remove",
8
+ bookmark_path(bookmark),
9
+ method: :delete,
10
+ data: { confirm: "Are you sure?" },
11
+ class: :button)
12
+ - if bookmark.urgent?
13
+ span.urgent Urgent
14
+ - if summary_part.bookmark_tags.any?
15
+ .lozenge
16
+ ul
17
+ - summary_part.bookmark_tags.each do |tag|
18
+ li= tag
19
+ p= summary_part.bookmark_notes
20
+
21
+ - if summary_part.on_worryboard?
22
+ .summary-part--worryboard-notes
23
+ article
24
+ header
25
+ h2 Worryboard notes
26
+ = link_to("Remove",
27
+ patient_worry_path( summary_part.patient, summary_part.worry),
28
+ method: :delete,
29
+ data: { confirm: "Are you sure you want to remove the patient from the worryboard?" },
30
+ class: :button)
31
+
32
+ p= summary_part.worryboard_notes
@@ -10,7 +10,7 @@
10
10
  url: patient_bookmarks_path(patient_id: patient) do |f|
11
11
  h2= t(".title")
12
12
  = f.input :urgent, as: :boolean, boolean_style: :inline
13
- = f.input :tags, label: "Tags"
13
+ = f.input :tags, label: "Tags", placeholder: "Optional comma-delimited list"
14
14
  = f.input :notes, as: :text, input_html: { autofocus: :autofocus }
15
15
  = f.submit t(".save"), class: :button
16
16
  span= " or "
@@ -7,6 +7,5 @@
7
7
  = within_patient_layout(title: "Clinical Summary") do
8
8
  .row
9
9
  - patient = clinical_summary.patient
10
- - summary_parts = clinical_summary.summary_parts.map{ |klass| klass.new(patient) }
11
- - summary_parts.select(&:render?).each do |summary_part|
10
+ - summary_parts = clinical_summary.summary_parts(current_user).each do |summary_part|
12
11
  = render summary_part
@@ -2,5 +2,8 @@
2
2
  .large-12.columns
3
3
  a name="#{name}"
4
4
  fieldset
5
- legend= legend
5
+ legend
6
+ = legend
7
+ - if local_assigns.key?(:legend_note)
8
+ span.legend-note= legend_note
6
9
  = yield
@@ -9,32 +9,42 @@ ruby:
9
9
 
10
10
  .form-content
11
11
  = f.simple_fields_for :document, f.object.document do |fd|
12
-
13
12
  = render layout: "renalware/shared/fieldset",
14
- locals: { legend: "Transplant Outcomes", name: "transplant_failure" } do
15
- = f.input :graft_function_onset, wrapper: :horizontal_small
16
- = f.input :last_post_transplant_dialysis_on, as: :date_picker, wrapper: :horizontal_datepicker
13
+ locals: { legend: "Transplant Outcomes",
14
+ name: "transplant_failure",
15
+ legend_note: "Bold items required for NHSBT" } do
16
+ = f.input :graft_function_onset, wrapper: :horizontal_small, label_html: { class: "label-emphasis" }
17
+ = f.input :last_post_transplant_dialysis_on, as: :date_picker, wrapper: :horizontal_datepicker, label_html: { class: "label-emphasis" }
17
18
  = f.input :stent_removed_on, as: :date_picker, wrapper: :horizontal_datepicker
18
- = f.input :return_to_regular_dialysis_on, as: :date_picker, wrapper: :horizontal_datepicker
19
+ = f.input :return_to_regular_dialysis_on, as: :date_picker, wrapper: :horizontal_datepicker, label_html: { class: "label-emphasis" }
19
20
  / readonly: nil here is required to prevent the No option being created with readonly=readonly
20
21
  / which causes Capybara to fail because it cannot change the value of read-only element
21
22
  = f.input :transplant_failed,
22
23
  as: :inline_radio_buttons,
23
24
  wrapper: :horizontal_small,
24
- readonly: nil
25
- = f.input :transplant_failed_on, as: :date_picker, wrapper: :horizontal_datepicker
25
+ readonly: nil,
26
+ label_html: { class: "label-emphasis" }
27
+ = f.input :transplant_failed_on,
28
+ as: :date_picker,
29
+ wrapper: :horizontal_datepicker,
30
+ label_html: { class: "label-emphasis" }
26
31
  = f.input :transplant_failure_cause_description_id,
27
32
  as: :grouped_select,
28
33
  collection: Renalware::Transplants::FailureCauseDescriptionGroup.all,
29
34
  group_method: :ordered_descriptions,
30
35
  group_label_method: :name,
31
36
  value_method: :id,
37
+ wrapper: :horizontal_medium,
38
+ label_html: { class: "label-emphasis" }
39
+ = f.input :transplant_failure_cause_other,
32
40
  wrapper: :horizontal_medium
33
- = f.input :transplant_failure_cause_other, wrapper: :horizontal_medium
34
41
  = f.input :transplant_failure_notes,
35
42
  input_html: { rows: 5 },
36
43
  wrapper: :horizontal_large
37
- = f.input :graft_nephrectomy_on, as: :date_picker, wrapper: :horizontal_datepicker
44
+ = f.input :graft_nephrectomy_on,
45
+ as: :date_picker,
46
+ wrapper: :horizontal_datepicker,
47
+ label_html: { class: "label-emphasis" }
38
48
 
39
49
  = render layout: "renalware/shared/fieldset",
40
50
  locals: { legend: "Cardiovascular Complication",
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ Devise.setup do |config|
4
+ # ==> Security Extension
5
+ # Configure security extension for devise
6
+
7
+ # Should the password expire (e.g 3.months)
8
+ # config.expire_password_after = false
9
+
10
+ # Need 1 char of A-Z, a-z and 0-9
11
+ # config.password_complexity = { digit: 1, lower: 1, symbol: 1, upper: 1 }
12
+
13
+ # How many passwords to keep in archive
14
+ # config.password_archiving_count = 5
15
+
16
+ # Deny old passwords (true, false, number_of_old_passwords_to_check)
17
+ # Examples:
18
+ # config.deny_old_passwords = false # allow old passwords
19
+ # config.deny_old_passwords = true # will deny all the old passwords
20
+ # config.deny_old_passwords = 3 # will deny new passwords that matches with the last 3 passwords
21
+ # config.deny_old_passwords = true
22
+
23
+ # enable email validation for :secure_validatable. (true, false, validation_options)
24
+ # dependency: see https://github.com/devise-security/devise-security/blob/master/README.md#e-mail-validation
25
+ # config.email_validation = true
26
+
27
+ # captcha integration for recover form
28
+ # config.captcha_for_recover = true
29
+
30
+ # captcha integration for sign up form
31
+ # config.captcha_for_sign_up = true
32
+
33
+ # captcha integration for sign in form
34
+ # config.captcha_for_sign_in = true
35
+
36
+ # captcha integration for unlock form
37
+ # config.captcha_for_unlock = true
38
+
39
+ # captcha integration for confirmation form
40
+ # config.captcha_for_confirmation = true
41
+
42
+ # Time period for account expiry from last_activity_at
43
+ # config.expire_after = 90.days
44
+ end
@@ -6,7 +6,6 @@ SimpleForm.setup do |config|
6
6
  class: :row,
7
7
  hint_class: :field_with_hint,
8
8
  error_class: :error do |b|
9
-
10
9
  b.use :html5
11
10
  b.use :placeholder
12
11
  b.optional :maxlength
@@ -6,7 +6,6 @@ SimpleForm.setup do |config|
6
6
  class: :row,
7
7
  hint_class: :field_with_hint,
8
8
  error_class: :error do |b|
9
-
10
9
  b.use :html5
11
10
  b.use :placeholder
12
11
  b.optional :maxlength
@@ -33,7 +32,6 @@ SimpleForm.setup do |config|
33
32
  class: :row,
34
33
  hint_class: :field_with_hint,
35
34
  error_class: :error do |b|
36
-
37
35
  b.use :html5
38
36
  b.use :placeholder
39
37
  b.optional :maxlength
@@ -54,7 +52,6 @@ SimpleForm.setup do |config|
54
52
  class: :row,
55
53
  hint_class: :field_with_hint,
56
54
  error_class: :error do |b|
57
-
58
55
  b.use :html5
59
56
  b.use :placeholder
60
57
  b.optional :maxlength
@@ -77,7 +77,6 @@ SimpleForm.setup do |config|
77
77
  class: "row",
78
78
  hint_class: :field_with_hint,
79
79
  error_class: :error do |b|
80
-
81
80
  b.use :html5
82
81
  b.use :placeholder
83
82
  b.optional :maxlength
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SimpleForm.setup do |config|
2
4
  def configure_label(b)
3
5
  b.use :html5
@@ -42,7 +44,6 @@ SimpleForm.setup do |config|
42
44
  hint_class: :field_with_hint,
43
45
  error_class: :error
44
46
  ) do |b|
45
-
46
47
  configure_label(b)
47
48
 
48
49
  b.wrapper :right_input_wrapper, tag: :div, class: "wrapper__input" do |ba|
@@ -1,16 +1,29 @@
1
1
  en:
2
2
  errors:
3
3
  messages:
4
- taken_in_past: "was used previously."
5
- equal_to_current_password: "must be different than the current password."
6
- password_format: "must contain big, small letters and digits"
4
+ taken_in_past: 'was used previously.'
5
+ equal_to_current_password: 'must be different than the current password.'
6
+ password_complexity:
7
+ digit:
8
+ one: must contain at least one digit
9
+ other: must contain at least %{count} numerals
10
+ lower:
11
+ one: must contain at least one lower-case letter
12
+ other: must contain at least %{count} lower-case letters
13
+ symbol:
14
+ one: must contain at least one punctuation mark or symbol
15
+ other: must contain at least %{count} puncutation marks or symbols
16
+ upper:
17
+ one: must contain at least one upper-case letter
18
+ other: must contain at least %{count} upper-case letters
7
19
  devise:
8
- invalid_captcha: "The captcha input was invalid."
20
+ invalid_captcha: 'The captcha input was invalid.'
21
+ invalid_security_question: 'The security question answer was invalid.'
9
22
  paranoid_verify:
10
- code_required: "Please enter the code our support team provided"
23
+ code_required: 'Please enter the code our support team provided'
11
24
  password_expired:
12
- updated: "Your new password is saved."
13
- change_required: "Your password is expired. Please renew your password."
25
+ updated: 'Your new password is saved.'
26
+ change_required: 'Your password is expired. Please renew your password.'
14
27
  failure:
15
28
  session_limited: 'Your login credentials were used in another browser. Please sign in again to continue in this browser.'
16
29
  expired: 'Your account has expired due to inactivity. Please contact the site administrator.'
@@ -1,27 +1,29 @@
1
1
  # This migration comes from active_storage (originally 20170806125915)
2
2
  class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
3
3
  def change
4
- create_table :active_storage_blobs do |t|
5
- t.string :key, null: false
6
- t.string :filename, null: false
7
- t.string :content_type
8
- t.text :metadata
9
- t.bigint :byte_size, null: false
10
- t.string :checksum, null: false
11
- t.datetime :created_at, null: false
4
+ within_renalware_schema do
5
+ create_table :active_storage_blobs do |t|
6
+ t.string :key, null: false
7
+ t.string :filename, null: false
8
+ t.string :content_type
9
+ t.text :metadata
10
+ t.bigint :byte_size, null: false
11
+ t.string :checksum, null: false
12
+ t.datetime :created_at, null: false
12
13
 
13
- t.index [:key], unique: true
14
- end
14
+ t.index [:key], unique: true
15
+ end
15
16
 
16
- create_table :active_storage_attachments do |t|
17
- t.string :name, null: false
18
- t.references :record, null: false, polymorphic: true, index: false
19
- t.references :blob, null: false
17
+ create_table :active_storage_attachments do |t|
18
+ t.string :name, null: false
19
+ t.references :record, null: false, polymorphic: true, index: false
20
+ t.references :blob, null: false
20
21
 
21
- t.datetime :created_at, null: false
22
+ t.datetime :created_at, null: false
22
23
 
23
- t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
24
- t.foreign_key :active_storage_blobs, column: :blob_id
24
+ t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
25
+ t.foreign_key :active_storage_blobs, column: :blob_id
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -1,15 +1,19 @@
1
1
  class CreateTransplantRejectionEpisodes < ActiveRecord::Migration[5.2]
2
2
  def change
3
- create_table :transplant_rejection_episodes do |t|
4
- t.date :recorded_on, null: false
5
- t.text :notes
6
- t.references :followup,
7
- foreign_key: { to_table: :transplant_recipient_followups },
8
- null: false,
9
- index: true
10
- t.references :updated_by, foreign_key: { to_table: :users }, index: true, null: false
11
- t.references :created_by, foreign_key: { to_table: :users }, index: true, null: false
12
- t.timestamps null: false
3
+ within_renalware_schema do
4
+ create_table :transplant_rejection_episodes do |t|
5
+ t.date :recorded_on, null: false
6
+ t.text :notes
7
+ t.references(
8
+ :followup,
9
+ foreign_key: { to_table: :transplant_recipient_followups },
10
+ null: false,
11
+ index: true
12
+ )
13
+ t.references :updated_by, foreign_key: { to_table: :users }, index: true, null: false
14
+ t.references :created_by, foreign_key: { to_table: :users }, index: true, null: false
15
+ t.timestamps null: false
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,17 +1,19 @@
1
1
  class CreateTransplantRejectionTreatments < ActiveRecord::Migration[5.2]
2
2
  def change
3
- # The treatment given for an episode
4
- create_table :transplant_rejection_treatments do |t|
5
- t.text :name, null: false, index: :unique
6
- t.integer :position, index: true, null: false, default: 0
7
- t.timestamps null: false
8
- end
3
+ within_renalware_schema do
4
+ # The treatment given for an episode
5
+ create_table :transplant_rejection_treatments do |t|
6
+ t.text :name, null: false, index: :unique
7
+ t.integer :position, index: true, null: false, default: 0
8
+ t.timestamps null: false
9
+ end
9
10
 
10
- add_reference(
11
- :transplant_rejection_episodes,
12
- :treatment,
13
- foreign_key: { to_table: :transplant_rejection_treatments },
14
- index: true
15
- )
11
+ add_reference(
12
+ :transplant_rejection_episodes,
13
+ :treatment,
14
+ foreign_key: { to_table: :transplant_rejection_treatments },
15
+ index: true
16
+ )
17
+ end
16
18
  end
17
19
  end
@@ -21,7 +21,7 @@ module CoreExtensions
21
21
  .map { |unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}" }
22
22
  .to_sentence(locale: ::I18n.default_locale)
23
23
  end
24
- # rubocop:enable Style/Semicolon, Style/EachWithObject, Metrics/AbcSize
24
+ # rubocop:enable Style/Semicolon, Style/EachWithObject
25
25
  end
26
26
  end
27
27
  end
@@ -82,6 +82,7 @@ module Renalware
82
82
  Renalware::Events::SummaryPart
83
83
  Renalware::Admissions::SummaryPart
84
84
  Renalware::Admissions::ConsultSummaryPart
85
+ Renalware::Patients::SummaryPart
85
86
  )
86
87
  }
87
88
  }
@@ -11,6 +11,7 @@ require "client_side_validations/simple_form"
11
11
  require "clipboard/rails"
12
12
  require "cocoon"
13
13
  require "devise"
14
+ require "devise-security"
14
15
  require "delayed_job_active_record"
15
16
  require "delayed_job_web"
16
17
  require "dotenv-rails"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.87"
4
+ VERSION = "2.0.88"
5
5
  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.87
4
+ version: 2.0.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-25 00:00:00.000000000 Z
11
+ date: 2019-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_type
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: 4.6.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: devise-security
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: 0.14.3
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
222
+ version: 0.14.3
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: dotenv-rails
211
225
  requirement: !ruby/object:Gem::Requirement
@@ -1354,7 +1368,6 @@ files:
1354
1368
  - app/models/application_record.rb
1355
1369
  - app/models/concerns/renalware/accountable.rb
1356
1370
  - app/models/concerns/renalware/broadcasting.rb
1357
- - app/models/concerns/renalware/clinics/most_recent_measurement_scopes.rb.dead
1358
1371
  - app/models/concerns/renalware/deviseable.rb
1359
1372
  - app/models/concerns/renalware/explicit_state_model.rb
1360
1373
  - app/models/concerns/renalware/feeds/job.rb
@@ -1999,6 +2012,7 @@ files:
1999
2012
  - app/presenters/renalware/pathology/results_presenter.rb
2000
2013
  - app/presenters/renalware/patient_presenter.rb
2001
2014
  - app/presenters/renalware/patients/banner_presenter.rb
2015
+ - app/presenters/renalware/patients/summary_part.rb
2002
2016
  - app/presenters/renalware/pd/dashboard_presenter.rb
2003
2017
  - app/presenters/renalware/pd/delivery_interval_presenter.rb
2004
2018
  - app/presenters/renalware/pd/mdm_presenter.rb
@@ -2547,6 +2561,7 @@ files:
2547
2561
  - app/views/renalware/patients/_person_form_fields.html.slim
2548
2562
  - app/views/renalware/patients/_search_form.html.slim
2549
2563
  - app/views/renalware/patients/_side_menu.html.slim
2564
+ - app/views/renalware/patients/_summary_part.html.slim
2550
2565
  - app/views/renalware/patients/alerts/_alert.html.slim
2551
2566
  - app/views/renalware/patients/alerts/_create_alert_link.html.slim
2552
2567
  - app/views/renalware/patients/alerts/_form.html.slim
@@ -2589,7 +2604,6 @@ files:
2589
2604
  - app/views/renalware/patients/side_menu/_actions.html.slim
2590
2605
  - app/views/renalware/patients/side_menu/_general.html.slim
2591
2606
  - app/views/renalware/patients/side_menu/_modalities.html.slim
2592
- - app/views/renalware/patients/side_menu/_options.html.slim.redundant
2593
2607
  - app/views/renalware/patients/side_menu/_site_specific_actions.html.slim
2594
2608
  - app/views/renalware/patients/side_menu/_site_specific_links.html.slim
2595
2609
  - app/views/renalware/patients/side_menu/_transplants.html.slim
@@ -2895,6 +2909,7 @@ files:
2895
2909
  - config/initializers/core_extensions.rb
2896
2910
  - config/initializers/delayed_job.rb
2897
2911
  - config/initializers/devise.rb
2912
+ - config/initializers/devise_security.rb
2898
2913
  - config/initializers/devise_security_extension.rb
2899
2914
  - config/initializers/inflections.rb
2900
2915
  - config/initializers/kaminari.rb
@@ -1,43 +0,0 @@
1
- require_dependency "renalware/letters"
2
-
3
- module Renalware
4
- module Clinics
5
- module MostRecentMeasurementScopes
6
- extend ActiveSupport::Concern
7
-
8
- ClinicalObservation = Struct.new(:date, :measurement)
9
-
10
- class_methods do
11
- # Returns [date, weight]
12
- def most_recent_weight_for(patient)
13
- result = ClinicVisit
14
- .most_recent_for_patient(patient)
15
- .where("weight is not null")
16
- .pluck(:date, :weight).first || []
17
-
18
- ClinicalObservation.new(result.first, result.last)
19
- end
20
-
21
- # Returns [date, height]
22
- def most_recent_height_for(patient)
23
- result = ClinicVisit
24
- .most_recent_for_patient(patient)
25
- .where("height is not null")
26
- .pluck(:date, :height).first || []
27
-
28
- ClinicalObservation.new(result.first, result.last)
29
- end
30
-
31
- # Returns [date, [systolic_bp, diastolic_bp]]
32
- def most_recent_blood_pressure_for(patient)
33
- result = ClinicVisit
34
- .most_recent_for_patient(patient)
35
- .where("systolic_bp is not null and diastolic_bp is not null")
36
- .pluck(:date, :systolic_bp, :diastolic_bp).first || [nil, nil, nil]
37
-
38
- ClinicalObservation.new(result[0], [result[1], result[2]])
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,24 +0,0 @@
1
- li.divider
2
-
3
- li.heading= t(".heading")
4
-
5
- - bookmark = find_user_bookmark_for_patient(patient)
6
-
7
- - if bookmark.present?
8
- li.link= render partial: "renalware/patients/bookmarks/delete",
9
- locals: { bookmark: bookmark, link_text: t(".delete_bookmark") }
10
- - else
11
- li.link= render partial: "renalware/patients/bookmarks/new",
12
- locals: { patient: patient, link_text: t(".create_bookmark") }
13
-
14
- - if patient.worry.present?
15
- li.link= render partial: "renalware/patients/worries/delete",
16
- locals: { patient: patient }
17
- - else
18
- li.link= render partial: "renalware/patients/worries/new",
19
- locals: { patient: patient }
20
-
21
- li.link.action
22
- = render partial: "renalware/patients/alerts/create_alert_link",
23
- locals: { patient: patient, link_text: t(".create_alert") }
24
- = render "renalware/patients/alerts/modal_dialog_placeholder"