From 2c7af09bfe90e672876345334173a5fd75660103 Mon Sep 17 00:00:00 2001 From: tomolopolis Date: Wed, 6 Mar 2024 18:07:19 +0000 Subject: [PATCH] 86940j1fm: fixed for old de-ID CDBs at GSTT --- webapp/api/api/solr_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/api/api/solr_utils.py b/webapp/api/api/solr_utils.py index 1fe38b17..6372a1b4 100644 --- a/webapp/api/api/solr_utils.py +++ b/webapp/api/api/solr_utils.py @@ -187,13 +187,14 @@ def _upload_payload(update_url, data, collection, commit=False): def _concept_dct(cui: str, cdb: CDB): + synonyms = list(cdb.addl_info.get('cui2original_names', {}).get(cui, set())) concept_dct = { 'cui': str(cui), 'pretty_name': cdb.get_name(cui), 'name': re.sub(r'\([\w+\s]+\)', '', cdb.get_name(cui)).strip(), 'type_ids': list(cdb.cui2type_ids[cui]), 'desc': cdb.addl_info.get('cui2description', {}).get(cui, ''), - 'synonyms': list(cdb.addl_info.get('cui2original_names', {}).get(cui, set())), + 'synonyms': synonyms if len(synonyms) > 0 else [cdb.get_name(cui)] } return concept_dct