-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scripts): add implications annotation order check
- Loading branch information
Showing
9 changed files
with
89 additions
and
50 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from analyze.checks.constants import CONSULT_TEXT | ||
from analyze.constants import CONSULT_TEXT | ||
|
||
def has_consult(_, annotations): | ||
return CONSULT_TEXT in annotations['recommendation'] |
26 changes: 26 additions & 0 deletions
26
scripts/analyze/checks/metabolization_before_consequence.py
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,26 @@ | ||
import analyze.constants as constants | ||
|
||
def _get_first_substring_position(string, substrings): | ||
positions = list(filter( | ||
lambda position: position > 0, | ||
map( | ||
lambda substring: string.find(substring), | ||
substrings, | ||
), | ||
)) | ||
if (len(positions) == 0): return None | ||
return min(positions) | ||
|
||
def check_metabolization_before_consequence(_, annotations): | ||
implication = annotations['implication'] | ||
metabolization_position = _get_first_substring_position( | ||
implication, | ||
constants.METABOLIZATION_FORMULATIONS, | ||
) | ||
consequence_position = _get_first_substring_position( | ||
implication, | ||
constants.CONSEQUENCE_FORMULATIONS, | ||
) | ||
if metabolization_position == None or consequence_position == None: | ||
return True | ||
return metabolization_position < consequence_position |
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,47 @@ | ||
CONSULT_TEXT = 'consult your pharmacist or doctor' | ||
WHOLE_CONSULT_TEXT = '{} for more information.'.format(CONSULT_TEXT) | ||
RED_TEXT = 'not be the right medication' | ||
NOT_RED_TEXTS = [ | ||
'if more than this dose is needed', | ||
"if #drug-name isn't working for you", | ||
] | ||
ADJUST_TEXT = 'adjusted' | ||
YELLOW_RECOMMENDATION_TEXTS = NOT_RED_TEXTS + [ | ||
ADJUST_TEXT, | ||
'increased', | ||
'decreased', | ||
'lower dose', | ||
'higher dose', | ||
'up to a certain dose', | ||
'dose increases should be done cautiously and slowly', | ||
'further testing is recommended', | ||
] | ||
MAY_NOT_WORK_TEXT = 'may not work' | ||
YELLOW_IMPLICATION_TEXTS = [ | ||
'increased risk', | ||
MAY_NOT_WORK_TEXT, | ||
] | ||
GREEN_TEXTS = ['at standard dose', 'there is no reason to avoid'] | ||
MUCH_IMPLYING_METABOLIZATION_FORMULATIONS = [ | ||
'greatly decreased', | ||
'greatly reduced', | ||
'significantly reduced', | ||
'extremely high concentrations', | ||
'when compared to cyp2c19 rapid and normal metabolizers', | ||
'as compared to non-poor metabolizers', | ||
'when compared to cyp2c19 normal and intermediate metabolizers', | ||
'as compared to normal and intermediate metabolizer', | ||
'complete dpd deficiency', | ||
] | ||
MUCH_METABOLIZATION_FORMULATIONS = [ | ||
'much faster', | ||
'much slower' | ||
] | ||
METABOLIZATION_FORMULATIONS = [ | ||
'activate', | ||
'break down', | ||
] | ||
CONSEQUENCE_FORMULATIONS = [ | ||
'risk', | ||
MAY_NOT_WORK_TEXT, | ||
] |
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