Skip to content

Commit

Permalink
litcoin name res without UMLS but with autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDietzMorris committed Feb 6, 2024
1 parent 0871332 commit dfc8f61
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Common/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
HMDB = 'HMDB'
HUMAN_GOA = 'HumanGOA'
INTACT = 'IntAct'
LITCOIN = 'LitCoin_without_umls'
LITCOIN = 'LitCoin_without_umls_with_autocomplete'
LITCOIN_SAPBERT = 'LitCoinSapBERT_without_umls'
MONARCH_KG = 'MonarchKG'
MONDO_PROPS = 'MONDOProps'
Expand Down
9 changes: 3 additions & 6 deletions Common/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def hit_node_norm_service(self, curies, retries=0):
resp: requests.models.Response = requests.post(f'{self.node_norm_endpoint}get_normalized_nodes',
json={'curies': curies,
'conflate': self.conflate_node_types,
'drug_chemical_conflate': self.conflate_node_types,
'description': True})
if resp.status_code == 200:
# if successful return the json as an object
Expand Down Expand Up @@ -535,16 +534,14 @@ def call_name_resolution(name: str, biolink_type: str, retries=0, logger=None):
nameres_payload = {
"string": name,
"biolink_type": biolink_type if biolink_type else "",
"autocomplete": False
"autocomplete": True,
"exclude_prefixes": "UMLS"
}
nameres_result = requests.get(NAME_RESOLVER_URL, params=nameres_payload, headers=NAME_RESOLVER_HEADERS)
if nameres_result.status_code == 200:
# return the first result if there is one
nameres_json = nameres_result.json()
if nameres_json:
for result in nameres_json:
if not result['curie'].startswith('UMLS'):
return result
return nameres_json[0] if nameres_json else None
else:
error_message = f'Non-200 result from name resolution ({NAME_RESOLVER_URL}): ' \
f'Status {nameres_result.status_code} - {nameres_payload}.'
Expand Down
8 changes: 4 additions & 4 deletions graph_specs/litcoin-graph-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ graphs:
sources:
- source_id: LitCoinSapBERT_without_umls

- graph_id: LitCoin_without_umls
graph_name: LitCoin_without_umls
- graph_id: LitCoin_without_umls_with_autocomplete
graph_name: LitCoin_without_umls_with_autocomplete
graph_description: A graph for the LitCoin project using Name Resolver for name resolution without umls identifiers
conflation: True
strict_normalization: True
output_format: neo4j
output_format: None
sources:
- source_id: LitCoin_without_umls
- source_id: LitCoin_without_umls_with_autocomplete


6 changes: 4 additions & 2 deletions parsers/LitCoin/src/loadLitCoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
##############
class LitCoinLoader(SourceDataLoader):

source_id: str = 'LitCoin_without_umls'
source_id: str = 'LitCoin_without_umls_with_autocomplete'
provenance_id: str = 'infores:robokop-kg' # TODO - change this to a LitCoin infores when it exists
parsing_version: str = '1.4'

Expand Down Expand Up @@ -250,7 +250,9 @@ def parse_llm_output(self, llm_output):
return valid_responses

def name_resolution_function(self, node_name, preferred_biolink_node_type, retries=0):
return call_name_resolution(node_name, preferred_biolink_node_type, retries, logger=self.logger)
return call_name_resolution(node_name,
preferred_biolink_node_type,
retries, logger=self.logger)

def standardize_name_resolution_results(self, name_res_json):
if not name_res_json:
Expand Down

0 comments on commit dfc8f61

Please sign in to comment.