Skip to content

Commit 6895ee5

Browse files
authored
Merge pull request #6554 from NHSDigital/next
Version 7.8.0
2 parents fc26aa5 + 6e9b90f commit 6895ee5

127 files changed

Lines changed: 3929 additions & 1806 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ jobs:
189189
name: Pre-deploy
190190
runs-on: ubuntu-latest
191191
needs: approve-deployments
192+
if:
193+
${{ inputs.run_pre_deploy_migrations || inputs.environment == 'production' ||
194+
inputs.environment == 'preview' || inputs.environment == 'training' }}
192195
permissions:
193196
id-token: write
194197
steps:

.github/workflows/end-to-end-tests-on-pull-request.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ jobs:
3030
name: Ensure E2E tests ran successfully
3131
runs-on: ubuntu-latest
3232
needs: [aws-e2e-flow, local-e2e-flow]
33-
if: |
34-
!cancelled() && (
35-
needs.aws-e2e-flow.result == 'success' ||
36-
needs.local-e2e-flow.result == 'success'
37-
)
33+
if: always()
3834
steps:
39-
- name: Output result
40-
run: echo "E2E tests ran successfully"
35+
- name: Fail if neither end-to-end job succeeded
36+
if: |
37+
needs.aws-e2e-flow.result != 'success' &&
38+
needs.local-e2e-flow.result != 'success'
39+
run: exit 1

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ gem "active_record_union"
2727
gem "amazing_print"
2828
gem "array_enum"
2929
gem "audited", github: "tvararu/audited", branch: "encryption"
30+
gem "aws-sdk-cloudwatch"
3031
gem "caxlsx"
3132
gem "charlock_holmes"
3233
gem "config"

Gemfile.lock

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/citizensadvice/capybara_accessible_selectors.git
3-
revision: 8827551846841bf98242c3085f0fb1f37963f573
3+
revision: e204122d3949530828ba8ea52e33409d86f72679
44
specs:
55
capybara_accessible_selectors (0.15.0)
66
capybara (~> 3.36)
@@ -115,7 +115,7 @@ GEM
115115
securerandom (>= 0.3)
116116
tzinfo (~> 2.0, >= 2.0.5)
117117
uri (>= 0.13.1)
118-
addressable (2.8.9)
118+
addressable (2.9.0)
119119
public_suffix (>= 2.0.2, < 8.0)
120120
aes_key_wrap (1.1.0)
121121
amazing_print (2.0.0)
@@ -179,6 +179,9 @@ GEM
179179
aws-sdk-accessanalyzer (1.86.0)
180180
aws-sdk-core (~> 3, >= 3.244.0)
181181
aws-sigv4 (~> 1.5)
182+
aws-sdk-cloudwatch (1.132.0)
183+
aws-sdk-core (~> 3, >= 3.244.0)
184+
aws-sigv4 (~> 1.5)
182185
aws-sdk-core (3.244.0)
183186
aws-eventstream (~> 1, >= 1.3.0)
184187
aws-partitions (~> 1, >= 1.992.0)
@@ -596,7 +599,7 @@ GEM
596599
activesupport (>= 3.0.0)
597600
raabro (1.4.0)
598601
racc (1.8.1)
599-
rack (3.2.5)
602+
rack (3.2.6)
600603
rack-oauth2 (2.3.0)
601604
activesupport
602605
attr_required
@@ -608,7 +611,7 @@ GEM
608611
base64 (>= 0.1.0)
609612
logger (>= 1.6.0)
610613
rack (>= 3.0.0, < 4)
611-
rack-session (2.1.1)
614+
rack-session (2.1.2)
612615
base64 (>= 0.1.0)
613616
rack (>= 3.0.0)
614617
rack-test (2.2.0)
@@ -670,7 +673,7 @@ GEM
670673
redis-client (0.28.0)
671674
connection_pool
672675
redis-prescription (2.6.0)
673-
regexp_parser (2.11.3)
676+
regexp_parser (2.12.0)
674677
reline (0.6.3)
675678
io-console (~> 0.5)
676679
responders (3.2.0)
@@ -933,6 +936,7 @@ DEPENDENCIES
933936
asciidoctor-diagram
934937
audited!
935938
aws-sdk-accessanalyzer
939+
aws-sdk-cloudwatch
936940
aws-sdk-ec2
937941
aws-sdk-ecr
938942
aws-sdk-iam

Procfile.dev

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ web: bin/falcon serve -b http://localhost:4000
22
sidekiq: bin/sidekiq
33
css: yarn build:css --watch
44
js: yarn build --watch
5-
redis: redis-server

Procfile.e2e

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
web: RAILS_ENV=end_to_end bin/falcon serve -b http://localhost:4100
1+
web: RAILS_ENV=end_to_end bin/falcon serve -b http://localhost:4100
22
sidekiq: RAILS_ENV=end_to_end bin/sidekiq
3-
css: yarn build:css --watch
4-
js: yarn build --watch=forever
5-
redis: redis-server --port 6380
3+
css: yarn build:css --watch
4+
js: yarn build --watch=forever

README.md

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ This is a service used within the NHS for managing and recording school-aged vac
66

77
| Name | URL | Purpose | Care Identity login | Code | Deployment | `RAILS_ENV` |
88
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------------- | ------------------------------ | ---------- | ------------------------------------------------- |
9-
| [Heroku](https://github.com/nhsuk/manage-vaccinations-in-schools/deployments/heroku) | mavis-pr-xxxx.herokuapp.com | PR review apps || pull request branch | automated | [`staging`](config/environments/staging.rb) |
109
| [Test](https://github.com/nhsuk/manage-vaccinations-in-schools/deployments/test) | [test.mavistesting.com](https://test.mavistesting.com) | Internal testing (manual) || `main` branch (latest) | automated | [`staging`](config/environments/staging.rb) |
1110
| [QA](https://github.com/nhsuk/manage-vaccinations-in-schools/deployments/qa) | [qa.mavistesting.com](https://qa.mavistesting.com) | Internal testing (automated) || `main` branch (latest) | automated | [`staging`](config/environments/staging.rb) |
1211
| [Preview](https://github.com/nhsuk/manage-vaccinations-in-schools/deployments/Preview) | [preview.mavistesting.com](https://preview.mavistesting.com) | External testing || `release` or release candidate | manual | [`staging`](config/environments/staging.rb) |
1312
| [Training](https://github.com/nhsuk/manage-vaccinations-in-schools/deployments/training) | [training.manage-vaccinations-in-schools.nhs.uk](https://training.manage-vaccinations-in-schools.nhs.uk) | External training || `release` branch | manual | [`staging`](config/environments/staging.rb) |
1413
| [Production](https://github.com/nhsuk/manage-vaccinations-in-schools/deployments/production) | [www.manage-vaccinations-in-schools.nhs.uk](https://www.manage-vaccinations-in-schools.nhs.uk) | Live service || `release` branch | manual | [`production`](config/environments/production.rb) |
1514

16-
## Documentation
15+
## API Documentation
1716

18-
We have two Rdoc versions:
17+
We have two RDoc versions:
1918

2019
1. [next](https://nhsuk.github.io/manage-vaccinations-in-schools/rdoc/next) - useful for dev work (based off the `next` branch).
2120
2. [release](https://nhsuk.github.io/manage-vaccinations-in-schools/rdoc/release) - useful for ops to debug live issues (based off the `release` branch).
@@ -47,9 +46,7 @@ We use `rladr` to generate the boilerplate for new records:
4746
bin/bundle exec rladr new title
4847
```
4948

50-
### Development toolchain
51-
52-
#### Mise
49+
### Installing dependencies
5350

5451
This project uses `mise`. Use the following to set up (replace `brew` and
5552
package names depending on your platform):
@@ -84,20 +81,46 @@ Then to install the required tools (or update, following a change to
8481
mise install
8582
```
8683

87-
After installing Postgres via `mise`, run the database in the background, and
88-
connect to it to create a user:
84+
### Background services
85+
86+
For the application to start successfully, PostgreSQL and Redis/Valkey must be
87+
running.
88+
89+
#### PostgreSQL
90+
91+
If using `brew`, the simplest option is to run `brew services start postgresql`.
92+
93+
Alternatively, you can run the server manually:
8994

9095
```shell
9196
pg_ctl start
9297
psql -U postgres -c "CREATE USER $(whoami); ALTER USER $(whoami) WITH SUPERUSER;"
9398
```
9499

95-
### Local development
100+
#### Redis/Valkey
96101

97-
To run the project locally:
102+
If using `brew`, the simplest option is to run `brew services start redis`.
103+
104+
Alternatively, you can run the server manually:
98105

99106
```shell
100-
bin/setup
107+
redis-server
108+
```
109+
110+
### Running locally
111+
112+
When running for the first time, `bin/setup` will automatically install Ruby
113+
dependencies and set up the database.
114+
115+
This application also comes with a `Procfile.dev` for use with `foreman` in
116+
development environments. Use the script `bin/dev` to run it:
117+
118+
```shell
119+
$ bin/dev
120+
13:07:31 web.1 | started with pid 73965
121+
13:07:31 css.1 | started with pid 73966
122+
13:07:31 js.1 | started with pid 73967
123+
...
101124
```
102125

103126
### Branching strategy
@@ -141,39 +164,7 @@ You'll also need to configure your editor's `solargraph` plugin to
141164
+ "solargraph.useBundler": true,
142165
```
143166

144-
### PostgreSQL
145-
146-
The script `bin/db` is included to start up PostgreSQL for setups that don't use
147-
system-started services. Note that this is meant to be a handy script to manage
148-
PostgreSQL, not run a console like `rails db` does.
149-
150-
```shell
151-
$ bin/db
152-
pg_ctl: no server running
153-
$ bin/db start
154-
waiting for server to start.... done
155-
server started
156-
$ bin/db
157-
pg_ctl: server is running (PID: 79113)
158-
```
159-
160-
This script attempts to be installation agnostic by relying on `pg_config` to
161-
determine postgres's installation directory and setting up logging accordingly.
162-
163-
### Development server
164-
165-
This application comes with a `Procfile.dev` for use with `foreman` in
166-
development environments. Use the script `bin/dev` to run it:
167-
168-
```shell
169-
$ bin/dev
170-
13:07:31 web.1 | started with pid 73965
171-
13:07:31 css.1 | started with pid 73966
172-
13:07:31 js.1 | started with pid 73967
173-
...
174-
```
175-
176-
#### Debugging with `binding.pry`
167+
### Debugging with `binding.pry`
177168

178169
TTY echo can get mangled when using `binding.pry` in `bin/dev`. To work around
179170
this, you can run `rails s` directly if you're not working with any JS or CSS
@@ -235,7 +226,7 @@ RAILS_ENV=end_to_end bin/mavis gias import --input-file=spec/fixtures/dfe-school
235226

236227
You can generate an example programme by seeding the database with `rails db:seed:replant`.
237228

238-
#### Adding a test user
229+
### Adding a test user
239230

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

@@ -260,11 +251,6 @@ rails users:create\[user@example.com,password123,John,Doe,R1L\]
260251

261252
The previews are defined in `spec/components/previews`.
262253

263-
### Deploying
264-
265-
This app can be deployed to AWS using the relevant [github workflow](.github/workflows/deploy.yml). The infrastructure
266-
configuration is located in [its own repository](https://github.com/NHSDigital/manage-vaccinations-in-schools-infrastructure)
267-
268254
### Notify
269255

270256
When developing locally, emails are sent using the `:file` delivery method, and
@@ -331,11 +317,11 @@ The `private_key` will automatically be used to generate a JWK on the
331317
`/oidc/jwks` endpoint, which is used by CIS2 to validate the JWT we use to
332318
request the access token from CIS2.
333319

334-
### Reporting
320+
## Reporting
335321

336322
See [docs/reporting.md](docs/reporting.md).
337323

338-
#### Key Rotation
324+
### Key Rotation
339325

340326
Keys should be rotated regularly. When a new key is introduced it's JWK will
341327
automatically be added to the JWKS generated for `/oidc/jwks`, but the old

app/components/app_activity_log_component.rb

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -485,55 +485,63 @@ def triage_events
485485
end
486486

487487
def vaccination_events
488-
vaccination_records.flat_map do |vaccination_record|
489-
title =
490-
if vaccination_record.administered?
491-
if (vaccine = vaccination_record.vaccine)
492-
"Vaccinated with #{vaccine.brand}"
493-
elsif vaccination_record.sourced_from_manual_report?
494-
"Vaccination record added manually"
495-
elsif vaccination_record.sourced_from_historical_upload?
496-
"Vaccination record uploaded"
488+
events =
489+
vaccination_records.flat_map do |vaccination_record|
490+
if vaccination_record.sourced_from_nhs_immunisations_api? &&
491+
vaccination_record.discarded?
492+
next
493+
end
494+
495+
title =
496+
if vaccination_record.administered?
497+
if (vaccine = vaccination_record.vaccine)
498+
"Vaccinated with #{vaccine.brand}"
499+
elsif vaccination_record.sourced_from_manual_report?
500+
"Vaccination record added manually"
501+
elsif vaccination_record.sourced_from_historical_upload?
502+
"Vaccination record uploaded"
503+
else
504+
"Vaccinated"
505+
end
497506
else
498-
"Vaccinated"
507+
"Vaccination not given: #{vaccination_record.human_enum_name(:outcome)}"
499508
end
500-
else
501-
"Vaccination not given: #{vaccination_record.human_enum_name(:outcome)}"
502-
end
503509

504-
subtitle =
505-
if historical_vaccination_event?(vaccination_record)
506-
"Record added to Mavis #{vaccination_record.created_at.to_fs(:long)} · " \
507-
"Vaccination given #{vaccination_record.performed_at.to_date.to_fs(:long)}"
508-
end
510+
subtitle =
511+
if historical_vaccination_event?(vaccination_record)
512+
"Record added to Mavis #{vaccination_record.created_at.to_fs(:long)} · " \
513+
"Vaccination given #{vaccination_record.performed_at.to_date.to_fs(:long)}"
514+
end
509515

510-
at =
511-
if historical_vaccination_event?(vaccination_record)
512-
vaccination_record.created_at
513-
else
514-
vaccination_record.performed_at
515-
end
516+
at =
517+
if historical_vaccination_event?(vaccination_record)
518+
vaccination_record.created_at
519+
else
520+
vaccination_record.performed_at
521+
end
516522

517-
kept = {
518-
title:,
519-
body: vaccination_record.notes,
520-
at:,
521-
by: vaccination_record.performed_by,
522-
programmes: [vaccination_record.programme],
523-
subtitle:
524-
}
523+
kept = {
524+
title:,
525+
body: vaccination_record.notes,
526+
at:,
527+
by: vaccination_record.performed_by,
528+
programmes: [vaccination_record.programme],
529+
subtitle:
530+
}
525531

526-
discarded =
527-
if vaccination_record.discarded?
528-
{
529-
title: "Vaccination record archived",
530-
at: vaccination_record.discarded_at,
531-
programmes: [vaccination_record.programme]
532-
}
533-
end
532+
discarded =
533+
if vaccination_record.discarded?
534+
{
535+
title: "Vaccination record archived",
536+
at: vaccination_record.discarded_at,
537+
programmes: [vaccination_record.programme]
538+
}
539+
end
534540

535-
[kept, discarded].compact
536-
end
541+
[kept, discarded].compact
542+
end
543+
544+
events.compact
537545
end
538546

539547
def historical_vaccination_event?(vaccination_record)

0 commit comments

Comments
 (0)