Skip to content

Commit

Permalink
PRMDR-270 & PRMDR-268 (#73)
Browse files Browse the repository at this point in the history
* [PRMDR-270] Start working with pdf stitching

* [PRMDR-270]

Committing a working example

* [PRMDR-270]

WIP committing what's been done so far.

* [PRMDR-270]

WIP adding tests

* [PRMDR-270]

WIP adding tests

* [PRMDR-270]

WIP adding tests

* [PRMDR-270] WIP Adding tests to sort LG file names in order

Co-authored-by: AlexHerbertNHS <alexandra.herbert1@nhs.net>

* [PRMDR-270]

WIP more tests

* [PRMDR-270]

WIP refactoring tests

* [PRMDR-270]

WIP refactoring tests

* [PRMDR-270]

WIP Adding functionality to check the number of records is as expected, and warn if not

* [PRMDR-270]

Removing unnecessary comment

* [PRMDR-270]

WIP committing what I've done to switch pairing

* [PRMDR-270] WIP Adding test for happy path

Co-authored-by: AlexHerbertNHS <alexandra.herbert1@nhs.net>

* [PRMDR-270] Add basic test for happy path, config neccessary mocks

* [PRMDR-270] Extract pdf stitching to a service, change to stitch pdf file in local file rather than in memory

* [PRMDR-270] Add pypdf to requirements.txt

* [PRMDR-270] Fix ruff warnings

* [PRMDR-270] Fix path issue

* [PRMDR-270] comment out local POC test files

* [PRMDR-270] add missing region name to dynamodb service

* [PRMDR-270] Fix improperly mocked dynamodb

* [PRMDR-270] Remove accidentally added stitched pdf file

* [PRMDR-270] Checked lambda working as expected on sandbox. Tidy up exception handling

* [PRMDR-270] Checked lambda working as expected on sandbox. Tidy up exception handling

* [PRMDR-270] Improve unit test for lambda, add test for pdf stitch service

* [PRMDR-270] Run formatter

* [PRMDR-268] create new page for LG view with patient details and update patient results page to navigate to it

* [PRMDR-268] add Card component to LG page

* [PRMDR-268] add search function to LG page and LG record request to helpers

* [PRMDR-268] update patient results page test with new route

* [PRMDR-268] add pdf viewer component which uses the pdfobject package to display an embedded test pdf

* [PRMDR-268] WIP -add pdf viewer component which uses the pdfobject package to display an embedded test pdf, need to update tests

* [PRMDR-270] Minor amend to unit test, remove commented out code

* [PRMDR-270] Add github action for deploy lambda to sandbox

* [PRMDR-268] amend test

* [PRMDR-270]

Adding new lambda into every workflow

* [PRMDR-270] Amend some error handling

Co-authored-by: AlexHerbertNHS <alexandra.herbert1@nhs.net>

* [PRMDR-268] add radio buttons to patient result page and amend/add tests

* [PRMDR-268] add style changes to LG record page and tidy up pdf viewer

* [PRMDR-268] add style changes to patient result page and fix tests

* [PRMDR-270] Amend LG stitch lambda to accomodate S3 file structure change in createDocRef lambda, use tempfile.mkdtemp() when downloading LG files from S3

* [PRMDR-268]

Updating the URL to allow downloading of stitched documents instead of just getting a static PDF

* [PRMDR-268]

Enabling the function to stitch the Lloyd George instead of displaying a static PDF

* [PRMDR-268] Edit LG record page to load presign url from lambda

* [PRMDR-270] Amend uploading method for stitched lloyd george to allow pdf file displayed inline

* [PRMDR-270] Amend LG stitch lambda to return number of files and last updated date along with presigned url

* [PRMDR-268] Amend LloydGeorgeRecordPage to display number of file and last updated date, add a loading notice while waiting lambda response

* [PRMDR-270]

Ensuring that the stitched PDF lifecycle tag is set appropriately

* [PRMDR-270]

fix for failing test

* [PRMDR-268] add test for pdf viewer

* [PRMDR-268] add unit test for LG page

* [PRMDR-268] add file size to LG page

* [PRMDR-268] add file size to LG page - fix

* [PRMDR-268] add file size to LG page - fix

* [PRMDR-270]

Attempting to upload to directory of nhs number

* [PRMDR-270] Add total_file_size to response of LloydGeorgeStitch lambda

* [PRMDR-270] Extract logic of patientId checking to decorator

* [PRMDR-270] Extract logic of env var checking to decorator

* [PRMDR-268] create new page for LG view with patient details and update patient results page to navigate to it

* [PRMDR-268] add Card component to LG page

* [PRMDR-268] add search function to LG page and LG record request to helpers

* [PRMDR-268] update patient results page test with new route

* [PRMDR-268] add pdf viewer component which uses the pdfobject package to display an embedded test pdf

* [PRMDR-268] WIP -add pdf viewer component which uses the pdfobject package to display an embedded test pdf, need to update tests

* [PRMDR-268] amend test

* [PRMDR-268] add radio buttons to patient result page and amend/add tests

* [PRMDR-268] add style changes to LG record page and tidy up pdf viewer

* [PRMDR-268] add style changes to patient result page and fix tests

* [PRMDR-268]

Updating the URL to allow downloading of stitched documents instead of just getting a static PDF

* [PRMDR-268]

Enabling the function to stitch the Lloyd George instead of displaying a static PDF

* [PRMDR-268] Edit LG record page to load presign url from lambda

* [PRMDR-268] Amend LloydGeorgeRecordPage to display number of file and last updated date, add a loading notice while waiting lambda response

* [PRMDR-268] add test for pdf viewer

* [PRMDR-268] add unit test for LG page

* [PRMDR-268] add file size to LG page

* [PRMDR-268] add file size to LG page - fix

* [PRMDR-268] add file size to LG page - fix

* [PRMDR-268] WIP - add unit tests

* [PRMDR-268] remove unnecessary dependencies from useEffect

* [PRMDR-268] fix tests and remove console log

* [PRMDR-270] fix failing e2e tests

* [PRMDR-270] Remove unused import

* [PRMDR-270] changes for code review

* [PRMDR-270] fix pipeline errors

* [PRMDR-270] Update lambdas-dev-to-main-ci.yml for Lloyd George stitch lambda

* [PRMDR-270] bugfix at uploading file to s3

* Fix the issue of frontend uploadDocuments repeat call for n * n times

---------

Co-authored-by: AlexHerbertNHS <alexandra.herbert1@nhs.net>
Co-authored-by: RachelHowellNHS <rachel.howell6@nhs.net>
  • Loading branch information
3 people authored Oct 6, 2023
1 parent f892f81 commit 4c0fc79
Show file tree
Hide file tree
Showing 44 changed files with 1,508 additions and 38 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/full-lambdas-dispatch-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,41 @@ jobs:
function_name: ${{ github.event.client_payload.sandbox }}_SearchDocumentReferencesLambda
zip_file: package_lambdas_document_reference_search_handler.zip


python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: ${{ github.event.client_payload.environment }}
needs: ["python_lambdas_test"]
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environement
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.client_payload.sandbox }}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
41 changes: 40 additions & 1 deletion .github/workflows/lambdas-deploy-feature-to-sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environement
- name: Make virtual environment
run: |
make env
Expand Down Expand Up @@ -371,3 +371,42 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LogoutHandler
zip_file: package_lambdas_logout_handler.zip

python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: development
needs: ["python_lambdas_test"]
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environment
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
39 changes: 39 additions & 0 deletions .github/workflows/lambdas-deploy-to-perf-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,42 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LogoutHandler
zip_file: package_lambdas_logout_handler.zip

python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: perf
needs: ["python_lambdas_test"]
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environment
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
43 changes: 42 additions & 1 deletion .github/workflows/lambdas-deploy-to-pre-prod-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Make virtual environement
run: |
run: |
make env
- name: Start virtual environement
Expand Down Expand Up @@ -408,3 +408,44 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LogoutHandler
zip_file: package_lambdas_logout_handler.zip

python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: development
needs: [ "python_lambdas_test" ]
strategy:
matrix:
python-version: [ "3.11" ]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{needs.tag_and_release.outputs.tag}}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environment
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
41 changes: 41 additions & 0 deletions .github/workflows/lambdas-deploy-to-prod-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,44 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LogoutHandler
zip_file: package_lambdas_logout_handler.zip

python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: prod
needs: ["python_lambdas_test"]
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tagVersion}}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environment
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ github.event.inputs.sandboxWorkspace}}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
41 changes: 41 additions & 0 deletions .github/workflows/lambdas-deploy-to-test-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,44 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ vars.BUILD_ENV }}_LogoutHandler
zip_file: package_lambdas_logout_handler.zip

python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: test
needs: ["python_lambdas_test"]
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.buildBranch}}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environment
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ vars.BUILD_ENV}}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
52 changes: 52 additions & 0 deletions .github/workflows/lambdas-dev-to-main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
token_changed: ${{steps.filter.outputs.token}}
authoriser_changed: ${{steps.filter.outputs.authoriser}}
logout_changed: ${{steps.filter.outputs.logout}}
lloyd_george_stitch_changed: ${{steps.filter.outputs.lloyd_george_stitch}}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -67,6 +68,9 @@ jobs:
- 'lambdas/handlers/authoriser_handler.py'
logout:
- 'lambdas/handlers/logout_handler.py'
lloyd_george_stitch:
- 'lambdas/handlers/lloyd_george_record_stitch.py'


Expand Down Expand Up @@ -481,3 +485,51 @@ jobs:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ vars.BUILD_ENV }_LogoutHandler
zip_file: package_lambdas_logout_handler.zip


python_deploy_lloyd_george_record_stitch_lambda:
runs-on: ubuntu-latest
environment: development
needs: [ "python_lambdas_test", "identify_changed_functions" ]
if: |
(github.ref == 'refs/heads/main')
&& (needs.identify_changed_functions.outputs.utils_changed == 'true'
|| needs.identify_changed_functions.outputs.enums_changed == 'true'
|| needs.identify_changed_functions.outputs.services_changed == 'true'
|| needs.identify_changed_functions.outputs.models_changed == 'true'
|| needs.identify_changed_functions.outputs.lloyd_george_stitch_changed == 'true'
)
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Make virtual environment
run: |
make env
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}

- name: Create release package for Lloyd George Stitch Lambda
run: |
make lambda_name=lloyd_george_record_stitch_handler zip
- name: Upload Lambda Function for LloydGeorgeStitchLambda
uses: appleboy/lambda-action@master
with:
aws_region: ${{ vars.AWS_REGION }}
function_name: ${{ vars.BUILD_ENV}}_LloydGeorgeStitchLambda
zip_file: package_lambdas_lloyd_george_record_stitch_handler.zip
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ node_modules/
*.zip
.idea/
.vscode/

lambdas/tests/unit/helpers/data/pdf/tmp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('GP Upload Workflow Step 1: Patient search and verify', () => {
cy.wait('@search');
};

it('(Smoke test) shows patient upload screen when patient search is used by a GP', () => {
it('(Smoke test) shows patient upload screen when patient search is used by a GP and Inactive patient radio button is selected', () => {
navigateToSearch(roles.GP);

if (!smokeTest) {
Expand All @@ -93,8 +93,9 @@ describe('GP Upload Workflow Step 1: Patient search and verify', () => {
cy.get('#gp-message').should('be.visible');
cy.get('#gp-message').should(
'have.text',
'Ensure these patient details match the electronic health records and attachments you are about to upload.',
'Ensure these patient details match the records and attachments that you upload',
);
cy.get('#inactive-radio-button').click();
cy.get('#verify-submit').click();

cy.url().should('include', 'submit');
Expand Down Expand Up @@ -124,8 +125,9 @@ describe('GP Upload Workflow Step 1: Patient search and verify', () => {
cy.get('#error-box-summary').should('have.text', 'There is a problem');
});

it('shows the upload documents page when upload patient is verified', () => {
it('shows the upload documents page when upload patient is verified and Inactive patient radio button selected', () => {
navigateToVerify(roles.GP);
cy.get('#inactive-radio-button').click();
cy.get('#verify-submit').click();

cy.url().should('include', 'submit');
Expand Down
Loading

0 comments on commit 4c0fc79

Please sign in to comment.