Skip to content

Commit cd53d9b

Browse files
[PRMP-858] Implement new doc upload index page (#909)
1 parent 8f5b61d commit cd53d9b

File tree

12 files changed

+219
-58
lines changed

12 files changed

+219
-58
lines changed

app/src/components/blocks/_documentUpload/documentSelectStage/DocumentSelectStage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ const DocumentSelectStage = ({
298298
></ErrorBox>
299299
)}
300300

301-
<h1>{pageTitle()}</h1>
301+
<h1 data-testid="page-title">{pageTitle()}</h1>
302302

303303
<div className="nhsuk-inset-text">
304304
<p>Make sure that all files uploaded are for this patient only:</p>

app/src/config/documentTypesConfig.json

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,27 @@
33
"name": "Scanned Paper Notes",
44
"snomed_code": "16521000000101",
55
"config_name": "scannedPaperNotesConfig",
6-
"content": [
7-
{
8-
"upload_title": "Scanned Lloyd George notes",
9-
"upload_description": "Upload and add files to a scanned paper Lloyd George record."
10-
}
11-
]
6+
"content": {
7+
"upload_title": "Scanned Lloyd George notes",
8+
"upload_description": "Upload and add files to a scanned paper Lloyd George record."
9+
}
1210
},
1311
{
1412
"name": "Electronic Health Record",
1513
"snomed_code": "16521000000102",
1614
"config_name": "electronicHealthRecordConfig",
17-
"content": [
18-
{
19-
"upload_title": "Electronic health record (EHR) summary",
20-
"upload_description": "Upload the summary file of an electronic health record. You might also call these a 'journal' or 'practice notes'. Upload this suymmary if, for example, GP2GP fails."
21-
}
22-
]
15+
"content": {
16+
"upload_title": "Electronic health record (EHR) summary",
17+
"upload_description": "Upload the summary file of an electronic health record. You might also call these a 'journal' or 'practice notes'. Upload this suymmary if, for example, GP2GP fails."
18+
}
2319
},
2420
{
2521
"name": "Electronic Health Record Attachments",
2622
"snomed_code": "16521000000103",
2723
"config_name": "electronicHealthRecordAttachmentsConfig",
28-
"content": [
29-
{
30-
"upload_title": "Attachments to an electronic health record",
31-
"upload_description": "Upload other files that are part of the patient's EHR on your clinical system. For example, letters, laboratory reports and imaging. Upload these files if, for example GP2GP fails."
32-
}
33-
]
24+
"content": {
25+
"upload_title": "Attachments to an electronic health record",
26+
"upload_description": "Upload other files that are part of the patient's EHR on your clinical system. For example, letters, laboratory reports and imaging. Upload these files if, for example GP2GP fails."
27+
}
3428
}
3529
]

app/src/config/electronicHealthRecordAttachmentsConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"canBeDiscarded": true,
1010
"stitched": false,
1111
"acceptedFileTypes": [],
12-
"content": []
12+
"content": {}
1313
}

app/src/config/electronicHealthRecordConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"canBeDiscarded": true,
1010
"stitched": false,
1111
"acceptedFileTypes": [],
12-
"content": []
12+
"content": {}
1313
}

app/src/config/lloydGeorgeConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"acceptedFileTypes": [
1212
".pdf"
1313
],
14-
"content": []
14+
"content": {}
1515
}

app/src/helpers/utils/documentType.test.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ vi.mock('../../config/lloydGeorgeConfig.json', () => ({
1414
canBeDiscarded: false,
1515
stitched: true,
1616
acceptedFileTypes: ['pdf'],
17-
content: [{ key: 'test', value: 'test' }]
18-
}
17+
content: { test: 'test' },
18+
},
1919
}));
2020

2121
vi.mock('../../config/electronicHealthRecordConfig.json', () => ({
@@ -30,8 +30,8 @@ vi.mock('../../config/electronicHealthRecordConfig.json', () => ({
3030
canBeDiscarded: true,
3131
stitched: false,
3232
acceptedFileTypes: ['xml', 'json'],
33-
content: [{ key: 'ehr', value: 'data' }]
34-
}
33+
content: { ehr: 'data' },
34+
},
3535
}));
3636

3737
vi.mock('../../config/electronicHealthRecordAttachmentsConfig.json', () => ({
@@ -46,8 +46,8 @@ vi.mock('../../config/electronicHealthRecordAttachmentsConfig.json', () => ({
4646
canBeDiscarded: true,
4747
stitched: false,
4848
acceptedFileTypes: ['pdf', 'jpg', 'png'],
49-
content: [{ key: 'attachment', value: 'file' }]
50-
}
49+
content: { attachment: 'file' },
50+
},
5151
}));
5252

5353
describe('documentType', () => {
@@ -61,11 +61,15 @@ describe('documentType', () => {
6161
});
6262

6363
it('should return correct label for EHR_ATTACHMENTS', () => {
64-
expect(getDocumentTypeLabel(DOCUMENT_TYPE.EHR_ATTACHMENTS)).toBe('Electronic health record attachments');
64+
expect(getDocumentTypeLabel(DOCUMENT_TYPE.EHR_ATTACHMENTS)).toBe(
65+
'Electronic health record attachments',
66+
);
6567
});
6668

6769
it('should return correct label for LETTERS_AND_DOCS', () => {
68-
expect(getDocumentTypeLabel(DOCUMENT_TYPE.LETTERS_AND_DOCS)).toBe('Patient letters and documents');
70+
expect(getDocumentTypeLabel(DOCUMENT_TYPE.LETTERS_AND_DOCS)).toBe(
71+
'Patient letters and documents',
72+
);
6973
});
7074

7175
it('should return empty string for unknown document type', () => {
@@ -96,13 +100,15 @@ describe('documentType', () => {
96100
});
97101

98102
it('should throw error for unsupported document type', () => {
99-
expect(() => getConfigForDocType(DOCUMENT_TYPE.LETTERS_AND_DOCS))
100-
.toThrow('No config found for document type: 16521000000104');
103+
expect(() => getConfigForDocType(DOCUMENT_TYPE.LETTERS_AND_DOCS)).toThrow(
104+
'No config found for document type: 16521000000104',
105+
);
101106
});
102107

103108
it('should throw error for unknown document type', () => {
104-
expect(() => getConfigForDocType('unknown' as DOCUMENT_TYPE))
105-
.toThrow('No config found for document type: unknown');
109+
expect(() => getConfigForDocType('unknown' as DOCUMENT_TYPE)).toThrow(
110+
'No config found for document type: unknown',
111+
);
106112
});
107113
});
108-
});
114+
});

app/src/helpers/utils/documentType.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export type DOCUMENT_TYPE_CONFIG = {
2121
canBeDiscarded: boolean;
2222
stitched: boolean;
2323
acceptedFileTypes: string[];
24-
content: { key: string, value: string }[];
25-
}
24+
content: { [key: string]: string };
25+
};
2626

2727
export const getDocumentTypeLabel = (docType: DOCUMENT_TYPE): string => {
2828
switch (docType) {
@@ -50,4 +50,4 @@ export const getConfigForDocType = (docType: DOCUMENT_TYPE): DOCUMENT_TYPE_CONFI
5050
default:
5151
throw new Error(`No config found for document type: ${docType}`);
5252
}
53-
};
53+
};

0 commit comments

Comments
 (0)