From 33d5aadec28923563453fe6d0ee299d29a301701 Mon Sep 17 00:00:00 2001 From: joeflack4 Date: Tue, 18 Oct 2022 18:17:58 -0400 Subject: [PATCH] OWL to FHIR - Add: New converter for OWL to FHIR CodeSystem JON (WIP) - Add: Tests for new converter (WIP) Misc - Update: .gitignore: added: .DS_Store --- .gitignore | 4 +--- src/oaklib/converters/owl_to_fhir.py | 25 +++++++++++++++++++++++ tests/test_converters/test_owl_to_fhir.py | 18 ++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/oaklib/converters/owl_to_fhir.py create mode 100644 tests/test_converters/test_owl_to_fhir.py diff --git a/.gitignore b/.gitignore index ab19e7a16..766c51667 100644 --- a/.gitignore +++ b/.gitignore @@ -13,12 +13,10 @@ db/ notebooks/output/*json notebooks/output/*tsv notebooks/input/* - - notebooks/api-key.txt .template.db .venv .tox/ .coverage.* - +.DS_Store diff --git a/src/oaklib/converters/owl_to_fhir.py b/src/oaklib/converters/owl_to_fhir.py new file mode 100644 index 000000000..78b41b7a3 --- /dev/null +++ b/src/oaklib/converters/owl_to_fhir.py @@ -0,0 +1,25 @@ +"""Convert OWL to FHIR CodeSystem JSON + +TODO's + 1. Write functioning converter + 2. Optional/Later: Schema mappings (Obograph -> FHIR CodeSystem). SchemaAutomator? Other approach? + 3. Add converter to CLI + 4. Test(s) + +todo's (minor) + 1. owl_to_fhir.py -> owl_to_fhir_codesystem.py? +""" +from typing import Dict + + +def convert(inpath: str, outpath: str) -> Dict: + """Convert + + Side effects: + - Writes file at `outpath`""" + + return {} + + +if __name__ == '__main__': + convert('path/to/mondo-example.owl') diff --git a/tests/test_converters/test_owl_to_fhir.py b/tests/test_converters/test_owl_to_fhir.py new file mode 100644 index 000000000..b5e6355e1 --- /dev/null +++ b/tests/test_converters/test_owl_to_fhir.py @@ -0,0 +1,18 @@ +"""Tests for OWL to FHIR CodeSystem converter.""" +import unittest + +from oaklib.converters.owl_to_fhir import convert +from tests import INPUT_DIR, OUTPUT_DIR + + +ONT = INPUT_DIR / "mondo-example.owl" +OUT = OUTPUT_DIR / "mondo-example.json" + + +class OwlToFhirConversionTest(unittest.TestCase): + """Tests""" + + def test_convert(self): + """Tests basic conversion""" + result = convert(ONT) + self.assertTrue(result != True) # todo