Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
joeflack4 committed Oct 6, 2023
1 parent 96ca67e commit 2ec1926
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand All @@ -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. |
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*;
Expand Down
10 changes: 6 additions & 4 deletions owl_on_fhir/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']


Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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='+',
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
REQUIRED = [
'bioontologies',
'oaklib>=0.5.1',
'requests',
'requests>2.28.2',
]

# Description
Expand Down

0 comments on commit 2ec1926

Please sign in to comment.