Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b7fee69
Rename sessions_for_current_academic_year
thomasleese Jul 22, 2025
d96edb9
Avoid for_current_academic_year in immunisation import
thomasleese Jul 31, 2025
38fa4d4
Remove for_current_academic_year scope
thomasleese Jul 31, 2025
8f1815b
Rename notify_parents column
thomasleese Aug 1, 2025
8ed8080
Add option to not send consent refusal to parents
thomasleese Jul 29, 2025
4f87a86
Add notify parent of decision question to consent summary
murugapl Aug 1, 2025
39407e1
Show import issues count on header item
thomasleese Jul 31, 2025
11af955
Simplify logic for next immunisations API action
thomasleese Aug 1, 2025
7335855
Add reload_steps method
thomasleese Aug 1, 2025
a84f109
Set @wizard_translations in reload_steps
thomasleese Aug 1, 2025
cbb27f2
Replace DraftClassImport with DraftImport
thomasleese Aug 1, 2025
e152269
Use patient_id when staging vaccination record changes
thomasleese Aug 1, 2025
1256e0e
Merge pull request #4149 from nhsuk/import-patient-id-duplicate
thomasleese Aug 4, 2025
c01d802
Merge pull request #4147 from nhsuk/refactor-draft-import
thomasleese Aug 4, 2025
1596092
Merge pull request #4031 from nhsuk/remove-for-current-academic-year
thomasleese Aug 4, 2025
7be3a2f
Merge pull request #4136 from nhsuk/import-issues-count
thomasleese Aug 4, 2025
6610d80
Merge pull request #4144 from nhsuk/simplify-imms-logic
thomasleese Aug 4, 2025
781cfaa
Merge pull request #4102 from nhsuk/ask-send-confirmation-to-parents
thomasleese Aug 4, 2025
45346cd
Rename Organisation to Team
thomasleese Jul 22, 2025
ac98192
Merge pull request #4038 from nhsuk/rename-organisation
thomasleese Aug 4, 2025
59fe13b
Put vaccination sync status behind feature flag
alistair-white-horne-tng Aug 4, 2025
d661ce4
Allow protocol to be nil
thomasleese Jul 28, 2025
dcdd0c6
Record already had vaccinations from consent response
thomasleese Jul 28, 2025
ba9abf2
Merge pull request #4094 from nhsuk/mark-already-vaccinated-from-cons…
thomasleese Aug 4, 2025
5adb58a
Add PatientsAgedOutOfSchoolJob
thomasleese Jul 23, 2025
abba712
Add PatientsAgedOutOfSchoolJob to schedule
thomasleese Jul 23, 2025
c9ce5b4
Fix "an team" typos
thomasleese Aug 4, 2025
e05edb2
Merge pull request #4054 from nhsuk/move-aged-out-patients-to-unknown…
thomasleese Aug 4, 2025
45654c3
Merge pull request #4162 from nhsuk/an-team
thomasleese Aug 4, 2025
20ad355
Merge pull request #4161 from nhsuk/api-status-feature-flag
alistair-white-horne-tng Aug 4, 2025
f9ffa4b
Stop trying to be clever with NHS numbers
MartinVanIJcken Aug 4, 2025
f64fa1e
Merge pull request #3705 from nhsuk/remove-zwj-from-nhs-number
MartinVanIJcken Aug 4, 2025
713f3cf
test: Test academic year filtering of consent and triage status
MartinVanIJcken Jul 23, 2025
1c018b3
feat: Add academic_year column to consent, triage, and PSD
MartinVanIJcken Aug 4, 2025
4ca7dc9
fix: Use academic year column for scopes on consent, triage, and PSD
MartinVanIJcken Jul 23, 2025
70371aa
feat: filter consents by academic year
MartinVanIJcken Jul 21, 2025
d41b8df
feat: filter triages by academic year
MartinVanIJcken Aug 4, 2025
e266a5c
test: test consent, triage, and PSD filters
MartinVanIJcken Jul 21, 2025
41d57e2
feat: add expiration of consent, triage, and PSD to activity tab
MartinVanIJcken Jul 24, 2025
f05783f
test: test the new activity log items
MartinVanIJcken Jul 24, 2025
328b0b2
refactor: put academic year behavior into academic year module
MartinVanIJcken Aug 4, 2025
21b5fec
test: test academic year properties of consent, triage, and PSD
MartinVanIJcken Jul 24, 2025
572d7c6
feat: Add academic_year column to consent form
MartinVanIJcken Aug 4, 2025
af8c08e
fix: determine academic year through session where possible
MartinVanIJcken Aug 4, 2025
1171958
refactor: use where rather than scope for academic year when possible
MartinVanIJcken Aug 4, 2025
4b53c4f
refactor: use where rather than scope for academic year when possible
MartinVanIJcken Aug 4, 2025
2e3f81b
refactor: inline belongs to academic_year
MartinVanIJcken Aug 4, 2025
e8d252c
Merge pull request #4053 from nhsuk/MAV-1514-rebased-on-PR-3996
thomasleese Aug 4, 2025
830467e
Fix session cohort stats
thomasleese Aug 4, 2025
18620cf
Revert "Delay preparation period in QA"
thomasleese Jul 31, 2025
e6ef6eb
Merge pull request #4164 from nhsuk/fix-cohort-stats
thomasleese Aug 4, 2025
e379b13
Bump aws-sdk-rds from 1.285.0 to 1.286.0
dependabot[bot] Aug 5, 2025
57c445d
Bump pg from 1.6.0 to 1.6.1
dependabot[bot] Aug 5, 2025
46c43bc
Bump aws-sdk-iam from 1.126.0 to 1.127.0
dependabot[bot] Aug 5, 2025
fa56916
Merge pull request #4166 from nhsuk/dependabot/bundler/next/aws-sdk-r…
thomasleese Aug 5, 2025
05e9b00
Bump aws-sdk-s3 from 1.195.0 to 1.196.0
dependabot[bot] Aug 5, 2025
72ffc8c
Merge pull request #4168 from nhsuk/dependabot/bundler/next/pg-1.6.1
thomasleese Aug 5, 2025
95b0032
Merge pull request #4169 from nhsuk/dependabot/bundler/next/aws-sdk-i…
thomasleese Aug 5, 2025
8ca0c57
Merge pull request #4167 from nhsuk/dependabot/bundler/next/aws-sdk-s…
thomasleese Aug 5, 2025
b6c904c
Add `notify_parents?` to `vaccination_record.rb`
alistair-white-horne-tng Jul 31, 2025
7e94f7c
Bump aws-sdk-ecr from 1.107.0 to 1.108.0
dependabot[bot] Aug 5, 2025
0667ea3
Merge pull request #4170 from nhsuk/dependabot/bundler/next/aws-sdk-e…
thomasleese Aug 5, 2025
bc51dae
Add DB column `notify_parents` to `VaccinationRecord`
alistair-white-horne-tng Jul 31, 2025
cf7dc83
Continue to fix session cohort stats
thomasleese Aug 5, 2025
8b5db2d
Merge pull request #4145 from nhsuk/vaccination-record-cache-notify-p…
alistair-white-horne-tng Aug 5, 2025
27b69d4
Merge pull request #4171 from nhsuk/fix-cohort-stats
thomasleese Aug 5, 2025
c353867
Bump aws-sdk-ec2 from 1.544.0 to 1.545.0
dependabot[bot] Aug 5, 2025
bc4a319
Correctly assign `notify_parents` during the database seed
alistair-white-horne-tng Aug 5, 2025
e8ef990
Merge pull request #4174 from nhsuk/dependabot/bundler/next/aws-sdk-e…
thomasleese Aug 5, 2025
e26dde6
Edit status logic, add new help text
alistair-white-horne-tng Jul 29, 2025
f46c5e0
Merge pull request #4173 from nhsuk/fix-notify-parents-factory
alistair-white-horne-tng Aug 5, 2025
7de43c6
Merge pull request #4098 from nhsuk/api-stop-gillick-sync
alistair-white-horne-tng Aug 5, 2025
ad71867
fix: use AcademicYear.current rather than Date.current
MartinVanIJcken Aug 5, 2025
614ccea
fix: use more idiomatic upcase_first
MartinVanIJcken Aug 5, 2025
7b6f930
fix: mention health information only if consent expired
MartinVanIJcken Aug 5, 2025
1e118b0
Merge pull request #4172 from nhsuk/fix-activity-log-date-override
MartinVanIJcken Aug 5, 2025
9202886
Add academic_year column to imports
thomasleese Aug 1, 2025
23b6812
Add import_choose_academic_year feature flag
thomasleese Aug 5, 2025
ba69c60
Choose academic year when importing
thomasleese Aug 1, 2025
f0ec5cc
Merge pull request #4150 from nhsuk/import-in-to-current-academic-year
thomasleese Aug 5, 2025
2f1aa9c
Merge pull request #4128 from nhsuk/revert-4127-qa-delay-preparation
thomasleese Aug 5, 2025
79edee3
Ensure academic year question is asked
thomasleese Aug 5, 2025
7aef36f
Merge pull request #4177 from nhsuk/fix-import-from-programmes
thomasleese Aug 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,34 +113,34 @@ GEM
ast (2.4.3)
attr_required (1.0.2)
aws-eventstream (1.4.0)
aws-partitions (1.1140.0)
aws-partitions (1.1141.0)
aws-sdk-accessanalyzer (1.75.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-core (3.228.0)
aws-sdk-core (3.229.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-ec2 (1.544.0)
aws-sdk-ec2 (1.545.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-ecr (1.107.0)
aws-sdk-ecr (1.108.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-iam (1.126.0)
aws-sdk-iam (1.127.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-kms (1.109.0)
aws-sdk-kms (1.110.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-rds (1.285.0)
aws-sdk-rds (1.286.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.195.0)
aws-sdk-s3 (1.196.0)
aws-sdk-core (~> 3, >= 3.228.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -429,8 +429,8 @@ GEM
parser (3.3.8.0)
ast (~> 2.4.1)
racc
pg (1.6.0-arm64-darwin)
pg (1.6.0-x86_64-linux)
pg (1.6.1-arm64-darwin)
pg (1.6.1-x86_64-linux)
phonelib (0.10.11)
pp (0.6.2)
prettyprint
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ You can generate an example programme by seeding the database with `rails db:see

#### Adding a test user

You can add a new user to an environment using the `users:create` [rake task](docs/rake-tasks.md#userscreateemailpasswordgiven_namefamily_nameorganisation_ods_code):
You can add a new user to an environment using the `users:create` [rake task](docs/rake-tasks.md#userscreateemailpasswordgiven_namefamily_nameteam_ods_code):

```shell

# With no arguments, it will prompt you for all the information it needs:
rails users:create

# Or, create a user belonging to the organisation with ODS code 'R1L' (this is created in db/seeds.rb):
# Or, create a user belonging to the team with ODS code 'R1L' (this is created in db/seeds.rb):
rails users:create['user@example.com','password123','John', 'Doe','R1L']

# Note that on some Mac machines, this syntax can throw an error saying something like 'zsh: bad pattern', in which case you may need to remove the single quotes and escape the square brackets:
Expand Down Expand Up @@ -279,7 +279,7 @@ because it's easier to work offline without it.

GOV.UK Notify can store reply-to email addresses and use them when sending mail.
Once you've added the reply-to email in GOV.UK Notify, get the UUID and add it to
the organisation.
the team.

### Care Identity Service (CIS2)

Expand All @@ -297,7 +297,7 @@ curl -s https://am.nhsint.auth-ptl.cis2.spineservices.nhs.uk/openam/oauth2/realm
```

Clients in the INT environment can be configured via CIS2 Connection Manager,
please contact other organisation members to get the details for that. Mavis can
please contact other team members to get the details for that. Mavis can
use either a client secret or a private key JWT when authenticating requests to
CIS2, these are configured via the Connection Manager.

Expand Down Expand Up @@ -340,7 +340,7 @@ See the [releasing documentation](docs/releasing.md) for more information.
- `access_log:for_patient[id]`
- `access_log:for_user[id]`
- `subteams:create[ods_code,name,email,phone]`
- `users:create[email,password,given_name,family_name,organisation_ods_code]`
- `users:create[email,password,given_name,family_name,team_ods_code]`
- `vaccines:seed[type]`

See the [Rake tasks documentation](docs/rake-tasks.md) for more information.
Expand Down
68 changes: 66 additions & 2 deletions app/components/app_activity_log_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def initialize(patient: nil, patient_session: nil)
:consent_form,
:parent,
:recorded_by,
:programme,
patient: :parent_relationships
)

Expand Down Expand Up @@ -60,6 +61,8 @@ def initialize(patient: nil, patient_session: nil)
:performed_by_user,
:vaccine
)

@patient_specific_directions = @patient.patient_specific_directions
end

attr_reader :patient,
Expand All @@ -71,7 +74,8 @@ def initialize(patient: nil, patient_session: nil)
:pre_screenings,
:session_attendances,
:triages,
:vaccination_records
:vaccination_records,
:patient_specific_directions

def events_by_day
all_events.sort_by { -_1[:at].to_i }.group_by { _1[:at].to_date }
Expand All @@ -87,7 +91,8 @@ def all_events
pre_screening_events,
session_events,
triage_events,
vaccination_events
vaccination_events,
decision_expiration_events
].flatten
end

Expand Down Expand Up @@ -294,4 +299,63 @@ def programmes_for(object)
def programmes_by_id
@programmes_by_id ||= Programme.all.index_by(&:id)
end

def decision_expiration_events
all_programmes = Programme.all.to_a

AcademicYear.all.filter_map do |academic_year|
next if academic_year >= AcademicYear.current

vaccinated_programmes =
all_programmes.select do |programme|
patient.vaccination_status(programme:, academic_year:).vaccinated?
end

programmes_with_expired_consents =
consents
.select { it.academic_year == academic_year }
.flat_map { programmes_for(it) }
.reject { vaccinated_programmes.include?(it) }

programmes_with_expired_triages =
triages
.select { it.academic_year == academic_year }
.flat_map { programmes_for(it) }
.reject { vaccinated_programmes.include?(it) }

programmes_with_expired_psds =
patient_specific_directions
.select { it.academic_year == academic_year }
.flat_map { programmes_for(it) }
.reject { vaccinated_programmes.include?(it) }

expired_items = []
if programmes_with_expired_consents.any?
expired_items += ["consent", "health information"]
end
expired_items << "triage outcome" if programmes_with_expired_triages.any?
expired_items << "PSD status" if programmes_with_expired_psds.any?

next if expired_items.empty?

programmes_with_expired_items = [
programmes_with_expired_consents,
programmes_with_expired_triages,
programmes_with_expired_psds
].flatten.uniq

expired_items_sentence =
expired_items.to_sentence(
words_connector: ", ",
last_word_connector: " and "
)

{
title: "#{expired_items_sentence.upcase_first} expired",
body: "#{@patient.full_name} was not vaccinated.",
at: academic_year.to_academic_year_date_range.end.end_of_day - 1.second,
programmes: programmes_with_expired_items
}
end
end
end
7 changes: 7 additions & 0 deletions app/components/app_consent_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def call
end
end

unless consent.notify_parent_on_refusal.nil?
summary_list.with_row do |row|
row.with_key { "Confirmation of decision sent to parent" }
row.with_value { consent.notify_parent_on_refusal ? "Yes" : "No" }
end
end

if consent.notes.present?
summary_list.with_row do |row|
row.with_key { "Notes" }
Expand Down
22 changes: 13 additions & 9 deletions app/components/app_count_component.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# frozen_string_literal: true

class AppCountComponent < ViewComponent::Base
erb_template <<-ERB
<span class="app-count">
<span class="nhsuk-u-visually-hidden">(</span>
<%= @count %>
<span class="nhsuk-u-visually-hidden">)</span>
</span>
ERB

def initialize(count:)
def initialize(count)
super

@count = count
end

def call
tag.span(class: "app-count") do
safe_join(
[
tag.span("(", class: "nhsuk-u-visually-hidden"),
@count.to_s,
tag.span(")", class: "nhsuk-u-visually-hidden")
]
)
end
end
end
9 changes: 2 additions & 7 deletions app/components/app_header_navigation_item_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def call
aria: {
current: current? ? "true" : nil
}
) { safe_join([@title, count_tag], "") }
) { safe_join([@title, count_tag].compact, " ") }
end
end

Expand All @@ -39,11 +39,6 @@ def show_count?
end

def count_tag
return "" unless show_count?

tag.span(class: "app-count") do
tag.span(" (", class: "nhsuk-u-visually-hidden") + @count.to_s +
tag.span(")", class: "nhsuk-u-visually-hidden")
end
render AppCountComponent.new(@count) if show_count?
end
end
7 changes: 3 additions & 4 deletions app/components/app_import_format_details_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(import:)

private

delegate :organisation, to: :@import
delegate :team, to: :@import

def summary_text
case @import
Expand Down Expand Up @@ -184,8 +184,7 @@ def parent_columns
end

def programme
programmes =
organisation.programmes.flat_map(&:import_names).map { tag.i(it) }
programmes = team.programmes.flat_map(&:import_names).map { tag.i(it) }

programmes_sentence =
programmes.to_sentence(
Expand All @@ -202,7 +201,7 @@ def programme
end

def vaccine_and_batch
vaccines = organisation.vaccines.pluck(:nivs_name).map { tag.i(it) }
vaccines = team.vaccines.pluck(:nivs_name).map { tag.i(it) }

vaccines_sentence =
vaccines.to_sentence(
Expand Down
22 changes: 8 additions & 14 deletions app/components/app_imports_navigation_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,18 @@ def call
attr_reader :active

def issues_text
vaccination_records_with_issues =
helpers.policy_scope(VaccinationRecord).with_pending_changes.distinct

patients_with_issues = helpers.policy_scope(Patient).with_pending_changes

unique_import_issues =
(vaccination_records_with_issues + patients_with_issues).uniq do |record|
record.is_a?(VaccinationRecord) ? record.patient_id : record.id
end

count = unique_import_issues.count

safe_join(["Import issues", " ", render(AppCountComponent.new(count:))])
safe_join(
[
"Import issues",
" ",
render(AppCountComponent.new(helpers.import_issues_count))
]
)
end

def notices_text
count = helpers.policy_scope(Patient).with_notice.count

safe_join(["Important notices", " ", render(AppCountComponent.new(count:))])
safe_join(["Important notices", " ", render(AppCountComponent.new(count))])
end
end
12 changes: 6 additions & 6 deletions app/components/app_imports_table_component.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

class AppImportsTableComponent < ViewComponent::Base
def initialize(organisation:)
def initialize(team:)
super

@organisation = organisation
@team = team
end

def render?
Expand All @@ -13,7 +13,7 @@ def render?

private

attr_reader :organisation
attr_reader :team

def imports
@imports ||=
Expand All @@ -26,7 +26,7 @@ def imports
def class_import_records
ClassImport
.select("class_imports.*", "COUNT(patients.id) AS record_count")
.where(organisation:)
.where(team:)
.left_outer_joins(:patients)
.includes(:location, :uploaded_by)
.group("class_imports.id")
Expand All @@ -35,7 +35,7 @@ def class_import_records
def cohort_import_records
CohortImport
.select("cohort_imports.*", "COUNT(patients.id) AS record_count")
.where(organisation:)
.where(team:)
.left_outer_joins(:patients)
.includes(:uploaded_by)
.group("cohort_imports.id")
Expand All @@ -47,7 +47,7 @@ def immunisation_import_records
"immunisation_imports.*",
"COUNT(vaccination_records.id) AS record_count"
)
.where(organisation:)
.where(team:)
.left_outer_joins(:vaccination_records)
.includes(:uploaded_by)
.group("immunisation_imports.id")
Expand Down
4 changes: 2 additions & 2 deletions app/components/app_patient_cohort_table_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if organisation %>
<% if team %>
<%= govuk_table(html_attributes: {
class: "nhsuk-table-responsive",
}) do |table| %>
Expand All @@ -18,7 +18,7 @@
<% row.with_cell do %>
<span class="nhsuk-table-responsive__heading">Actions</span>
<%= form_with model: @patient, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.hidden_field :organisation_id, value: organisation.id %>
<%= f.hidden_field :team_id, value: team.id %>
<%= f.govuk_submit "Remove from cohort", class: "app-button--secondary-warning app-button--small" %>
<% end %>
<% end %>
Expand Down
Loading
Loading