meds-tab 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meds_tab-0.0.1/.github/workflows/code-quality-main.yaml +22 -0
- meds_tab-0.0.1/.github/workflows/code-quality-pr.yaml +36 -0
- meds_tab-0.0.1/.github/workflows/tests.yaml +41 -0
- meds_tab-0.0.1/.gitignore +160 -0
- meds_tab-0.0.1/.pre-commit-config.yaml +131 -0
- meds_tab-0.0.1/.readthedocs.yaml +13 -0
- meds_tab-0.0.1/LICENSE +21 -0
- meds_tab-0.0.1/PKG-INFO +105 -0
- meds_tab-0.0.1/README.md +69 -0
- meds_tab-0.0.1/docs/Makefile +20 -0
- meds_tab-0.0.1/docs/make.bat +35 -0
- meds_tab-0.0.1/docs/requirements.txt +15 -0
- meds_tab-0.0.1/docs/source/api.rst +8 -0
- meds_tab-0.0.1/docs/source/conf.py +91 -0
- meds_tab-0.0.1/docs/source/generated/src.MEDS_tabular_automl.rst +4 -0
- meds_tab-0.0.1/docs/source/generated/src.rst +30 -0
- meds_tab-0.0.1/docs/source/index.rst +20 -0
- meds_tab-0.0.1/docs/source/installation.rst +7 -0
- meds_tab-0.0.1/docs/source/license.rst +4 -0
- meds_tab-0.0.1/docs/source/overview.rst +6 -0
- meds_tab-0.0.1/docs/source/usage.rst +7 -0
- meds_tab-0.0.1/pyproject.toml +38 -0
- meds_tab-0.0.1/setup.cfg +4 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/__init__.py +0 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/__init__.py +0 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/default.yaml +17 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/describe_codes.yaml +14 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/launch_xgboost.yaml +79 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/tabularization/__init__.py +0 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/tabularization/default.yaml +22 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/tabularization.yaml +12 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/configs/task_specific_caching.yaml +14 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/describe_codes.py +198 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/file_name.py +28 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/generate_static_features.py +182 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/generate_summarized_reps.py +272 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/generate_ts_features.py +160 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/mapper.py +278 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/__init__.py +0 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/cache_task.py +100 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/describe_codes.py +116 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/launch_xgboost.py +419 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/sweep_xgboost.py +85 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/tabularize_static.py +161 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/scripts/tabularize_time_series.py +124 -0
- meds_tab-0.0.1/src/MEDS_tabular_automl/utils.py +444 -0
- meds_tab-0.0.1/src/meds_tab.egg-info/PKG-INFO +105 -0
- meds_tab-0.0.1/src/meds_tab.egg-info/SOURCES.txt +52 -0
- meds_tab-0.0.1/src/meds_tab.egg-info/dependency_links.txt +1 -0
- meds_tab-0.0.1/src/meds_tab.egg-info/entry_points.txt +7 -0
- meds_tab-0.0.1/src/meds_tab.egg-info/requires.txt +25 -0
- meds_tab-0.0.1/src/meds_tab.egg-info/top_level.txt +1 -0
- meds_tab-0.0.1/tests/test_integration.py +288 -0
- meds_tab-0.0.1/tests/test_tabularize.py +419 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Same as `code-quality-pr.yaml` but triggered on commit to main branch
|
|
2
|
+
# and runs on all files (instead of only the changed ones)
|
|
3
|
+
|
|
4
|
+
name: Code Quality Main
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
code-quality:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v3
|
|
20
|
+
|
|
21
|
+
- name: Run pre-commits
|
|
22
|
+
uses: pre-commit/action@v3.0.1
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This workflow finds which files were changed, prints them,
|
|
2
|
+
# and runs `pre-commit` on those files.
|
|
3
|
+
|
|
4
|
+
# Inspired by the sktime library:
|
|
5
|
+
# https://github.com/alan-turing-institute/sktime/blob/main/.github/workflows/test.yml
|
|
6
|
+
|
|
7
|
+
name: Code Quality PR
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [main, "release/*", "dev"]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
code-quality:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: actions/checkout@v3
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v3
|
|
23
|
+
|
|
24
|
+
- name: Find modified files
|
|
25
|
+
id: file_changes
|
|
26
|
+
uses: trilom/file-changes-action@v1.2.4
|
|
27
|
+
with:
|
|
28
|
+
output: " "
|
|
29
|
+
|
|
30
|
+
- name: List modified files
|
|
31
|
+
run: echo '${{ steps.file_changes.outputs.files}}'
|
|
32
|
+
|
|
33
|
+
- name: Run pre-commits
|
|
34
|
+
uses: pre-commit/action@v3.0.1
|
|
35
|
+
with:
|
|
36
|
+
extra_args: --files ${{ steps.file_changes.outputs.files}}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, "release/*", "dev"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
run_tests_ubuntu:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
|
|
16
|
+
timeout-minutes: 30
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v3
|
|
21
|
+
|
|
22
|
+
- name: Set up Python 3.12
|
|
23
|
+
uses: actions/setup-python@v3
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
|
|
27
|
+
- name: Install packages
|
|
28
|
+
run: |
|
|
29
|
+
pip install -e .[tests]
|
|
30
|
+
|
|
31
|
+
#----------------------------------------------
|
|
32
|
+
# run test suite
|
|
33
|
+
#----------------------------------------------
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: |
|
|
36
|
+
pytest -v --doctest-modules --cov --ignore=hf_cohort/
|
|
37
|
+
|
|
38
|
+
- name: Upload coverage to Codecov
|
|
39
|
+
uses: codecov/codecov-action@v4.0.1
|
|
40
|
+
with:
|
|
41
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
#.idea/
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
default_language_version:
|
|
2
|
+
python: python3.12
|
|
3
|
+
|
|
4
|
+
exclude: "sample_data|docs/MIMIC_IV_tutorial/wandb_reports"
|
|
5
|
+
|
|
6
|
+
repos:
|
|
7
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
8
|
+
rev: v4.4.0
|
|
9
|
+
hooks:
|
|
10
|
+
# list of supported hooks: https://pre-commit.com/hooks.html
|
|
11
|
+
- id: trailing-whitespace
|
|
12
|
+
- id: end-of-file-fixer
|
|
13
|
+
- id: check-docstring-first
|
|
14
|
+
- id: check-yaml
|
|
15
|
+
- id: debug-statements
|
|
16
|
+
- id: detect-private-key
|
|
17
|
+
- id: check-executables-have-shebangs
|
|
18
|
+
- id: check-toml
|
|
19
|
+
- id: check-case-conflict
|
|
20
|
+
- id: check-added-large-files
|
|
21
|
+
args: [--maxkb, "800"]
|
|
22
|
+
|
|
23
|
+
# python code formatting
|
|
24
|
+
- repo: https://github.com/psf/black
|
|
25
|
+
rev: 23.7.0
|
|
26
|
+
hooks:
|
|
27
|
+
- id: black
|
|
28
|
+
args: [--line-length, "110"]
|
|
29
|
+
|
|
30
|
+
# python import sorting
|
|
31
|
+
- repo: https://github.com/PyCQA/isort
|
|
32
|
+
rev: 5.12.0
|
|
33
|
+
hooks:
|
|
34
|
+
- id: isort
|
|
35
|
+
args: ["--profile", "black", "--filter-files", "-o", "wandb"]
|
|
36
|
+
|
|
37
|
+
- repo: https://github.com/PyCQA/autoflake
|
|
38
|
+
rev: v2.2.0
|
|
39
|
+
hooks:
|
|
40
|
+
- id: autoflake
|
|
41
|
+
args: [--in-place, --remove-all-unused-imports]
|
|
42
|
+
|
|
43
|
+
# python upgrading syntax to newer version
|
|
44
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
45
|
+
rev: v3.10.1
|
|
46
|
+
hooks:
|
|
47
|
+
- id: pyupgrade
|
|
48
|
+
args: [--py310-plus]
|
|
49
|
+
|
|
50
|
+
# python docstring formatting
|
|
51
|
+
- repo: https://github.com/myint/docformatter
|
|
52
|
+
rev: v1.7.5
|
|
53
|
+
hooks:
|
|
54
|
+
- id: docformatter
|
|
55
|
+
args: [--in-place, --wrap-summaries=110, --wrap-descriptions=110]
|
|
56
|
+
|
|
57
|
+
# python check (PEP8), programming errors and code complexity
|
|
58
|
+
- repo: https://github.com/PyCQA/flake8
|
|
59
|
+
rev: 6.1.0
|
|
60
|
+
hooks:
|
|
61
|
+
- id: flake8
|
|
62
|
+
args:
|
|
63
|
+
[
|
|
64
|
+
"--max-complexity=10",
|
|
65
|
+
"--extend-ignore",
|
|
66
|
+
"E402,E701,E251,E226,E302,W504,E704,E402,E401,C901,E203",
|
|
67
|
+
"--max-line-length=110",
|
|
68
|
+
"--exclude",
|
|
69
|
+
"logs/*,data/*",
|
|
70
|
+
"--per-file-ignores",
|
|
71
|
+
"__init__.py:F401",
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
# yaml formatting
|
|
75
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
76
|
+
rev: v3.0.3
|
|
77
|
+
hooks:
|
|
78
|
+
- id: prettier
|
|
79
|
+
types: [yaml]
|
|
80
|
+
exclude: "environment.yaml"
|
|
81
|
+
|
|
82
|
+
# shell scripts linter
|
|
83
|
+
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
84
|
+
rev: v0.9.0.5
|
|
85
|
+
hooks:
|
|
86
|
+
- id: shellcheck
|
|
87
|
+
|
|
88
|
+
# md formatting
|
|
89
|
+
- repo: https://github.com/executablebooks/mdformat
|
|
90
|
+
rev: 0.7.17
|
|
91
|
+
hooks:
|
|
92
|
+
- id: mdformat
|
|
93
|
+
args: ["--number"]
|
|
94
|
+
additional_dependencies:
|
|
95
|
+
- mdformat-gfm
|
|
96
|
+
- mdformat-tables
|
|
97
|
+
- mdformat_frontmatter
|
|
98
|
+
- mdformat-myst
|
|
99
|
+
- mdformat-black
|
|
100
|
+
- mdformat-config
|
|
101
|
+
- mdformat-shfmt
|
|
102
|
+
|
|
103
|
+
# word spelling linter
|
|
104
|
+
- repo: https://github.com/codespell-project/codespell
|
|
105
|
+
rev: v2.2.5
|
|
106
|
+
hooks:
|
|
107
|
+
- id: codespell
|
|
108
|
+
args:
|
|
109
|
+
- --skip=logs/**,data/**,*.ipynb,*.bib,env.yml,env_cpu.yml,*.svg,poetry.lock
|
|
110
|
+
- --ignore-words-list=ehr
|
|
111
|
+
|
|
112
|
+
# jupyter notebook cell output clearing
|
|
113
|
+
- repo: https://github.com/kynan/nbstripout
|
|
114
|
+
rev: 0.6.1
|
|
115
|
+
hooks:
|
|
116
|
+
- id: nbstripout
|
|
117
|
+
|
|
118
|
+
# jupyter notebook linting
|
|
119
|
+
- repo: https://github.com/nbQA-dev/nbQA
|
|
120
|
+
rev: 1.7.0
|
|
121
|
+
hooks:
|
|
122
|
+
- id: nbqa-black
|
|
123
|
+
args: ["--line-length=110"]
|
|
124
|
+
- id: nbqa-isort
|
|
125
|
+
args: ["--profile=black"]
|
|
126
|
+
- id: nbqa-flake8
|
|
127
|
+
args:
|
|
128
|
+
[
|
|
129
|
+
"--extend-ignore=E203,E402,E501,F401,F841",
|
|
130
|
+
"--exclude=logs/*,data/*",
|
|
131
|
+
]
|
meds_tab-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Matthew McDermott
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
meds_tab-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: meds-tab
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Scalable Tabularization of MEDS format Time-Series data
|
|
5
|
+
Author-email: Matthew McDermott <mattmcdermott8@gmail.com>, Nassim Oufattole <noufattole@gmail.com>, Teya Bergamaschi <teyabergamaschi@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/mmcdermott/MEDS_Tabular_AutoML
|
|
7
|
+
Project-URL: Issues, https://github.com/mmcdermott/MEDS_Tabular_AutoML/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.12
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: polars
|
|
15
|
+
Requires-Dist: pyarrow
|
|
16
|
+
Requires-Dist: loguru
|
|
17
|
+
Requires-Dist: hydra-core
|
|
18
|
+
Requires-Dist: numpy
|
|
19
|
+
Requires-Dist: scipy
|
|
20
|
+
Requires-Dist: pandas
|
|
21
|
+
Requires-Dist: tqdm
|
|
22
|
+
Requires-Dist: xgboost
|
|
23
|
+
Requires-Dist: scikit-learn
|
|
24
|
+
Requires-Dist: hydra-optuna-sweeper
|
|
25
|
+
Requires-Dist: hydra-joblib-launcher
|
|
26
|
+
Requires-Dist: ml-mixins
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
29
|
+
Provides-Extra: tests
|
|
30
|
+
Requires-Dist: pytest; extra == "tests"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "tests"
|
|
32
|
+
Requires-Dist: rootutils; extra == "tests"
|
|
33
|
+
Provides-Extra: profiling
|
|
34
|
+
Requires-Dist: mprofile; extra == "profiling"
|
|
35
|
+
Requires-Dist: matplotlib; extra == "profiling"
|
|
36
|
+
|
|
37
|
+
# Scalable tabularization and tabular feature usage utilities over generic MEDS datasets
|
|
38
|
+
|
|
39
|
+
This repository provides utilities and scripts to run limited automatic tabular ML pipelines for generic MEDS
|
|
40
|
+
datasets.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Installation
|
|
44
|
+
|
|
45
|
+
**Pip Install**
|
|
46
|
+
```bash
|
|
47
|
+
pip install meds-tab
|
|
48
|
+
```
|
|
49
|
+
**Local Install**
|
|
50
|
+
```
|
|
51
|
+
# clone the git repo
|
|
52
|
+
pip install .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
# Usage
|
|
56
|
+
|
|
57
|
+
This repository consists of two key pieces:
|
|
58
|
+
|
|
59
|
+
1. Construction of and efficient loading of tabular (flat, non-longitudinal) summary features describing
|
|
60
|
+
patient records in MEDS over arbitrary time-windows (e.g. 1 year, 6 months, etc.) either backwards or
|
|
61
|
+
forwards in time from a given index date. Naturally, only "look-back" windows should be used for
|
|
62
|
+
future-event prediction tasks, and are thus currently implemented.
|
|
63
|
+
2. Running a basic XGBoost AutoML pipeline over these tabular features to predict arbitrary binary classification or regression
|
|
64
|
+
downstream tasks defined over these datasets. The "AutoML" part of this is not particularly advanced --
|
|
65
|
+
what is more advanced is the efficient construction, storage, and loading of tabular features for the
|
|
66
|
+
candidate AutoML models, enabling a far more extensive search over different featurization strategies.
|
|
67
|
+
|
|
68
|
+
### Scripts and Examples
|
|
69
|
+
|
|
70
|
+
See `tests/test_integration.py` for an example of the end-to-end pipeline being run on synthetic data. This
|
|
71
|
+
script is a functional test that is also run with `pytest` to verify the correctness of the algorithm.
|
|
72
|
+
|
|
73
|
+
For an end to end example over MIMIC-IV, see the [companion repository](https://github.com/mmcdermott/MEDS_TAB_MIMIC_IV)
|
|
74
|
+
|
|
75
|
+
### Core CLI Scripts Overview
|
|
76
|
+
|
|
77
|
+
1. **`meds-tab-describe`**: This command processes MEDS data shards to compute the frequencies of different code-types
|
|
78
|
+
- time-series codes (codes with timestamps)
|
|
79
|
+
- time-series numerical values (codes with timestamps and numerical values)
|
|
80
|
+
- static codes (codes without timestamps)
|
|
81
|
+
- static numerical codes (codes without timestamps but with numerical values).
|
|
82
|
+
|
|
83
|
+
2. **`meds-tab-tabularize-static`**: Filters and processes the dataset based on the frequency of codes, generating a tabular vector for each patient at each timestamp in the shards. Each row corresponds to a unique `patient_id` and `timestamp` combination, thus rows are duplicated across multiple timestamps for the same patient.
|
|
84
|
+
|
|
85
|
+
3. **`meds-tab-tabularize-time-series`**: Iterates through combinations of a shard, `window_size`, and `aggregation` to generate feature vectors that aggregate patient data for each unique `patient_id` x `timestamp`. This stage (and the previous stage) use sparse matrix formats to efficiently handle the computational and storage demands of rolling window calculations on large datasets. We support parallelization through Hydra's `--multirun` flag and the `joblib` launcher.
|
|
86
|
+
|
|
87
|
+
4. **`meds-tab-cache-task`**: Aligns task-specific labels with the nearest prior event in the tabularized data. It requires a labeled dataset directory with three columns (`patient_id`, `timestamp`, `label`) structured similarly to the `MEDS_cohort_dir`.
|
|
88
|
+
|
|
89
|
+
5. **`meds-tab-xgboost`**: Trains an XGBoost model using user-specified parameters.
|
|
90
|
+
|
|
91
|
+
6. **`meds-tab-xgboost-sweep`**: Conducts an Optuna hyperparameter sweep to optimize over `window_sizes`, `aggregations`, and `min_code_inclusion_frequency`, aiming to enhance model performance and adaptability.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
#### What do you mean "tabular pipelines"? Isn't _all_ structured EHR data already tabular?
|
|
95
|
+
|
|
96
|
+
This is a common misconception. _Tabular_ data refers to data that can be organized in a consistent, logical
|
|
97
|
+
set of rows/columns such that the entirety of a "sample" or "instance" for modeling or analysis is contained
|
|
98
|
+
in a single row, and the set of columns possibly observed (there can be missingness) is consistent across all
|
|
99
|
+
rows. Structured EHR data does not satisfy this definition, as we will have different numbers of observations
|
|
100
|
+
of medical codes and values at different timestamps for different patients, so it cannot simultanesouly
|
|
101
|
+
satisfy the (1) "single row single instance", (2) "consistent set of columns", and (3) "logical" requirements.
|
|
102
|
+
Thus, in this pipeline, when we say we will produce a "tabular" view of MEDS data, we mean a dataset that can
|
|
103
|
+
realize these constraints, which will explicitly involve summarizing the patient data over various historical
|
|
104
|
+
or future windows in time to produce a single row per patient with a consistent, logical set of columns
|
|
105
|
+
(though there may still be missingness).
|
meds_tab-0.0.1/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Scalable tabularization and tabular feature usage utilities over generic MEDS datasets
|
|
2
|
+
|
|
3
|
+
This repository provides utilities and scripts to run limited automatic tabular ML pipelines for generic MEDS
|
|
4
|
+
datasets.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Installation
|
|
8
|
+
|
|
9
|
+
**Pip Install**
|
|
10
|
+
```bash
|
|
11
|
+
pip install meds-tab
|
|
12
|
+
```
|
|
13
|
+
**Local Install**
|
|
14
|
+
```
|
|
15
|
+
# clone the git repo
|
|
16
|
+
pip install .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
# Usage
|
|
20
|
+
|
|
21
|
+
This repository consists of two key pieces:
|
|
22
|
+
|
|
23
|
+
1. Construction of and efficient loading of tabular (flat, non-longitudinal) summary features describing
|
|
24
|
+
patient records in MEDS over arbitrary time-windows (e.g. 1 year, 6 months, etc.) either backwards or
|
|
25
|
+
forwards in time from a given index date. Naturally, only "look-back" windows should be used for
|
|
26
|
+
future-event prediction tasks, and are thus currently implemented.
|
|
27
|
+
2. Running a basic XGBoost AutoML pipeline over these tabular features to predict arbitrary binary classification or regression
|
|
28
|
+
downstream tasks defined over these datasets. The "AutoML" part of this is not particularly advanced --
|
|
29
|
+
what is more advanced is the efficient construction, storage, and loading of tabular features for the
|
|
30
|
+
candidate AutoML models, enabling a far more extensive search over different featurization strategies.
|
|
31
|
+
|
|
32
|
+
### Scripts and Examples
|
|
33
|
+
|
|
34
|
+
See `tests/test_integration.py` for an example of the end-to-end pipeline being run on synthetic data. This
|
|
35
|
+
script is a functional test that is also run with `pytest` to verify the correctness of the algorithm.
|
|
36
|
+
|
|
37
|
+
For an end to end example over MIMIC-IV, see the [companion repository](https://github.com/mmcdermott/MEDS_TAB_MIMIC_IV)
|
|
38
|
+
|
|
39
|
+
### Core CLI Scripts Overview
|
|
40
|
+
|
|
41
|
+
1. **`meds-tab-describe`**: This command processes MEDS data shards to compute the frequencies of different code-types
|
|
42
|
+
- time-series codes (codes with timestamps)
|
|
43
|
+
- time-series numerical values (codes with timestamps and numerical values)
|
|
44
|
+
- static codes (codes without timestamps)
|
|
45
|
+
- static numerical codes (codes without timestamps but with numerical values).
|
|
46
|
+
|
|
47
|
+
2. **`meds-tab-tabularize-static`**: Filters and processes the dataset based on the frequency of codes, generating a tabular vector for each patient at each timestamp in the shards. Each row corresponds to a unique `patient_id` and `timestamp` combination, thus rows are duplicated across multiple timestamps for the same patient.
|
|
48
|
+
|
|
49
|
+
3. **`meds-tab-tabularize-time-series`**: Iterates through combinations of a shard, `window_size`, and `aggregation` to generate feature vectors that aggregate patient data for each unique `patient_id` x `timestamp`. This stage (and the previous stage) use sparse matrix formats to efficiently handle the computational and storage demands of rolling window calculations on large datasets. We support parallelization through Hydra's `--multirun` flag and the `joblib` launcher.
|
|
50
|
+
|
|
51
|
+
4. **`meds-tab-cache-task`**: Aligns task-specific labels with the nearest prior event in the tabularized data. It requires a labeled dataset directory with three columns (`patient_id`, `timestamp`, `label`) structured similarly to the `MEDS_cohort_dir`.
|
|
52
|
+
|
|
53
|
+
5. **`meds-tab-xgboost`**: Trains an XGBoost model using user-specified parameters.
|
|
54
|
+
|
|
55
|
+
6. **`meds-tab-xgboost-sweep`**: Conducts an Optuna hyperparameter sweep to optimize over `window_sizes`, `aggregations`, and `min_code_inclusion_frequency`, aiming to enhance model performance and adaptability.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
#### What do you mean "tabular pipelines"? Isn't _all_ structured EHR data already tabular?
|
|
59
|
+
|
|
60
|
+
This is a common misconception. _Tabular_ data refers to data that can be organized in a consistent, logical
|
|
61
|
+
set of rows/columns such that the entirety of a "sample" or "instance" for modeling or analysis is contained
|
|
62
|
+
in a single row, and the set of columns possibly observed (there can be missingness) is consistent across all
|
|
63
|
+
rows. Structured EHR data does not satisfy this definition, as we will have different numbers of observations
|
|
64
|
+
of medical codes and values at different timestamps for different patients, so it cannot simultanesouly
|
|
65
|
+
satisfy the (1) "single row single instance", (2) "consistent set of columns", and (3) "logical" requirements.
|
|
66
|
+
Thus, in this pipeline, when we say we will produce a "tabular" view of MEDS data, we mean a dataset that can
|
|
67
|
+
realize these constraints, which will explicitly involve summarizing the patient data over various historical
|
|
68
|
+
or future windows in time to produce a single row per patient with a consistent, logical set of columns
|
|
69
|
+
(though there may still be missingness).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|