Skip to content

Commit

Permalink
Merge branch 'main' into PRMP-1332
Browse files Browse the repository at this point in the history
  • Loading branch information
steph-torres-nhs authored Dec 20, 2024
2 parents 84c17c6 + f87cbc5 commit aa73427
Show file tree
Hide file tree
Showing 23 changed files with 108 additions and 137 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/subscribe-to-mns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ on:
sandbox:
required: true
type: string
secrets:
AWS_ASSUME_ROLE:
required: true
permissions:
pull-requests: write
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
batch_update_build_docker_image:
placeholder:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
defaults:
run:
working-directory: lambdas
steps:
- name: Placeholder
run: |
echo "Running placeholder job on ${inputs.sandbox}"
run: |
echo "Running placeholder job on ${inputs.sandbox}"
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ describe('GP Workflow: View Lloyd George record', () => {
// Assert contents of page when downloading
cy.getByTestId('lloyd-george-download-header').should('exist');
cy.getByTestId('cancel-download-link').should('exist');
cy.getByTestId('download-file-header-' + testFiles.length + '-files').should(
'exist',
);

// Assert contents of page after download
cy.wait('@documentManifestCompleted');
Expand Down Expand Up @@ -225,7 +222,6 @@ describe('GP Workflow: View Lloyd George record', () => {
cy.title().should('eq', downloadingPageTitle);
// Assert contents of page when downloading
cy.getByTestId('lloyd-george-download-header').should('exist');
cy.getByTestId('download-file-header-2-files').should('exist');

cy.getByTestId('cancel-download-link').should('exist');

Expand Down Expand Up @@ -289,8 +285,6 @@ describe('GP Workflow: View Lloyd George record', () => {
cy.title().should('eq', downloadingPageTitle);
// Assert contents of page when downloading
cy.getByTestId('lloyd-george-download-header').should('exist');
cy.getByTestId('download-file-header-1-files').should('exist');

cy.getByTestId('cancel-download-link').should('exist');

// Assert contents of page after download
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ describe('GP Workflow: View Lloyd George record', () => {
assertPatientInfo();
cy.getByTestId('pdf-card')
.should('include.text', 'Lloyd George record')
.should('include.text', 'Last updated: 09 October 2023 at 15:41:38')
.should('include.text', '12 files | File size: 502 KB | File format: PDF');
.should('include.text', 'Last updated: 09 October 2023 at 15:41:38');
cy.getByTestId('pdf-viewer').should('be.visible');

// Act - open full screen view
Expand Down
2 changes: 1 addition & 1 deletion app/cypress/e2e/0-ndr-core-tests/homepage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Home Page', () => {
});

it('displays service banner', { tags: 'regression' }, () => {
cy.get('.govuk-phase-banner__content__tag').should('have.text', 'New Service');
cy.get('.govuk-phase-banner__content__tag').should('have.text', 'New service');
cy.get('.govuk-phase-banner__text').should(
'have.text',
'Your feedback will help us to improve this service.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ describe('LloydGeorgeDownloadStage', () => {

const renderComponent = (history: MemoryHistory, propsOverride?: Partial<Props>) => {
const props: Omit<Props, 'setStage' | 'setDownloadStage'> = {
numberOfFiles: mockPdf.numberOfFiles,
deleteAfterDownload: false,
...propsOverride,
numberOfFiles: mockPdf.numberOfFiles,
};

return render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ function LloydGeorgeDownloadStage({
filename: '',
});
const linkRef = useRef<HTMLAnchorElement | null>(null);

const pageDownloadCountId = 'download-file-header-' + numberOfFiles + '-files';
const mounted = useRef(false);
const navigate = useNavigate();
const { mockLocal } = useConfig();
const patientDetails = usePatient();
const nhsNumber = patientDetails?.nhsNumber ?? '';
const [delayTimer, setDelayTimer] = useState<NodeJS.Timeout>();

const pageDownloadCountId = 'download-file-header-' + numberOfFiles + '-files';

const progressTimer = useMemo(() => {
return new FakeProgress({
timeConstant: timeToComplete,
Expand Down Expand Up @@ -145,7 +143,6 @@ function LloydGeorgeDownloadStage({
navigate,
mockLocal,
selectedDocuments,
numberOfFiles,
]);

const pageHeader = 'Downloading documents';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render, screen } from '@testing-library/react';
import LgRecordDetails, { Props } from './LloydGeorgeRecordDetails';
import { buildLgSearchResult } from '../../../../helpers/test/testBuilders';
import formatFileSize from '../../../../helpers/utils/formatFileSize';

const mockPdf = buildLgSearchResult();

Expand All @@ -19,20 +18,13 @@ describe('LloydGeorgeRecordDetails', () => {
renderComponent();

expect(screen.getByText(`Last updated: ${mockPdf.lastUpdated}`)).toBeInTheDocument();
expect(screen.getByText(`${mockPdf.numberOfFiles} files`)).toBeInTheDocument();
expect(
screen.getByText(`File size: ${formatFileSize(mockPdf.totalFileSizeInBytes)}`),
).toBeInTheDocument();
expect(screen.getByText('File format: PDF')).toBeInTheDocument();
});
});
});

const renderComponent = (propsOverride?: Partial<Props>) => {
const props: Props = {
lastUpdated: mockPdf.lastUpdated,
numberOfFiles: mockPdf.numberOfFiles,
totalFileSizeInBytes: mockPdf.totalFileSizeInBytes,
...propsOverride,
};
return render(<LgRecordDetails {...props} />);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
import React from 'react';
import formatFileSize from '../../../../helpers/utils/formatFileSize';

export type Props = {
lastUpdated: string;
numberOfFiles: number;
totalFileSizeInBytes: number;
};

function LloydGeorgeRecordDetails({ lastUpdated, numberOfFiles, totalFileSizeInBytes }: Props) {
function LloydGeorgeRecordDetails({ lastUpdated }: Props) {
return (
<div className="lloydgeorge_record-details">
<div className="lloydgeorge_record-details_details">
<div className="lloydgeorge_record-details_details--last-updated">
Last updated: {lastUpdated}
</div>
<div className="lloydgeorge_record-details_details--num-files">
<span>{numberOfFiles} files</span>
{' | '}
<span>File size: {formatFileSize(totalFileSizeInBytes)}</span>
{' | '}
<span>File format: PDF</span>
{' |'}
</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import useRole from '../../../../helpers/hooks/useRole';
import useIsBSOL from '../../../../helpers/hooks/useIsBSOL';
import useConfig from '../../../../helpers/hooks/useConfig';
import { act, render, screen, waitFor } from '@testing-library/react';
import formatFileSize from '../../../../helpers/utils/formatFileSize';
import { DOWNLOAD_STAGE } from '../../../../types/generic/downloadStage';
import { getFormattedDate } from '../../../../helpers/utils/formatDate';
import userEvent from '@testing-library/user-event';
Expand Down Expand Up @@ -62,11 +61,6 @@ describe('LloydGeorgeViewRecordStage', () => {
expect(screen.getByText('View in full screen')).toBeInTheDocument();
expect(screen.getByText('Lloyd George record')).toBeInTheDocument();
expect(screen.getByText(`Last updated: ${mockPdf.lastUpdated}`)).toBeInTheDocument();
expect(screen.getByText(`${mockPdf.numberOfFiles} files`)).toBeInTheDocument();
expect(
screen.getByText(`File size: ${formatFileSize(mockPdf.totalFileSizeInBytes)}`),
).toBeInTheDocument();
expect(screen.getByText('File format: PDF')).toBeInTheDocument();

expect(
screen.queryByText('No documents are available for this patient.'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ function LloydGeorgeViewRecordStage({
const recordDetailsProps: RecordDetailsProps = {
downloadStage,
lastUpdated,
numberOfFiles,
totalFileSizeInBytes,
};

const pageHeader = 'Available records';
Expand Down Expand Up @@ -258,17 +256,9 @@ function LloydGeorgeViewRecordStage({
);
}

type RecordDetailsProps = Pick<
Props,
'downloadStage' | 'lastUpdated' | 'numberOfFiles' | 'totalFileSizeInBytes'
>;
type RecordDetailsProps = Pick<Props, 'downloadStage' | 'lastUpdated'>;

const RecordDetails = ({
downloadStage,
lastUpdated,
numberOfFiles,
totalFileSizeInBytes,
}: RecordDetailsProps) => {
const RecordDetails = ({ downloadStage, lastUpdated }: RecordDetailsProps) => {
switch (downloadStage) {
case DOWNLOAD_STAGE.INITIAL:
case DOWNLOAD_STAGE.PENDING:
Expand All @@ -277,8 +267,6 @@ const RecordDetails = ({
case DOWNLOAD_STAGE.SUCCEEDED: {
const detailsProps = {
lastUpdated,
numberOfFiles,
totalFileSizeInBytes,
};
return <LloydGeorgeRecordDetails {...detailsProps} />;
}
Expand Down
5 changes: 4 additions & 1 deletion app/src/components/layout/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ function Footer() {
Privacy notice
</NHSFooter.ListItem>
</NHSFooter.List>
<NHSFooter.Copyright>&copy; {'Crown copyright'}</NHSFooter.Copyright>
{/* TODO - PRMP-1348: Remove hardcoded styling below if no longer required */}
<NHSFooter.Copyright style={{ color: '#231f20' }}>
&copy; {'NHS England'}
</NHSFooter.Copyright>
</NHSFooter>
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/layout/phaseBanner/PhaseBanner.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('PhaseBanner', () => {
it('renders PhaseBanner with content', () => {
renderComponent();

expect(screen.getByText('New Service')).toBeInTheDocument();
expect(screen.getByText('New service')).toBeInTheDocument();

expect(screen.getByText(/Your/i)).toBeInTheDocument();
expect(screen.getByText(/feedback/i)).toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/layout/phaseBanner/PhaseBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function PhaseBanner() {
<div className="nhsuk-width-container">
<div className="govuk-phase-banner__content">
<strong className="govuk-tag govuk-phase-banner__content__tag">
New Service
New service
</strong>
<p className="govuk-phase-banner__text">
Your {linkToFeedbackPage} will help us to improve this service.
Expand Down
21 changes: 0 additions & 21 deletions app/src/pages/lloydGeorgeRecordPage/LloydGeorgeRecordPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '../../helpers/test/testBuilders';
import { getFormattedDate } from '../../helpers/utils/formatDate';
import axios from 'axios';
import formatFileSize from '../../helpers/utils/formatFileSize';
import usePatient from '../../helpers/hooks/usePatient';
import useConfig from '../../helpers/hooks/useConfig';
import useRole from '../../helpers/hooks/useRole';
Expand Down Expand Up @@ -99,20 +98,6 @@ describe('LloydGeorgeRecordPage', () => {
});
});

it('calls refreshRecord and updates state when successful', async () => {
const lgResult = buildLgSearchResult();
mockAxios.post.mockResolvedValue({ data: { jobStatus: 'Complete' } });
mockAxios.get.mockResolvedValue({ data: lgResult });

renderPage(history);

await waitFor(async () => {
expect(screen.getByText(`${lgResult.numberOfFiles} files`)).toBeInTheDocument();
});

expect(screen.getByText('File format: PDF')).toBeInTheDocument();
});

it('renders initial lg record view with no docs available text if lambda return records status is uploading for more than 3 min', async () => {
const errorResponse = {
response: {
Expand Down Expand Up @@ -199,12 +184,6 @@ describe('LloydGeorgeRecordPage', () => {

expect(screen.getByText('Lloyd George record')).toBeInTheDocument();
expect(screen.queryByText('No documents are available')).not.toBeInTheDocument();

expect(screen.getByText(`${lgResult.numberOfFiles} files`)).toBeInTheDocument();
expect(
screen.getByText(`File size: ${formatFileSize(lgResult.totalFileSizeInBytes)}`),
).toBeInTheDocument();
expect(screen.getByText('File format: PDF')).toBeInTheDocument();
});

describe('Accessibility', () => {
Expand Down
4 changes: 4 additions & 0 deletions app/src/styles/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ $hunit: '%';
border: none;
}

.govuk-phase-banner__content__tag {
text-transform: none;
}

.govuk-warning-text__icon {
border: 3px solid $color_nhsuk-yellow;
background: $color_nhsuk-yellow;
Expand Down
19 changes: 14 additions & 5 deletions lambdas/enums/snomed_codes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from enum import StrEnum
from enum import Enum

from pydantic import BaseModel

class SnomedCodesType(StrEnum):
LLOYD_GEORGE = "16521000000101"

class SnomedCode(BaseModel):
code: str
display_name: str

class SnomedCodesCategory(StrEnum):
CARE_PLAN = "734163000"

class SnomedCodes(Enum):
LLOYD_GEORGE = SnomedCode(
code="16521000000101", display_name="Lloyd George record folder"
)
CARE_PLAN = SnomedCode(code="734163000", display_name="Care plan")
GENERAL_MEDICAL_PRACTICE = SnomedCode(
code="1060971000000108", display_name="General practice service"
)
27 changes: 21 additions & 6 deletions lambdas/models/nrl_fhir_document_reference.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Optional

from enums.snomed_codes import SnomedCode, SnomedCodes
from fhir.resources.R4B.documentreference import DocumentReference
from models.nrl_sqs_message import NrlAttachment
from pydantic import BaseModel, ConfigDict
Expand All @@ -10,9 +11,11 @@ class FhirDocumentReference(BaseModel):
model_config = ConfigDict(alias_generator=to_camel)
nhs_number: str
custodian: str
snomed_code_doc_type: str = "None"
snomed_code_category: str = "None"
snomed_code_category_display: str = "Care plan"
snomed_code_doc_type: SnomedCode = SnomedCodes.LLOYD_GEORGE.value
snomed_code_category: SnomedCode = SnomedCodes.CARE_PLAN.value
snomed_code_practice_setting: SnomedCode = (
SnomedCodes.GENERAL_MEDICAL_PRACTICE.value
)
attachment: Optional[NrlAttachment] = NrlAttachment()

def build_fhir_dict(self):
Expand All @@ -36,7 +39,8 @@ def build_fhir_dict(self):
"coding": [
{
"system": snomed_url,
"code": self.snomed_code_doc_type,
"code": self.snomed_code_doc_type.code,
"display": self.snomed_code_doc_type.display_name,
}
]
},
Expand All @@ -45,8 +49,8 @@ def build_fhir_dict(self):
"coding": [
{
"system": snomed_url,
"code": self.snomed_code_category,
"display": self.snomed_code_category_display,
"code": self.snomed_code_category.code,
"display": self.snomed_code_category.display_name,
}
]
}
Expand All @@ -71,5 +75,16 @@ def build_fhir_dict(self):
},
}
],
"context": {
"practiceSetting": {
"coding": [
{
"system": snomed_url,
"code": self.snomed_code_practice_setting.code,
"display": self.snomed_code_practice_setting.display_name,
}
]
}
},
}
return DocumentReference(**structure_json)
Loading

0 comments on commit aa73427

Please sign in to comment.