Skip to content

Commit

Permalink
feat(#639): add non metabolizer check
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Oct 15, 2024
1 parent 7e30f7e commit dedfeea
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ and optionally correct what can be corrected easily in
| `none_warning` | None warning level should be applied in all not handled warning level cases. |||
| `metabolization_before_consequence` | Metabolization implications should come before consequences. |||
| `annotated_but_not_staged` | Warns if a guideline is annotated but not staged (ignored drugs in `IGNORE_STAGED_CHECK`) |||
| `should_not_have_normal_risk` | Warns if a guideline uses "normal risk" if not mentioned in external data. |||
| `should_not_have_normal_risk` | Warns if an annotation uses "normal risk" if not mentioned in external data. |||
| `non_metabolizer` | Warns if an annotation uses "break down" or "activate" but is for `NON_METABOLIZERS`. |||

\* Skips guidelines with multiple genes unless all results but one are missing
or indeterminate.
2 changes: 2 additions & 0 deletions scripts/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from analyze_functions.checks.brand_name_whitespace import 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
from analyze_functions.checks.normal_side_effect_risk import check_normal_side_effect_risk
from analyze_functions.checks.warning_levels import check_green_warning_level, \
check_none_warning_level, check_red_warning_level, \
Expand Down Expand Up @@ -40,6 +41,7 @@
'metabolization_before_consequence': check_metabolization_before_consequence,
'annotated_but_not_staged': check_if_fully_annotated_staged,
'should_not_have_normal_risk': check_normal_side_effect_risk,
'non_metabolizer': check_non_metabolizer,
}

GUIDELINE_CORRECTIONS = {
Expand Down
18 changes: 18 additions & 0 deletions scripts/analyze_functions/checks/non_metabolizer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import analyze_functions.constants as constants

def check_non_metabolizer(args):
guideline = args['item']
annotations = args['annotations']
is_non_metabolizer_guideline = any(map(
lambda gene: gene in constants.NON_METABOLIZERS,
guideline['phenotypes'].keys(),
)) and all(map(
lambda gene: gene in constants.NON_METABOLIZERS or \
guideline['phenotypes'][gene][0].lower() in constants.MISSING_PHENOTYPES,
guideline['phenotypes'].keys(),
))
has_metabolizer_text = any(map(
lambda metabolizer_text: metabolizer_text in annotations['implication'],
constants.METABOLIZER_TEXTS,
))
return not is_non_metabolizer_guideline or not has_metabolizer_text
11 changes: 10 additions & 1 deletion scripts/analyze_functions/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
'weak or no evidence for an increased risk',
'"normal" risk',
]
IGNORED_PHENOTYPES = ['no result', 'indeterminate', 'normal metabolizer']
NON_METABOLIZERS = [
'G6PD',
'SLCO1B1',
'MT-RNR1',
'HLA-B',
'HLA-A',
]
METABOLIZER_TEXTS = ['break down', 'activate']
MISSING_PHENOTYPES = ['no result', 'indeterminate']
IGNORED_PHENOTYPES = [*MISSING_PHENOTYPES, 'normal metabolizer']
RED_TEXT = 'not be the right medication'
NOT_RED_TEXTS = [
'if more than this dose is needed',
Expand Down

0 comments on commit dedfeea

Please sign in to comment.