diff --git a/setup.cfg b/setup.cfg index d1b41e94e..b4f164632 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,28 +1,31 @@ [metadata] # would we ever want to use pyproject.toml ? +# yes! works with setuptools and poetry + name = crdch_model -# see home_page notes -url = https://cancerdhc.github.io/ccdhmodel -# author metadata, license etc is totally incomplete -# str -# add maintainer -author = Mark A. Miller -author_email = MAM@lbl.gov -# summary is alias for description ? -summary = CRDC-H model in LinkML, developed by the Center for Cancer Data Harmonization (CCDH) +# version + +author = Center for Cancer Data Harmonization +# are we sure somebody reads this email? +author_email = centerforcancerdh@gmail.com +maintainer = Gaurav Vaidya, Sujay Patil, Mark A. Miller etc. See https://github.com/cancerDHC/ccdhmodel/graphs/contributors + +# summary is alias for description description = CRDC-H model in LinkML, developed by the Center for Cancer Data Harmonization (CCDH) + long_description = CRDC-H model in LinkML, developed by the Center for Cancer Data Harmonization (CCDH). This Python package contains the dataclasses necessary to build and operate over data objects according to the CRDC-H model. -# is this where mkdocs artifacts gets SENT? -# or will this be used as a base for URLs in the mkdocs artifacts? -# should change, but be careful not to overwrite the existing ccdhmodel docs yet -# no, this is probably just what appears on the package's PyPI page -# see also url -# https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html says -# home-page is an alias for url + + +# see also https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html +# which says home-page is an alias for url # note hyphen vs underscore! -home_page = https://cancerdhc.github.io/ccdhmodel +url = https://cancerdhc.github.io/ccdhmodel + +# LICENSE file looks like BSD 3-clause +# license = MIT license = MIT python_requires = >=3.7 + classifiers = Topic :: Scientific/Engineering :: Bio-Informatics Intended Audience :: Healthcare Industry @@ -36,10 +39,13 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + +# MAM 2021-11-18 cancer research keywords = python google-sheets linkml + cancer research [options] include_package_data = True diff --git a/tests/secondary_inputs/test_AlcoholExposureObservation.json b/tests/secondary_inputs/test_AlcoholExposureObservation.json new file mode 100644 index 000000000..26f9e220a --- /dev/null +++ b/tests/secondary_inputs/test_AlcoholExposureObservation.json @@ -0,0 +1,11 @@ +{ + "id": "a1b2c3", + "value_integer": 6, + "observation_type": { + "text": "alcohol_drinks_per_day", + "coding": { + "code": "marksterms:dpd", + "system": "http://example.com/broken_uris_ok/" + } + } +} diff --git a/tests/secondary_inputs/test_ObservationSet.json b/tests/secondary_inputs/test_ObservationSet.json new file mode 100644 index 000000000..c18087c15 --- /dev/null +++ b/tests/secondary_inputs/test_ObservationSet.json @@ -0,0 +1,21 @@ +{ + "id": "123", + "category": { + "coding": { + "code": "example:123", + "system": "http://example.com" + }, + "text": "tobacco exposure observations" + }, + "observations": [ + { + "observation_type": { + "text": "cigarettes_per_day", + "coding": { + "code": "marksterms:cpd", + "system": "not a real uri" + } + } + } + ] +} \ No newline at end of file diff --git a/tests/secondary_inputs/test_TobaccoExposureObservation.json b/tests/secondary_inputs/test_TobaccoExposureObservation.json new file mode 100644 index 000000000..9f4d6c5cc --- /dev/null +++ b/tests/secondary_inputs/test_TobaccoExposureObservation.json @@ -0,0 +1,9 @@ +{ + "observation_type": { + "text": "cigarettes_per_day", + "coding": { + "code": "marksterms:cpd", + "system": "not a real uri" + } + } +} \ No newline at end of file diff --git a/tests/secondary_inputs/test_TobaccoExposureObservation.json.notes.txt b/tests/secondary_inputs/test_TobaccoExposureObservation.json.notes.txt new file mode 100644 index 000000000..4204796d6 --- /dev/null +++ b/tests/secondary_inputs/test_TobaccoExposureObservation.json.notes.txt @@ -0,0 +1,12 @@ +# can't be a list +# use observation set +# misspellings in text are tolerated, as are bogus uris in coding.system +# coding.system validationa s string instead of URI is a known bug +# can enums goin any of these slots? +# look at values from +# learn more about attributes vs slots +[ + { "observation_type": { "text": "cigarettes_per_dayZZZ", "coding": "marksterms:cpd" }}, + { "observation_type": { "text": "cigarettes_per_day" }} +] + diff --git a/tests/test_alcohol_exp_static.py b/tests/test_alcohol_exp_static.py new file mode 100644 index 000000000..a4e7f9913 --- /dev/null +++ b/tests/test_alcohol_exp_static.py @@ -0,0 +1,35 @@ +import os +import unittest + +from linkml_runtime.loaders import json_loader, rdf_loader + +from crdch_model.crdch_model import AlcoholExposureObservation + +CWD = os.path.abspath(os.path.dirname(__file__)) + +INPUT_DIR = os.path.join(CWD, 'secondary_inputs') + + +class InputFileTestCase(unittest.TestCase): + def test_alcohol_file(self): + nyaml, njson, nttl = 0, 0, 0 + pyaml, pjson, pttl = 0, 0, 0 + nread, nfailures = 0, 0 + print("AlcoholExposureObservation test") + alcohol_data_filename = 'test_AlcoholExposureObservation.json' + alcohol_data_filepath = os.path.join(INPUT_DIR, alcohol_data_filename) + print("Attempting to load " + alcohol_data_filepath + " as one or more AlcoholExposureObservation(s)") + + try: + njson += 1 + Diagnosis = json_loader.load(alcohol_data_filepath, AlcoholExposureObservation) + pjson += 1 + print("Successfully parsed:") + print(Diagnosis) + except Exception as e: + print(e) + nfailures += 1 + self.assertEqual(0, nfailures) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_tobacco_exp_static.py b/tests/test_tobacco_exp_static.py new file mode 100644 index 000000000..18f18c53f --- /dev/null +++ b/tests/test_tobacco_exp_static.py @@ -0,0 +1,35 @@ +import os +import unittest + +from linkml_runtime.loaders import json_loader, rdf_loader + +from crdch_model.crdch_model import TobaccoExposureObservation + +CWD = os.path.abspath(os.path.dirname(__file__)) + +INPUT_DIR = os.path.join(CWD, 'secondary_inputs') + + +class InputFileTestCase(unittest.TestCase): + def test_tobacco_file(self): + nyaml, njson, nttl = 0, 0, 0 + pyaml, pjson, pttl = 0, 0, 0 + nread, nfailures = 0, 0 + print("TobaccoExposureObservation test") + toboacco_data_filename = 'test_TobaccoExposureObservation.json' + toboacco_data_filepath = os.path.join(INPUT_DIR, toboacco_data_filename) + print("Attempting to load " + toboacco_data_filepath + " as one or more TobaccoExposureObservation(s)") + + try: + njson += 1 + Diagnosis = json_loader.load(toboacco_data_filepath, TobaccoExposureObservation) + pjson += 1 + print("Successfully parsed:") + print(Diagnosis) + except Exception as e: + print(e) + nfailures += 1 + self.assertEqual(0, nfailures) + +if __name__ == '__main__': + unittest.main()