Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
b9ea64f
Refactor User#find_or_create_from_cis2_oidc
thomasleese Jun 19, 2025
aa0de6a
Attach users to organisations when signing in
thomasleese Jun 19, 2025
0993f5b
Add healthcase assistant fallback role
thomasleese Jun 19, 2025
2fc92cc
Rename unprocessable_entity
thomasleese Aug 5, 2025
80f6086
Merge pull request #4179 from nhsuk/rename-unprocessable-entity
thomasleese Aug 5, 2025
621ed33
Merge pull request #3788 from nhsuk/healthcare-assistant-fallback-role
thomasleese Aug 5, 2025
d58a12b
Merge pull request #3779 from nhsuk/add-user-to-organisation-on-sign-in
thomasleese Aug 5, 2025
5e8ad0b
Bump aws-sdk-accessanalyzer from 1.75.0 to 1.76.0
dependabot[bot] Aug 5, 2025
092e149
Merge pull request #4180 from nhsuk/dependabot/bundler/next/aws-sdk-a…
thomasleese Aug 5, 2025
b2434e4
Remove unused organisation personalisation
thomasleese Jul 23, 2025
f839bec
Remove ODS code from generic clinics
thomasleese Jul 23, 2025
b3743e1
Create Organisation
thomasleese Jul 23, 2025
ccb4338
Update references to team ODS code
thomasleese Jul 23, 2025
4876c2a
Merge pull request #4063 from nhsuk/create-organisation-for-ods-code
thomasleese Aug 5, 2025
0558a84
Create ArchiveReason model
thomasleese Jul 30, 2025
c37b603
Add archived and not_archived scopes
thomasleese Jul 30, 2025
fefff0c
Include archived patients in policy
thomasleese Jul 30, 2025
fce743d
Add archive entries to activity log
thomasleese Jul 30, 2025
8561dcb
Add archived? and not_archived? methods
thomasleese Jul 30, 2025
e31e3eb
Archive patients on receipt of date of death
thomasleese Jul 30, 2025
28df465
Handle merging archived patients
thomasleese Jul 30, 2025
8922a54
Update "show only" filter content
thomasleese Aug 3, 2025
b3a97c7
Add ability to see archived patients
thomasleese Jul 30, 2025
3cbc556
Remove "Remove from cohort" functionality
thomasleese Jul 30, 2025
a5dd82c
Add PatientMergeForm
thomasleese Jul 30, 2025
8be1047
Add PatientArchiveForm
thomasleese Jul 30, 2025
788eeff
Add archive feature
thomasleese Aug 3, 2025
b35cc28
Archive and unarchive patients in school moves
thomasleese Aug 3, 2025
5c3e0bf
Add archive_deceased_patients task
thomasleese Aug 3, 2025
68feb5b
Add archive_moved_out_of_cohort_patients task
thomasleese Aug 4, 2025
5acc346
Merge pull request #4120 from nhsuk/archive-patients
thomasleese Aug 5, 2025
6c0cca3
Don't add deceased patients to sessions
thomasleese Aug 5, 2025
9c20da5
Redirect to patient if no session exists
thomasleese Aug 5, 2025
da33f46
Show notify_parents_on_vaccination on confirmation
thomasleese Aug 4, 2025
bfa9329
Fix incorrect reference to organisations
thomasleese Aug 5, 2025
300e070
Fix patient show page layout
thomasleese Aug 5, 2025
ed5c698
Merge pull request #4184 from nhsuk/fix-rename-organisation-to-team
thomasleese Aug 5, 2025
3945008
Merge pull request #4185 from nhsuk/fix-patient-show-layout
thomasleese Aug 5, 2025
b665393
Merge pull request #4183 from nhsuk/redirect-no-session
thomasleese Aug 5, 2025
3ef6832
Merge pull request #4182 from nhsuk/deceased-no-sessions
thomasleese Aug 5, 2025
e8b8f3b
Merge pull request #4165 from nhsuk/show-notify-parents-on-vaccination
thomasleese Aug 5, 2025
9e433e0
Flatten Location::ProgrammeYearGroup model
thomasleese Aug 5, 2025
437c0ee
Add ProgrammeYearGroups
thomasleese Aug 5, 2025
42ba0fa
Hide school and year group for some patients
thomasleese Aug 5, 2025
7046682
Merge pull request #4175 from nhsuk/hide-year-group-aged-out
thomasleese Aug 5, 2025
8721ddb
build(deps-dev): bump aws-sdk-s3 from 1.196.0 to 1.196.1
dependabot[bot] Aug 5, 2025
eb02b37
build(deps-dev): bump annotaterb from 4.17.0 to 4.18.0
dependabot[bot] Aug 5, 2025
b043d55
build(deps): bump thruster from 0.1.14 to 0.1.15
dependabot[bot] Aug 5, 2025
2856308
build(deps-dev): bump aws-sdk-rds from 1.286.0 to 1.287.0
dependabot[bot] Aug 5, 2025
f031584
Merge pull request #4188 from nhsuk/dependabot/bundler/next/aws-sdk-s…
thomasleese Aug 6, 2025
0fb05e3
Merge pull request #4189 from nhsuk/dependabot/bundler/next/annotater…
thomasleese Aug 6, 2025
629d61e
Merge pull request #4190 from nhsuk/dependabot/bundler/next/thruster-…
thomasleese Aug 6, 2025
7ce488d
Merge pull request #4191 from nhsuk/dependabot/bundler/next/aws-sdk-r…
thomasleese Aug 6, 2025
09b6747
Hide archived patients by default
thomasleese Aug 6, 2025
e43e5f3
Show archived tag on patient page
thomasleese Aug 6, 2025
b9e3c63
Update archive flash message
thomasleese Aug 6, 2025
4551331
Merge pull request #4193 from nhsuk/archive-tweaks
thomasleese Aug 6, 2025
65abb26
Handle discarded vaccination records on merge
thomasleese Aug 6, 2025
cd8fa05
Log requests to immunisations API
misaka Aug 6, 2025
da980bf
Merge pull request #4195 from nhsuk/imms-api-logging
misaka Aug 6, 2025
d0e337a
Merge pull request #4194 from nhsuk/fix-patient-merge-vaccination-rec…
thomasleese Aug 6, 2025
d4efd5c
Show year group according to pending academic year
thomasleese Aug 6, 2025
3249f60
Merge pull request #4196 from nhsuk/show-year-group-according-to-pending
thomasleese Aug 6, 2025
ac2f61a
Ensure patients are unarchived
thomasleese Aug 6, 2025
66fc0d2
Merge pull request #4197 from nhsuk/unarchive-even-if-patient-same
thomasleese Aug 6, 2025
794e405
Fix archive_moved_out_of_cohort_patients
thomasleese Aug 6, 2025
b2b53c6
Merge pull request #4200 from nhsuk/fix-archive-moved-out-of-cohort
thomasleese Aug 6, 2025
f43b19f
Fix important notice ordering bug
alistair-white-horne-tng Jul 30, 2025
1472652
Add important notice for `gillick_no_notify` patients
alistair-white-horne-tng Jul 30, 2025
32b8771
Add not_appear_in_programmes scope
thomasleese Aug 6, 2025
ea7e1e1
Hide patients aged out of all programmes
thomasleese Aug 6, 2025
9037de1
Add filter to view children who have aged out
thomasleese Aug 6, 2025
80aa5eb
Bump good_job from 4.11.1 to 4.11.2
dependabot[bot] Aug 6, 2025
6673dce
Bump aws-sdk-ec2 from 1.545.0 to 1.546.0
dependabot[bot] Aug 6, 2025
20ede61
Merge pull request #4203 from nhsuk/dependabot/bundler/next/good_job-…
thomasleese Aug 7, 2025
fb72160
Merge pull request #4204 from nhsuk/dependabot/bundler/next/aws-sdk-e…
thomasleese Aug 7, 2025
2636e07
Refactor notice text into helper function
alistair-white-horne-tng Aug 5, 2025
49a76cf
Improve performance
alistair-white-horne-tng Aug 6, 2025
3d2578f
Force exclamation icon to stay the same size
alistair-white-horne-tng Aug 5, 2025
1464136
Merge pull request #4176 from nhsuk/show-gillick-no-notify-patients-i…
alistair-white-horne-tng Aug 7, 2025
30b3878
Merge pull request #4198 from nhsuk/aged-out-filter
thomasleese Aug 7, 2025
f84e966
Update cohort import filename
misaka Aug 6, 2025
57ede3c
Add ods code option for cli generate cohort-import
misaka Aug 6, 2025
afb2368
Add spec for cli generate cohort-import
misaka Aug 6, 2025
8eabac5
Merge pull request #4202 from nhsuk/cli-generate-cohort-import-updates
misaka Aug 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
aes_key_wrap (1.1.0)
amazing_print (1.8.1)
annotaterb (4.17.0)
annotaterb (4.18.0)
activerecord (>= 6.0.0)
activesupport (>= 6.0.0)
array_enum (1.6.0)
Expand All @@ -113,8 +113,8 @@ GEM
ast (2.4.3)
attr_required (1.0.2)
aws-eventstream (1.4.0)
aws-partitions (1.1141.0)
aws-sdk-accessanalyzer (1.75.0)
aws-partitions (1.1143.0)
aws-sdk-accessanalyzer (1.76.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-core (3.229.0)
Expand All @@ -125,7 +125,7 @@ GEM
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-ec2 (1.545.0)
aws-sdk-ec2 (1.546.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-ecr (1.108.0)
Expand All @@ -137,10 +137,10 @@ GEM
aws-sdk-kms (1.110.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-rds (1.286.0)
aws-sdk-rds (1.287.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.196.0)
aws-sdk-s3 (1.196.1)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -270,7 +270,7 @@ GEM
raabro (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
good_job (4.11.1)
good_job (4.11.2)
activejob (>= 6.1.0)
activerecord (>= 6.1.0)
concurrent-ruby (>= 1.3.1)
Expand Down Expand Up @@ -664,8 +664,8 @@ GEM
syntax_tree (>= 2.0.1)
temple (0.10.0)
thor (1.4.0)
thruster (0.1.14-arm64-darwin)
thruster (0.1.14-x86_64-linux)
thruster (0.1.15-arm64-darwin)
thruster (0.1.15-x86_64-linux)
tilt (2.6.0)
timeout (0.4.3)
turbo-rails (2.0.16)
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/components/_status.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
gap: nhsuk-spacing(1);

.nhsuk-icon {
flex-shrink: 0;
height: 1.5em;
margin-left: nhsuk-spacing(-1);
margin-top: nhsuk-spacing(-1);
width: 1.5em;
}

&--aqua-green {
Expand Down
21 changes: 18 additions & 3 deletions app/components/app_activity_log_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppActivityLogComponent < ViewComponent::Base
<% end %>
ERB

def initialize(patient: nil, patient_session: nil)
def initialize(team:, patient: nil, patient_session: nil)
super

if patient.nil? && patient_session.nil?
Expand Down Expand Up @@ -63,14 +63,17 @@ def initialize(patient: nil, patient_session: nil)
)

@patient_specific_directions = @patient.patient_specific_directions

@archive_reasons = @patient.archive_reasons.where(team:)
end

attr_reader :patient,
:patient_sessions,
attr_reader :archive_reasons,
:consents,
:gillick_assessments,
:notes,
:notify_log_entries,
:patient,
:patient_sessions,
:pre_screenings,
:session_attendances,
:triages,
Expand All @@ -83,6 +86,7 @@ def events_by_day

def all_events
[
archive_events,
attendance_events,
consent_events,
gillick_assessment_events,
Expand All @@ -96,6 +100,17 @@ def all_events
].flatten
end

def archive_events
archive_reasons.flat_map do |archive_reason|
{
title: "Record archived: #{archive_reason.human_enum_name(:type)}",
body: archive_reason.other_details,
at: archive_reason.created_at,
by: archive_reason.created_by
}
end
end

def consent_events
consents.flat_map do |consent|
events = []
Expand Down
52 changes: 44 additions & 8 deletions app/components/app_child_summary_component.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# frozen_string_literal: true

class AppChildSummaryComponent < ViewComponent::Base
def initialize(child, show_parents: false, change_links: {}, remove_links: {})
def initialize(
child,
current_team: nil,
show_parents: false,
show_school_and_year_group: true,
change_links: {},
remove_links: {}
)
super

@child = child
@current_team = current_team
@show_parents = show_parents
@show_school_and_year_group = show_school_and_year_group
@change_links = change_links
@remove_links = remove_links
end
Expand All @@ -25,6 +34,14 @@ def call
)
end
end

if archive_reason
summary_list.with_row do |row|
row.with_key { "Archive reason" }
row.with_value { format_archive_reason }
end
end

summary_list.with_row do |row|
row.with_key { "Full name" }
row.with_value { format_full_name }
Expand Down Expand Up @@ -57,14 +74,16 @@ def call
row.with_value { format_address }
end
end
summary_list.with_row do |row|
row.with_key { "School" }
row.with_value { format_school }
end
if @child.respond_to?(:year_group)
if @show_school_and_year_group
summary_list.with_row do |row|
row.with_key { "Year group" }
row.with_value { format_year_group }
row.with_key { "School" }
row.with_value { format_school }
end
if @child.respond_to?(:year_group)
summary_list.with_row do |row|
row.with_key { "Year group" }
row.with_value { format_year_group }
end
end
end
if (gp_practice = @child.try(:gp_practice))
Expand Down Expand Up @@ -112,10 +131,27 @@ def call

def academic_year = AcademicYear.current

def archive_reason
@archive_reason ||=
if @current_team
ArchiveReason.find_by(team: @current_team, patient: @child)
end
end

def format_nhs_number
highlight_if(helpers.patient_nhs_number(@child), @child.nhs_number_changed?)
end

def format_archive_reason
type_string = archive_reason.human_enum_name(:type)

if archive_reason.other?
"#{type_string}: #{archive_reason.other_details}"
else
type_string
end
end

def format_full_name
highlight_if(
@child.full_name,
Expand Down
18 changes: 17 additions & 1 deletion app/components/app_consent_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ def call
end
end

unless consent.notify_parents_on_vaccination.nil?
summary_list.with_row do |row|
row.with_key { "Confirmation of vaccination sent to parent?" }
row.with_value do
consent.notify_parents_on_vaccination ? "Yes" : "No"
end
if (href = change_links[:notify_parents_on_vaccination])
row.with_action(
text: "Change",
visually_hidden_text: "decision",
href:
)
end
end
end

if consent.reason_for_refusal.present?
summary_list.with_row do |row|
row.with_key { "Reason for refusal" }
Expand All @@ -63,7 +79,7 @@ def call

unless consent.notify_parent_on_refusal.nil?
summary_list.with_row do |row|
row.with_key { "Confirmation of decision sent to parent" }
row.with_key { "Confirmation of decision sent to parent?" }
row.with_value { consent.notify_parent_on_refusal ? "Yes" : "No" }
end
end
Expand Down
54 changes: 19 additions & 35 deletions app/components/app_notices_table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,39 @@ class AppNoticesTableComponent < ViewComponent::Base
def initialize(
deceased_patients:,
invalidated_patients:,
restricted_patients:
restricted_patients:,
has_vaccination_records_dont_notify_parents_patients:
)
super

@deceased_patients = deceased_patients
@invalidated_patients = invalidated_patients
@restricted_patients = restricted_patients
@has_vaccination_records_dont_notify_parents_patients =
has_vaccination_records_dont_notify_parents_patients
end

def render?
@deceased_patients.present? || @invalidated_patients.present? ||
@restricted_patients.present?
@restricted_patients.present? ||
@has_vaccination_records_dont_notify_parents_patients.present?
end

private

def notices
(deceased_notices + invalidated_notices + restricted_notices)
.sort_by { _1[:date] }
.reverse
end

def deceased_notices
@deceased_patients.map do |patient|
{
patient:,
date_time: patient.date_of_death_recorded_at,
message: "Record updated with child’s date of death"
}
end
end

def invalidated_notices
@invalidated_patients.map do |patient|
{
patient:,
date_time: patient.invalidated_at,
message: "Record flagged as invalid"
}
end
end

def restricted_notices
@restricted_patients.map do |patient|
{
patient:,
date_time: patient.restricted_at,
message: "Record flagged as sensitive"
}
end
all_patients =
(
@deceased_patients + @invalidated_patients + @restricted_patients +
@has_vaccination_records_dont_notify_parents_patients
).uniq

notices =
all_patients.flat_map do |patient|
helpers
.patient_important_notices(patient)
.map { |notification| notification.merge(patient:) }
end
notices.sort_by { it[:date_time] }.reverse
end
end
46 changes: 26 additions & 20 deletions app/components/app_patient_card_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,47 @@ class AppPatientCardComponent < ViewComponent::Base
erb_template <<-ERB
<%= render AppCardComponent.new(heading_level:, section: true) do |card| %>
<% card.with_heading { "Child’s details" } %>

<% if patient.date_of_death.present? %>
<%= render AppStatusComponent.new(
text: "Record updated with child’s date of death"
) %>
<% end %>

<% if patient.invalidated? %>
<%= render AppStatusComponent.new(
text: "Record flagged as invalid"
) %>

<% helpers.patient_important_notices(patient).each do |notification| %>
<%= render AppStatusComponent.new(text: notification[:message]) %>
<% end %>

<% if patient.restricted? %>
<%= render AppStatusComponent.new(
text: "Record flagged as sensitive"
) %>
<% end %>

<%= render AppChildSummaryComponent.new(patient, show_parents: true, change_links:, remove_links:) %>
<%= render AppChildSummaryComponent.new(
patient,
current_team:,
show_parents: true,
show_school_and_year_group:,
change_links:,
remove_links:
) %>

<%= content %>
<% end %>
ERB

def initialize(patient, change_links: {}, remove_links: {}, heading_level: 3)
def initialize(
patient,
current_team:,
change_links: {},
remove_links: {},
heading_level: 3
)
super

@patient = patient
@current_team = current_team
@change_links = change_links
@remove_links = remove_links
@heading_level = heading_level
end

private

attr_reader :patient, :change_links, :remove_links, :heading_level
attr_reader :patient,
:current_team,
:change_links,
:remove_links,
:heading_level

def show_school_and_year_group = patient.show_year_group?(team: current_team)
end
Loading