-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prmdr-370 initial commit * prmdr-370 added checks to validtors * prmdr-370 fix pydantic syntax * fix unit test * small fixes * add unit tests * unit tests * [PRMDR-372] Add model for bulk upload status, add test for parsing records * [PRMDR-372] Modify upload status model for easier interaction with dynamodb * [PRMDR-372] rebase with prmdr-370 * [PRMDR-372] Add unit test for bulk upload reporting, remove unwanted comments * [PRMDR-372] Fix mismatch of env var * [PRMDR-372] fix misspelling, fix missing by_alias=True * Add bulk upload validation for virus scanner * [PRMDR-372] hotfix to use mock pds service in LG validation * [PRMDR-372] replace mocked pds patient ods code * [PRMDR-372] Fix unit test that was broken during merge * [PRMDR-372] run formatter * Merge branch prmdr-369-squash into prmdr-372-subtask * [PRMDR-372] Fix import error * [PRMDR-372] modify bulk upload lambda * [PRMDR-372] Amend send_message_with_nhs_number_attr to have delay_second default as 0 instead of None * Add get object tag unit testt * [PRMDR-369] Add unhappy path test for get_tag_value, minor refactoring * [PRMDR-369] Replace literal strings with enum / constants for virus scan result. Amend logic of check_virus_result to fit ticket description * [PRMDR-369] Add unit tests for check_virus_result, add logic to handle the case when required file not exist in S3 * [PRMDR-372] Amend mock test data of Bulk Upload to fit default mock patient of mock pds service * [PRMDR-372] Add unit tests for bulk upload service * run formatter * [PRMDR-372] Remove redundant handle_invalid_message method * run formatter * [PRMDR-372] Amend test of bulk upload status, use freezegun for patching datetime * [PRMDR-369] Fix incorrect comparison of Enum and str * [PRMDR-372] Amend LG Validator to correctly report the cases for too few files and too many files * [PRMDR-372] Amend LG Validator to give proper failure reason on PDS related errors * [PRMDR-369] Replace base classs StrEnum with (str, Enum) as github action still using python 3.10 * [PRMDR-372] Undo unintended change to non related code * [PRMDR-372] minor change on wordings * [PRMDR-372] Fix bulk upload report lambda possible failure due related to fieldnames issue * [PRMDR-372] Undo unintended change to scss file by linter * [PRMDR-372] patch get_user_ods_code to return mock ODS code in sandboxes * [PRMDR-372] patch get_user_ods_code * [PRMDR-372] Replace generic Exception catch with specific error types * [PRMDR-372] Amend one test, update the catch error types at lambda_handler * [PRMDR-372] Replace custom field name transform function with inflection.camelize * [PRMDR-372] Change function name for clarity: to_capwords --> to_capitalized_camel --------- Co-authored-by: NogaNHS <noga.sasson1@nhs.net> Co-authored-by: Rio Knightley <rio.knightley2@nhs.net>
- Loading branch information
1 parent
987f5d2
commit f0aafa8
Showing
24 changed files
with
782 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from enum import Enum | ||
|
||
|
||
class VirusScanResult(str, Enum): | ||
CLEAN = "Clean" | ||
INFECTED = "Infected" | ||
INFECTED_ALLOWED = "InfectedAllowed" | ||
UNSCANNABLE = "Unscannable" | ||
ERROR = "Error" | ||
|
||
|
||
SCAN_RESULT_TAG_KEY = "scan-result" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from datetime import datetime | ||
from typing import Literal | ||
|
||
from models.config import to_capitalized_camel | ||
from pydantic import BaseModel, ConfigDict, Field | ||
from utils.utilities import create_reference_id | ||
|
||
|
||
class UploadStatusBaseClass(BaseModel): | ||
model_config = ConfigDict( | ||
alias_generator=to_capitalized_camel, populate_by_name=True | ||
) | ||
id: str = Field(alias="ID", default_factory=create_reference_id) | ||
nhs_number: str | ||
timestamp: int = Field(default_factory=lambda: int(datetime.now().timestamp())) | ||
date: str = Field(default_factory=lambda: date_string_yyyymmdd(datetime.now())) | ||
file_path: str | ||
|
||
|
||
class SuccessfulUpload(UploadStatusBaseClass): | ||
upload_status: Literal["complete"] = "complete" | ||
|
||
|
||
class FailedUpload(UploadStatusBaseClass): | ||
upload_status: Literal["failed"] = "failed" | ||
failure_reason: str | ||
|
||
|
||
FieldNamesForBulkUploadReport = [ | ||
"NhsNumber", | ||
"UploadStatus", | ||
"FailureReason", | ||
"FilePath", | ||
"Date", | ||
"Timestamp", | ||
"ID", | ||
] | ||
|
||
|
||
def date_string_yyyymmdd(time_now: datetime) -> str: | ||
return time_now.strftime("%Y-%m-%d") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.