Skip to content

Commit ab6d112

Browse files
Merge remote-tracking branch 'origin/main' into PRMP-1057-2
2 parents 11327c7 + f92c1a2 commit ab6d112

File tree

70 files changed

+2313
-730
lines changed

Some content is hidden

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

70 files changed

+2313
-730
lines changed

.github/workflows/base-run-bulk-upload.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ on:
3535
required: false
3636
type: "string"
3737
default: "3"
38+
lambda_type:
39+
description: "Which lambda to trigger (BulkUploadMetadataLambda or BulkUploadMetadataProcessor)"
40+
required: false
41+
type: "string"
42+
default: "BulkUploadMetadataLambda"
43+
run_bulk_upload_setup:
44+
description: "Run bulk upload setup step"
45+
required: false
46+
type: "boolean"
47+
default: true
48+
run_document_review_setup:
49+
description: "Run document review setup step"
50+
required: false
51+
type: "boolean"
52+
default: true
3853
secrets:
3954
AWS_ASSUME_ROLE:
4055
required: true
@@ -67,6 +82,7 @@ jobs:
6782
working-directory: ./tests/bulk-upload/scripts
6883

6984
- name: Setup Bulk Upload
85+
if: ${{ inputs.run_bulk_upload_setup }}
7086
run: |
7187
python setup_bulk_upload.py \
7288
--environment "${{ inputs.sandbox }}" \
@@ -80,6 +96,7 @@ jobs:
8096
working-directory: ./tests/bulk-upload/scripts
8197

8298
- name: Setup Document Review
99+
if: ${{ inputs.run_document_review_setup }}
83100
run: |
84101
python setup_document_review.py
85102
working-directory: ./tests/bulk-upload/scripts
@@ -90,5 +107,6 @@ jobs:
90107
run: |
91108
python run_bulk_upload.py \
92109
--environment "${{ inputs.sandbox }}" \
110+
--lambda-type "${{ inputs.lambda_type }}" \
93111
--start-bulk-upload
94112
working-directory: ./tests/bulk-upload/scripts

.github/workflows/full-deploy-to-sandbox.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ on:
2525
required: true
2626
type: boolean
2727
default: false
28+
lambda_type:
29+
description: "Which lambda to trigger for bulk upload (only applies if bulk_upload is true)"
30+
required: false
31+
type: choice
32+
options:
33+
- "Bulk upload metadata"
34+
- "NEW bulk metadata processor"
35+
default: "Bulk upload metadata"
2836
disable_pds:
2937
description: "Do you want to disable the PDS stub?"
3038
required: true
@@ -169,5 +177,6 @@ jobs:
169177
combi_settings: "combi300"
170178
base_branch: ${{ inputs.build_branch }}
171179
file_count: "3"
180+
lambda_type: ${{ inputs.lambda_type == 'NEW bulk metadata processor' && 'BulkUploadMetadataProcessor' || 'BulkUploadMetadataLambda' }}
172181
secrets:
173182
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}

.github/workflows/run-bulk-upload-dev.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Run Bulk Upload - Dev
22

3-
run-name: "${{ github.event.inputs.sandbox }} | ${{ github.event.inputs.combi_settings }} | ${{ github.event.inputs.file_count }}"
3+
run-name: "${{ github.event.inputs.sandbox }} | ${{ github.event.inputs.combi_settings }} | ${{ github.event.inputs.file_count }} | ${{ github.event.inputs.lambda_type }}"
44

55
permissions:
66
pull-requests: write
@@ -27,6 +27,14 @@ on:
2727
required: true
2828
type: "string"
2929
default: "3"
30+
lambda_type:
31+
description: "Which lambda to trigger"
32+
required: true
33+
type: choice
34+
options:
35+
- "BulkUploadMetadataLambda"
36+
- "BulkUploadMetadataProcessor"
37+
default: "BulkUploadMetadataLambda"
3038

3139
jobs:
3240
bulk_upload:
@@ -36,5 +44,6 @@ jobs:
3644
sandbox: "${{ inputs.sandbox }}"
3745
combi_settings: "${{ inputs.combi_settings }}"
3846
file_count: "${{ inputs.file_count }}"
47+
lambda_type: "${{ inputs.lambda_type }}"
3948
secrets:
4049
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}

app/src/components/blocks/_admin/reviewDetailsAssessmentStage/ReviewDetailsAssessmentStage.test.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import * as getReviewsModule from '../../../../helpers/requests/getReviews';
1414
import { DOCUMENT_TYPE } from '../../../../helpers/utils/documentType';
1515

1616
const mockedUseNavigate = vi.fn();
17+
const mockSetPatientDetails = vi.fn();
18+
const mockUsePatientDetailsContext = vi.fn();
1719

1820
vi.mock('../../../../helpers/utils/getPdfObjectUrl', () => ({
1921
getPdfObjectUrl: vi.fn().mockResolvedValue(200),
@@ -91,6 +93,10 @@ vi.mock(
9193
}),
9294
);
9395

96+
vi.mock('../../../../providers/patientProvider/PatientProvider', () => ({
97+
usePatientDetailsContext: (): unknown => mockUsePatientDetailsContext(),
98+
}));
99+
94100
const mockSetReviewData = vi.fn();
95101
const mockSetDownloadStage = vi.fn();
96102

@@ -175,6 +181,8 @@ describe('ReviewDetailsAssessmentPage', () => {
175181

176182
describe('Rendering', () => {
177183
it('displays spinner when reviewData is null', () => {
184+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
185+
178186
render(
179187
<ReviewDetailsAssessmentStage
180188
reviewData={null}
@@ -190,6 +198,8 @@ describe('ReviewDetailsAssessmentPage', () => {
190198
});
191199

192200
it('displays spinner only when uploadDocuments is null/undefined or reviewData is null', () => {
201+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
202+
193203
const { rerender } = render(
194204
<ReviewDetailsAssessmentStage
195205
reviewData={null}
@@ -220,6 +230,8 @@ describe('ReviewDetailsAssessmentPage', () => {
220230
});
221231

222232
it('renders page title for review with existing and new files', () => {
233+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
234+
223235
render(
224236
<ReviewDetailsAssessmentStage
225237
reviewData={createMockReviewData(true, true, true)}
@@ -237,6 +249,8 @@ describe('ReviewDetailsAssessmentPage', () => {
237249
});
238250

239251
it('renders accept/reject radio buttons when only canBeDiscarded is true', () => {
252+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
253+
240254
render(
241255
<ReviewDetailsAssessmentStage
242256
reviewData={createMockReviewData(
@@ -258,6 +272,8 @@ describe('ReviewDetailsAssessmentPage', () => {
258272
});
259273

260274
it('renders add-all and choose-files radio buttons when no existing record', () => {
275+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
276+
261277
render(
262278
<ReviewDetailsAssessmentStage
263279
reviewData={createMockReviewData(true, true, false)}
@@ -277,6 +293,8 @@ describe('ReviewDetailsAssessmentPage', () => {
277293
});
278294

279295
it('renders all radio options when has existing record in storage', () => {
296+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
297+
280298
render(
281299
<ReviewDetailsAssessmentStage
282300
reviewData={createMockReviewData(true, true, true)}
@@ -304,6 +322,8 @@ describe('ReviewDetailsAssessmentPage', () => {
304322
});
305323

306324
it('displays existing files table when available', () => {
325+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
326+
307327
render(
308328
<ReviewDetailsAssessmentStage
309329
reviewData={createMockReviewData(true, true, true)}
@@ -319,6 +339,8 @@ describe('ReviewDetailsAssessmentPage', () => {
319339
});
320340

321341
it('displays new files table', () => {
342+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
343+
322344
render(
323345
<ReviewDetailsAssessmentStage
324346
reviewData={createMockReviewData(true, true, true)}
@@ -336,6 +358,8 @@ describe('ReviewDetailsAssessmentPage', () => {
336358
});
337359

338360
it('displays "all files" viewing message by default', () => {
361+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
362+
339363
render(
340364
<ReviewDetailsAssessmentStage
341365
reviewData={createMockReviewData()}
@@ -349,6 +373,26 @@ describe('ReviewDetailsAssessmentPage', () => {
349373

350374
expect(screen.getByText('You are currently viewing: all files')).toBeInTheDocument();
351375
});
376+
377+
it('displays patient demographics', async () => {
378+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
379+
380+
render(
381+
<ReviewDetailsAssessmentStage
382+
reviewData={createMockReviewData()}
383+
setReviewData={mockSetReviewData}
384+
uploadDocuments={createMockUploadDocuments()}
385+
downloadStage={DOWNLOAD_STAGE.SUCCEEDED}
386+
setDownloadStage={mockSetDownloadStage}
387+
hasExistingRecordInStorage={false}
388+
/>,
389+
);
390+
391+
expect(screen.getByTestId('patient-summary')).toBeInTheDocument();
392+
expect(screen.getByTestId('patient-summary-full-name')).toBeInTheDocument();
393+
expect(screen.getByTestId('patient-summary-nhs-number')).toBeInTheDocument();
394+
expect(screen.getByTestId('patient-summary-date-of-birth')).toBeInTheDocument();
395+
});
352396
});
353397

354398
describe('File viewing', () => {

app/src/components/blocks/_admin/reviewDetailsAssessmentStage/ReviewDetailsAssessmentStage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import DocumentUploadLloydGeorgePreview from '../../_documentUpload/documentUploadLloydGeorgePreview/DocumentUploadLloydGeorgePreview';
2828
import { AxiosError } from 'axios';
2929
import { errorToParams } from '../../../../helpers/utils/errorToParams';
30+
import PatientSummary, { PatientInfo } from '../../../generic/patientSummary/PatientSummary';
3031

3132
type FileAction = 'add-all' | 'choose-files' | 'duplicate' | 'accept' | 'reject' | '';
3233

@@ -327,6 +328,14 @@ const ReviewDetailsAssessmentStage = ({
327328

328329
<h1>{pageTitle}</h1>
329330

331+
<div className="nhsuk-inset-text">
332+
<PatientSummary>
333+
<PatientSummary.Child item={PatientInfo.FULL_NAME} />
334+
<PatientSummary.Child item={PatientInfo.NHS_NUMBER} />
335+
<PatientSummary.Child item={PatientInfo.BIRTH_DATE} />
336+
</PatientSummary>
337+
</div>
338+
330339
{canBeUpdatedAndDiscarded && reviewData.existingFiles!.length > 0 && (
331340
<ExistingRecordTable
332341
existingFiles={reviewData.existingFiles!}

app/src/components/blocks/_admin/reviewDetailsFileSelectStage/ReviewDetailsFileSelectStage.test.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ vi.mock('../../../../helpers/hooks/useTitle', () => ({
1818
}));
1919

2020
const mockNavigate = vi.fn();
21+
const mockSetPatientDetails = vi.fn();
22+
const mockUsePatientDetailsContext = vi.fn();
2123
const mockReviewId = 'test-review-123';
2224
let currentReviewId: string | undefined = mockReviewId;
2325

@@ -30,6 +32,10 @@ vi.mock('react-router-dom', async (): Promise<unknown> => {
3032
};
3133
});
3234

35+
vi.mock('../../../../providers/patientProvider/PatientProvider', () => ({
36+
usePatientDetailsContext: (): unknown => mockUsePatientDetailsContext(),
37+
}));
38+
3339
const mockGetConfigForDocType = getConfigForDocType as Mock;
3440

3541
const makeReviewDoc = (
@@ -76,6 +82,8 @@ describe('ReviewDetailsFileSelectStage', () => {
7682
});
7783

7884
it('renders a spinner when reviewData is null', () => {
85+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
86+
7987
render(
8088
<ReviewDetailsFileSelectStage
8189
reviewData={null}
@@ -88,6 +96,8 @@ describe('ReviewDetailsFileSelectStage', () => {
8896
});
8997

9098
it('renders heading and only shows REVIEW documents in the table', () => {
99+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
100+
91101
const documents: ReviewUploadDocument[] = [
92102
makeReviewDoc('file1.pdf', DOCUMENT_UPLOAD_STATE.UNSELECTED, UploadDocumentType.REVIEW),
93103
makeReviewDoc(
@@ -116,7 +126,36 @@ describe('ReviewDetailsFileSelectStage', () => {
116126
expect(screen.queryByText('existing.pdf')).not.toBeInTheDocument();
117127
});
118128

129+
it('renders patient demograhics', () => {
130+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
131+
132+
const documents: ReviewUploadDocument[] = [
133+
makeReviewDoc('file1.pdf', DOCUMENT_UPLOAD_STATE.UNSELECTED, UploadDocumentType.REVIEW),
134+
makeReviewDoc(
135+
'existing.pdf',
136+
DOCUMENT_UPLOAD_STATE.UNSELECTED,
137+
UploadDocumentType.EXISTING,
138+
),
139+
];
140+
141+
render(
142+
<ReviewDetailsFileSelectStage
143+
reviewData={mockReviewData}
144+
uploadDocuments={documents}
145+
setUploadDocuments={vi.fn() as any}
146+
/>,
147+
);
148+
149+
expect(screen.getByTestId('patient-summary')).toBeInTheDocument();
150+
expect(screen.getByTestId('patient-summary-full-name')).toBeInTheDocument();
151+
expect(screen.getByTestId('patient-summary-nhs-number')).toBeInTheDocument();
152+
expect(screen.getByTestId('patient-summary-date-of-birth')).toBeInTheDocument();
153+
154+
});
155+
119156
it('allows viewing a selected file and passes the object URL to the PDF viewer', async () => {
157+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
158+
120159
const user = userEvent.setup();
121160
const documents: ReviewUploadDocument[] = [
122161
makeReviewDoc('file1.pdf', DOCUMENT_UPLOAD_STATE.UNSELECTED, UploadDocumentType.REVIEW),
@@ -165,6 +204,8 @@ describe('ReviewDetailsFileSelectStage', () => {
165204
});
166205

167206
it('clears the error summary after selecting a file', async () => {
207+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
208+
168209
const user = userEvent.setup();
169210
const initialDocs: ReviewUploadDocument[] = [
170211
makeReviewDoc('file1.pdf', DOCUMENT_UPLOAD_STATE.UNSELECTED, UploadDocumentType.REVIEW),
@@ -194,6 +235,8 @@ describe('ReviewDetailsFileSelectStage', () => {
194235
});
195236

196237
it('navigates to add-more-choice when all files are selected', async () => {
238+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
239+
197240
const user = userEvent.setup();
198241
const initialDocs: ReviewUploadDocument[] = [
199242
makeReviewDoc('file1.pdf', DOCUMENT_UPLOAD_STATE.SELECTED, UploadDocumentType.REVIEW),
@@ -217,6 +260,8 @@ describe('ReviewDetailsFileSelectStage', () => {
217260
});
218261

219262
it('navigates to download-choice when some files are unselected', async () => {
263+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
264+
220265
const user = userEvent.setup();
221266
const initialDocs: ReviewUploadDocument[] = [
222267
makeReviewDoc('file1.pdf', DOCUMENT_UPLOAD_STATE.SELECTED, UploadDocumentType.REVIEW),
@@ -238,6 +283,8 @@ describe('ReviewDetailsFileSelectStage', () => {
238283
});
239284

240285
it('does not navigate if reviewId is missing', async () => {
286+
mockUsePatientDetailsContext.mockReturnValue([null, mockSetPatientDetails]);
287+
241288
const user = userEvent.setup();
242289
currentReviewId = undefined;
243290

app/src/components/blocks/_admin/reviewDetailsFileSelectStage/ReviewDetailsFileSelectStage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ReviewUploadDocument,
1414
UploadDocumentType,
1515
} from '../../../../types/pages/UploadDocumentsPage/types';
16+
import PatientSummary, { PatientInfo } from '../../../generic/patientSummary/PatientSummary';
1617

1718
export type ReviewDetailsFileSelectStageProps = {
1819
reviewData: ReviewDetails | null;
@@ -142,6 +143,14 @@ const ReviewDetailsFileSelectStage = ({
142143

143144
<h1>Choose files to add to the existing {reviewTypeLabel.toSentenceCase()}</h1>
144145

146+
<div className="nhsuk-inset-text">
147+
<PatientSummary>
148+
<PatientSummary.Child item={PatientInfo.FULL_NAME} />
149+
<PatientSummary.Child item={PatientInfo.NHS_NUMBER} />
150+
<PatientSummary.Child item={PatientInfo.BIRTH_DATE} />
151+
</PatientSummary>
152+
</div>
153+
145154
<section id="new-files-table" className="new-files mb-4">
146155
<h2>New files</h2>
147156
<form>

0 commit comments

Comments
 (0)