From c83b5dd5ddb561e010ef6d7b0ade8801aa47c52a Mon Sep 17 00:00:00 2001 From: Jake Benilov Date: Wed, 6 Nov 2024 23:51:14 +0000 Subject: [PATCH] Remove the unable_to_vaccinate_not_gillick_competent state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Gillick assessment must be passed in order to record self consent, but it in itself shouldn't affect the patient's state – instead, the presence (or absence) of self-consent should. So the logic that a failed Gillick assessment automatically leads to the child not getting vaccinated isn't quite right --- .../concerns/patient_tabs_concern.rb | 2 -- .../concerns/patient_session_state_concern.rb | 7 ------ app/models/patient_session.rb | 2 +- app/models/patient_session_stats.rb | 3 +-- .../locales/patient_session_statuses.en.yml | 5 ---- .../concerns/patient_tabs_concern_spec.rb | 14 +---------- spec/factories/patient_sessions.rb | 25 ------------------- ...self_consent_not_gillick_competent_spec.rb | 6 +++++ .../patient_session_state_concern_spec.rb | 5 ---- 9 files changed, 9 insertions(+), 60 deletions(-) diff --git a/app/controllers/concerns/patient_tabs_concern.rb b/app/controllers/concerns/patient_tabs_concern.rb index bf551d62db..a117ed2a00 100644 --- a/app/controllers/concerns/patient_tabs_concern.rb +++ b/app/controllers/concerns/patient_tabs_concern.rb @@ -16,7 +16,6 @@ module PatientTabsConcern consent_given_triage_not_needed vaccinated unable_to_vaccinate - unable_to_vaccinate_not_gillick_competent ] }, vaccinations: { @@ -28,7 +27,6 @@ module PatientTabsConcern delay_vaccination triaged_do_not_vaccinate unable_to_vaccinate - unable_to_vaccinate_not_gillick_competent ] } }.with_indifferent_access.freeze diff --git a/app/models/concerns/patient_session_state_concern.rb b/app/models/concerns/patient_session_state_concern.rb index 51cfb80667..b7e438ea96 100644 --- a/app/models/concerns/patient_session_state_concern.rb +++ b/app/models/concerns/patient_session_state_concern.rb @@ -10,8 +10,6 @@ def state "vaccinated" elsif triage_delay_vaccination? || vaccination_can_be_delayed? "delay_vaccination" - elsif not_gillick_competent? - "unable_to_vaccinate_not_gillick_competent" elsif vaccination_not_administered? "unable_to_vaccinate" elsif triage_keep_in_triage? @@ -43,7 +41,6 @@ def state triaged_do_not_vaccinate triaged_kept_in_triage unable_to_vaccinate - unable_to_vaccinate_not_gillick_competent delay_vaccination vaccinated ].each { |state| define_method("#{state}?") { self.state == state } } @@ -103,10 +100,6 @@ def vaccination_not_administered? vaccination_records.any?(&:not_administered?) end - def not_gillick_competent? - latest_gillick_assessment&.gillick_competent == false - end - def vaccination_can_be_delayed? latest_vaccination_record&.not_administered? && latest_vaccination_record&.retryable_reason? diff --git a/app/models/patient_session.rb b/app/models/patient_session.rb index 4b009e5bee..9ec09c592e 100644 --- a/app/models/patient_session.rb +++ b/app/models/patient_session.rb @@ -118,7 +118,7 @@ def gillick_competent? end def able_to_vaccinate? - !unable_to_vaccinate? && !unable_to_vaccinate_not_gillick_competent? + !unable_to_vaccinate? end def safe_to_destroy? diff --git a/app/models/patient_session_stats.rb b/app/models/patient_session_stats.rb index 111994aa7f..4454b85182 100644 --- a/app/models/patient_session_stats.rb +++ b/app/models/patient_session_stats.rb @@ -55,8 +55,7 @@ def include_in_statistics?(patient_session, key) patient_session.delay_vaccination? || patient_session.consent_refused? || patient_session.consent_conflicts? || patient_session.triaged_do_not_vaccinate? || - patient_session.unable_to_vaccinate? || - patient_session.unable_to_vaccinate_not_gillick_competent? + patient_session.unable_to_vaccinate? end end end diff --git a/config/locales/patient_session_statuses.en.yml b/config/locales/patient_session_statuses.en.yml index 6da1b98855..efc9da9578 100644 --- a/config/locales/patient_session_statuses.en.yml +++ b/config/locales/patient_session_statuses.en.yml @@ -59,11 +59,6 @@ en: gave_consent: "Their %{who_responded} gave consent" triaged_do_not_vaccinate: "Do not vaccinate in programme" unable_to_vaccinate: "Refused vaccine" - unable_to_vaccinate_not_gillick_competent: - colour: red - text: Not vaccinated - banner_title: Not vaccinated - banner_explanation: No-one responded to our requests for consent. When assessed, the child was not Gillick competent. vaccinated: colour: green text: Vaccinated diff --git a/spec/controllers/concerns/patient_tabs_concern_spec.rb b/spec/controllers/concerns/patient_tabs_concern_spec.rb index 7e95558b7d..35f366e493 100644 --- a/spec/controllers/concerns/patient_tabs_concern_spec.rb +++ b/spec/controllers/concerns/patient_tabs_concern_spec.rb @@ -41,14 +41,6 @@ let(:unable_to_vaccinate) do create(:patient_session, :unable_to_vaccinate, programme:, session:) end - let(:unable_to_vaccinate_not_gillick_competent) do - create( - :patient_session, - :unable_to_vaccinate_not_gillick_competent, - programme:, - session: - ) - end let(:vaccinated) do create(:patient_session, :vaccinated, programme:, session:) end @@ -65,7 +57,6 @@ triaged_kept_in_triage, triaged_ready_to_vaccinate, unable_to_vaccinate, - unable_to_vaccinate_not_gillick_competent, vaccinated ] end @@ -88,7 +79,6 @@ triaged_kept_in_triage, triaged_ready_to_vaccinate, unable_to_vaccinate, - unable_to_vaccinate_not_gillick_competent, vaccinated ], consent_refused: [consent_refused], @@ -139,7 +129,6 @@ consent_given_triage_not_needed, consent_refused, unable_to_vaccinate, - unable_to_vaccinate_not_gillick_competent, vaccinated ] }.with_indifferent_access @@ -167,8 +156,7 @@ consent_refused, delay_vaccination, triaged_do_not_vaccinate, - unable_to_vaccinate, - unable_to_vaccinate_not_gillick_competent + unable_to_vaccinate ] }.with_indifferent_access ) diff --git a/spec/factories/patient_sessions.rb b/spec/factories/patient_sessions.rb index 38d1e30e5f..9feb14d7b1 100644 --- a/spec/factories/patient_sessions.rb +++ b/spec/factories/patient_sessions.rb @@ -182,31 +182,6 @@ end end - trait :unable_to_vaccinate_not_gillick_competent do - patient do - association :patient, - :consent_given_triage_needed, - :triage_ready_to_vaccinate, - performed_by: user, - programme:, - organisation:, - school: session.location - end - - after(:create) do |patient_session, evaluator| - create(:gillick_assessment, :not_competent, patient_session:) - - create( - :vaccination_record, - :not_administered, - patient_session:, - programme: evaluator.programme, - performed_by: evaluator.user, - reason: :already_had - ) - end - end - trait :vaccinated do patient do association :patient, diff --git a/spec/features/self_consent_not_gillick_competent_spec.rb b/spec/features/self_consent_not_gillick_competent_spec.rb index 1597629e56..b102d7f16b 100644 --- a/spec/features/self_consent_not_gillick_competent_spec.rb +++ b/spec/features/self_consent_not_gillick_competent_spec.rb @@ -15,6 +15,7 @@ when_the_nurse_assesses_the_child_as_not_being_gillick_competent then_the_child_cannot_give_their_own_consent + and_the_childs_status_reflects_that_there_is_no_consent end def given_an_hpv_programme_is_underway @@ -89,5 +90,10 @@ def then_the_child_cannot_give_their_own_consent expect(page).not_to have_content( "Do they agree to them having the HPV vaccination?" ) + click_on "Back" + end + + def and_the_childs_status_reflects_that_there_is_no_consent + expect(page).to have_content("No response") end end diff --git a/spec/models/concerns/patient_session_state_concern_spec.rb b/spec/models/concerns/patient_session_state_concern_spec.rb index 3c7457e901..2aa1a19fce 100644 --- a/spec/models/concerns/patient_session_state_concern_spec.rb +++ b/spec/models/concerns/patient_session_state_concern_spec.rb @@ -25,7 +25,6 @@ consent_refused?: false, consent_conflicts?: false, no_consent?: false, - not_gillick_competent?: false, triage_needed?: false, triage_not_needed?: false, triage_ready_to_vaccinate?: false, @@ -66,10 +65,6 @@ state: :consent_conflicts, conditions: [:consent_conflicts] - it_behaves_like "it supports the state", - state: :unable_to_vaccinate_not_gillick_competent, - conditions: [:not_gillick_competent] - it_behaves_like "it supports the state", state: :triaged_ready_to_vaccinate, conditions: [:triage_ready_to_vaccinate]