medpipe 0.4.0.dev2__tar.gz → 0.5.0__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.
Files changed (43) hide show
  1. medpipe-0.5.0/PKG-INFO +110 -0
  2. medpipe-0.5.0/README.md +59 -0
  3. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/pyproject.toml +52 -25
  4. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/__init__.py +4 -3
  5. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/metrics/core.py +281 -69
  6. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/metrics/registry.py +15 -2
  7. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/pipeline/estimator.py +2 -2
  8. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/pipeline/evaluator.py +67 -42
  9. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/pipeline/orchestrator.py +19 -6
  10. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/pipeline/pipeline.py +115 -82
  11. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/pipeline/runner.py +108 -44
  12. medpipe-0.5.0/src/medpipe/py.typed +0 -0
  13. medpipe-0.5.0/src/medpipe/utils/bootstrap.py +80 -0
  14. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/config.py +669 -145
  15. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/io.py +43 -5
  16. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/logger.py +18 -1
  17. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/registry.py +2 -4
  18. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/reproducibility.py +1 -3
  19. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/validation.py +1 -1
  20. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/visualisation/displayer.py +392 -165
  21. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/visualisation/plots.py +99 -38
  22. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/visualisation/themes.py +1 -2
  23. medpipe-0.5.0/src/medpipe.egg-info/PKG-INFO +110 -0
  24. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe.egg-info/SOURCES.txt +4 -1
  25. medpipe-0.5.0/src/medpipe.egg-info/requires.txt +30 -0
  26. medpipe-0.5.0/tests/test_packaging_metadata.py +26 -0
  27. medpipe-0.4.0.dev2/PKG-INFO +0 -155
  28. medpipe-0.4.0.dev2/README.md +0 -114
  29. medpipe-0.4.0.dev2/src/medpipe.egg-info/PKG-INFO +0 -155
  30. medpipe-0.4.0.dev2/src/medpipe.egg-info/requires.txt +0 -17
  31. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/LICENSE +0 -0
  32. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/setup.cfg +0 -0
  33. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/data/__init__.py +0 -0
  34. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/data/registry.py +0 -0
  35. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/data/utils.py +0 -0
  36. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/metrics/__init__.py +0 -0
  37. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/models/__init__.py +0 -0
  38. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/models/registry.py +0 -0
  39. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/pipeline/__init__.py +0 -0
  40. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/utils/__init__.py +0 -0
  41. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe/visualisation/__init__.py +0 -0
  42. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe.egg-info/dependency_links.txt +0 -0
  43. {medpipe-0.4.0.dev2 → medpipe-0.5.0}/src/medpipe.egg-info/top_level.txt +0 -0
medpipe-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: medpipe
3
+ Version: 0.5.0
4
+ Summary: Configuration-driven, TRIPOD+AI compliant ML pipelines for tabular clinical data.
5
+ Author-email: Mathias Roesler <mathias.roesler@auckland.co.nz>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Changelog, https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/main/CHANGELOG.md
8
+ Project-URL: Homepage, https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe
9
+ Project-URL: Repository, https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe.git
10
+ Classifier: Intended Audience :: Healthcare Industry
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: matplotlib>=3.10.0
24
+ Requires-Dist: ngboost>=0.5.10
25
+ Requires-Dist: numpy>=2.0.0
26
+ Requires-Dist: ordboost>=0.6.0
27
+ Requires-Dist: pandas>=2.2.0
28
+ Requires-Dist: pyarrow>=15.0.0
29
+ Requires-Dist: pydantic>=2.0.0
30
+ Requires-Dist: pysplinecalib>=0.0.1
31
+ Requires-Dist: scikit-learn>=1.8.0
32
+ Requires-Dist: scipy>=1.12.0
33
+ Requires-Dist: scores>=2.6.0
34
+ Provides-Extra: excel
35
+ Requires-Dist: openpyxl>=3.1.0; extra == "excel"
36
+ Provides-Extra: dev
37
+ Requires-Dist: openpyxl>=3.1.0; extra == "dev"
38
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
39
+ Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
40
+ Requires-Dist: trove-classifiers>=2024.1.1; extra == "dev"
41
+ Requires-Dist: medpipe[docs]; extra == "dev"
42
+ Provides-Extra: docs
43
+ Requires-Dist: mkdocs<2,>=1.5.0; extra == "docs"
44
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
45
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
46
+ Requires-Dist: mkdocs-include-markdown-plugin; extra == "docs"
47
+ Requires-Dist: ruff>=0.16.7; extra == "docs"
48
+ Requires-Dist: mypy>=2.3.0; extra == "docs"
49
+ Requires-Dist: pandas-stubs; extra == "docs"
50
+ Dynamic: license-file
51
+
52
+ # MedPipe
53
+
54
+ [![PyPI Version](https://img.shields.io/pypi/v/medpipe.svg)](https://pypi.org/project/medpipe/)
55
+ [![PyPI Python Versions](https://img.shields.io/pypi/pyversions/medpipe.svg)](https://pypi.org/project/medpipe/)
56
+ [![License](https://img.shields.io/github/license/Surgical-Recovery-and-Safety-Lab/medpipe)](https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/main/LICENSE)
57
+ [![tests](https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/actions/workflows/run_test.yml/badge.svg)](https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/actions/workflows/run_test.yml)
58
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-526CFE?style=flat&logo=materialforgithub)](https://Surgical-Recovery-and-Safety-Lab.github.io/medpipe/)
59
+
60
+ ## Table of content
61
+ 1. [Overview](#overview)
62
+ 2. [Installation](#installation)
63
+ 3. [Key features](#key-features)
64
+ 4. [Quickstart example](#quickstart-example)
65
+ 5. [Acknowledgements](#acknowledgements)
66
+
67
+ ## Overview
68
+ The **MedPipe** package is a layer to help create AI models (classifiers and regressors) for clinical applications from tabular data. It covers data loading and preprocessing, model creation and training, recalibration, and visualisation.
69
+ ___
70
+
71
+ ## Installation
72
+
73
+ To install **MedPipe** use pip:
74
+ ```
75
+ $ pip install medpipe
76
+ ```
77
+ ___
78
+
79
+ ## Key features
80
+
81
+ * **TRIPOD+AI Guideline Compliant**: Designed from the ground up to follow rigorous clinical machine learning reporting standards.
82
+ * **Scikit-Learn Compatible**: Integrates seamlessly with standard Scikit-Learn estimators, transformers, and pipelines.
83
+ * **Declarative TOML Configuration**: Define entire experiments, from preprocessing to plotting aesthetics, in a single validated TOML configuration file.
84
+ * **Multi-Outcome Pipelines**: Model distinct clinical outcomes in a single run with independent hyperparameter and recalibration overrides.
85
+ * **Integrated Recalibration & Fairness**: Native probability recalibration and stratified subgroup analysis to evaluate algorithmic fairness across patient cohorts.
86
+ * **Clinical Metrics & Visualizations**: Automatic generation of Decision Curve Analysis (DCA), reliability diagrams, ROC/PR curves, and bootstrapped 95% confidence intervals.
87
+ * **Standardized Artifact Tracking**: Automatic, structured output management for models, metrics, environment metadata, and execution logs in a unified `artifacts/` hierarchy.
88
+ ___
89
+
90
+ ## Quickstart example
91
+
92
+ Minimal example based on the provided configuration file (`examples/default_classifier_config.toml`):
93
+
94
+ ``` py linenums="1", title="Minimal example"
95
+ from pydantic import ValidationError
96
+
97
+ from medpipe import MedpipeClassifier
98
+
99
+ try: # Catch any Pydantic configuration errors
100
+ pipe = MedpipeClassifier("default_classifier_config.toml")
101
+ pipe.run()
102
+ except ValidationError as err:
103
+ print(err)
104
+ exit()
105
+ ```
106
+ ___
107
+
108
+ ## Acknowledgements
109
+
110
+ This package was developed using Claude Sonnet 5.5. The code was reviewed and edited by humans.
@@ -0,0 +1,59 @@
1
+ # MedPipe
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/medpipe.svg)](https://pypi.org/project/medpipe/)
4
+ [![PyPI Python Versions](https://img.shields.io/pypi/pyversions/medpipe.svg)](https://pypi.org/project/medpipe/)
5
+ [![License](https://img.shields.io/github/license/Surgical-Recovery-and-Safety-Lab/medpipe)](https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/main/LICENSE)
6
+ [![tests](https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/actions/workflows/run_test.yml/badge.svg)](https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/actions/workflows/run_test.yml)
7
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-526CFE?style=flat&logo=materialforgithub)](https://Surgical-Recovery-and-Safety-Lab.github.io/medpipe/)
8
+
9
+ ## Table of content
10
+ 1. [Overview](#overview)
11
+ 2. [Installation](#installation)
12
+ 3. [Key features](#key-features)
13
+ 4. [Quickstart example](#quickstart-example)
14
+ 5. [Acknowledgements](#acknowledgements)
15
+
16
+ ## Overview
17
+ The **MedPipe** package is a layer to help create AI models (classifiers and regressors) for clinical applications from tabular data. It covers data loading and preprocessing, model creation and training, recalibration, and visualisation.
18
+ ___
19
+
20
+ ## Installation
21
+
22
+ To install **MedPipe** use pip:
23
+ ```
24
+ $ pip install medpipe
25
+ ```
26
+ ___
27
+
28
+ ## Key features
29
+
30
+ * **TRIPOD+AI Guideline Compliant**: Designed from the ground up to follow rigorous clinical machine learning reporting standards.
31
+ * **Scikit-Learn Compatible**: Integrates seamlessly with standard Scikit-Learn estimators, transformers, and pipelines.
32
+ * **Declarative TOML Configuration**: Define entire experiments, from preprocessing to plotting aesthetics, in a single validated TOML configuration file.
33
+ * **Multi-Outcome Pipelines**: Model distinct clinical outcomes in a single run with independent hyperparameter and recalibration overrides.
34
+ * **Integrated Recalibration & Fairness**: Native probability recalibration and stratified subgroup analysis to evaluate algorithmic fairness across patient cohorts.
35
+ * **Clinical Metrics & Visualizations**: Automatic generation of Decision Curve Analysis (DCA), reliability diagrams, ROC/PR curves, and bootstrapped 95% confidence intervals.
36
+ * **Standardized Artifact Tracking**: Automatic, structured output management for models, metrics, environment metadata, and execution logs in a unified `artifacts/` hierarchy.
37
+ ___
38
+
39
+ ## Quickstart example
40
+
41
+ Minimal example based on the provided configuration file (`examples/default_classifier_config.toml`):
42
+
43
+ ``` py linenums="1", title="Minimal example"
44
+ from pydantic import ValidationError
45
+
46
+ from medpipe import MedpipeClassifier
47
+
48
+ try: # Catch any Pydantic configuration errors
49
+ pipe = MedpipeClassifier("default_classifier_config.toml")
50
+ pipe.run()
51
+ except ValidationError as err:
52
+ print(err)
53
+ exit()
54
+ ```
55
+ ___
56
+
57
+ ## Acknowledgements
58
+
59
+ This package was developed using Claude Sonnet 5.5. The code was reviewed and edited by humans.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "medpipe"
3
- description = "Clinical AI pipeline developement following TRIPOD+AI guidelines"
3
+ description = "Configuration-driven, TRIPOD+AI compliant ML pipelines for tabular clinical data."
4
4
  readme = "README.md"
5
5
  requires-python = ">=3.12"
6
6
  license = "Apache-2.0"
@@ -9,7 +9,6 @@ authors = [
9
9
  { name = "Mathias Roesler", email = "mathias.roesler@auckland.co.nz" },
10
10
  ]
11
11
  classifiers = [
12
- "Development Status :: 4 - Beta",
13
12
  "Intended Audience :: Healthcare Industry",
14
13
  "Intended Audience :: Science/Research",
15
14
  "Operating System :: POSIX :: Linux",
@@ -28,14 +27,14 @@ dependencies = [
28
27
  "matplotlib>=3.10.0",
29
28
  "ngboost>=0.5.10",
30
29
  "numpy>=2.0.0",
31
- "ordboost>=0.3.1",
30
+ "ordboost>=0.6.0",
32
31
  "pandas>=2.2.0",
33
32
  "pyarrow>=15.0.0",
34
33
  "pydantic>=2.0.0",
34
+ "pysplinecalib>=0.0.1",
35
35
  "scikit-learn>=1.8.0",
36
36
  "scipy>=1.12.0",
37
37
  "scores>=2.6.0",
38
- "splinecalib>=0.0.13",
39
38
  ]
40
39
 
41
40
  [project.urls]
@@ -43,36 +42,58 @@ Changelog = "https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe/blob/ma
43
42
  Homepage = "https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe"
44
43
  Repository = "https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe.git"
45
44
 
46
- # Development and testing dependencies
45
+ # Optional features, development and testing dependencies
47
46
  [project.optional-dependencies]
47
+ excel = [
48
+ "openpyxl>=3.1.0",
49
+ ]
48
50
  dev = [
49
51
  "openpyxl>=3.1.0",
50
52
  "pytest>=8.0.0",
51
53
  "pytest-mock>=3.12.0",
54
+ "trove-classifiers>=2024.1.1",
55
+ "medpipe[docs]",
56
+ ]
57
+ docs = [
58
+ "mkdocs>=1.5.0,<2",
59
+ "mkdocs-material>=9.5.0",
60
+ "mkdocstrings[python]>=0.24.0",
61
+ "mkdocs-include-markdown-plugin",
52
62
  "ruff>=0.16.7",
63
+ "mypy>=2.3.0",
64
+ "pandas-stubs",
53
65
  ]
54
66
 
55
67
  [build-system]
56
68
  requires = ["setuptools>=61.0"]
57
69
  build-backend = "setuptools.build_meta"
58
70
 
71
+ [tool.mypy]
72
+
73
+ # These libraries ship neither inline types nor stubs.
74
+ [[tool.mypy.overrides]]
75
+ module = [
76
+ "joblib.*",
77
+ "mpl_toolkits.*",
78
+ "ngboost.*",
79
+ "ordboost.*",
80
+ "pysplinecalib.*",
81
+ "scores.*",
82
+ "sklearn.*",
83
+ ]
84
+ ignore_missing_imports = true
85
+
59
86
  [tool.pytest.ini_options]
60
87
  addopts = "-ra -q"
61
- minversion = "8.0"
62
- testpaths = ["tests"]
63
88
  filterwarnings = [
64
- # pandas' own feather I/O calls pyarrow's deprecated feather.write_feather /
65
- # read_feather instead of the new pyarrow.ipc API. This is pandas-internal,
66
- # not something medpipe controls, and will resolve itself once pandas
67
- # updates its feather backend.
68
- "ignore:pyarrow\\.feather\\.(write|read)_feather is deprecated.*:FutureWarning",
89
+ # pandas' own feather I/O calls pyarrow's deprecated feather.write_feather /
90
+ # read_feather instead of the new pyarrow.ipc API. This is pandas-internal,
91
+ # not something medpipe controls, and will resolve itself once pandas
92
+ # updates its feather backend.
93
+ "ignore:pyarrow\\.feather\\.(write|read)_feather is deprecated.*:FutureWarning",
69
94
  ]
70
-
71
- [tool.setuptools.packages.find]
72
- where = ["src"]
73
-
74
- [tool.setuptools.dynamic]
75
- version = { attr = "medpipe.__version__" }
95
+ minversion = "8.0"
96
+ testpaths = ["tests"]
76
97
 
77
98
  [tool.ruff]
78
99
  target-version = "py312"
@@ -81,13 +102,19 @@ src = ["src"]
81
102
 
82
103
  [tool.ruff.lint]
83
104
  select = [
84
- "E", # pycodestyle errors
85
- "W", # pycodestyle warnings
86
- "F", # Pyflakes
87
- "I", # isort
105
+ "E", # pycodestyle errors
106
+ "W", # pycodestyle warnings
107
+ "F", # Pyflakes
108
+ "I", # isort
88
109
  "UP", # pyupgrade
89
- "B", # flake8-bugbear
110
+ "B", # flake8-bugbear
90
111
  "C4", # flake8-comprehensions
91
- "SIM", # flake8-simplify
92
- "RUF", # Ruff-specific rules
112
+ "SIM", # flake8-simplify
113
+ "RUF", # Ruff-specific rules
93
114
  ]
115
+
116
+ [tool.setuptools.packages.find]
117
+ where = ["src"]
118
+
119
+ [tool.setuptools.dynamic]
120
+ version = { attr = "medpipe.__version__" }
@@ -1,12 +1,12 @@
1
1
  """
2
- Medpipe: A Python framework for clinical machine learning pipeline
2
+ MedPipe: A Python framework for clinical machine learning pipeline
3
3
  orchestration.
4
4
 
5
5
  Provides unified high-level interfaces for data preparation, model fitting,
6
6
  post-hoc calibration, TRIPOD+AI compliant evaluation, and reproducibility tracking.
7
7
  """
8
8
 
9
- from medpipe.metrics import MetricRegistry
9
+ from medpipe.metrics import MetricRegistry, MetricSpec
10
10
  from medpipe.models import ModelRegistry
11
11
  from medpipe.pipeline import (
12
12
  MedpipeClassifier,
@@ -19,7 +19,7 @@ from medpipe.pipeline import (
19
19
  )
20
20
  from medpipe.utils import MedpipeClassifierConfig, MedpipeRegressorConfig
21
21
 
22
- __version__ = "0.4.0.dev2"
22
+ __version__ = "0.5.0"
23
23
 
24
24
  __all__ = [ # noqa: RUF022 (grouped by category, not alphabetical)
25
25
  # Primary API Entry Points
@@ -36,6 +36,7 @@ __all__ = [ # noqa: RUF022 (grouped by category, not alphabetical)
36
36
  # Component Registries (for custom models & metrics)
37
37
  "ModelRegistry",
38
38
  "MetricRegistry",
39
+ "MetricSpec",
39
40
  # Package Metadata
40
41
  "__version__",
41
42
  ]