renalware-core 2.0.83 → 2.0.84

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/renalware/transplants.js +3 -0
  3. data/app/assets/stylesheets/renalware/modules/_transplants.scss +30 -0
  4. data/app/controllers/renalware/transplants/recipient_followups_controller.rb +57 -23
  5. data/app/models/renalware/feeds/files/practice_memberships/import_job.rb +1 -1
  6. data/app/models/renalware/feeds/files/primary_care_physicians/import_job.rb +1 -1
  7. data/app/models/renalware/feeds/message_processor.rb +3 -3
  8. data/app/models/renalware/letters/event/clinic_visit.rb +1 -1
  9. data/app/models/renalware/letters/pathology_layout.rb +0 -1
  10. data/app/models/renalware/letters/rtf_renderer.rb +1 -1
  11. data/app/models/renalware/system/render_liquid_template.rb +1 -1
  12. data/app/models/renalware/transplants/recipient_followup.rb +9 -0
  13. data/app/models/renalware/transplants/registrations/wait_list_query.rb +0 -1
  14. data/app/models/renalware/transplants/rejection_episode.rb +22 -0
  15. data/app/models/renalware/transplants/rejection_treatment.rb +16 -0
  16. data/app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb +3 -3
  17. data/app/models/renalware/ukrdc/patients_query.rb +6 -4
  18. data/app/models/renalware/ukrdc/transmission_log.rb +3 -3
  19. data/app/policies/renalware/transplants/recipient_followup_policy.rb +10 -0
  20. data/app/policies/renalware/transplants/rejection_episode_policy.rb +16 -0
  21. data/app/presenters/renalware/hd/session_presenter.rb +1 -1
  22. data/app/views/renalware/api/ukrdc/patients/_medications.xml.builder +0 -1
  23. data/app/views/renalware/transplants/recipient_followups/_form.html.slim +23 -2
  24. data/app/views/renalware/transplants/recipient_followups/_rejection_episode_fields.html.slim +13 -0
  25. data/app/views/renalware/transplants/recipient_followups/show.html.slim +7 -0
  26. data/app/views/renalware/transplants/recipient_operations/_list.html.slim +1 -1
  27. data/app/views/renalware/transplants/rejection_episodes/_table.html.slim +15 -0
  28. data/config/locales/renalware/transplants/rejection_episode.en.yml +7 -0
  29. data/db/migrate/20190612124015_create_transplant_rejection_episodes.rb +15 -0
  30. data/db/migrate/20190617121528_create_transplant_rejection_treatments.rb +17 -0
  31. data/db/seeds/default/transplants/{transplant_donor_stages.rb → donor_stages.rb} +1 -3
  32. data/db/seeds/default/transplants/{transplant_failure_cause_descriptions.rb → failure_cause_descriptions.rb} +0 -1
  33. data/db/seeds/default/transplants/{transplant_registration_statuses.rb → registration_statuses.rb} +0 -1
  34. data/db/seeds/default/transplants/rejection_treatments.rb +21 -0
  35. data/db/seeds/default/transplants/seeds.rb +4 -3
  36. data/lib/core_extensions/active_support/duration.rb +1 -1
  37. data/lib/core_extensions/i18n/always_cascade.rb +1 -1
  38. data/lib/document/base.rb +1 -1
  39. data/lib/renalware/version.rb +1 -1
  40. data/spec/factories/system/api_logs.rb +1 -1
  41. data/spec/factories/transplants/rejection_episodes.rb +9 -0
  42. data/spec/factories/transplants/rejection_treatments.rb +7 -0
  43. metadata +34 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea36b70295976ad3764e8988b21a0160126325d05e82494067da8df9d8d22f3d
4
- data.tar.gz: '0805c5b0363012e45a99f006a45780a15975e910abb553da28dda14e0e2e2adf'
3
+ metadata.gz: f61c5bd90607cab06899b310da72383a3aa1ca3aff93486b8380bef054c53a22
4
+ data.tar.gz: b259dbd924ce1ec71afc4285ab6a7dfb3925e277abe45940eaa5c48e3b82984a
5
5
  SHA512:
6
- metadata.gz: a7b2e1287fde1f498844038df58db88456ff9db4195e0e288a442b1da3663bc8c3a69c830d83354c0f72deab19a61a7a08ee778c70e2bf2c68f416f412093082
7
- data.tar.gz: 9bd91cf49ba364a0126ecc37f13ac9b92f7bf93ddafce8a25a5b2e69afa9b1d9566ed33a6d05f20c2821247c093f6990768c570179729ce36489e942ab7a72ef
6
+ metadata.gz: ea7b8e06397195ebd8b2323e049c300ed8b331a2a116f54192b02719be35a500e254eeb97972a8521aeeefdca2c4cb566237a21f8865a7f9a7927e60e493d4df
7
+ data.tar.gz: dd8a0a12995f7903d4bc72daae8fa7812ed67473e95db75f4f7f7fdfe86acf79cffd546329242df09058d37accd2ed212a2d7022dbd59626c08d05b16067b2c0
@@ -0,0 +1,3 @@
1
+ $('#rejection-episodes').on('cocoon:after-insert', function(e, insertedItem) {
2
+ initDatepickersIn('#rejection-episodes');
3
+ });
@@ -15,3 +15,33 @@
15
15
  }
16
16
  }
17
17
  }
18
+
19
+ .rejection-episode {
20
+ position: relative;
21
+ border: solid 1px #aaa;
22
+ padding: 1rem 1rem 0.2rem 1rem;
23
+ clear: both;
24
+ margin: 0 0 1rem 0;
25
+ border-radius: 2px;
26
+ box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
27
+ transition: 0.3s;
28
+
29
+ &:hover {
30
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
31
+ }
32
+
33
+ a.remove_fields {
34
+ position: absolute;
35
+ right: 12px;
36
+ top: 5px;
37
+ z-index: 1;
38
+ }
39
+
40
+ .rejection-episode--creation {
41
+ text-align: right;
42
+ padding: 0;
43
+ margin: 0;
44
+ color: $mid-grey;
45
+ font-size: .9rem;
46
+ }
47
+ }
@@ -2,33 +2,31 @@
2
2
 
3
3
  require_dependency "renalware/transplants/base_controller"
4
4
 
5
+ # rubocop:disable Metrics/ClassLength
5
6
  module Renalware
6
7
  module Transplants
7
8
  class RecipientFollowupsController < BaseController
8
- before_action :load_patient
9
+ # before_action :load_patient
9
10
 
10
11
  def show
11
- recipient_followup = operation.followup
12
- render locals: { patient: patient, recipient_followup: recipient_followup }
12
+ followup = operation.followup
13
+ authorize followup
14
+ render locals: { patient: patient, recipient_followup: followup }
13
15
  end
14
16
 
15
17
  def new
16
- render locals: {
17
- patient: patient,
18
- recipient_followup: operation.build_followup
19
- }
18
+ render_new(operation.build_followup)
20
19
  end
21
20
 
22
21
  def create
23
- recipient_followup = operation.build_followup
24
- recipient_followup.attributes = followup_attributes
25
-
26
- if recipient_followup.save
22
+ followup = copy_attributes_onto_followup(operation.build_followup)
23
+ authorize followup
24
+ if followup.save
27
25
  redirect_to patient_transplants_recipient_dashboard_path(patient),
28
- notice: t(".success", model_name: "recipient follow up")
26
+ notice: success_msg_for("recipient follow up")
29
27
  else
30
- flash.now[:error] = t(".failed", model_name: "recipient follow up")
31
- render :new, locals: { patient: patient, recipient_followup: recipient_followup }
28
+ flash.now[:error] = failed_msg_for("recipient follow up")
29
+ render_new(followup)
32
30
  end
33
31
  end
34
32
 
@@ -37,25 +35,47 @@ module Renalware
37
35
  end
38
36
 
39
37
  def update
40
- recipient_followup = operation.followup
41
- recipient_followup.attributes = followup_attributes
42
-
43
- if recipient_followup.save
38
+ followup = copy_attributes_onto_followup(operation.followup)
39
+ authorize followup
40
+ if followup.save
44
41
  redirect_to patient_transplants_recipient_dashboard_path(patient),
45
42
  notice: success_msg_for("recipient follow up")
46
43
  else
47
44
  flash.now[:error] = failed_msg_for("recipient follow up")
48
- render_edit(recipient_followup)
45
+ render_edit(followup)
49
46
  end
50
47
  end
51
48
 
52
49
  protected
53
50
 
51
+ def copy_attributes_onto_followup(followup)
52
+ followup.attributes = followup_attributes
53
+ followup.rejection_episodes.each do |episode|
54
+ episode.by = current_user
55
+ end
56
+ followup
57
+ end
58
+
59
+ def render_new(followup)
60
+ authorize followup
61
+ render(
62
+ :new,
63
+ locals: {
64
+ patient: patient,
65
+ recipient_followup: followup
66
+ }
67
+ )
68
+ end
69
+
54
70
  def render_edit(followup)
55
- render :edit, locals: {
56
- patient: patient,
57
- recipient_followup: followup
58
- }
71
+ authorize followup
72
+ render(
73
+ :edit,
74
+ locals: {
75
+ patient: patient,
76
+ recipient_followup: followup
77
+ }
78
+ )
59
79
  end
60
80
 
61
81
  def operation
@@ -69,6 +89,7 @@ module Renalware
69
89
  .merge(document: document_attributes)
70
90
  end
71
91
 
92
+ # rubocop:disable Metrics/MethodLength
72
93
  def attributes
73
94
  [
74
95
  :notes,
@@ -82,9 +103,21 @@ module Renalware
82
103
  :graft_function_onset,
83
104
  :last_post_transplant_dialysis_on,
84
105
  :return_to_regular_dialysis_on,
106
+ rejection_episodes_attributes: [
107
+ :id,
108
+ :recorded_on,
109
+ :notes,
110
+ :treatment_id,
111
+ :created_at,
112
+ :updated_at,
113
+ :created_by_id,
114
+ :updated_by_id,
115
+ :_destroy
116
+ ],
85
117
  document: []
86
118
  ]
87
119
  end
120
+ # rubocop:enable Metrics/MethodLength
88
121
 
89
122
  def document_attributes
90
123
  params
@@ -95,3 +128,4 @@ module Renalware
95
128
  end
96
129
  end
97
130
  end
131
+ # rubocop:enable Metrics/ClassLength
@@ -9,7 +9,7 @@ module Renalware
9
9
  class ImportJob < ApplicationJob
10
10
  include StringLogging
11
11
  include Feeds::Job
12
- FILE_TO_EXTRACT_FROM_ARCHIVE = /epracmem.csv/
12
+ FILE_TO_EXTRACT_FROM_ARCHIVE = /epracmem.csv/.freeze
13
13
 
14
14
  def perform(file)
15
15
  logging_to_stringio(strio = StringIO.new)
@@ -10,7 +10,7 @@ module Renalware
10
10
  include StringLogging
11
11
  include Feeds::Job
12
12
 
13
- FILE_TO_EXTRACT_FROM_ARCHIVE = /^egpcur.csv$/
13
+ FILE_TO_EXTRACT_FROM_ARCHIVE = /^egpcur.csv$/.freeze
14
14
 
15
15
  def perform(file)
16
16
  logging_to_stringio(strio = StringIO.new)
@@ -46,9 +46,9 @@ module Renalware
46
46
  # - so that any error in the listener has its own try mechansim and does not cause the
47
47
  # current job to retry,
48
48
  broadcast(:message_processed, feed_message: feed_message)
49
- rescue StandardError => exception
50
- notify_exception(exception)
51
- raise exception
49
+ rescue StandardError => e
50
+ notify_exception(e)
51
+ raise e
52
52
  end
53
53
 
54
54
  private
@@ -16,7 +16,7 @@ module Renalware
16
16
  end
17
17
 
18
18
  def part_classes
19
- super.merge!({ clinical_observations: Part::ClinicalObservations })
19
+ super.merge!(clinical_observations: Part::ClinicalObservations)
20
20
  end
21
21
 
22
22
  def to_s
@@ -15,7 +15,6 @@ module Renalware
15
15
  .order("letter_group asc, letter_order asc")
16
16
  .group_by(&:letter_group)
17
17
  .each do |group_number, descriptions|
18
-
19
18
  yield(group_number, descriptions) if block_given?
20
19
  end
21
20
  end
@@ -6,7 +6,7 @@ module Renalware
6
6
  module Letters
7
7
  class RTFRenderer
8
8
  include ActionController::Rendering
9
- REGEX_TO_STRIP_IMAGES = %r{(?m)<img\s*.*?"\s*\/>}
9
+ REGEX_TO_STRIP_IMAGES = %r{(?m)<img\s*.*?"\s*\/>}.freeze
10
10
 
11
11
  def initialize(letter, controller)
12
12
  @letter = letter
@@ -55,7 +55,7 @@ module Renalware
55
55
  Liquid::Template.error_mode = :strict
56
56
  template = Template.find_by!(name: template_name)
57
57
  liquified_template = Liquid::Template.parse(template.body)
58
- liquified_template.render!(variables, { strict_variables: true })
58
+ liquified_template.render!(variables, strict_variables: true)
59
59
  end
60
60
  end
61
61
  end
@@ -18,6 +18,15 @@ module Renalware
18
18
  belongs_to :transplant_failure_cause_description,
19
19
  class_name: "Transplants::FailureCauseDescription",
20
20
  foreign_key: "transplant_failure_cause_description_id"
21
+ has_many :rejection_episodes,
22
+ class_name: "RejectionEpisode",
23
+ dependent: :restrict_with_exception,
24
+ foreign_key: "followup_id",
25
+ inverse_of: :followup
26
+
27
+ accepts_nested_attributes_for :rejection_episodes,
28
+ reject_if: :all_blank,
29
+ allow_destroy: true
21
30
 
22
31
  has_paper_trail class_name: "Renalware::Transplants::Version",
23
32
  on: [:create, :update, :destroy]
@@ -27,7 +27,6 @@ module Renalware
27
27
  .merge(HD::Patient.with_profile)
28
28
  .merge(Renal::Patient.with_profile)
29
29
  .ransack(query).tap do |s|
30
-
31
30
  s.sorts = ["patient_family_name, patient_given_name"]
32
31
  end
33
32
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/transplants"
4
+
5
+ module Renalware
6
+ module Transplants
7
+ class RejectionEpisode < ApplicationRecord
8
+ include Accountable
9
+ has_paper_trail(
10
+ class_name: "Renalware::Transplants::Version",
11
+ on: [:create, :update, :destroy]
12
+ )
13
+ belongs_to :followup, class_name: "RecipientFollowup", touch: true
14
+ belongs_to :treatment, class_name: "RejectionTreatment"
15
+ validates :recorded_on, presence: true
16
+ validates :notes, presence: true
17
+ validates :followup, presence: true, if: proc { |re| re.followup_id.blank? }
18
+ validates :followup_id, presence: true, if: proc { |re| re.followup.blank? }
19
+ scope :ordered, -> { order(:recorded_on, :created_at) }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/transplants"
4
+
5
+ module Renalware
6
+ module Transplants
7
+ class RejectionTreatment < ApplicationRecord
8
+ validates :name, presence: true
9
+ scope :ordered, -> { order(:position) }
10
+
11
+ def to_s
12
+ name
13
+ end
14
+ end
15
+ end
16
+ end
@@ -46,10 +46,10 @@ module Renalware
46
46
  print_summary
47
47
  email_summary
48
48
  end
49
- rescue StandardError => exception
49
+ rescue StandardError => e
50
50
  # TODO: if fails before copying to outgoing then we should roll back BatchNumber
51
- Engine.exception_notifier.notify(exception)
52
- raise exception
51
+ Engine.exception_notifier.notify(e)
52
+ raise e
53
53
  end
54
54
 
55
55
  private
@@ -20,16 +20,18 @@ module Renalware
20
20
  class PatientsQuery
21
21
  def call(changed_since: nil)
22
22
  if changed_since.present?
23
- rpv_patients.where("updated_at > ?", changed_since)
23
+ sendable_patients.where("updated_at > ?", changed_since)
24
24
  else
25
- rpv_patients.where("(sent_to_ukrdc_at is null) or (updated_at > sent_to_ukrdc_at)")
25
+ sendable_patients.where("(sent_to_ukrdc_at is null) or (updated_at > sent_to_ukrdc_at)")
26
26
  end
27
27
  end
28
28
 
29
29
  private
30
30
 
31
- def rpv_patients
32
- Renalware::Patient.where(send_to_rpv: true)
31
+ def sendable_patients
32
+ Renalware::Patient.where(send_to_rpv: true).or(
33
+ Renalware::Patient.where(send_to_renalreg: true)
34
+ )
33
35
  end
34
36
  end
35
37
  end
@@ -15,11 +15,11 @@ module Renalware
15
15
  log = new(patient: patient, sent_at: Time.zone.now, request_uuid: request_uuid)
16
16
  yield log if block_given?
17
17
  log.save!
18
- rescue StandardError => error
19
- log.error << formatted_exception(error)
18
+ rescue StandardError => e
19
+ log.error << formatted_exception(e)
20
20
  log.status = :error
21
21
  log.save!
22
- raise error
22
+ raise e
23
23
  end
24
24
 
25
25
  def self.formatted_exception(error)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/transplants"
4
+
5
+ module Renalware
6
+ module Transplants
7
+ class RecipientFollowupPolicy < BasePolicy
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/transplants"
4
+
5
+ module Renalware
6
+ module Transplants
7
+ class RejectionEpisodePolicy < BasePolicy
8
+ def destroy?
9
+ return true unless record.persisted?
10
+ return true if user_is_devops? || user_is_super_admin?
11
+
12
+ false
13
+ end
14
+ end
15
+ end
16
+ end
@@ -100,7 +100,7 @@ module Renalware
100
100
  when ::Float then (post - pre).round(1)
101
101
  when ::Integer then (post - pre)
102
102
  end
103
- rescue StandardError => exception
103
+ rescue StandardError => e
104
104
  nil
105
105
  end
106
106
 
@@ -27,7 +27,6 @@ xml.Medications do
27
27
  prescription.dose_unit&.text,
28
28
  prescription.frequency].compact.join(" ")
29
29
 
30
-
31
30
  # rubocop:disable Style/RescueModifier
32
31
  # Only output DoseQuantity is it is an integer or decimal
33
32
  dose_amount_is_a_number = Float(prescription.dose_amount) rescue nil
@@ -3,7 +3,7 @@ ruby:
3
3
 
4
4
  .row.top
5
5
  .medium-6.columns
6
- = f.submit "Save", class: "button"
6
+ = f.submit "Save", class: "button save-button"
7
7
  span= " or "
8
8
  = link_to "cancel", back_path
9
9
 
@@ -56,15 +56,36 @@ ruby:
56
56
  = render_input fd, :acute_rejection_biopsy_proven
57
57
  = render_input fd, :primary_or_recurrent_renal_disease
58
58
 
59
+ / followup.rejection_episodes can be dynamically added using the helpers in the cooon gem
60
+ / We use accepts_nested.. on the server to rebuild the collection on save
61
+ article.rejection-episodes
62
+ header
63
+ h2 Transplant Rejection
64
+ = link_to_add_association "Add",
65
+ f,
66
+ :rejection_episodes,
67
+ class: "button",
68
+ data: { "association-insertion-node" => "#rejection-episodes",
69
+ "association-insertion-method" => "append" }
70
+ #rejection-episodes
71
+ / It is important we do not try and SQL-order the episodes here as that discards the
72
+ / unsaved ones that cocoon has kept around for us. So instead use #sort_by, allowing for
73
+ / a nil recorded_on date if that value in a newly added and unsaved episode has not yet been
74
+ / entered.
75
+ - episodes = f.object.rejection_episodes.sort_by{ |ep| ep.recorded_on || Time.zone.today }
76
+ = f.simple_fields_for :rejection_episodes, episodes do |episode|
77
+ = render "rejection_episode_fields", f: episode
78
+
59
79
  = render layout: "renalware/shared/fieldset",
60
80
  locals: { legend: "Admin", name: "admin" } do
61
81
  = f.input :notes,
62
82
  as: :text,
63
83
  input_html: { rows: 5 }
64
84
 
85
+
65
86
  .row
66
87
  .large-12.columns
67
- = f.submit "Save", class: "button"
88
+ = f.submit "Save", class: "button save-button"
68
89
 
69
90
  span= " or "
70
91
  = link_to "cancel", back_path
@@ -0,0 +1,13 @@
1
+ / Fields for cocoon gem
2
+ .rejection-episode.nested-fields(data={rejection_episode_id: f.object.id} )
3
+ - if policy(f.object).destroy?
4
+ = link_to_remove_association "Remove", f
5
+ = f.input :recorded_on, as: :date_picker, wrapper: :horizontal_datepicker
6
+ = f.association :treatment, wrapper: :horizontal_medium
7
+ = f.input :notes, as: :text, input_html: { rows: 3 }, wrapper: :horizontal_large
8
+ = f.input :updated_by_id, as: :hidden
9
+ = f.input :created_by_id, as: :hidden
10
+ = f.input :updated_at, as: :hidden
11
+ = f.input :created_at, as: :hidden
12
+ - if f.object.persisted?
13
+ .rejection-episode--creation= "Created by #{f.object.created_by} on #{l(f.object.created_at.to_date)}"
@@ -39,3 +39,10 @@
39
39
  = render "renalware/shared/attributes_group",
40
40
  legend: "Admin", destination: "admin",
41
41
  models: { recipient_followup => [:notes] }
42
+
43
+ .columns.small-12
44
+ article
45
+ header
46
+ h2 Transplant Rejection
47
+ = render "renalware/transplants/rejection_episodes/table",
48
+ episodes: recipient_followup.rejection_episodes.ordered.includes(:created_by)
@@ -1,4 +1,4 @@
1
- article
1
+ article.recipient-operations
2
2
  header
3
3
  h2 Recipient Operations
4
4
 
@@ -0,0 +1,15 @@
1
+ - return if episodes.blank?
2
+
3
+ table
4
+ thead
5
+ tr
6
+ th.col-width-date Recorded On
7
+ th.col-width-medium Recorded By
8
+ th.col-width-large Treatment
9
+ th Notes
10
+ - episodes.each do |episode|
11
+ tr
12
+ td= l(episode.recorded_on)
13
+ td.col-width-medium-with-ellipsis= episode.created_by
14
+ td= episode.treatment
15
+ td= episode.notes
@@ -0,0 +1,7 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ renalware/transplants/rejection_episode:
5
+ treatment: Treatment given
6
+ recorded_on: Recorded on
7
+ notes: Notes
@@ -0,0 +1,15 @@
1
+ class CreateTransplantRejectionEpisodes < ActiveRecord::Migration[5.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
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ class CreateTransplantRejectionTreatments < ActiveRecord::Migration[5.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
9
+
10
+ add_reference(
11
+ :transplant_rejection_episodes,
12
+ :treatment,
13
+ foreign_key: { to_table: :transplant_rejection_treatments },
14
+ index: true
15
+ )
16
+ end
17
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Transplant Donor Stage Positions" do
5
-
6
5
  names = [
7
6
  "Currently Active",
8
7
  "Active Workup but on Hold",
@@ -22,13 +21,12 @@ module Renalware
22
21
  end
23
22
 
24
23
  log "Adding Transplant Donor Stage Statuses" do
25
-
26
24
  names = [
27
25
  "Initial Contact",
28
26
  "Initial Meeting / Tests",
29
27
  "Extended Assessment",
30
28
  "Awaiting HTA",
31
- "Completed / Ready",
29
+ "Completed / Ready"
32
30
  ]
33
31
 
34
32
  names.each_with_index do |name, index|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Failure Causes" do
5
-
6
5
  file_path = File.join(File.dirname(__FILE__), "failure_cause_descriptions.csv")
7
6
 
8
7
  CSV.foreach(file_path, headers: true) do |row|
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  log "Adding Transplant Registration Statuses" do
5
-
6
5
  # HC on #1664: The only difficulty is for patients who receive a pre-emptive transplant so
7
6
  # their ESRF date is the date of their transplant. The RR list does not
8
7
  # accommodate that but I would put them as On Transplant List (3)
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Renalware
4
+ log "Adding Transplant Rejection Treatments" do
5
+ names = [
6
+ "None",
7
+ "Methylprednisolone",
8
+ "ATG",
9
+ "Methylprednisolone and ATG",
10
+ "PEX and ivImmunoglobulin",
11
+ "Change in oral immunosuppression"
12
+ ]
13
+
14
+ names.each_with_index do |name, index|
15
+ Transplants::RejectionTreatment.find_or_create_by(
16
+ name: name,
17
+ position: index
18
+ )
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./transplant_registration_statuses"
4
- require_relative "./transplant_failure_cause_descriptions"
5
- require_relative "./transplant_donor_stages"
3
+ require_relative "./registration_statuses"
4
+ require_relative "./failure_cause_descriptions"
5
+ require_relative "./donor_stages"
6
+ require_relative "./rejection_treatments"
@@ -12,7 +12,7 @@ module CoreExtensions
12
12
  # duration.inspect #=> "1 week, 0 days, and 0 hours"
13
13
  # duration.to_formatted_s #=> "1 week"
14
14
  #
15
- # rubocop:disable Style/Semicolon, Style/EachWithObject, Metrics/AbcSize
15
+ # rubocop:disable Style/Semicolon, Style/EachWithObject
16
16
  def to_formatted_s
17
17
  parts
18
18
  .reduce(::Hash.new(0)) { |h, (l, r)| h[l] += r; h }
@@ -22,7 +22,7 @@ module CoreExtensions
22
22
  module I18n
23
23
  module AlwaysCascade
24
24
  def translate(key, options = {})
25
- super(key, options.merge({ cascade: { offset: 2, skip_root: false } }))
25
+ super(key, options.merge(cascade: { offset: 2, skip_root: false }))
26
26
  end
27
27
  alias t translate
28
28
  end
@@ -80,7 +80,7 @@ module Document
80
80
  Date.new(*date_fields)
81
81
  else
82
82
  args = date_fields + time_fields
83
- Time.zone ? Time.zone.local(*args) : Time.new(*args)
83
+ Time.zone ? Time.zone.local(*args) : Time.zone.new(*args)
84
84
  end
85
85
  end
86
86
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.83"
4
+ VERSION = "2.0.84"
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :api_log, class: "Renalware::System::APILog" do
5
- identifier { "A1"}
5
+ identifier { "A1" }
6
6
 
7
7
  trait :done do
8
8
  status { Renalware::System::APILog::STATUS_DONE }
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :transplant_rejection_episode, class: Renalware::Transplants::RejectionEpisode do
5
+ accountable
6
+ recorded_on { "2019-01-01" }
7
+ notes { "xyz" }
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :transplant_rejection_treatment, class: Renalware::Transplants::RejectionTreatment do
5
+ name { "Treatment A" }
6
+ end
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.83
4
+ version: 2.0.84
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-14 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_type
@@ -310,14 +310,14 @@ dependencies:
310
310
  requirements:
311
311
  - - "~>"
312
312
  - !ruby/object:Gem::Version
313
- version: 0.3.7
313
+ version: 0.3.9
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: 0.3.7
320
+ version: 0.3.9
321
321
  - !ruby/object:Gem::Dependency
322
322
  name: httparty
323
323
  requirement: !ruby/object:Gem::Requirement
@@ -602,16 +602,16 @@ dependencies:
602
602
  name: rack-attack
603
603
  requirement: !ruby/object:Gem::Requirement
604
604
  requirements:
605
- - - "~>"
605
+ - - ">="
606
606
  - !ruby/object:Gem::Version
607
- version: '5.4'
607
+ version: '0'
608
608
  type: :runtime
609
609
  prerelease: false
610
610
  version_requirements: !ruby/object:Gem::Requirement
611
611
  requirements:
612
- - - "~>"
612
+ - - ">="
613
613
  - !ruby/object:Gem::Version
614
- version: '5.4'
614
+ version: '0'
615
615
  - !ruby/object:Gem::Dependency
616
616
  name: rails
617
617
  requirement: !ruby/object:Gem::Requirement
@@ -828,14 +828,14 @@ dependencies:
828
828
  requirements:
829
829
  - - "~>"
830
830
  - !ruby/object:Gem::Version
831
- version: 4.0.2
831
+ version: 4.1.0
832
832
  type: :runtime
833
833
  prerelease: false
834
834
  version_requirements: !ruby/object:Gem::Requirement
835
835
  requirements:
836
836
  - - "~>"
837
837
  - !ruby/object:Gem::Version
838
- version: 4.0.2
838
+ version: 4.1.0
839
839
  - !ruby/object:Gem::Dependency
840
840
  name: virtus
841
841
  requirement: !ruby/object:Gem::Requirement
@@ -854,30 +854,30 @@ dependencies:
854
854
  name: whenever
855
855
  requirement: !ruby/object:Gem::Requirement
856
856
  requirements:
857
- - - "~>"
857
+ - - ">="
858
858
  - !ruby/object:Gem::Version
859
- version: 0.10.0
859
+ version: '0'
860
860
  type: :runtime
861
861
  prerelease: false
862
862
  version_requirements: !ruby/object:Gem::Requirement
863
863
  requirements:
864
- - - "~>"
864
+ - - ">="
865
865
  - !ruby/object:Gem::Version
866
- version: 0.10.0
866
+ version: '0'
867
867
  - !ruby/object:Gem::Dependency
868
868
  name: wicked_pdf
869
869
  requirement: !ruby/object:Gem::Requirement
870
870
  requirements:
871
- - - "~>"
871
+ - - ">="
872
872
  - !ruby/object:Gem::Version
873
- version: 1.1.0
873
+ version: '0'
874
874
  type: :runtime
875
875
  prerelease: false
876
876
  version_requirements: !ruby/object:Gem::Requirement
877
877
  requirements:
878
- - - "~>"
878
+ - - ">="
879
879
  - !ruby/object:Gem::Version
880
- version: 1.1.0
880
+ version: '0'
881
881
  - !ruby/object:Gem::Dependency
882
882
  name: wisper
883
883
  requirement: !ruby/object:Gem::Requirement
@@ -1010,6 +1010,7 @@ files:
1010
1010
  - app/assets/javascripts/renalware/table.js
1011
1011
  - app/assets/javascripts/renalware/tabs.js
1012
1012
  - app/assets/javascripts/renalware/toggler.js
1013
+ - app/assets/javascripts/renalware/transplants.js
1013
1014
  - app/assets/stylesheets/renalware/application.scss
1014
1015
  - app/assets/stylesheets/renalware/base/_mixins.scss
1015
1016
  - app/assets/stylesheets/renalware/base/_variables.scss
@@ -1813,6 +1814,8 @@ files:
1813
1814
  - app/models/renalware/transplants/registration_status.rb
1814
1815
  - app/models/renalware/transplants/registration_status_description.rb
1815
1816
  - app/models/renalware/transplants/registrations/wait_list_query.rb
1817
+ - app/models/renalware/transplants/rejection_episode.rb
1818
+ - app/models/renalware/transplants/rejection_treatment.rb
1816
1819
  - app/models/renalware/transplants/version.rb
1817
1820
  - app/models/renalware/ukrdc.rb
1818
1821
  - app/models/renalware/ukrdc/batch_number.rb
@@ -1905,9 +1908,11 @@ files:
1905
1908
  - app/policies/renalware/system/message_policy.rb
1906
1909
  - app/policies/renalware/system/user_feedback_policy.rb
1907
1910
  - app/policies/renalware/transplants/donor_stage_policy.rb
1911
+ - app/policies/renalware/transplants/recipient_followup_policy.rb
1908
1912
  - app/policies/renalware/transplants/recipient_operation_policy.rb
1909
1913
  - app/policies/renalware/transplants/recipient_workup_policy.rb
1910
1914
  - app/policies/renalware/transplants/registration_policy.rb
1915
+ - app/policies/renalware/transplants/rejection_episode_policy.rb
1911
1916
  - app/policies/renalware/user_policy.rb
1912
1917
  - app/policies/renalware/virology/dashboard_policy.rb
1913
1918
  - app/policies/renalware/virology/profile_policy.rb
@@ -2836,6 +2841,7 @@ files:
2836
2841
  - app/views/renalware/transplants/recipient_dashboards/_page_actions.html.slim
2837
2842
  - app/views/renalware/transplants/recipient_dashboards/show.html.slim
2838
2843
  - app/views/renalware/transplants/recipient_followups/_form.html.slim
2844
+ - app/views/renalware/transplants/recipient_followups/_rejection_episode_fields.html.slim
2839
2845
  - app/views/renalware/transplants/recipient_followups/edit.html.slim
2840
2846
  - app/views/renalware/transplants/recipient_followups/new.html.slim
2841
2847
  - app/views/renalware/transplants/recipient_followups/show.html.slim
@@ -2863,6 +2869,7 @@ files:
2863
2869
  - app/views/renalware/transplants/registrations/_summary.html.slim
2864
2870
  - app/views/renalware/transplants/registrations/edit.html.slim
2865
2871
  - app/views/renalware/transplants/registrations/show.html.slim
2872
+ - app/views/renalware/transplants/rejection_episodes/_table.html.slim
2866
2873
  - app/views/renalware/transplants/wait_lists/_registration.html.slim
2867
2874
  - app/views/renalware/transplants/wait_lists/show.html.slim
2868
2875
  - app/views/renalware/ukrdc/summary_mailer/export_summary.html.slim
@@ -3003,6 +3010,7 @@ files:
3003
3010
  - config/locales/renalware/transplants/recipient_operation.yml
3004
3011
  - config/locales/renalware/transplants/recipient_workup.yml
3005
3012
  - config/locales/renalware/transplants/registration.yml
3013
+ - config/locales/renalware/transplants/rejection_episode.en.yml
3006
3014
  - config/locales/renalware/virology/virology.en.yml
3007
3015
  - config/locales/simple_form.en.yml
3008
3016
  - config/locales/validates_timeliness.en.yml
@@ -3493,6 +3501,8 @@ files:
3493
3501
  - db/migrate/20190603165812_drop_import_practices_csv_function.rb
3494
3502
  - db/migrate/20190607134717_add_ukrdc_modality_code_id_to_modality_descriptions.rb
3495
3503
  - db/migrate/20190611152859_add_fields_to_transplant_recipient_workup.rb
3504
+ - db/migrate/20190612124015_create_transplant_rejection_episodes.rb
3505
+ - db/migrate/20190617121528_create_transplant_rejection_treatments.rb
3496
3506
  - db/seeds.rb
3497
3507
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
3498
3508
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
@@ -3566,11 +3576,12 @@ files:
3566
3576
  - db/seeds/default/system/roles.rb
3567
3577
  - db/seeds/default/system/seeds.rb
3568
3578
  - db/seeds/default/system/users.rb
3579
+ - db/seeds/default/transplants/donor_stages.rb
3569
3580
  - db/seeds/default/transplants/failure_cause_descriptions.csv
3581
+ - db/seeds/default/transplants/failure_cause_descriptions.rb
3582
+ - db/seeds/default/transplants/registration_statuses.rb
3583
+ - db/seeds/default/transplants/rejection_treatments.rb
3570
3584
  - db/seeds/default/transplants/seeds.rb
3571
- - db/seeds/default/transplants/transplant_donor_stages.rb
3572
- - db/seeds/default/transplants/transplant_failure_cause_descriptions.rb
3573
- - db/seeds/default/transplants/transplant_registration_statuses.rb
3574
3585
  - db/seeds/default/ukrdc/modality_codes.csv
3575
3586
  - db/seeds/default/ukrdc/modality_codes.rb
3576
3587
  - db/seeds/default/ukrdc/seeds.rb
@@ -3817,6 +3828,8 @@ files:
3817
3828
  - spec/factories/transplants/registration_status_descriptions.rb
3818
3829
  - spec/factories/transplants/registration_statuses.rb
3819
3830
  - spec/factories/transplants/registrations.rb
3831
+ - spec/factories/transplants/rejection_episodes.rb
3832
+ - spec/factories/transplants/rejection_treatments.rb
3820
3833
  - spec/factories/ukrdc/modality_codes.rb
3821
3834
  - spec/factories/virology/patients.rb
3822
3835
  - spec/factories/virology/vaccinations.rb