Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
921faf8
Add phone_instructions field to organisations and teams
murugapl Apr 29, 2025
1914abc
Display phone instructions in user communications
murugapl Apr 30, 2025
9479e26
Allow auth using client secret
misaka Jan 30, 2025
1de94e2
Check workgroup first on auth
misaka Jan 30, 2025
06310ab
Simplify and fix cis2 auth mock usage
misaka Jan 30, 2025
aae6e42
Update organisation not found page
misaka Mar 12, 2025
a220a99
Order search results by match similarity before alphabetical name
alistair-white-horne-tng Apr 1, 2025
d98984e
Add tests
alistair-white-horne-tng Apr 1, 2025
fa17c7b
Fix alignment of filters with results
paulrobertlloyd May 12, 2025
cfd9344
Update only confirmation_sent_at column when emails are sent
murugapl Apr 3, 2025
e915990
Overwrite gender if not already in Mavis
alistair-white-horne-tng Apr 15, 2025
2355c6c
Add tests
alistair-white-horne-tng Apr 15, 2025
935096d
Use valid NHS numbers
thomasleese Apr 30, 2025
93c38be
Extract programme overview cards into dedicated component
murugapl Apr 22, 2025
4d468ce
Create ConsentNotificationPolicy and restructure notifications filtering
murugapl Apr 23, 2025
d59d570
Accept address if none existed before
alistair-white-horne-tng Apr 15, 2025
7871c93
Add tests
alistair-white-horne-tng Apr 15, 2025
c83a667
Create string normalisation function
alistair-white-horne-tng Apr 22, 2025
f9cf590
Normalise all string fields during the CSV parsing (inc. headers)
alistair-white-horne-tng Apr 30, 2025
b5c0a3f
Add unit tests for normalise_whitespace.rb
alistair-white-horne-tng Apr 30, 2025
587298e
Add test to ensure that normalisation happens during import
alistair-white-horne-tng Apr 30, 2025
63ca86b
Add PatientNHSNumberLookupWithPendingChanges
thomasleese Apr 21, 2025
6354f29
Enqueue PatientNHSNumberLookupWithPendingChangesJob
thomasleese Apr 21, 2025
bdecdf7
Remove date of death from PDS fixture
thomasleese Apr 21, 2025
c263664
Add a test for uploading twins
thomasleese Apr 21, 2025
1b64b27
Overwrite incoming address if matching postcode, and any incoming add…
alistair-white-horne-tng May 1, 2025
358943f
Add tests
alistair-white-horne-tng May 1, 2025
2e58ba9
Add spec for programme cohorts page, fix sort order
benilovj Apr 30, 2025
f448b50
Add missing length validations
thomasleese Apr 23, 2025
2c2c806
Add missing text field length validation for imports
jhenderson May 2, 2025
361a646
Add vaccine code column to CarePlus vaccination reports
jhenderson May 7, 2025
ee6ff7b
Ensure patients who don't need triage are hidden
thomasleese May 7, 2025
1288b96
Triage from vaccination history requires consent
thomasleese May 8, 2025
d1cf05b
Optimise offline session exporter
jhenderson Apr 30, 2025
5a043ff
Add phone instructions for organisations and teams (#3480)
murugapl May 12, 2025
2a18661
Fix alignment of filters with results (#3530)
thomasleese May 12, 2025
144b0c1
Bump idb from 8.0.2 to 8.0.3
dependabot[bot] May 12, 2025
8a12527
Bump sass from 1.87.0 to 1.88.0
dependabot[bot] May 12, 2025
28c38e8
Bump esbuild from 0.25.3 to 0.25.4
dependabot[bot] May 12, 2025
48b2b95
Bump aws-sdk-s3 from 1.185.0 to 1.186.0
dependabot[bot] May 12, 2025
308eca6
Bump phonelib from 0.10.4 to 0.10.8
dependabot[bot] May 12, 2025
a87b727
Bump shoulda-matchers from 6.4.0 to 6.5.0
dependabot[bot] May 12, 2025
9b37084
Bump csv from 3.3.2 to 3.3.4
dependabot[bot] May 12, 2025
de4e0ed
Bump rspec-rails from 7.1.1 to 8.0.0
dependabot[bot] May 12, 2025
d5adf7f
Bump idb from 8.0.2 to 8.0.3 (#3533)
thomasleese May 13, 2025
7829834
Bump sass from 1.87.0 to 1.88.0 (#3534)
thomasleese May 13, 2025
31b53de
Bump esbuild from 0.25.3 to 0.25.4 (#3535)
thomasleese May 13, 2025
2718280
Bump aws-sdk-s3 from 1.185.0 to 1.186.0 (#3536)
thomasleese May 13, 2025
f699852
Bump phonelib from 0.10.4 to 0.10.8 (#3537)
thomasleese May 13, 2025
dfbadcc
Bump shoulda-matchers from 6.4.0 to 6.5.0 (#3538)
thomasleese May 13, 2025
4412078
Bump csv from 3.3.2 to 3.3.4 (#3539)
thomasleese May 13, 2025
324e32f
Bump rspec-rails from 7.1.1 to 8.0.0 (#3540)
thomasleese May 13, 2025
11cce64
Reorder test params
alistair-white-horne-tng May 7, 2025
e1d1f53
Extract attribute acceptance into its own function
alistair-white-horne-tng May 7, 2025
8c7430f
Add auto acceptance of preferred names
alistair-white-horne-tng May 7, 2025
9958f88
Automatically accept preferred names (#3509)
alistair-white-horne-tng May 13, 2025
c42f335
Use reading width for school moves introduction
paulrobertlloyd May 13, 2025
2ab2f78
Use reading width for school moves introduction (#3542)
thomasleese May 13, 2025
f919bcc
Set batch name length limit to 100 when importing
thomasleese May 13, 2025
bd7eb61
Set batch name length limit to 100 when importing (#3543)
thomasleese May 13, 2025
424a70d
Trim the timestamps being sent to Splunk
misaka May 13, 2025
6ffdd3b
Check if HostingEnvironment is defined for logs
misaka May 13, 2025
4fcb11c
Trim the timestamps being sent to Splunk (#3546)
misaka May 13, 2025
de5ec47
Return list of import files generated
misaka Apr 28, 2025
9b4ffc4
Limit schools to provided URNs
misaka Apr 28, 2025
054bcad
Make Generate::Consents more robust
jhenderson May 1, 2025
5d04373
Make Generate::VaccinationRecords more robust
jhenderson Apr 30, 2025
3be0dca
Allow locations factory to use existing organisation team
jhenderson May 1, 2025
0b5abbc
Add support for generating random nhs numbers
misaka May 1, 2025
9615449
Generate random NHS numbers
misaka May 1, 2025
cc6178f
Only generate cohort imports
misaka May 1, 2025
e64e02f
Allow specifying year_groups to cohort generator
misaka May 1, 2025
0e237ac
Rename PatientImports to CohortImports
misaka May 1, 2025
48df2e9
Ensure we don't have duplicate nhs numbers
misaka May 2, 2025
8307e85
Fix deadline-passed page
misaka May 6, 2025
1ec1cb1
Refactor before_actions for parental consent
misaka May 6, 2025
39b07c5
Add test for parents too slow confirming consent
misaka May 6, 2025
af5c021
Lazy patients for cohort import gneeration
misaka May 13, 2025
5df846c
Improve cohort imports generation docs
misaka May 13, 2025
bb2b211
Deadline passed (#3514)
misaka May 13, 2025
81dae9b
Only select schools with year groups
misaka May 13, 2025
7b4d079
Allow changing consent response from child to parent
thomasleese May 13, 2025
c3c510a
Allow changing consent response from child to parent (#3547)
thomasleese May 13, 2025
58eedcd
Updates to the data generators (#3478)
misaka May 13, 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
34 changes: 17 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ GEM
ast (2.4.3)
attr_required (1.0.2)
aws-eventstream (1.3.2)
aws-partitions (1.1090.0)
aws-partitions (1.1103.0)
aws-sdk-accessanalyzer (1.70.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-core (3.223.0)
aws-sdk-core (3.224.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
Expand All @@ -130,13 +130,13 @@ GEM
aws-sdk-iam (1.120.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-kms (1.100.0)
aws-sdk-kms (1.101.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-rds (1.269.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.185.0)
aws-sdk-s3 (1.186.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -187,7 +187,7 @@ GEM
crass (1.0.6)
cssbundling-rails (1.4.1)
railties (>= 6.0.0)
csv (3.3.2)
csv (3.3.4)
cuprite (0.15.1)
capybara (~> 3.0)
ferrum (~> 0.15.0)
Expand All @@ -202,7 +202,7 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.6.1)
diff-lcs (1.6.2)
discard (1.4.0)
activerecord (>= 4.2, < 9.0)
docile (1.4.0)
Expand Down Expand Up @@ -329,7 +329,7 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
loofah (2.24.0)
loofah (2.24.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand Down Expand Up @@ -416,7 +416,7 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.9)
phonelib (0.10.4)
phonelib (0.10.8)
pp (0.6.2)
prettyprint
prettier_print (1.2.1)
Expand All @@ -432,7 +432,7 @@ GEM
method_source (~> 1.0)
pry-rails (0.3.11)
pry (>= 0.13.0)
psych (5.2.3)
psych (5.2.6)
date
stringio
public_suffix (6.0.1)
Expand Down Expand Up @@ -520,24 +520,24 @@ GEM
rspec-mocks (~> 3.13.0)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
rspec-expectations (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-html-matchers (0.10.0)
nokogiri (~> 1)
rspec (>= 3.0.0.a)
rspec-mocks (3.13.2)
rspec-mocks (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.1.1)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-rails (8.0.0)
actionpack (>= 7.2)
activesupport (>= 7.2)
railties (>= 7.2)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.2)
rspec-support (3.13.3)
rubocop (1.75.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -595,7 +595,7 @@ GEM
sentry-ruby (5.23.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shoulda-matchers (6.4.0)
shoulda-matchers (6.5.0)
activesupport (>= 5.2.0)
simplecov (0.22.0)
docile (~> 1.1)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/_grid.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Search filters and results
.app-grid-column-filters > .nhsuk-card--feature,
.app-grid-column-filters .nhsuk-card--feature.app-filters,
.app-grid-column-results > .nhsuk-card--feature,
.app-grid-column-results > .nhsuk-warning-callout {
margin-top: nhsuk-spacing(3);
Expand Down
22 changes: 22 additions & 0 deletions app/components/app_programme_stats_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="nhsuk-grid-row nhsuk-card-group">
<div class="nhsuk-grid-column-one-third nhsuk-card-group__item">
<%= render AppCardComponent.new(link_to: programme_cohorts_path(@programme), colour: "reversed", data: true) do |card| %>
<% card.with_heading { "Children" } %>
<% card.with_description { patients_count.to_s } %>
<% end %>
</div>

<div class="nhsuk-grid-column-one-third nhsuk-card-group__item">
<%= render AppCardComponent.new(link_to: programme_vaccination_records_path(@programme), colour: "reversed", data: true) do |card| %>
<% card.with_heading { "Vaccinations" } %>
<% card.with_description { vaccinations_count.to_s } %>
<% end %>
</div>

<div class="nhsuk-grid-column-one-third nhsuk-card-group__item">
<%= render AppCardComponent.new(data: true, colour: "reversed") do |card| %>
<% card.with_heading { "Consent requests and reminders sent" } %>
<% card.with_description { consent_notifications_count.to_s } %>
<% end %>
</div>
</div>
20 changes: 20 additions & 0 deletions app/components/app_programme_stats_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

class AppProgrammeStatsComponent < ViewComponent::Base
def initialize(programme:)
super
@programme = programme
end

def patients_count
helpers.policy_scope(Patient).in_programmes([@programme]).count
end

def vaccinations_count
helpers.policy_scope(VaccinationRecord).where(programme: @programme).count
end

def consent_notifications_count
helpers.policy_scope(ConsentNotification).has_programme(@programme).count
end
end
3 changes: 3 additions & 0 deletions app/controllers/cohorts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ def index
.where(birth_academic_year: birth_academic_years)
.group(:birth_academic_year)
.count
.sort
.reverse
.to_h

birth_academic_years.each do |birth_academic_year|
@patient_count_by_birth_academic_year[birth_academic_year] ||= 0
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/concerns/authentication_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ def authenticate_user!
redirect_to start_path
end
elsif cis2_session?
if !selected_cis2_org_is_registered?
redirect_to users_organisation_not_found_path
if !selected_cis2_workgroup_is_valid?
redirect_to users_workgroup_not_found_path
elsif !selected_cis2_role_is_valid?
redirect_to users_role_not_found_path
elsif !selected_cis2_org_is_registered?
redirect_to users_organisation_not_found_path
end
end
end
Expand All @@ -38,8 +40,8 @@ def selected_cis2_org_is_registered?
end

def selected_cis2_workgroup_is_valid?
selected_cis2_nrbac_role.key?("workgroups") &&
CIS2_WORKGROUP.in?(selected_cis2_nrbac_role["workgroups"])
workgroups = session.dig("cis2_info", "selected_role", "workgroups")
workgroups.present? && CIS2_WORKGROUP.in?(workgroups)
end

def valid_cis2_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ class ConsentForms::BaseController < ApplicationController
skip_before_action :authenticate_user!
skip_after_action :verify_policy_scoped

prepend_before_action :set_team
prepend_before_action :set_programmes
prepend_before_action :set_organisation
prepend_before_action :set_session
prepend_before_action :set_consent_form
before_action :authenticate_consent_form_user!
before_action :set_privacy_policy_url
Expand All @@ -16,10 +20,41 @@ def set_consent_form
ConsentForm.includes(:programmes, :vaccines).find(
params[:consent_form_id] || params[:id]
)
@organisation = @consent_form.organisation
@programmes = @consent_form.programmes
@session = @consent_form.original_session
@team = @consent_form.team
end

def set_session
if params[:session_slug]
@session = Session.find_by!(slug: params[:session_slug])
elsif @consent_form.present?
@session = @consent_form.original_session
end
end

def set_organisation
@organisation =
if @consent_form.present?
@consent_form.organisation
elsif @session.present?
@session.organisation
end
end

def set_programmes
@programmes =
if @consent_form.present?
@consent_form.programmes
elsif @session.present? && params[:programme_types].present?
@session.programmes.where(type: params[:programme_types].split("-"))
end
end

def set_team
@team =
if @consent_form.present?
@consent_form.team
elsif @session.present?
@session.team
end
end

def authenticate_consent_form_user!
Expand Down
14 changes: 3 additions & 11 deletions app/controllers/parent_interface/consent_forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module ParentInterface
class ConsentFormsController < ConsentForms::BaseController
include ConsentFormMailerConcern

prepend_before_action :set_session_and_programmes,
only: %i[start create deadline_passed]
skip_before_action :set_consent_form, only: %i[start create deadline_passed]
skip_before_action :authenticate_consent_form_user!,
only: %i[start create deadline_passed]
Expand Down Expand Up @@ -63,21 +61,15 @@ def record

private

def set_session_and_programmes
@session = Session.find_by!(slug: params[:session_slug])
@organisation = @session.organisation
@programmes =
@session.programmes.where(type: params[:programme_types].split("-"))
@team = @session.team
end

def clear_session_edit_variables
session.delete(:follow_up_changes_start_page)
end

def check_if_past_deadline
return if @session.open_for_consent?
redirect_to action: :deadline_passed
redirect_to action: :deadline_passed,
programme_types: @programmes.map(&:type).join("-"),
session_slug: @session.slug
end
end
end
5 changes: 1 addition & 4 deletions app/controllers/patients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ class PatientsController < ApplicationController
before_action :record_access_log_entry, only: %i[show log]

def index
patients =
@form.apply(
policy_scope(Patient).includes(:school).not_deceased.order_by_name
)
patients = @form.apply(policy_scope(Patient).includes(:school).not_deceased)

@pagy, @patients = pagy(patients)

Expand Down
6 changes: 0 additions & 6 deletions app/controllers/programmes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ def index

def show
patients = policy_scope(Patient).in_programmes([@programme])

@patients_count = patients.count
@vaccinations_count =
policy_scope(VaccinationRecord).where(programme: @programme).count
@consent_notifications_count =
@programme.consent_notifications.has_programme(@programme).count
@consents =
policy_scope(Consent).where(patient: patients, programme: @programme)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sessions/triage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Sessions::TriageController < ApplicationController
layout "full"

def show
@statuses = Patient::TriageStatus.statuses.keys - [:not_required]
@statuses = Patient::TriageStatus.statuses.keys - %w[not_required]
@programmes = @session.programmes

scope =
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def cis2
set_cis2_session_info

if !selected_cis2_role_is_valid?
if !selected_cis2_workgroup_is_valid?
redirect_to users_workgroup_not_found_path
elsif !selected_cis2_role_is_valid?
redirect_to users_role_not_found_path
elsif !selected_cis2_org_is_registered?
redirect_to users_organisation_not_found_path
elsif !selected_cis2_workgroup_is_valid?
redirect_to users_workgroup_not_found_path
else
@user = User.find_or_create_from_cis2_oidc(user_cis2_info)

Expand Down
10 changes: 9 additions & 1 deletion app/forms/batch_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ class BatchForm
attribute :name, :string
attribute :expiry, :date

validates :name, presence: true, format: { with: /\A[A-Za-z0-9]+\z/ }
validates :name,
presence: true,
format: {
with: /\A[A-Za-z0-9]+\z/
},
length: {
minimum: 2,
maximum: 100
}

validates :expiry,
comparison: {
Expand Down
9 changes: 9 additions & 0 deletions app/helpers/phone_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module PhoneHelper
def format_phone_with_instructions(entity)
return entity.phone if entity.phone_instructions.blank?

"#{entity.phone} (#{entity.phone_instructions})"
end
end
Loading
Loading