You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently in #12 we created an ad hoc robot template for Mondo-->ORDO-->ICD11.foundation mappings.
During this process, we needed labels added to the template, and quickly. So I used a quick and dirty method. I had an existing components/icd11.foundation.db in mondo-ingest. So I queried that, then copy/pasted the icd11foundation_labels.tsv to the root of this repository, committed that, and then pulled it in via a static reference constant (not the CLI) into the robot template script.
If we need another robot template in the future, or feel there is any other advantage to setting this up, we'd want to do this:
Delete: icd11foundation_labels.tsv
Add a make goal for a SemanticSQL .db
Add a goal to makeicd11foundation_labels.tsv in the temp dir
This could be a CLI command probably, but I've also already written a Python script (see additioanl details).
Add that goal as a prerequisite to the goal for making the robot template, and pass it as an arg to the Python script.
Add a CLI param for that in the Python script, and do the rest needed to wire that up correctly.
Additional details
Python script for getting labels
The one change I'd make here to add a CLI and use args for the input and output paths.
fromtypingimportList, Unionimportpandasaspdfromoaklibimportget_implementation_from_shorthandfromoaklib.typesimportCURIE, URIDB_PATH='icd11foundation.db'OUTPATH='icd11foundation_labels.tsv'deflabels(db_path: str=DB_PATH, outpath: str=OUTPATH) ->pd.DataFrame:
"""Create mapping status tables"""oi=get_implementation_from_shorthand(db_path)
# Get all terms and labelsids_all: List[Union[CURIE, URI]] = [xforxinoi.entities(filter_obsoletes=False)]
id_labels_all: List[tuple] = [xforxinoi.labels(ids_all)]
df=pd.DataFrame(id_labels_all, columns=['id', 'label'])
df.to_csv(outpath, sep='\t', index=False)
returndf
The text was updated successfully, but these errors were encountered:
joeflack4
changed the title
Improve: code for adding labels to robot template
Optional: Improve: code for adding labels to robot template
Apr 28, 2024
Overview
Recently in #12 we created an ad hoc robot template for Mondo-->ORDO-->ICD11.foundation mappings.
During this process, we needed labels added to the template, and quickly. So I used a quick and dirty method. I had an existing
components/icd11.foundation.db
inmondo-ingest
. So I queried that, then copy/pasted theicd11foundation_labels.tsv
to the root of this repository, committed that, and then pulled it in via a static reference constant (not the CLI) into the robot template script.If we need another robot template in the future, or feel there is any other advantage to setting this up, we'd want to do this:
icd11foundation_labels.tsv
make
goal for a SemanticSQL.db
icd11foundation_labels.tsv
in the temp dirAdditional details
Python script for getting labels
The one change I'd make here to add a CLI and use args for the input and output paths.
The text was updated successfully, but these errors were encountered: