From 525de49db9e97714a47975182f014e4daeebbfd9 Mon Sep 17 00:00:00 2001 From: Tamara Slosarek Date: Tue, 15 Oct 2024 20:17:06 +0200 Subject: [PATCH] feat(#639): add brand name comma check --- scripts/README.md | 1 + scripts/analyze.py | 3 ++- .../checks/{brand_name_whitespace.py => brand_name.py} | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) rename scripts/analyze_functions/checks/{brand_name_whitespace.py => brand_name.py} (54%) diff --git a/scripts/README.md b/scripts/README.md index ad5a924a..0caa3898 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -94,6 +94,7 @@ and optionally correct what can be corrected easily in | Check | Description | `--correct`ed | Only for single-gene results* | | ----- | ----------- | ------------- | ----------------------------- | | `brand_whitespace` | Drug brand names should not have leading or trailing white space. | ✅ | ❌ | +| `brand_comma` | Drug brand names should not include commas (spit these, could do automatically). | ❌ | ❌ | | `single_any_fallback` | If any fallback guidelines `*` are present, only one guideline should be present (otherwise other guidelines are ignored) | ❌ | ❌ | | `fallback_single_lookup` | If fallback guidelines `*` or `~` are present, only one lookup value per gene should be present (otherwise other lookup values are ignored) | ❌ | ❌ | | `annotated_but_not_staged` | Warns if a drug is annotated but not staged (ignored drugs in `IGNORE_STAGED_CHECK`) | ❌ | ❌ | diff --git a/scripts/analyze.py b/scripts/analyze.py index eeeecae9..8b15ddcd 100644 --- a/scripts/analyze.py +++ b/scripts/analyze.py @@ -1,7 +1,7 @@ import sys from analyze_functions.checks.fully_annotated_staged import check_if_fully_annotated_staged -from analyze_functions.checks.brand_name_whitespace import check_brand_name_whitespace +from analyze_functions.checks.brand_name import check_brand_name_comma, check_brand_name_whitespace from analyze_functions.checks.metabolization_before_consequence import check_metabolization_before_consequence from analyze_functions.checks.fallback_guidelines import check_single_any_fallback_guideline, check_single_lookup_fallback_guideline from analyze_functions.checks.non_metabolizer import check_non_metabolizer @@ -22,6 +22,7 @@ DRUG_CHECKS = { 'brand_whitespace': check_brand_name_whitespace, + 'brand_comma': check_brand_name_comma, 'single_any_fallback': check_single_any_fallback_guideline, 'fallback_single_lookup': check_single_lookup_fallback_guideline, 'annotated_but_not_staged': check_if_fully_annotated_staged, diff --git a/scripts/analyze_functions/checks/brand_name_whitespace.py b/scripts/analyze_functions/checks/brand_name.py similarity index 54% rename from scripts/analyze_functions/checks/brand_name_whitespace.py rename to scripts/analyze_functions/checks/brand_name.py index 751ecf5c..6e78b7a2 100644 --- a/scripts/analyze_functions/checks/brand_name_whitespace.py +++ b/scripts/analyze_functions/checks/brand_name.py @@ -6,4 +6,13 @@ def check_brand_name_whitespace(args): if trimmed_name != brand_name: check_applies = False break + return check_applies + +def check_brand_name_comma(args): + annotations = args['annotations'] + check_applies = True + for brand_name in annotations['brand_names']: + if ',' in brand_name: + check_applies = False + break return check_applies \ No newline at end of file