Skip to content

Commit 4ef2935

Browse files
authored
Merge pull request #4181 from nhsuk/next
Version 2.14
2 parents 8ccfc39 + 7aef36f commit 4ef2935

File tree

428 files changed

+4595
-3572
lines changed

Some content is hidden

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

428 files changed

+4595
-3572
lines changed

Gemfile.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,34 @@ GEM
113113
ast (2.4.3)
114114
attr_required (1.0.2)
115115
aws-eventstream (1.4.0)
116-
aws-partitions (1.1140.0)
116+
aws-partitions (1.1141.0)
117117
aws-sdk-accessanalyzer (1.75.0)
118118
aws-sdk-core (~> 3, >= 3.228.0)
119119
aws-sigv4 (~> 1.5)
120-
aws-sdk-core (3.228.0)
120+
aws-sdk-core (3.229.0)
121121
aws-eventstream (~> 1, >= 1.3.0)
122122
aws-partitions (~> 1, >= 1.992.0)
123123
aws-sigv4 (~> 1.9)
124124
base64
125125
bigdecimal
126126
jmespath (~> 1, >= 1.6.1)
127127
logger
128-
aws-sdk-ec2 (1.544.0)
128+
aws-sdk-ec2 (1.545.0)
129129
aws-sdk-core (~> 3, >= 3.228.0)
130130
aws-sigv4 (~> 1.5)
131-
aws-sdk-ecr (1.107.0)
131+
aws-sdk-ecr (1.108.0)
132132
aws-sdk-core (~> 3, >= 3.228.0)
133133
aws-sigv4 (~> 1.5)
134-
aws-sdk-iam (1.126.0)
134+
aws-sdk-iam (1.127.0)
135135
aws-sdk-core (~> 3, >= 3.228.0)
136136
aws-sigv4 (~> 1.5)
137-
aws-sdk-kms (1.109.0)
137+
aws-sdk-kms (1.110.0)
138138
aws-sdk-core (~> 3, >= 3.228.0)
139139
aws-sigv4 (~> 1.5)
140-
aws-sdk-rds (1.285.0)
140+
aws-sdk-rds (1.286.0)
141141
aws-sdk-core (~> 3, >= 3.228.0)
142142
aws-sigv4 (~> 1.5)
143-
aws-sdk-s3 (1.195.0)
143+
aws-sdk-s3 (1.196.0)
144144
aws-sdk-core (~> 3, >= 3.228.0)
145145
aws-sdk-kms (~> 1)
146146
aws-sigv4 (~> 1.5)
@@ -429,8 +429,8 @@ GEM
429429
parser (3.3.8.0)
430430
ast (~> 2.4.1)
431431
racc
432-
pg (1.6.0-arm64-darwin)
433-
pg (1.6.0-x86_64-linux)
432+
pg (1.6.1-arm64-darwin)
433+
pg (1.6.1-x86_64-linux)
434434
phonelib (0.10.11)
435435
pp (0.6.2)
436436
prettyprint

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ You can generate an example programme by seeding the database with `rails db:see
229229

230230
#### Adding a test user
231231

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

234234
```shell
235235

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

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

242242
# 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:
@@ -279,7 +279,7 @@ because it's easier to work offline without it.
279279

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

284284
### Care Identity Service (CIS2)
285285

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

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

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

346346
See the [Rake tasks documentation](docs/rake-tasks.md) for more information.

app/components/app_activity_log_component.rb

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def initialize(patient: nil, patient_session: nil)
3232
:consent_form,
3333
:parent,
3434
:recorded_by,
35+
:programme,
3536
patient: :parent_relationships
3637
)
3738

@@ -60,6 +61,8 @@ def initialize(patient: nil, patient_session: nil)
6061
:performed_by_user,
6162
:vaccine
6263
)
64+
65+
@patient_specific_directions = @patient.patient_specific_directions
6366
end
6467

6568
attr_reader :patient,
@@ -71,7 +74,8 @@ def initialize(patient: nil, patient_session: nil)
7174
:pre_screenings,
7275
:session_attendances,
7376
:triages,
74-
:vaccination_records
77+
:vaccination_records,
78+
:patient_specific_directions
7579

7680
def events_by_day
7781
all_events.sort_by { -_1[:at].to_i }.group_by { _1[:at].to_date }
@@ -87,7 +91,8 @@ def all_events
8791
pre_screening_events,
8892
session_events,
8993
triage_events,
90-
vaccination_events
94+
vaccination_events,
95+
decision_expiration_events
9196
].flatten
9297
end
9398

@@ -294,4 +299,63 @@ def programmes_for(object)
294299
def programmes_by_id
295300
@programmes_by_id ||= Programme.all.index_by(&:id)
296301
end
302+
303+
def decision_expiration_events
304+
all_programmes = Programme.all.to_a
305+
306+
AcademicYear.all.filter_map do |academic_year|
307+
next if academic_year >= AcademicYear.current
308+
309+
vaccinated_programmes =
310+
all_programmes.select do |programme|
311+
patient.vaccination_status(programme:, academic_year:).vaccinated?
312+
end
313+
314+
programmes_with_expired_consents =
315+
consents
316+
.select { it.academic_year == academic_year }
317+
.flat_map { programmes_for(it) }
318+
.reject { vaccinated_programmes.include?(it) }
319+
320+
programmes_with_expired_triages =
321+
triages
322+
.select { it.academic_year == academic_year }
323+
.flat_map { programmes_for(it) }
324+
.reject { vaccinated_programmes.include?(it) }
325+
326+
programmes_with_expired_psds =
327+
patient_specific_directions
328+
.select { it.academic_year == academic_year }
329+
.flat_map { programmes_for(it) }
330+
.reject { vaccinated_programmes.include?(it) }
331+
332+
expired_items = []
333+
if programmes_with_expired_consents.any?
334+
expired_items += ["consent", "health information"]
335+
end
336+
expired_items << "triage outcome" if programmes_with_expired_triages.any?
337+
expired_items << "PSD status" if programmes_with_expired_psds.any?
338+
339+
next if expired_items.empty?
340+
341+
programmes_with_expired_items = [
342+
programmes_with_expired_consents,
343+
programmes_with_expired_triages,
344+
programmes_with_expired_psds
345+
].flatten.uniq
346+
347+
expired_items_sentence =
348+
expired_items.to_sentence(
349+
words_connector: ", ",
350+
last_word_connector: " and "
351+
)
352+
353+
{
354+
title: "#{expired_items_sentence.upcase_first} expired",
355+
body: "#{@patient.full_name} was not vaccinated.",
356+
at: academic_year.to_academic_year_date_range.end.end_of_day - 1.second,
357+
programmes: programmes_with_expired_items
358+
}
359+
end
360+
end
297361
end

app/components/app_consent_summary_component.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ def call
6161
end
6262
end
6363

64+
unless consent.notify_parent_on_refusal.nil?
65+
summary_list.with_row do |row|
66+
row.with_key { "Confirmation of decision sent to parent" }
67+
row.with_value { consent.notify_parent_on_refusal ? "Yes" : "No" }
68+
end
69+
end
70+
6471
if consent.notes.present?
6572
summary_list.with_row do |row|
6673
row.with_key { "Notes" }
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# frozen_string_literal: true
22

33
class AppCountComponent < ViewComponent::Base
4-
erb_template <<-ERB
5-
<span class="app-count">
6-
<span class="nhsuk-u-visually-hidden">(</span>
7-
<%= @count %>
8-
<span class="nhsuk-u-visually-hidden">)</span>
9-
</span>
10-
ERB
11-
12-
def initialize(count:)
4+
def initialize(count)
135
super
146

157
@count = count
168
end
9+
10+
def call
11+
tag.span(class: "app-count") do
12+
safe_join(
13+
[
14+
tag.span("(", class: "nhsuk-u-visually-hidden"),
15+
@count.to_s,
16+
tag.span(")", class: "nhsuk-u-visually-hidden")
17+
]
18+
)
19+
end
20+
end
1721
end

app/components/app_header_navigation_item_component.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def call
1818
aria: {
1919
current: current? ? "true" : nil
2020
}
21-
) { safe_join([@title, count_tag], "") }
21+
) { safe_join([@title, count_tag].compact, " ") }
2222
end
2323
end
2424

@@ -39,11 +39,6 @@ def show_count?
3939
end
4040

4141
def count_tag
42-
return "" unless show_count?
43-
44-
tag.span(class: "app-count") do
45-
tag.span(" (", class: "nhsuk-u-visually-hidden") + @count.to_s +
46-
tag.span(")", class: "nhsuk-u-visually-hidden")
47-
end
42+
render AppCountComponent.new(@count) if show_count?
4843
end
4944
end

app/components/app_import_format_details_component.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(import:)
99

1010
private
1111

12-
delegate :organisation, to: :@import
12+
delegate :team, to: :@import
1313

1414
def summary_text
1515
case @import
@@ -184,8 +184,7 @@ def parent_columns
184184
end
185185

186186
def programme
187-
programmes =
188-
organisation.programmes.flat_map(&:import_names).map { tag.i(it) }
187+
programmes = team.programmes.flat_map(&:import_names).map { tag.i(it) }
189188

190189
programmes_sentence =
191190
programmes.to_sentence(
@@ -202,7 +201,7 @@ def programme
202201
end
203202

204203
def vaccine_and_batch
205-
vaccines = organisation.vaccines.pluck(:nivs_name).map { tag.i(it) }
204+
vaccines = team.vaccines.pluck(:nivs_name).map { tag.i(it) }
206205

207206
vaccines_sentence =
208207
vaccines.to_sentence(

app/components/app_imports_navigation_component.rb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,18 @@ def call
3636
attr_reader :active
3737

3838
def issues_text
39-
vaccination_records_with_issues =
40-
helpers.policy_scope(VaccinationRecord).with_pending_changes.distinct
41-
42-
patients_with_issues = helpers.policy_scope(Patient).with_pending_changes
43-
44-
unique_import_issues =
45-
(vaccination_records_with_issues + patients_with_issues).uniq do |record|
46-
record.is_a?(VaccinationRecord) ? record.patient_id : record.id
47-
end
48-
49-
count = unique_import_issues.count
50-
51-
safe_join(["Import issues", " ", render(AppCountComponent.new(count:))])
39+
safe_join(
40+
[
41+
"Import issues",
42+
" ",
43+
render(AppCountComponent.new(helpers.import_issues_count))
44+
]
45+
)
5246
end
5347

5448
def notices_text
5549
count = helpers.policy_scope(Patient).with_notice.count
5650

57-
safe_join(["Important notices", " ", render(AppCountComponent.new(count:))])
51+
safe_join(["Important notices", " ", render(AppCountComponent.new(count))])
5852
end
5953
end

app/components/app_imports_table_component.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

33
class AppImportsTableComponent < ViewComponent::Base
4-
def initialize(organisation:)
4+
def initialize(team:)
55
super
66

7-
@organisation = organisation
7+
@team = team
88
end
99

1010
def render?
@@ -13,7 +13,7 @@ def render?
1313

1414
private
1515

16-
attr_reader :organisation
16+
attr_reader :team
1717

1818
def imports
1919
@imports ||=
@@ -26,7 +26,7 @@ def imports
2626
def class_import_records
2727
ClassImport
2828
.select("class_imports.*", "COUNT(patients.id) AS record_count")
29-
.where(organisation:)
29+
.where(team:)
3030
.left_outer_joins(:patients)
3131
.includes(:location, :uploaded_by)
3232
.group("class_imports.id")
@@ -35,7 +35,7 @@ def class_import_records
3535
def cohort_import_records
3636
CohortImport
3737
.select("cohort_imports.*", "COUNT(patients.id) AS record_count")
38-
.where(organisation:)
38+
.where(team:)
3939
.left_outer_joins(:patients)
4040
.includes(:uploaded_by)
4141
.group("cohort_imports.id")
@@ -47,7 +47,7 @@ def immunisation_import_records
4747
"immunisation_imports.*",
4848
"COUNT(vaccination_records.id) AS record_count"
4949
)
50-
.where(organisation:)
50+
.where(team:)
5151
.left_outer_joins(:vaccination_records)
5252
.includes(:uploaded_by)
5353
.group("immunisation_imports.id")

app/components/app_patient_cohort_table_component.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<% if organisation %>
1+
<% if team %>
22
<%= govuk_table(html_attributes: {
33
class: "nhsuk-table-responsive",
44
}) do |table| %>
@@ -18,7 +18,7 @@
1818
<% row.with_cell do %>
1919
<span class="nhsuk-table-responsive__heading">Actions</span>
2020
<%= form_with model: @patient, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
21-
<%= f.hidden_field :organisation_id, value: organisation.id %>
21+
<%= f.hidden_field :team_id, value: team.id %>
2222
<%= f.govuk_submit "Remove from cohort", class: "app-button--secondary-warning app-button--small" %>
2323
<% end %>
2424
<% end %>

0 commit comments

Comments
 (0)