prodrome 0.1.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.
- prodrome-0.1.0/.gitignore +49 -0
- prodrome-0.1.0/CHANGELOG.md +33 -0
- prodrome-0.1.0/LICENSE +202 -0
- prodrome-0.1.0/PKG-INFO +352 -0
- prodrome-0.1.0/README.md +279 -0
- prodrome-0.1.0/configs/clock.yaml +17 -0
- prodrome-0.1.0/configs/default.yaml +39 -0
- prodrome-0.1.0/configs/logistic.yaml +13 -0
- prodrome-0.1.0/configs/qsofa.yaml +13 -0
- prodrome-0.1.0/configs/sirs.yaml +12 -0
- prodrome-0.1.0/pyproject.toml +107 -0
- prodrome-0.1.0/src/prodrome/__init__.py +9 -0
- prodrome-0.1.0/src/prodrome/calibrate/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/calibrate/policy.py +307 -0
- prodrome-0.1.0/src/prodrome/cli.py +754 -0
- prodrome-0.1.0/src/prodrome/core/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/core/channels.py +93 -0
- prodrome-0.1.0/src/prodrome/core/config.py +175 -0
- prodrome-0.1.0/src/prodrome/core/errors.py +54 -0
- prodrome-0.1.0/src/prodrome/core/interfaces.py +86 -0
- prodrome-0.1.0/src/prodrome/core/registry.py +70 -0
- prodrome-0.1.0/src/prodrome/core/types.py +452 -0
- prodrome-0.1.0/src/prodrome/data/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/data/fetch.py +173 -0
- prodrome-0.1.0/src/prodrome/data/parse.py +214 -0
- prodrome-0.1.0/src/prodrome/data/splits.py +116 -0
- prodrome-0.1.0/src/prodrome/data/synthetic.py +157 -0
- prodrome-0.1.0/src/prodrome/eval/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/eval/ablation.py +148 -0
- prodrome-0.1.0/src/prodrome/eval/gate.py +181 -0
- prodrome-0.1.0/src/prodrome/eval/metrics.py +252 -0
- prodrome-0.1.0/src/prodrome/eval/report.py +163 -0
- prodrome-0.1.0/src/prodrome/eval/runner.py +232 -0
- prodrome-0.1.0/src/prodrome/eval/utility.py +183 -0
- prodrome-0.1.0/src/prodrome/features/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/features/causal.py +310 -0
- prodrome-0.1.0/src/prodrome/features/clinical.py +164 -0
- prodrome-0.1.0/src/prodrome/features/windows.py +177 -0
- prodrome-0.1.0/src/prodrome/models/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/models/baselines.py +259 -0
- prodrome-0.1.0/src/prodrome/models/gbdt.py +202 -0
- prodrome-0.1.0/src/prodrome/models/sequence.py +262 -0
- prodrome-0.1.0/src/prodrome/pipeline.py +267 -0
- prodrome-0.1.0/src/prodrome/publish/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/publish/card.py +277 -0
- prodrome-0.1.0/src/prodrome/publish/hub.py +131 -0
- prodrome-0.1.0/src/prodrome/serve/__init__.py +1 -0
- prodrome-0.1.0/src/prodrome/serve/app.py +217 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
.venv/
|
|
3
|
+
.venv-docs/
|
|
4
|
+
__pycache__/
|
|
5
|
+
*.pyc
|
|
6
|
+
*.egg-info/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.coverage
|
|
13
|
+
htmlcov/
|
|
14
|
+
|
|
15
|
+
# The corpus is never committed. `prodrome data fetch` downloads it from the
|
|
16
|
+
# PhysioNet mirror and verifies it against a pinned digest, so every copy is the
|
|
17
|
+
# one the published numbers were measured on. No patient data reaches this
|
|
18
|
+
# repository, the wheel, or the model repositories.
|
|
19
|
+
/data/
|
|
20
|
+
|
|
21
|
+
# Runtime artefacts: prepared tables, trained weights, calibration records, traces.
|
|
22
|
+
# Weights live on the Hugging Face Hub, which is where a weight belongs.
|
|
23
|
+
/.prodrome/
|
|
24
|
+
/models/
|
|
25
|
+
*.log
|
|
26
|
+
|
|
27
|
+
# Reports: the baseline the gate compares against (reports/latest/) and the
|
|
28
|
+
# leaderboard are committed on purpose, so the history of quality is visible in
|
|
29
|
+
# review. Timestamped runs and CI output are not.
|
|
30
|
+
/reports/*Z.json
|
|
31
|
+
/reports/ci/
|
|
32
|
+
|
|
33
|
+
# Design documents stay private; the public contract is the documentation site.
|
|
34
|
+
PLAN.md
|
|
35
|
+
SPEC.md
|
|
36
|
+
**/NOTES.md
|
|
37
|
+
.private/
|
|
38
|
+
|
|
39
|
+
# Docs site build output
|
|
40
|
+
/site/
|
|
41
|
+
|
|
42
|
+
# Environment and editors
|
|
43
|
+
.env
|
|
44
|
+
.env.*
|
|
45
|
+
!.env.example
|
|
46
|
+
.DS_Store
|
|
47
|
+
.idea/
|
|
48
|
+
.vscode/
|
|
49
|
+
/ci/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Prodrome are recorded here. The format follows Keep a
|
|
4
|
+
Changelog and versions follow Semantic Versioning. The corpus manifest, the alert
|
|
5
|
+
policy and the evaluation report are versioned formats and only change with a note
|
|
6
|
+
here.
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-09-06
|
|
9
|
+
|
|
10
|
+
The first release: the measured pipeline.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Ingest and prepare the PhysioNet/CinC 2019 corpus with a pinned digest; nothing
|
|
15
|
+
under `data/` is ever committed or packaged.
|
|
16
|
+
- Causal window features with a truncation test that proves, per column, that no
|
|
17
|
+
feature can see a stay's future or its neighbours.
|
|
18
|
+
- Models: gradient boosting, logistic regression, a forward-only recurrent net, the
|
|
19
|
+
qSOFA and SIRS bedside scores, and a clock baseline that alerts on ICU hour alone.
|
|
20
|
+
- Calibrated abstention by conformal risk control under an explicit alert budget,
|
|
21
|
+
stating the promise in one sentence and alerting on nothing when it cannot be
|
|
22
|
+
certified.
|
|
23
|
+
- The challenge utility score, checked against the official implementation, reported
|
|
24
|
+
alongside strict and generous detection rates, lead times, calibration and alert
|
|
25
|
+
burden.
|
|
26
|
+
- Cross-hospital evaluation as the primary result, and an ablation separating
|
|
27
|
+
physiology from the workup and the clock.
|
|
28
|
+
- A promotion gate that exits non-zero on regression, including a widening gap
|
|
29
|
+
between the internal and the external site.
|
|
30
|
+
- A FastAPI service with per-hour websocket streaming, Prometheus metrics and the
|
|
31
|
+
guarantee attached to every response.
|
|
32
|
+
- `prodrome publish`, which generates the model card from the measured reports and
|
|
33
|
+
refuses to upload anything that could carry a patient row.
|
prodrome-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
prodrome-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: prodrome
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Early warning for sepsis with a calibrated alert budget, validated on a hospital it never trained on.
|
|
5
|
+
Project-URL: Homepage, https://github.com/rhs2/prodrome
|
|
6
|
+
Project-URL: Documentation, https://rhs2.github.io/prodrome/
|
|
7
|
+
Project-URL: Repository, https://github.com/rhs2/prodrome
|
|
8
|
+
Project-URL: Changelog, https://github.com/rhs2/prodrome/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Rakibul Hasan Sium
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: clinical,conformal,early-warning,icu,sepsis,time-series
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: lightgbm<5,>=4.3
|
|
24
|
+
Requires-Dist: numpy<3,>=1.26
|
|
25
|
+
Requires-Dist: pandas<3,>=2.1
|
|
26
|
+
Requires-Dist: pyarrow>=15.0
|
|
27
|
+
Requires-Dist: pydantic<3,>=2.9
|
|
28
|
+
Requires-Dist: pyyaml<7,>=6.0
|
|
29
|
+
Requires-Dist: rich<15,>=13.7
|
|
30
|
+
Requires-Dist: scikit-learn<2,>=1.4
|
|
31
|
+
Requires-Dist: scipy<2,>=1.11
|
|
32
|
+
Requires-Dist: typer<1,>=0.12
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: fastapi<1,>=0.112; extra == 'all'
|
|
35
|
+
Requires-Dist: flwr<2,>=1.9; extra == 'all'
|
|
36
|
+
Requires-Dist: huggingface-hub<1,>=0.24; extra == 'all'
|
|
37
|
+
Requires-Dist: opentelemetry-api<2,>=1.26; extra == 'all'
|
|
38
|
+
Requires-Dist: opentelemetry-sdk<2,>=1.26; extra == 'all'
|
|
39
|
+
Requires-Dist: prometheus-client<1,>=0.20; extra == 'all'
|
|
40
|
+
Requires-Dist: skops<1,>=0.10; extra == 'all'
|
|
41
|
+
Requires-Dist: torch>=2.2; extra == 'all'
|
|
42
|
+
Requires-Dist: uvicorn[standard]<1,>=0.30; extra == 'all'
|
|
43
|
+
Requires-Dist: websockets>=12.0; extra == 'all'
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
46
|
+
Requires-Dist: fastapi<1,>=0.112; extra == 'dev'
|
|
47
|
+
Requires-Dist: mypy>=1.11; extra == 'dev'
|
|
48
|
+
Requires-Dist: opentelemetry-api<2,>=1.26; extra == 'dev'
|
|
49
|
+
Requires-Dist: opentelemetry-sdk<2,>=1.26; extra == 'dev'
|
|
50
|
+
Requires-Dist: pandas-stubs; extra == 'dev'
|
|
51
|
+
Requires-Dist: prometheus-client<1,>=0.20; extra == 'dev'
|
|
52
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
53
|
+
Requires-Dist: pytest>=8.3; extra == 'dev'
|
|
54
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
55
|
+
Requires-Dist: types-pyyaml; extra == 'dev'
|
|
56
|
+
Requires-Dist: uvicorn[standard]<1,>=0.30; extra == 'dev'
|
|
57
|
+
Requires-Dist: websockets>=12.0; extra == 'dev'
|
|
58
|
+
Provides-Extra: federated
|
|
59
|
+
Requires-Dist: flwr<2,>=1.9; extra == 'federated'
|
|
60
|
+
Provides-Extra: hub
|
|
61
|
+
Requires-Dist: huggingface-hub<1,>=0.24; extra == 'hub'
|
|
62
|
+
Requires-Dist: skops<1,>=0.10; extra == 'hub'
|
|
63
|
+
Provides-Extra: serve
|
|
64
|
+
Requires-Dist: fastapi<1,>=0.112; extra == 'serve'
|
|
65
|
+
Requires-Dist: opentelemetry-api<2,>=1.26; extra == 'serve'
|
|
66
|
+
Requires-Dist: opentelemetry-sdk<2,>=1.26; extra == 'serve'
|
|
67
|
+
Requires-Dist: prometheus-client<1,>=0.20; extra == 'serve'
|
|
68
|
+
Requires-Dist: uvicorn[standard]<1,>=0.30; extra == 'serve'
|
|
69
|
+
Requires-Dist: websockets>=12.0; extra == 'serve'
|
|
70
|
+
Provides-Extra: torch
|
|
71
|
+
Requires-Dist: torch>=2.2; extra == 'torch'
|
|
72
|
+
Description-Content-Type: text/markdown
|
|
73
|
+
|
|
74
|
+
# Prodrome
|
|
75
|
+
|
|
76
|
+
[](https://github.com/rhs2/prodrome/actions/workflows/ci.yml)
|
|
77
|
+
[](https://pypi.org/project/prodrome/)
|
|
78
|
+
[](https://pypi.org/project/prodrome/)
|
|
79
|
+
[](LICENSE)
|
|
80
|
+
|
|
81
|
+
**Early warning for sepsis with a calibrated alert budget, validated on a hospital it
|
|
82
|
+
never trained on.**
|
|
83
|
+
|
|
84
|
+
A prodrome is the early set of signs that a disease is coming, before the specific
|
|
85
|
+
symptoms that name it. Greek *prodromos*, "running before": a forerunner.
|
|
86
|
+
|
|
87
|
+
> **Not a medical device. Not cleared by any regulator. Not for clinical use.**
|
|
88
|
+
> It predicts a *recorded clinical suspicion*, not a biological event. Read
|
|
89
|
+
> [What this must never claim](#what-this-must-never-claim) before quoting any number
|
|
90
|
+
> here.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## The numbers
|
|
95
|
+
|
|
96
|
+
Trained on hospital system A, calibrated on held-out patients from A, then tested on
|
|
97
|
+
every patient of hospital system B, which it never saw. External results first,
|
|
98
|
+
because that is the number that means something.
|
|
99
|
+
|
|
100
|
+
| config | train | test | utility | auprc | auroc | detect | in window | lead h | alerts/pt-day | precision | ece |
|
|
101
|
+
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
102
|
+
| default | A | B | 0.2468 | 0.072 | 0.802 | 0.456 | 0.153 | 33.0 | 0.11 | 0.305 | 0.003 |
|
|
103
|
+
| clock | A | B | 0.2413 | 0.047 | 0.628 | 0.347 | 0.065 | 45.5 | 0.04 | 0.346 | 0.097 |
|
|
104
|
+
| logistic | A | B | 0.1504 | 0.043 | 0.667 | 0.394 | 0.137 | 30.0 | 0.19 | 0.166 | 0.015 |
|
|
105
|
+
| qsofa | A | B | 0.0000 | 0.018 | 0.578 | 0.000 | 0.000 | n/a | 0.00 | n/a | 0.173 |
|
|
106
|
+
| sirs | A | B | 0.0000 | 0.026 | 0.652 | 0.000 | 0.000 | n/a | 0.00 | n/a | 0.274 |
|
|
107
|
+
| default (internal) | A | A | 0.3338 | 0.109 | 0.834 | 0.573 | 0.207 | 23.0 | 0.17 | 0.332 | 0.004 |
|
|
108
|
+
| clock (internal) | A | A | 0.2938 | 0.080 | 0.642 | 0.369 | 0.101 | 30.5 | 0.04 | 0.506 | 0.090 |
|
|
109
|
+
| logistic (internal) | A | A | 0.1976 | 0.078 | 0.763 | 0.441 | 0.176 | 25.0 | 0.19 | 0.311 | 0.006 |
|
|
110
|
+
|
|
111
|
+
`utility` is the published PhysioNet/CinC 2019 scoring function, where alerting through
|
|
112
|
+
the whole beneficial window scores 1 and never alerting scores 0. `detect` is the share
|
|
113
|
+
of septic patients ever alerted in time; `in window` is the stricter share alerted
|
|
114
|
+
inside the window the utility score actually rewards. `precision` is the share of
|
|
115
|
+
alerted patients who go on to become septic, against a base rate of 7.3 percent.
|
|
116
|
+
|
|
117
|
+
### Three findings, and none of them flatter the model
|
|
118
|
+
|
|
119
|
+
**A three-feature clock gets 98 percent of the utility score.** The `clock` row alerts
|
|
120
|
+
on nothing but how long the patient has been in the unit. No physiology, no laboratory
|
|
121
|
+
values, nothing learned. It scores 0.2413 against the trained model's 0.2468. Septic
|
|
122
|
+
stays in this corpus run 59 hours on average against 38 for the rest, so "this patient
|
|
123
|
+
has been here a while" predicts "this patient will be recorded septic at some point",
|
|
124
|
+
and the utility metric rewards it. Alerting on *every* patient from ICU hour 48
|
|
125
|
+
onward, with no model at all, scores +0.227.
|
|
126
|
+
|
|
127
|
+
What the trained model actually buys is visible in the other columns: it ranks far
|
|
128
|
+
better (AUROC 0.802 against 0.628), catches more than twice as many patients inside
|
|
129
|
+
the window that matters (0.153 against 0.065), and its probabilities mean something
|
|
130
|
+
(calibration error 0.003 against 0.097, a factor of thirty). That is a real
|
|
131
|
+
difference, and a table reporting utility alone would have hidden all of it. This is
|
|
132
|
+
why the clock is a shipped configuration rather than a footnote.
|
|
133
|
+
|
|
134
|
+
**The model is substantially reading the workup, not the patient.** `prodrome
|
|
135
|
+
ablation` refits the same model on restricted feature sets:
|
|
136
|
+
|
|
137
|
+
| ablation | features | utility | share of full | auroc | in window |
|
|
138
|
+
|---|---|---|---|---|---|
|
|
139
|
+
| full | 205 | 0.2468 | 100% | 0.8016 | 0.153 |
|
|
140
|
+
| physiology_only | 125 | 0.1159 | 47% | 0.7697 | 0.117 |
|
|
141
|
+
| process_only | 75 | 0.2159 | 87% | 0.7263 | 0.109 |
|
|
142
|
+
| clock_only | 3 | 0.2428 | 98% | 0.6656 | 0.074 |
|
|
143
|
+
| workup_only | 72 | 0.2119 | 86% | 0.7539 | 0.115 |
|
|
144
|
+
| no_time_index | 202 | 0.2316 | 94% | 0.7937 | 0.156 |
|
|
145
|
+
|
|
146
|
+
Measured values and bedside scores alone reach 47 percent of the full utility. The
|
|
147
|
+
staleness and ordering pattern alone, with no measured value of any kind, reach 86
|
|
148
|
+
percent. Nobody orders a lactate for a patient they are relaxed about, so *which tests
|
|
149
|
+
exist* encodes clinician suspicion, and the label is a record of clinician suspicion.
|
|
150
|
+
That is a real signal and a useful one in a deployed system, but it is not an early
|
|
151
|
+
warning: by the time the workup starts, somebody is already worried.
|
|
152
|
+
|
|
153
|
+
**A guarantee calibrated at one hospital does not automatically survive the move to
|
|
154
|
+
another.** Each model states one sentence after calibration, and the report checks it
|
|
155
|
+
on held-out patients:
|
|
156
|
+
|
|
157
|
+
| model | precision on A (calibrated here) | precision on B (never seen) | promise held on B |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
| clock | 0.506 | 0.346 | yes |
|
|
160
|
+
| default | 0.332 | 0.305 | yes, barely |
|
|
161
|
+
| logistic | 0.311 | 0.166 | **no** |
|
|
162
|
+
|
|
163
|
+
The logistic model kept its promise at home and broke it at the other hospital, by a
|
|
164
|
+
wide margin. Nothing about its internal report predicted that. This is the entire
|
|
165
|
+
argument for treating external validation as the primary result rather than a
|
|
166
|
+
robustness appendix.
|
|
167
|
+
|
|
168
|
+
And the two bedside scores could not make a promise at all. Neither qSOFA nor SIRS can
|
|
169
|
+
certify 30 percent precision at any threshold within the alert budget, so their policy
|
|
170
|
+
alerts on nothing and their utility is exactly zero. That is the honest output, not a
|
|
171
|
+
failure of the harness.
|
|
172
|
+
|
|
173
|
+
Subgroup results on site B are stable rather than uniform: utility runs from 0.200 in
|
|
174
|
+
the medical ICU and 0.202 for patients over 80, to 0.287 for ages 65 to 79 and 0.286
|
|
175
|
+
in the surgical ICU, with AUROC between 0.787 and 0.818. The full table is in
|
|
176
|
+
`reports/latest/default-siteB.json`.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Quickstart
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
pip install "prodrome[dev]"
|
|
184
|
+
prodrome init # writes configs/
|
|
185
|
+
prodrome data fetch # 42 MB, 40,336 patients, no credentials needed
|
|
186
|
+
prodrome data prepare # parses to columnar and pins the corpus digest
|
|
187
|
+
prodrome train # fits on site A
|
|
188
|
+
prodrome calibrate # chooses the threshold and states the promise
|
|
189
|
+
prodrome eval # scores site A and site B, writes a report each
|
|
190
|
+
prodrome ablation # is it reading the patient or the workup?
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`prodrome calibrate` prints the sentence the system is committing to:
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
With probability at least 95% over the calibration draw, at most 4.0 alerts are raised
|
|
197
|
+
per patient-day and at least 30% of alerted patients go on to develop sepsis
|
|
198
|
+
(observed on the calibration slice: 0.17 alerts per patient-day, 34% precision).
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Then make it worse on purpose and watch the gate refuse it:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
prodrome eval --config configs/default.yaml --out reports/good.json
|
|
205
|
+
prodrome gate --baseline reports/good.json --candidate reports/degraded.json
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
roll back: default@A against default@A
|
|
210
|
+
- utility dropped by 0.1500 (baseline 0.3338, candidate 0.1838); the allowed drop is 0.0000.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
That exit code is the point. Wire it into CI and a change that makes the system worse
|
|
214
|
+
cannot be merged by accident.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## The data
|
|
219
|
+
|
|
220
|
+
The PhysioNet/CinC 2019 challenge corpus, published under the **Open Database
|
|
221
|
+
License**, which is why this project can exist in public: the models can be shared and
|
|
222
|
+
every number can be reproduced by a stranger.
|
|
223
|
+
|
|
224
|
+
| | |
|
|
225
|
+
|---|---|
|
|
226
|
+
| patients | 40,336 across two hospital systems (A: 20,336, B: 20,000) |
|
|
227
|
+
| rows | 1,552,210, one per ICU hour |
|
|
228
|
+
| septic | 2,932 patients, 7.3 percent |
|
|
229
|
+
| channels | 8 vital signs, 26 laboratory values, 6 demographic fields |
|
|
230
|
+
| size | 42 MB |
|
|
231
|
+
|
|
232
|
+
**Nothing under `data/` is committed or packaged.** `prodrome data fetch` downloads it
|
|
233
|
+
and `prodrome data prepare` verifies it, computing a digest over the sorted per-patient
|
|
234
|
+
content hashes. Every report carries that digest and the gate refuses to compare two
|
|
235
|
+
reports that disagree on it.
|
|
236
|
+
|
|
237
|
+
The label is `SepsisLabel`, which the organisers set six hours before a recorded
|
|
238
|
+
clinical onset defined by suspicion of infection together with a rise in SOFA score.
|
|
239
|
+
It is a proxy for a biological event, not the event.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## How it works
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
hourly rows -> causal features -> model -> risk per hour
|
|
247
|
+
| |
|
|
248
|
+
no feature sees the alert policy
|
|
249
|
+
future, proven per column (threshold + promise)
|
|
250
|
+
| |
|
|
251
|
+
| above -> alert, with the guarantee
|
|
252
|
+
| below -> silence
|
|
253
|
+
v
|
|
254
|
+
evaluate on the training site AND on a site never trained on
|
|
255
|
+
|
|
|
256
|
+
promotion gate -> promote or exit non-zero
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Causality is tested, not asserted.** Every feature at hour *t* is a function of hours
|
|
260
|
+
0 to *t* of that stay and nothing else. The test truncates each stay at seven different
|
|
261
|
+
points, rebuilds, and compares every column: if one value changes, some feature read an
|
|
262
|
+
hour that had not happened yet, and the test names the column. A second test rebuilds
|
|
263
|
+
each stay alone and checks it against the same stay inside a crowd, which catches a
|
|
264
|
+
window running off the start into the previous patient. Both were verified by injecting
|
|
265
|
+
a deliberate leak and watching them fail.
|
|
266
|
+
|
|
267
|
+
**The alert policy is a decision, not a score.** On calibration patients the model has
|
|
268
|
+
never seen, the threshold sweep takes the lowest cut whose precision, at its exact
|
|
269
|
+
Clopper-Pearson lower bound, clears the floor, and whose alert rate stays inside the
|
|
270
|
+
budget. When nothing qualifies, `attainable` is false, the threshold goes above every
|
|
271
|
+
reachable risk, and the system alerts on nothing. A guarantee that cannot be certified
|
|
272
|
+
must not be implied.
|
|
273
|
+
|
|
274
|
+
**An alert is an event, not an hour.** If the risk sits above the threshold for
|
|
275
|
+
fourteen hours a ward sees one alarm, not fourteen. Alerts are counted as rising edges,
|
|
276
|
+
which has a consequence worth knowing: the alert rate is *not* monotone in the
|
|
277
|
+
threshold, because lowering it can merge two episodes into one.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Configurations
|
|
282
|
+
|
|
283
|
+
| File | Model | What it is for |
|
|
284
|
+
|---|---|---|
|
|
285
|
+
| `default.yaml` | LightGBM on 205 causal features | the model the gate protects |
|
|
286
|
+
| `clock.yaml` | ICU hour alone | the trivial baseline every row is read against |
|
|
287
|
+
| `qsofa.yaml` | partial qSOFA, two of three components | the bar a ward already clears |
|
|
288
|
+
| `sirs.yaml` | the four SIRS criteria | the same, older and less specific |
|
|
289
|
+
| `logistic.yaml` | regularised logistic regression | is the boosting earning its complexity? |
|
|
290
|
+
|
|
291
|
+
A `gru` sequence model and a `sofa` baseline are registered too; the recurrent one
|
|
292
|
+
needs the `torch` extra. Every score here is partial where the corpus cannot support
|
|
293
|
+
the published definition, and the names say so: this data carries no Glasgow Coma
|
|
294
|
+
Scale, so qSOFA can never reach 3 and SOFA covers four of six organ systems.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Serve
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
pip install "prodrome[serve]"
|
|
302
|
+
prodrome serve --config configs/default.yaml
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
`POST /score` scores a whole stay. `WS /stream` takes one hour at a time and answers
|
|
306
|
+
with the risk after that hour, which is the shape a real integration has and the one
|
|
307
|
+
that demonstrates causality end to end: the service holds the history, appends the new
|
|
308
|
+
hour, and has never been sent the next one. `GET /health` reports the loaded model, the
|
|
309
|
+
corpus digest and the promise in force. `GET /metrics` exposes Prometheus counters.
|
|
310
|
+
Every response carries the threshold, the guarantee and the disclaimer, because a
|
|
311
|
+
clinical score arriving over an API with no context is how research code ends up
|
|
312
|
+
somewhere it should not be.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Development
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
make install # virtualenv with the dev extra
|
|
320
|
+
make check # ruff, mypy strict, the offline test suite
|
|
321
|
+
make bench # every configuration on both sites
|
|
322
|
+
make ablation # what is the model reading?
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
The test suite runs entirely on a synthetic corpus this package generates, so a fresh
|
|
326
|
+
clone with no download and no data licence still proves the pipeline works. CI runs
|
|
327
|
+
lint, types and tests on Python 3.10 and 3.12, then the measured pipeline on synthetic
|
|
328
|
+
data, then the gate.
|
|
329
|
+
|
|
330
|
+
What is committed: the code, the configurations, the reports under `reports/latest/`
|
|
331
|
+
that the gate compares against, and the leaderboard. What is not: anything under
|
|
332
|
+
`data/`, any trained weight, any `.env`.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## What this must never claim
|
|
337
|
+
|
|
338
|
+
- **Not a medical device**, not cleared by any regulator, not for clinical use.
|
|
339
|
+
- It predicts **a recorded clinical suspicion**, not a biological event. Every label in
|
|
340
|
+
this field is a proxy and pretending otherwise is the standard dishonesty here.
|
|
341
|
+
- Two hospital systems in one country is not the world. The only supported claim is
|
|
342
|
+
"it generalised from A to B by this much".
|
|
343
|
+
- The reported lead times are generous. A median of 33 hours largely reflects patients
|
|
344
|
+
flagged early in a long stay, not a targeted prediction of that episode, which is
|
|
345
|
+
why the strict in-window detection rate is reported beside it.
|
|
346
|
+
- The model leans heavily on the workup and the clock. See the ablation above.
|
|
347
|
+
- No survival or treatment-effect claim. This is a warning system, not a causal one.
|
|
348
|
+
|
|
349
|
+
## Licence
|
|
350
|
+
|
|
351
|
+
Apache-2.0. The corpus is separately licensed under the Open Database License by
|
|
352
|
+
PhysioNet and is neither redistributed nor committed here.
|