From 2ec19263f87ea306612c810d8a4ff7ad71cd75f4 Mon Sep 17 00:00:00 2001 From: joeflack4 Date: Fri, 6 Oct 2023 18:13:53 -0400 Subject: [PATCH] Minor updates - Docs: Corrected some verbiage in docs / code documentaiton. - Docs: Added prerequisite information for Python/Java - Dependencies: Updated requests for a securiy update. - Update: robot.jar pathing --- README.md | 8 ++++++-- makefile | 2 +- owl_on_fhir/__main__.py | 10 ++++++---- setup.py | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6ea25c4..57e1b4b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ A Python-based non-minimalistic OWL to FHIR converter. +## Prerequisite +* [Python 3.9+](https://www.python.org/downloads/) +* [Java 11+](https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html) + ## Installation `pip install owl-on-fhir` @@ -18,8 +22,8 @@ A Python-based non-minimalistic OWL to FHIR converter. |:-----------|:----------|:------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | -h | --help | | Show this help message and exit. | | -i | --input-path-or-url | True | URL or path to OWL file to convert. | -| -s | --code-system-id | True | For `fhirjson` only. The code system ID to use for identification on the server uploaded to. See: https://hl7.org/fhir/resource-definitions.html#Resource.id | -| -S | --code-system-url | True | For `fhirjson` only. Canonical URL for the code system. See: https://hl7.org/fhir/codesystem-definitions.html#CodeSystem.url | +| -s | --code-system-id | True | The code system ID to use for identification on the server uploaded to. See: https://hl7.org/fhir/resource-definitions.html#Resource.id | +| -S | --code-system-url | True | Canonical URL for the code system. See: https://hl7.org/fhir/codesystem-definitions.html#CodeSystem.url | | -u | --native-uri-stems | True | A comma-separated list of URI stems that will be used to determine whether a concept is native to the CodeSystem. For example, for OMIM, the following URI stems are native: https://omim.org/entry/,https://omim.org/phenotypicSeries/PS". As of 2023-01-15, there is still a bug in the Obographs spec and/or `robot` where certain nodes are not being converted. This converter adds back the nodes, but to know which ones belong to the CodeSystem itself and are not foreign concepts, this parameter is necessary. OAK also makes use of this parameter. See also: https://github.com/geneontology/obographs/issues/90 | | -o | --out-dir | False | The directory where results should be saved. | | -n | --out-filename | False | Filename for the primary file converted, e.g. CodeSystem. | diff --git a/makefile b/makefile index e4e1bcf..78ead8b 100644 --- a/makefile +++ b/makefile @@ -8,7 +8,7 @@ clean: rm -rf ./*.egg-info build: clean - python3 setup.py sdist bdist_wheel + python setup.py sdist bdist_wheel pypi: build twine upload --repository-url https://upload.pypi.org/legacy/ dist/*; diff --git a/owl_on_fhir/__main__.py b/owl_on_fhir/__main__.py index 932b147..f731a87 100644 --- a/owl_on_fhir/__main__.py +++ b/owl_on_fhir/__main__.py @@ -21,7 +21,7 @@ BIN_DIR = SRC_DIR PROJECT_DIR = os.path.join(SRC_DIR, '..') CACHE_DIR = os.path.join(PROJECT_DIR, 'cache') -ROBOT_PATH = os.path.join(BIN_DIR, 'robot') +ROBOT_PATH = os.path.join(BIN_DIR, 'robot.jar') INTERMEDIARY_TYPES = ['obographs', 'semsql'] @@ -113,7 +113,7 @@ def owl_to_obograph(inpath: str, out_dir: str, use_cache=False, cache_output=Fal infile = os.path.basename(inpath) cache_path = os.path.join(CACHE_DIR, infile + '.obographs.json') outpath = os.path.join(out_dir, infile + '.obographs.json') - command = f'java -jar {ROBOT_PATH}.jar convert -i {inpath} -o {outpath} --format json' + command = f'java -jar {ROBOT_PATH} convert -i {inpath} -o {outpath} --format json' # Convert if not os.path.exists(out_dir): @@ -266,17 +266,19 @@ def owl_to_fhir( return os.path.join(out_dir, out_filename) +# TODO: some of these args said"for fhirjson only". Was this because I was going to add an option for NPM output when +# OAK supports? Either way, removed for now till I figure out if I really was parameterizing something here. def cli(): """Command line interface.""" parser = ArgumentParser(prog='OWL on FHIR', description='Python-based non-minimalistic OWL to FHIR converter.') parser.add_argument('-i', '--input-path-or-url', required=True, help='URL or path to OWL file to convert.') parser.add_argument( '-s', '--code-system-id', required=True, default=False, - help="For `fhirjson` only. The code system ID to use for identification on the server uploaded to. " + help="The code system ID to use for identification on the server uploaded to. " "See: https://hl7.org/fhir/resource-definitions.html#Resource.id") parser.add_argument( '-S', '--code-system-url', required=True, default=False, - help="For `fhirjson` only. Canonical URL for the code system. " + help="Canonical URL for the code system. " "See: https://hl7.org/fhir/codesystem-definitions.html#CodeSystem.url") parser.add_argument( '-u', '--native-uri-stems', required=True, nargs='+', diff --git a/setup.py b/setup.py index dc6cd52..16c2d07 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ REQUIRED = [ 'bioontologies', 'oaklib>=0.5.1', - 'requests', + 'requests>2.28.2', ] # Description