Skip to content

Commit

Permalink
Remove boilerplate (#70)
Browse files Browse the repository at this point in the history
* Move stuff around

Signed-off-by: zethson <[email protected]>

* Move back

Signed-off-by: zethson <[email protected]>

* Fix checkout version

Signed-off-by: zethson <[email protected]>

* Remove unused imports

Signed-off-by: zethson <[email protected]>

* Fix docs

Signed-off-by: zethson <[email protected]>

* Fix docs

Signed-off-by: zethson <[email protected]>

* promote info to warning where more meaningful

* exclude slow tests by default, keep them in ci

* they're also omitted in ci

---------

Signed-off-by: zethson <[email protected]>
Co-authored-by: eroell <[email protected]>
  • Loading branch information
Zethson and eroell authored Dec 4, 2024
1 parent 2bdceb3 commit e06ea34
Show file tree
Hide file tree
Showing 17 changed files with 20 additions and 218 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
Expand Down
27 changes: 0 additions & 27 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,6 @@
dt.mimic_ii
```

## Preprocessing

```{eval-rst}
.. module:: ehrdata.pp
.. currentmodule:: ehrdata
.. autosummary::
:toctree: generated
pp.basic_preproc
```

## Tools

```{eval-rst}
.. module:: ehrdata.tl
.. currentmodule:: ehrdata
.. autosummary::
:toctree: generated
tl.basic_tool
tl.get_concept_name
```

## Plotting

```{eval-rst}
Expand All @@ -74,7 +49,5 @@
.. autosummary::
:toctree: generated
pl.basic_plot
pl.BasicClass
pl.vitessce.gen_config
```
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
# If building the documentation fails because of a missing link that is outside your control,
# you can add an exception to this list:
nitpick_ignore = [
("py:class", "types.EllipsisType"),
# https://github.com/duckdb/duckdb-web/issues/3806
("py:class", "duckdb.duckdb.DuckDBPyConnection"),
# Is documented as a py:attribute instead
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies = [
"awkward",
"duckdb",
# for debug logging (referenced from the issue template)
"lamin-utils",
"session-info",
"xarray",
]
Expand Down
4 changes: 4 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
addopts = -m "not slow"
8 changes: 2 additions & 6 deletions src/ehrdata/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from importlib.metadata import version

from . import dt, io, pl, pp, tl
from . import dt, io, pl
from .core import EHRData

__all__ = ["EHRData", "dt", "io", "pl", "pp", "tl"]
__all__ = ["EHRData", "dt", "io", "pl"]

__version__ = version("ehrdata")

from .logging_config import configure_logging

configure_logging()
File renamed without changes.
6 changes: 3 additions & 3 deletions src/ehrdata/io/omop/omop.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pandas as pd
from duckdb.duckdb import DuckDBPyConnection

from ehrdata._omop_utils import get_table_catalog_dict
from ehrdata.io.omop._check_arguments import (
VALID_OBSERVATION_TABLES_JOIN,
VALID_OBSERVATION_TABLES_SINGLE,
Expand All @@ -32,7 +33,6 @@
_check_valid_variable_data_tables,
)
from ehrdata.io.omop._queries import _time_interval_table
from ehrdata.utils._omop_utils import get_table_catalog_dict

DOWNLOAD_VERIFICATION_TAG = "download_verification_tag"

Expand Down Expand Up @@ -328,7 +328,7 @@ def setup_variables(
# dbms complains about our queries, which sometimes need a column to be of type e.g. datetime, when it can't infer types from data
count = backend_handle.execute(f"SELECT COUNT(*) as count FROM {data_tables[0]}").df()["count"].item()
if count == 0:
logging.info(f"No data found in {data_tables[0]}. Returning edata without additional variables.")
logging.warning(f"No data found in {data_tables[0]}. Returning edata without additional variables.")
return edata

ds = (
Expand Down Expand Up @@ -463,7 +463,7 @@ def setup_interval_variables(
# dbms complains about our queries, which sometimes need a column to be of type e.g. datetime, when it can't infer types from data
count = backend_handle.execute(f"SELECT COUNT(*) as count FROM {data_tables[0]}").df()["count"].item()
if count == 0:
logging.info(f"No data in {data_tables}.")
logging.warning(f"No data in {data_tables}.")
return edata

ds = (
Expand Down
10 changes: 0 additions & 10 deletions src/ehrdata/logging_config.py

This file was deleted.

4 changes: 1 addition & 3 deletions src/ehrdata/pl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from importlib.util import find_spec

__all__ = ["BasicClass", "basic_plot", "vitessce"]

from .basic import BasicClass, basic_plot
__all__ = ["vitessce"]

if find_spec("vitessce"):
from . import vitessce
63 changes: 0 additions & 63 deletions src/ehrdata/pl/basic.py

This file was deleted.

1 change: 0 additions & 1 deletion src/ehrdata/pp/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/ehrdata/pp/basic.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/ehrdata/tl/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/ehrdata/tl/basic.py

This file was deleted.

65 changes: 0 additions & 65 deletions src/ehrdata/tl/omop.py

This file was deleted.

4 changes: 4 additions & 0 deletions tests/test_dt/test_dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def duckdb_connection():
con.close()


@pytest.mark.slow
def test_mimic_iv_omop(tmp_path):
duckdb_connection = duckdb.connect()
ed.dt.mimic_iv_omop(data_path=tmp_path, backend_handle=duckdb_connection)
Expand All @@ -22,6 +23,7 @@ def test_mimic_iv_omop(tmp_path):
duckdb_connection.close()


@pytest.mark.slow
def test_gibleed_omop(tmp_path):
duckdb_connection = duckdb.connect()
ed.dt.gibleed_omop(data_path=tmp_path, backend_handle=duckdb_connection)
Expand All @@ -31,6 +33,7 @@ def test_gibleed_omop(tmp_path):
duckdb_connection.close()


@pytest.mark.slow
def test_synthea27nj_omop(tmp_path):
duckdb_connection = duckdb.connect()
ed.dt.synthea27nj_omop(data_path=tmp_path, backend_handle=duckdb_connection)
Expand All @@ -40,6 +43,7 @@ def test_synthea27nj_omop(tmp_path):
duckdb_connection.close()


@pytest.mark.slow
def test_physionet2012():
edata = ed.dt.physionet2012()
assert edata.shape == (11988, 38)
Expand Down

0 comments on commit e06ea34

Please sign in to comment.