Skip to content

Commit

Permalink
Merge pull request #43 from callahantiff/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
callahantiff committed Oct 5, 2020
2 parents 7f13f83 + 47ddc2e commit 599086d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 2 additions & 0 deletions omop2obo/string_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

from omop2obo.utils import column_splitter, data_frame_subsetter, merge_dictionaries

# TODO: Update script so all ontologies in the ont list (i.e. ontology_dictionary keys) are processed in parallel.

# load stopwords into environment -- horrible workaround until Travis is fixed
# nltk.download('wordnet')
stopwords = ['i', 'me', 'my', 'myself', 'we', 'our', 'ours', 'ourselves', 'you', "you're", "you've", "you'll", "you'd",
Expand Down
30 changes: 11 additions & 19 deletions omop2obo/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,29 +518,21 @@ def assigns_mapping_category(mapping_result: List, map_evidence: str) -> str:
mapping_category: A string containing the mapping category.
"""

if len(mapping_result[0]) == 1:
if 'CONCEPT_SIMILARITY:' in map_evidence:
if len(map_evidence.split(' | ')) == 1:
mapping_category = 'Manual Exact - Concept Similarity'
else:
mapping_category = 'Automatic Exact - Concept'
if 'CONCEPT_SIMILARITY:' in map_evidence:
if len(map_evidence.split(' | ')) > 1:
mapping_category = 'Automatic Constructor - Concept'
else:
mapping_category = 'Automatic Exact - '
elif len(mapping_result[0]) > 1:
if 'CONCEPT_SIMILARITY:' in map_evidence:
mapping_category = 'Manual Exact - Concept Similarity'
elif any(x for x in ['ANCESTOR_CODE', 'ANCESTOR_SYNONYM', 'ANCESTOR_LABEL'] if x not in map_evidence):
if len(mapping_result[0]) > 1:
mapping_category = 'Automatic Constructor - Concept'
else:
mapping_category = 'Automatic Constructor - '
mapping_category = 'Automatic Exact - Concept'
else:
mapping_category = ''

# determine mapping level (i.e. concept or ancestor)
if any(x for x in ['CONCEPT_CODE', 'CONCEPT_SYNONYM', 'CONCEPT_LABEL'] if x in map_evidence):
mapping_category = mapping_category + 'Concept'
elif any(x for x in ['ANCESTOR_CODE', 'ANCESTOR_SYNONYM', 'ANCESTOR_LABEL'] if x in map_evidence):
mapping_category = mapping_category + 'Ancestor'
else:
mapping_category = mapping_category + ''
if len(mapping_result[0]) > 1:
mapping_category = 'Automatic Constructor - Ancestor'
else:
mapping_category = 'Automatic Exact - Ancestor'

return mapping_category

Expand Down

0 comments on commit 599086d

Please sign in to comment.