Skip to content

Conversation

thomasleese
Copy link
Contributor

No description provided.

thomasleese and others added 30 commits August 4, 2025 10:25
To `pending_sessions` to reflect the fact that these are sessions in the
pending academic year.
This replaces the use of `for_current_academic_year` in the
`ImmunisationImportRow` with an explicit academic year.
This removes the scope from the session model as it is no longer being
used.
This renames the column from `notify_parents` to
`notify_parents_on_vaccination` as we're going to have a new column to
capture whether a parent should be notified on refusal and this could
potentially be confusing with its existing name.

Jira-Issue: MAV-1586
This adds a question when recording verbal consent, and where the parent
has refused for personal reasons, allowing the nurses to not send a
confirmation to this parent.

This will be used in the preparation period for the next academic year
where nurses will record refusal for parents they know will refuse
consent and wouldn't like to receive confirmation.

Jira-Issue: MAV-1586
Display whether the parent was notified of their refusal or not, based on nurse's
response to the question during verbal consent flow.

Jira-Issue: MAV-1586
This updates the "Import" header item to show the count of the number of
import issues rather than the count of the number of imports. This was
actually supposed to be the case originally but it was built
incorrectly.

I've implemented this by using a helper method since we need this number
to be accessible in both the import issues navigation item and the
global header item. A helper means it's available to every page.

It's a little awkard to test the helper on its own as it relies on the
use of `policy_scope`, so instead test coverage is provided by the
feature tests.

Jira-Issue: MAV-1695
This logic was checking `is_recorded` inside a block where `is_recorded`
is already `true`, and therefore it was unnecessary to make those
checks. Instead this can be simplified while ensuring the same result is
given before and after.
This adds a convenience method which encapsulates the logic of two
methods which we call in a number of places.
This reduces duplication of code by having it there only once.
This replaces the existing draft class import model with a model that
handles more of the steps of the import process, specifically it now
includes the step of choosing the type of import.

I've made this change because we're probably going to adding a step to
two of the import types allowing users to specify which academic year
they're importing records for, and therefore we need this page to be
shown for multiple import types.

By making this change it also means we can get validation if an invalid
type is specified.

Jira-Issue: MAV-1700
This updates the immunisation import process to ensure that when
importing details for a vaccination record that already exists, we use
the `patient_id` as the value rather than the `patient` object. This
ensures that the resulting pending changes can be saved successfully as
it contains a single value rather than a hash of the patient.

Although we anticipate this structure will change soon with the PDS
improvements, we saw an unhandled error occur in the test environment so
this puts in a fix for the issue.

Sentry-Issue: 6784604544
Use `patient_id` when staging vaccination record changes
Remove `Session#for_current_academic_year`
Show import issues count on header item
Simplify logic for next immunisations API action
Add option to not send consent refusal to parents
This renames the organisation model, and all associated models and
foreign keys to team. The functionality of the service before and after
should be the same.

We're doing this because we're going to be restructuring organisations
and teams in to three levels. What we currently call teams becomes
subteams, organisations becomes teams and we'll be introducing a new
top-level organisation to group teams together.

To support this change I've also added two new personalisation
variables to use in GOV.UK Notify: `team_privacy_policy_url` and
`team_privacy_notice_url`. These are equivalent to the existing
variables prefixed with `organisation_` and once the templates
have been updated we can remove them.

Jira-Issue: MAV-1280
Before, the Imms API sync status was visible in production, which was confusing for users. Now it won't show until the feature flag is enabled.
This updates the validation of the `VaccinationRecord` model to match
the fact that the column itself cannot be null. This is a valid scenario
in the case of already had vaccinations where we won't necessarily know
the protocol.

Jira-Issue: MAV-1517
If the parents responded to consent during an academic year and
indicated that the patient was already vaccinated, provided that the
academic year has come to an end, we should be recording these as
vaccination records to ensure that the patient doesn't get asked for
consent again next year.

To implement this I've created a job which only runs during the
preparation period before an academic year starts.

Jira-Issue: MAV-1517
…ents

Record already had vaccinations from consent response
This adds a job which handles the logic related to moving patients that
cannot go to their school anymore (because the school no longer teachers
their year group) to unknown school.

During the rollover preparation period, patients who have been moved up
a year will be moved to unknown school if their school no longer
teachs their year group. For example, a primary school patient in year 6
and a secondary school patient in year 11.

Jira-Issue: MAV-1511
This ensures that the job runs on a daily basis to ensure that patients
are correctly moved out of their school if approriate.

I've decided to schedule this daily rather than running it only on a
yearly basis to catch any uploads that might put the patient in the
wrong school during the preparation period for the next academic year,
to ensure that the job is well tested by running often, and to avoid the
need for a manual task to run each rollover.

Jira-Issue: MAV-1511
This fixes a number of typos where the phrase "an team" is used. This
happened when team was renamed from organisation.
…-school

Move aged out patients to unknown school
Put imms API sync status behind feature flag
thomasleese and others added 22 commits August 5, 2025 08:27
…cr-1.108.0

Bump aws-sdk-ecr from 1.107.0 to 1.108.0
This column allows the value of `notify_parents` to be cached in the database. This is useful for two reasons:
1) It freezes this value to what it was at the time that the vaccination record was created. This is an accurate representation of what this value should hold; "at the time of vaccination, the patient didn't want their parents to be notified"
2) Patients who fall into this category will soon need to be exposed in the "Important notices" tab (MAV-1674), which will otherwise require a very heavy database query
This follows on from 830467e and
applies the same filtering in a number of other places which were missed
in the original commit.

Without this filtering we can end up with percentages higher than 100%
which is incorrect.

Jira-Issue: MAV-1520
…arents

Add `notify_parents`, and cache as a column on `VaccinationRecord`
Continue to fix session cohort stats
Bumps [aws-sdk-ec2](https://github.com/aws/aws-sdk-ruby) from 1.544.0 to 1.545.0.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-ec2/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)

---
updated-dependencies:
- dependency-name: aws-sdk-ec2
  dependency-version: 1.545.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Now, the `notify_parents` are assigned the correct value based on the consent forms
…c2-1.545.0

Bump aws-sdk-ec2 from 1.544.0 to 1.545.0
If a child has requested that their parents aren't notified of the vaccination event, then this shouldn't be synced to the API. This also requires a new help text under when the vaccination record is viewed

Also, use this logic in the vaccination mailer to decide whether a patient's parents should be notified
Correctly assign `notify_parents` during the database seed
Prevent sync to the imms API if the patient has requested that their parents aren't notified
This achieves two things. First, the academic year rollover date should
not be hard-coded so we get rid of that, second  it means that this now
works with the date override which can be performed on AcademicYear.
Health information comes from consents so it only exists if there were
expired consents.
fix: use AcademicYear.current rather than Date.current
This adds a new `academic_year` column to imports which allows us to
create imports during the preparation period that target a specific
academic year, rather than currently where it's always the pending
academic year.

We don't anticipate that this will be used much by SAIS teams, but
it's useful for testing.

Jira-Issue: MAV-1700
This adds a feature flag that we can turn on in test and QA, allowing
testers to import patients in to the current academic year during the
preparation period.

Jira-Issue: MAV-1700
During the preparation period (where there are two possible academic
year), this adds a new step where users can choose whether to add these
patients in to the current academic year (as well as the upcoming one).

Jira-Issue: MAV-1700
When importing patients from the programmes page, we need to also ask
the question about which academic year to import the patients in to if
the question is enabled. Without it, the user sees an error page when
trying to import patients from that link.

Jira-Issue: MAV-1700
Sentry-Issue: 6791519688
Ensure academic year question is asked
@thomasleese thomasleese requested review from a team as code owners August 5, 2025 16:12
@thomasleese thomasleese enabled auto-merge August 5, 2025 16:12
Copy link

sonarqubecloud bot commented Aug 5, 2025

@tvararu tvararu temporarily deployed to mavis-pr-4181 August 5, 2025 16:15 Inactive
@thomasleese thomasleese merged commit 4ef2935 into main Aug 5, 2025
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants