-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: meddra_german | ||
|
||
dict: | ||
custom: | ||
umls_meta_path: ${oc.env:UMLS_HOME}/2023AA/META | ||
sabs: | ||
- MDR | ||
- MDRGER |
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,25 @@ | ||
from tqdm.auto import tqdm | ||
from xmen.umls import read_umls_file_headers | ||
|
||
|
||
def get_concept_details(cfg): | ||
mrconso = "MRCONSO.RRF" | ||
concept_details = {} | ||
meta_path = cfg.dict.custom.umls_meta_path | ||
sabs = cfg.dict.custom.sabs | ||
|
||
headers = read_umls_file_headers(meta_path, mrconso) | ||
|
||
with open(f"{meta_path}/{mrconso}") as fin: | ||
for line in tqdm(fin.readlines()): | ||
splits = line.strip().split("|") | ||
assert len(headers) == len(splits) | ||
concept = dict(zip(headers, splits)) | ||
if concept["SAB"] in sabs: | ||
sid = concept["SDUI"] | ||
name = concept["STR"] | ||
if sid in concept_details: | ||
concept_details[sid]["aliases"].append(name) | ||
else: | ||
concept_details[sid] = {"concept_id": sid, "canonical_name": name, "types": [], "aliases": []} | ||
return concept_details |