From 051f2d0027fd514165843fded861cbaa9d3c9396 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Tue, 7 Nov 2023 18:10:39 +1100 Subject: [PATCH] Added snomed term to submission df --- .../lambda_code.py | 10 +++++++--- .../lambda_code.py | 17 +++++++++++++---- .../lambdas/layers/lambda_utils/globals.py | 3 +-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/deploy/cttso-ica-to-pieriandx-cdk/lambdas/get_metadata_from_portal_and_defaults_and_launch_validation_workflow/lambda_code.py b/deploy/cttso-ica-to-pieriandx-cdk/lambdas/get_metadata_from_portal_and_defaults_and_launch_validation_workflow/lambda_code.py index baca52b..f58e857 100644 --- a/deploy/cttso-ica-to-pieriandx-cdk/lambdas/get_metadata_from_portal_and_defaults_and_launch_validation_workflow/lambda_code.py +++ b/deploy/cttso-ica-to-pieriandx-cdk/lambdas/get_metadata_from_portal_and_defaults_and_launch_validation_workflow/lambda_code.py @@ -46,7 +46,8 @@ def lambda_handler(event, context): "ica_workflow_run_id": "wfr.123abc", "panel_type": "main", "sample_type": "validation", - "is_identified": False + "is_identified": False | "deidentified", + "disease_name": ""Disseminated malignancy of unknown primary"" } """ @@ -93,13 +94,16 @@ def lambda_handler(event, context): if (is_identified := event.get("is_identified", None)) is None: is_identified = VALIDATION_DEFAULTS["is_identified"] + # Check disease name + if (disease_name := event.get("disease_name", None)) is None: + disease_name = VALIDATION_DEFAULTS["disease_name"] + # Update sample_df with validation defaults sample_df["sample_type"] = sample_type sample_df["panel_type"] = panel_type sample_df["is_identified"] = is_identified + sample_df["disease_name"] = disease_name sample_df["indication"] = VALIDATION_DEFAULTS["indication"] - sample_df["disease_id"] = VALIDATION_DEFAULTS["disease_id"] - sample_df["disease_name"] = VALIDATION_DEFAULTS["disease_name"] sample_df["requesting_physicians_first_name"] = VALIDATION_DEFAULTS["requesting_physicians_first_name"] sample_df["requesting_physicians_last_name"] = VALIDATION_DEFAULTS["requesting_physicians_last_name"] sample_df["specimen_type"] = VALIDATION_DEFAULTS["specimen_type"] diff --git a/deploy/cttso-ica-to-pieriandx-cdk/lambdas/launch_available_payloads_and_update_cttso_lims_sheet/lambda_code.py b/deploy/cttso-ica-to-pieriandx-cdk/lambdas/launch_available_payloads_and_update_cttso_lims_sheet/lambda_code.py index 0e7918c..728c586 100644 --- a/deploy/cttso-ica-to-pieriandx-cdk/lambdas/launch_available_payloads_and_update_cttso_lims_sheet/lambda_code.py +++ b/deploy/cttso-ica-to-pieriandx-cdk/lambdas/launch_available_payloads_and_update_cttso_lims_sheet/lambda_code.py @@ -195,6 +195,7 @@ def get_libraries_for_processing(merged_df) -> pd.DataFrame: * is_identified * needs_redcap * redcap_is_complete + * default_snomed_term """ # Initialise @@ -206,7 +207,8 @@ def get_libraries_for_processing(merged_df) -> pd.DataFrame: "sample_type", "is_identified", "needs_redcap", - "redcap_is_complete" + "redcap_is_complete", + "default_snomed_term" ] # Processing libraries must meet the following criteria @@ -273,6 +275,7 @@ def get_libraries_for_processing(merged_df) -> pd.DataFrame: "sample_type", "is_identified", "needs_redcap" + "default_snomed_term" ] for column_name in new_column_names: @@ -284,14 +287,17 @@ def get_libraries_for_processing(merged_df) -> pd.DataFrame: ] -def submit_library_to_pieriandx(subject_id: str, library_id: str, workflow_run_id: str, lambda_arn: str, panel_type: str, sample_type: str, is_identified: bool): +def submit_library_to_pieriandx(subject_id: str, library_id: str, workflow_run_id: str, lambda_arn: str, panel_type: str, sample_type: str, is_identified: Union[bool | str], default_snomed_term: str): """ Submit library to pieriandx + :param is_identified: + :param sample_type: :param subject_id: :param library_id: :param workflow_run_id: :param lambda_arn: :param panel_type: + :param default_snomed_term :return: """ lambda_client: LambdaClient = get_boto3_lambda_client() @@ -302,7 +308,8 @@ def submit_library_to_pieriandx(subject_id: str, library_id: str, workflow_run_i "ica_workflow_run_id": workflow_run_id, "panel_type": panel_type, "sample_type": sample_type, - "is_identified": is_identified + "is_identified": is_identified, + "disease_name": default_snomed_term } logger.info(f"Launching lambda function {lambda_arn} with the following payload {json.dumps(lambda_payload)}") @@ -361,6 +368,7 @@ def submit_libraries_to_pieriandx(processing_df: pd.DataFrame) -> pd.DataFrame: * is_identified * needs_redcap * redcap_is_complete + * default_snomed_term :return: A pandas dataframe with the following columns * subject_id @@ -411,7 +419,8 @@ def submit_libraries_to_pieriandx(processing_df: pd.DataFrame) -> pd.DataFrame: lambda_arn=row.submission_arn, panel_type=row.panel, sample_type=row.sample_type, - is_identified=row.is_identified + is_identified=row.is_identified, + default_snomed_term=row.default_snomed_term ) except ValueError: pass diff --git a/deploy/cttso-ica-to-pieriandx-cdk/lambdas/layers/lambda_utils/globals.py b/deploy/cttso-ica-to-pieriandx-cdk/lambdas/layers/lambda_utils/globals.py index 5408023..224d37d 100644 --- a/deploy/cttso-ica-to-pieriandx-cdk/lambdas/layers/lambda_utils/globals.py +++ b/deploy/cttso-ica-to-pieriandx-cdk/lambdas/layers/lambda_utils/globals.py @@ -97,7 +97,6 @@ class SampleType(Enum): "sample_type": "validation", "panel_type": PanelType.MAIN, "indication": "NA", - "disease_id": 285645000, "disease_name": "Disseminated malignancy of unknown primary", "is_identified": True, "requesting_physicians_first_name": "Sean", @@ -175,7 +174,7 @@ class SampleType(Enum): EXPECTED_ATTRIBUTES = [ "sample_type", - "disease_id", + "disease_name", "indication", "accession_number", "external_specimen_id",