Skip to content

Commit

Permalink
refactor: clean up regulatory_approval
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed May 6, 2022
1 parent 8a1e6c5 commit 9325757
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion metakb/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _add_descriptor(tx, descriptor: Dict, added_ids: Set[str]):
'alternate_labels'))

if descr_type == 'TherapyDescriptor':
# handle extensions field in therapy descriptor
# capture regulatory_approval field in therapy descriptor extensions
extensions = descriptor.get('extensions', [])
for ext in extensions:
name = ext['name']
Expand Down
7 changes: 3 additions & 4 deletions metakb/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ def get_regulatory_approval_extension(

if any(ar in {ApprovalRating.FDA_PRESCRIPTION, ApprovalRating.FDA_OTC}
for ar in approval_ratings):
matched_ext_value = "FDA"
if ApprovalRating.FDA_DISCONTINUED in approval_ratings:
if ApprovalRating.CHEMBL_4 not in approval_ratings:
matched_ext_value = None
if ApprovalRating.FDA_DISCONTINUED not in approval_ratings or \
ApprovalRating.CHEMBL_4 in approval_ratings: # noqa: E125
matched_ext_value = "FDA"
elif ApprovalRating.CHEMBL_4 in approval_ratings:
matched_ext_value = "chembl_phase_4"

Expand Down

0 comments on commit 9325757

Please sign in to comment.