Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #187 from umccr/bugfix/coerce-isidentified-to-boolean
Browse files Browse the repository at this point in the history
Coerce is_identified to boolean
  • Loading branch information
alexiswl authored Nov 22, 2023
2 parents 1cc4810 + 51dad3b commit d4df8b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,16 @@ def lambda_handler(event, context):
sample_type = VALIDATION_DEFAULTS["sample_type"]

# Get is identified
is_identified: str
is_identified: any # Union[str | bool] not supported in python=3.9
if (is_identified := event.get("is_identified", None)) is None:
is_identified = VALIDATION_DEFAULTS["is_identified"]

# Coerce is_identified to a boolean value
if isinstance(is_identified, str) and is_identified == 'identified':
is_identified = True
elif isinstance(is_identified, str) and is_identified == 'deidentified':
is_identified = False

# Check disease name
if (disease_name := event.get("disease_name", None)) is None:
disease_name = VALIDATION_DEFAULTS["disease_name"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,16 @@ def lambda_handler(event, context):
if (sample_type := event.get("sample_type", None)) is None:
sample_type = CLINICAL_DEFAULTS["sample_type"].name.lower()

is_identified: any # Union[str | bool] not supported in python=3.9
if (is_identified := event.get("is_identified", None)) is None:
is_identified = CLINICAL_DEFAULTS["is_identified"].name.lower()

# Coerce is_identified to a boolean value
if isinstance(is_identified, str) and is_identified == 'identified':
is_identified = True
elif isinstance(is_identified, str) and is_identified == 'deidentified':
is_identified = False

# Set panel type (if not null)
merged_df["panel_type"] = panel_type
merged_df["sample_type"] = sample_type
Expand Down

0 comments on commit d4df8b3

Please sign in to comment.