meds-algorithm 0.4.0a5__tar.gz → 0.4.0a6__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 (78) hide show
  1. meds_algorithm-0.4.0a6/.github/workflows/catalogue.yml +44 -0
  2. meds_algorithm-0.4.0a6/.github/workflows/docs.yml +29 -0
  3. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/.gitignore +4 -0
  4. meds_algorithm-0.4.0a6/.readthedocs.yaml +17 -0
  5. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/PKG-INFO +34 -4
  6. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/README.md +32 -2
  7. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/RELEASING.md +8 -8
  8. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/pyproject.toml +7 -2
  9. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/CONTRACT.md +17 -3
  10. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/TESTING.md +16 -2
  11. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/end_to_end.py +9 -22
  12. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/suite.py +19 -1
  13. meds_algorithm-0.4.0a6/src/meds_algorithm/conformance/temporal.py +350 -0
  14. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/runtime/process.py +29 -2
  15. meds_algorithm-0.4.0a6/tests/test_process.py +65 -0
  16. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_suite.py +6 -5
  17. meds_algorithm-0.4.0a6/tests/test_temporal.py +224 -0
  18. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/uv.lock +597 -3
  19. meds_algorithm-0.4.0a5/tests/test_process.py +0 -36
  20. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/.github/workflows/ci.yml +0 -0
  21. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/.github/workflows/publish.yml +0 -0
  22. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/ARCHITECTURE.md +0 -0
  23. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/LICENSE +0 -0
  24. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/ORCHESTRATION.md +0 -0
  25. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/__init__.py +0 -0
  26. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/algorithms.py +0 -0
  27. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/artifacts/__init__.py +0 -0
  28. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/artifacts/inputs.py +0 -0
  29. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/artifacts/manifest.py +0 -0
  30. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/artifacts/publication.py +0 -0
  31. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/artifacts/references.py +0 -0
  32. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/artifacts/results.py +0 -0
  33. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/configuration.py +0 -0
  34. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/__init__.py +0 -0
  35. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/assertions.py +0 -0
  36. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/cases.py +0 -0
  37. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/meds_dev.py +0 -0
  38. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/reports.py +0 -0
  39. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/signal.py +0 -0
  40. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/conformance/types.py +0 -0
  41. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/contracts/__init__.py +0 -0
  42. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/contracts/commands.py +0 -0
  43. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/contracts/enums.py +0 -0
  44. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/data/__init__.py +0 -0
  45. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/data/index.py +0 -0
  46. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/data/labels.py +0 -0
  47. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/data/predicates.py +0 -0
  48. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/data/validation.py +0 -0
  49. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/evaluation/__init__.py +0 -0
  50. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/evaluation/predictions.py +0 -0
  51. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/integrations/__init__.py +0 -0
  52. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/integrations/meds_dev.py +0 -0
  53. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/orchestration/__init__.py +0 -0
  54. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/orchestration/cli.py +0 -0
  55. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/orchestration/config.py +0 -0
  56. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/orchestration/execution.py +0 -0
  57. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/orchestration/planning.py +0 -0
  58. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/requests.py +0 -0
  59. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/runner.py +0 -0
  60. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/runtime/__init__.py +0 -0
  61. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/runtime/provenance.py +0 -0
  62. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/runtime/resources.py +0 -0
  63. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/serialization.py +0 -0
  64. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/spec.py +0 -0
  65. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/tasks/__init__.py +0 -0
  66. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/tasks/spec.py +0 -0
  67. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/src/meds_algorithm/version.py +0 -0
  68. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_algorithms.py +0 -0
  69. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_artifacts.py +0 -0
  70. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_configuration.py +0 -0
  71. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_conformance.py +0 -0
  72. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_core.py +0 -0
  73. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_evaluation.py +0 -0
  74. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_integrations.py +0 -0
  75. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_orchestration.py +0 -0
  76. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_predicates.py +0 -0
  77. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/test_reports.py +0 -0
  78. {meds_algorithm-0.4.0a5 → meds_algorithm-0.4.0a6}/tests/wheel_smoke.py +0 -0
@@ -0,0 +1,44 @@
1
+ name: Catalogue updates
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '23 9 * * 1'
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: catalogue-updates
13
+ cancel-in-progress: false
14
+
15
+ jobs:
16
+ observe:
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ contents: write
20
+ pull-requests: write
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ ref: main
25
+ - uses: astral-sh/setup-uv@v6
26
+ - run: uv sync --locked --group docs
27
+ - run: uv run --group docs pytest -q docs/tests/test_catalogue.py
28
+ - run: uv run python docs/catalogue.py --check-remote
29
+ - run: uv run --group docs mkdocs build --strict
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: catalogue-observations
33
+ path: catalogue/updates.json
34
+ - uses: peter-evans/create-pull-request@v8
35
+ with:
36
+ branch: codex/catalogue-release-observations
37
+ add-paths: catalogue/updates.json
38
+ commit-message: Refresh catalogue release observations
39
+ title: Review algorithm catalogue release observations
40
+ body: |
41
+ Public release metadata changed. Review catalogue/updates.json, then update
42
+ catalogue/algorithms.yaml separately after checking the relevant revision and evidence.
43
+ This PR does not promote implementation or validation status and does not change install pins.
44
+ Private repositories were not queried. Registry tests and strict docs ran in the update workflow.
@@ -0,0 +1,29 @@
1
+ name: Docs
2
+
3
+ # Read the Docs hosts the site. This workflow only validates documentation changes.
4
+
5
+ on:
6
+ pull_request:
7
+ push:
8
+ branches: [main]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v6
19
+ - run: uv sync --locked --group docs
20
+ - uses: actions/setup-node@v4
21
+ with:
22
+ node-version: "24"
23
+ - run: npm ci --ignore-scripts
24
+ - run: npm test
25
+ - run: uv run --group docs pytest -q docs/tests
26
+ - run: uv run --group docs python docs/catalogue.py
27
+ - run: uv run ruff check docs
28
+ - run: uv run ruff format --check docs
29
+ - run: uv run --group docs mkdocs build --strict
@@ -6,3 +6,7 @@ __pycache__/
6
6
  *.egg-info/
7
7
  build/
8
8
  dist/
9
+ site/
10
+
11
+ .cache/
12
+ node_modules/
@@ -0,0 +1,17 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-24.04
5
+ tools:
6
+ python: "3.12"
7
+
8
+ python:
9
+ install:
10
+ - method: uv
11
+ command: sync
12
+ groups:
13
+ - docs
14
+
15
+ mkdocs:
16
+ configuration: mkdocs.yml
17
+ fail_on_warning: true
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: meds-algorithm
3
- Version: 0.4.0a5
3
+ Version: 0.4.0a6
4
4
  Summary: Shared MEDS algorithm contracts and conformance boundaries.
5
5
  Project-URL: Repository, https://github.com/McDermottHealthAI/meds-algorithm
6
- Project-URL: Documentation, https://github.com/McDermottHealthAI/meds-algorithm/blob/main/ARCHITECTURE.md
6
+ Project-URL: Documentation, https://meds-algorithm.readthedocs.io/en/latest/
7
7
  License-Expression: MIT
8
8
  License-File: LICENSE
9
9
  Requires-Python: >=3.11
@@ -32,7 +32,7 @@ Description-Content-Type: text/markdown
32
32
  [![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue?logo=python&logoColor=white)](https://www.python.org/downloads/)
33
33
  [![PyPI](https://img.shields.io/pypi/v/meds-algorithm)](https://pypi.org/project/meds-algorithm/)
34
34
  [![Tests and code quality](https://github.com/McDermottHealthAI/meds-algorithm/actions/workflows/ci.yml/badge.svg)](https://github.com/McDermottHealthAI/meds-algorithm/actions/workflows/ci.yml)
35
- [![Documentation](https://img.shields.io/badge/docs-architecture-blue)](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/ARCHITECTURE.md)
35
+ [![Documentation](https://readthedocs.org/projects/meds-algorithm/badge/?version=latest)](https://meds-algorithm.readthedocs.io/en/latest/)
36
36
  [![Contributors](https://img.shields.io/github/contributors/McDermottHealthAI/meds-algorithm)](https://github.com/McDermottHealthAI/meds-algorithm/graphs/contributors)
37
37
  [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)](https://github.com/McDermottHealthAI/meds-algorithm/pulls)
38
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-green)](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/LICENSE)
@@ -47,6 +47,16 @@ Algorithm architectures, tokenizers, training objectives and task-specific logic
47
47
  See the [architecture and UML diagrams](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/ARCHITECTURE.md) for the profile hierarchy, typed requests,
48
48
  algorithm-owned configuration, artifact references and shared execution path.
49
49
 
50
+ Browse the [algorithm catalogue](https://meds-algorithm.readthedocs.io/en/latest/implemented-algorithms/)
51
+ for implementations, reviewed installation commands and validation evidence. Register or update an
52
+ entry through `catalogue/algorithms.yaml`; documentation builds and release observations are independent
53
+ of the runtime package and never query private source repositories. See
54
+ [site maintenance](https://meds-algorithm.readthedocs.io/en/latest/documentation/).
55
+
56
+ The [unified documentation](https://meds-algorithm.readthedocs.io/en/latest/) also contains the
57
+ template workflow, [implementation prompt builder](https://meds-algorithm.readthedocs.io/en/latest/prompt-builder/),
58
+ manual tutorial, publishing guides and API/UML references.
59
+
50
60
  ## Package layout
51
61
 
52
62
  ```text
@@ -154,7 +164,8 @@ uv build
154
164
  Tests inject publication/restoration failures, launch a child from a worker thread, check explicit
155
165
  algorithm provenance, reject missing/mixed/overlapping label inputs, and exercise all six lifecycles with
156
166
  synthetic command implementations. Full-lifecycle conformance reruns algorithm adapters with forbidden
157
- outcomes removed and fresh artifacts; algorithm-specific cutoff, frozen-weight, compatibility and primary
167
+ outcomes removed, and again with every evaluated future rewritten, with fresh artifacts; a null-world run checks
168
+ chance-level discrimination of the future; algorithm-specific cutoff, frozen-weight, compatibility and primary
158
169
  behavior tests remain required. Package tests do not establish scientific validity of a downstream algorithm.
159
170
 
160
171
  MEDS-DEV provisioning requires explicit `-m meds_dev` or `-m real_data` selection; setting
@@ -163,6 +174,25 @@ training. Keep each algorithm's data-access and cluster approval rules in its ow
163
174
 
164
175
  ## Changes
165
176
 
177
+ ### 0.4.0a6 (2026-11-24)
178
+
179
+ - Add temporal-leakage conformance (`conformance/temporal.py`): `test_end_to_end` reruns the lifecycle with every
180
+ evaluated subject's events after its latest prediction time rewritten and requires predictions identical up to floating-point rounding (relative 1e-12);
181
+ the new inherited `test_null_world_predictions_are_at_chance` runs non-zero-shot profiles on a null world whose
182
+ future is independent of its past. `run_e2e` adapters must honour a perturbed `external_meds_dir` and accept the
183
+ `null_world` dataset. The suite grows from 38 to 44 collected tests.
184
+ - The future-blind rerun compares probabilities to a relative tolerance of 1e-12 (`FUTURE_BLIND_RTOL`) instead of
185
+ bit for bit: a leak-free polars score moved by one unit in the last place on a GitHub runner, while the smallest
186
+ measured leak moves a probability by about 1e-7.
187
+ - Stop the owned process group when the caller is terminated.
188
+ - Add an explicit raw-data access guard to the implementation prompt.
189
+ - Consolidate the template guides, implementation prompt and interactive builder on Read the Docs;
190
+ use Read the Docs as the only documentation host.
191
+ - Configure Read the Docs hosting with the existing MkDocs theme and docs dependency group; update
192
+ documentation links and document Read the Docs hosting.
193
+ - Host the algorithm catalogue and its release-observation workflow in this ecosystem repository.
194
+ - Add independently built documentation; catalogue metadata and tooling are excluded from Python distributions.
195
+
166
196
  ### 0.4.0a5 (2026-11-03)
167
197
 
168
198
  - Add an optional profile-runner prototype: shared Hydra schema, resolved dry-run plans, local
@@ -3,7 +3,7 @@
3
3
  [![Python 3.11+](https://img.shields.io/badge/Python-3.11%2B-blue?logo=python&logoColor=white)](https://www.python.org/downloads/)
4
4
  [![PyPI](https://img.shields.io/pypi/v/meds-algorithm)](https://pypi.org/project/meds-algorithm/)
5
5
  [![Tests and code quality](https://github.com/McDermottHealthAI/meds-algorithm/actions/workflows/ci.yml/badge.svg)](https://github.com/McDermottHealthAI/meds-algorithm/actions/workflows/ci.yml)
6
- [![Documentation](https://img.shields.io/badge/docs-architecture-blue)](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/ARCHITECTURE.md)
6
+ [![Documentation](https://readthedocs.org/projects/meds-algorithm/badge/?version=latest)](https://meds-algorithm.readthedocs.io/en/latest/)
7
7
  [![Contributors](https://img.shields.io/github/contributors/McDermottHealthAI/meds-algorithm)](https://github.com/McDermottHealthAI/meds-algorithm/graphs/contributors)
8
8
  [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)](https://github.com/McDermottHealthAI/meds-algorithm/pulls)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-green)](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/LICENSE)
@@ -18,6 +18,16 @@ Algorithm architectures, tokenizers, training objectives and task-specific logic
18
18
  See the [architecture and UML diagrams](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/ARCHITECTURE.md) for the profile hierarchy, typed requests,
19
19
  algorithm-owned configuration, artifact references and shared execution path.
20
20
 
21
+ Browse the [algorithm catalogue](https://meds-algorithm.readthedocs.io/en/latest/implemented-algorithms/)
22
+ for implementations, reviewed installation commands and validation evidence. Register or update an
23
+ entry through `catalogue/algorithms.yaml`; documentation builds and release observations are independent
24
+ of the runtime package and never query private source repositories. See
25
+ [site maintenance](https://meds-algorithm.readthedocs.io/en/latest/documentation/).
26
+
27
+ The [unified documentation](https://meds-algorithm.readthedocs.io/en/latest/) also contains the
28
+ template workflow, [implementation prompt builder](https://meds-algorithm.readthedocs.io/en/latest/prompt-builder/),
29
+ manual tutorial, publishing guides and API/UML references.
30
+
21
31
  ## Package layout
22
32
 
23
33
  ```text
@@ -125,7 +135,8 @@ uv build
125
135
  Tests inject publication/restoration failures, launch a child from a worker thread, check explicit
126
136
  algorithm provenance, reject missing/mixed/overlapping label inputs, and exercise all six lifecycles with
127
137
  synthetic command implementations. Full-lifecycle conformance reruns algorithm adapters with forbidden
128
- outcomes removed and fresh artifacts; algorithm-specific cutoff, frozen-weight, compatibility and primary
138
+ outcomes removed, and again with every evaluated future rewritten, with fresh artifacts; a null-world run checks
139
+ chance-level discrimination of the future; algorithm-specific cutoff, frozen-weight, compatibility and primary
129
140
  behavior tests remain required. Package tests do not establish scientific validity of a downstream algorithm.
130
141
 
131
142
  MEDS-DEV provisioning requires explicit `-m meds_dev` or `-m real_data` selection; setting
@@ -134,6 +145,25 @@ training. Keep each algorithm's data-access and cluster approval rules in its ow
134
145
 
135
146
  ## Changes
136
147
 
148
+ ### 0.4.0a6 (2026-11-24)
149
+
150
+ - Add temporal-leakage conformance (`conformance/temporal.py`): `test_end_to_end` reruns the lifecycle with every
151
+ evaluated subject's events after its latest prediction time rewritten and requires predictions identical up to floating-point rounding (relative 1e-12);
152
+ the new inherited `test_null_world_predictions_are_at_chance` runs non-zero-shot profiles on a null world whose
153
+ future is independent of its past. `run_e2e` adapters must honour a perturbed `external_meds_dir` and accept the
154
+ `null_world` dataset. The suite grows from 38 to 44 collected tests.
155
+ - The future-blind rerun compares probabilities to a relative tolerance of 1e-12 (`FUTURE_BLIND_RTOL`) instead of
156
+ bit for bit: a leak-free polars score moved by one unit in the last place on a GitHub runner, while the smallest
157
+ measured leak moves a probability by about 1e-7.
158
+ - Stop the owned process group when the caller is terminated.
159
+ - Add an explicit raw-data access guard to the implementation prompt.
160
+ - Consolidate the template guides, implementation prompt and interactive builder on Read the Docs;
161
+ use Read the Docs as the only documentation host.
162
+ - Configure Read the Docs hosting with the existing MkDocs theme and docs dependency group; update
163
+ documentation links and document Read the Docs hosting.
164
+ - Host the algorithm catalogue and its release-observation workflow in this ecosystem repository.
165
+ - Add independently built documentation; catalogue metadata and tooling are excluded from Python distributions.
166
+
137
167
  ### 0.4.0a5 (2026-11-03)
138
168
 
139
169
  - Add an optional profile-runner prototype: shared Hydra schema, resolved dry-run plans, local
@@ -38,7 +38,7 @@ and [publishing action](https://docs.pypi.org/trusted-publishers/using-a-publish
38
38
 
39
39
  ## 2. Release the shared package first
40
40
 
41
- Current candidate: **0.4.0a5**. Run the following in Bash/WSL with Git, GitHub CLI and uv installed.
41
+ Current candidate: **0.4.0a6**. Run the following in Bash/WSL with Git, GitHub CLI and uv installed.
42
42
  Use the reviewed `main` commit, and wait for its CI checks before tagging. Do not move or reuse a
43
43
  published release tag/version; increment `project.version` for a replacement.
44
44
 
@@ -53,11 +53,11 @@ uv run ruff format --check .
53
53
  uv run pytest -q
54
54
  uv build
55
55
  uvx --from 'twine>=6' twine check --strict dist/*
56
- git tag v0.4.0a5
57
- git push origin v0.4.0a5
56
+ git tag v0.4.0a6
57
+ git push origin v0.4.0a6
58
58
 
59
59
  gh workflow run publish.yml --repo McDermottHealthAI/meds-algorithm \
60
- --ref v0.4.0a5 -f index=testpypi
60
+ --ref v0.4.0a6 -f index=testpypi
61
61
  gh run list --repo McDermottHealthAI/meds-algorithm --workflow publish.yml --limit 5
62
62
  # Select the run created above and watch it:
63
63
  gh run watch RUN_ID --repo McDermottHealthAI/meds-algorithm --exit-status
@@ -76,7 +76,7 @@ check_env=$(mktemp -d)
76
76
  uv venv "$check_env"
77
77
  uv pip install --python "$check_env/bin/python" 'pyyaml>=6'
78
78
  uv pip install --python "$check_env/bin/python" --no-deps \
79
- --index-url https://test.pypi.org/simple/ 'meds-algorithm==0.4.0a5'
79
+ --index-url https://test.pypi.org/simple/ 'meds-algorithm==0.4.0a6'
80
80
  "$check_env/bin/python" -I tests/wheel_smoke.py
81
81
  uv pip check --python "$check_env/bin/python"
82
82
  ```
@@ -85,11 +85,11 @@ After the test release is verified, publish the same tag to PyPI and approve its
85
85
 
86
86
  ```bash
87
87
  gh workflow run publish.yml --repo McDermottHealthAI/meds-algorithm \
88
- --ref v0.4.0a5 -f index=pypi
88
+ --ref v0.4.0a6 -f index=pypi
89
89
  # Find and watch the new run as above. After it succeeds:
90
90
  pypi_env=$(mktemp -d)
91
91
  uv venv "$pypi_env"
92
- uv pip install --python "$pypi_env/bin/python" 'meds-algorithm==0.4.0a5'
92
+ uv pip install --python "$pypi_env/bin/python" 'meds-algorithm==0.4.0a6'
93
93
  "$pypi_env/bin/python" -I tests/wheel_smoke.py
94
94
  uv pip check --python "$pypi_env/bin/python"
95
95
  ```
@@ -99,7 +99,7 @@ See the official [TestPyPI guide](https://packaging.python.org/en/latest/guides/
99
99
 
100
100
  ## 3. Cut over and release the template
101
101
 
102
- Only after `meds-algorithm==0.4.0a5` installs from PyPI, follow the
102
+ Only after `meds-algorithm==0.4.0a6` installs from PyPI, follow the
103
103
  [template release guide](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/RELEASING.md).
104
104
  It switches the development and generated dependencies from the Git pin to the released package,
105
105
  updates the lockfile/docs, and publishes the generator at **0.4.0a2** with tag **v0.4.0a2**.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meds-algorithm"
7
- version = "0.4.0a5"
7
+ version = "0.4.0a6"
8
8
  description = "Shared MEDS algorithm contracts and conformance boundaries."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -29,6 +29,10 @@ packages = ["src/meds_algorithm"]
29
29
  [tool.hatch.build.targets.wheel.force-include]
30
30
  "ARCHITECTURE.md" = "meds_algorithm/ARCHITECTURE.md"
31
31
 
32
+ # Discovery metadata and its documentation tooling evolve independently of runtime releases.
33
+ [tool.hatch.build.targets.sdist]
34
+ exclude = ["/catalogue", "/docs", "/mkdocs.yml", "/node_modules", "/package.json", "/package-lock.json", "/.cache"]
35
+
32
36
  [tool.pytest.ini_options]
33
37
  testpaths = ["tests"]
34
38
  markers = [
@@ -39,10 +43,11 @@ markers = [
39
43
 
40
44
  [project.urls]
41
45
  Repository = "https://github.com/McDermottHealthAI/meds-algorithm"
42
- Documentation = "https://github.com/McDermottHealthAI/meds-algorithm/blob/main/ARCHITECTURE.md"
46
+ Documentation = "https://meds-algorithm.readthedocs.io/en/latest/"
43
47
 
44
48
  [dependency-groups]
45
49
  dev = ["ruff"]
50
+ docs = ["mkdocs>=1.6,<2", "mkdocs-material>=9.5,<10", "jinja2>=3.1", "packaging>=24", "pytest>=8"]
46
51
 
47
52
  [tool.ruff]
48
53
  line-length = 110
@@ -325,6 +325,19 @@ dry-run, and its real end-to-end chain. The rendered `tests/test_end_to_end.py`
325
325
  the integer `seed` override, seed every RNG/framework/subprocess and use deterministic fixture settings.
326
326
  `attach_ground_truth` returns predictions unchanged on an unlabelled index. This tests outcome
327
327
  independence on the exercised fixture, not every possible code path.
328
+ - **Temporal cutoff (future perturbation):** the complete lifecycle runs again on a copy of the MEDS
329
+ dataset in which every evaluated subject's events after its latest indexed prediction time are deleted
330
+ and replaced by plain events copied from the same shard at log-uniform offsets, many within seconds of
331
+ `T` (`conformance.temporal.perturb_future`). Histories at every indexed time, including the row order
332
+ of ties, are unchanged, so probabilities MUST be identical by key up to floating-point rounding (relative 1e-12). Any path from the future to a
333
+ prediction fails this check, even one the fitted model barely uses; no statistical threshold is
334
+ involved.
335
+ - **Temporal cutoff (null world):** for non-zero-shot profiles, the full lifecycle runs on
336
+ `conformance.temporal.build_null_world_dataset`, where events follow one homogeneous Poisson process and
337
+ the label ("any event in `(T, T + ln 2 / rate]`") is independent of everything recorded up to `T`. A
338
+ one-sided Mann-Whitney test on one key per held-out subject MUST NOT reject chance at `alpha = 1e-3`.
339
+ This is a smoke alarm for leaks that training learned to exploit; the perturbation check is the gate.
340
+ `run_e2e` MUST accept this dataset (`dataset.json` names it `null_world`) with its test settings.
328
341
  - **Prediction validity:** validate every Parquet shard in both runs, including unique/non-null keys and
329
342
  finite probabilities in [0, 1]. No particular shard filename is required.
330
343
  - **Transductive fitting:** every tuning and held-out subject carries a canary code that occurs in no
@@ -566,6 +579,7 @@ payloads. Implement these algorithm-specific assertions rather than relying only
566
579
  The shared `assert_profile_run` conformance helper reruns the full lifecycle through `run_e2e` with
567
580
  forbidden label columns removed. It requires fresh artifacts below a new run directory and preserves
568
581
  permitted training/context labels. Include `seed`, `external_meds_dir` and all task inputs in `E2EResult.inputs`
569
- so the check uses the same histories and task. This detects forbidden reads on the exercised path;
570
- it does not prove all possible code paths, temporal cutoffs, or absence of labels encoded in other
571
- features. Implement the corresponding algorithm-specific checks as well.
582
+ so the check uses the same histories and task. The same helper reruns the lifecycle with every evaluated
583
+ subject's future rewritten (`assert_future_blind_pipeline`). These detect forbidden reads and future
584
+ information on the exercised path; they do not prove all possible code paths or absence of labels encoded
585
+ in other features. Implement the corresponding algorithm-specific checks as well.
@@ -24,7 +24,7 @@ local processes and temporary files. The default suite does not opt in to MEDS-D
24
24
  Passing establishes the checked software boundaries, not clinical validity, numerical equivalence to a
25
25
  paper, GPU correctness or absence of all leakage. Algorithm repositories must supply scientific tests,
26
26
  cutoff/frozen-weight checks and end-to-end adapters for their concrete implementations. The label-blind
27
- rerun is an adversarial check, not a filesystem sandbox or proof against malicious code.
27
+ and future-blind reruns are adversarial checks, not a filesystem sandbox or proof against malicious code.
28
28
 
29
29
  ## Downstream acceptance suite
30
30
 
@@ -49,7 +49,8 @@ in the generated `tests/e2e.py` and the shared `E2EResult`/`MEDSDevRun` types.
49
49
  |---|---|---|
50
50
  | `test_profile_implementations_match_contract` | Compares each registered profile's commands with the core lifecycle. | Detect incorrect registration or dispatch wiring. |
51
51
  | `test_algorithm_configuration_roundtrips` | Saves and reloads each supplied concrete configuration. | Preserve settings across independent processes, including required constructor fields. |
52
- | `test_end_to_end` | Runs each implemented profile and checks artifacts, manifests, coverage, fresh label-blind reruns, split canaries and zero-shot task binding. | Detect broken persistence, label leakage and transductive fitting through the real lifecycle. |
52
+ | `test_end_to_end` | Runs each implemented profile and checks artifacts, manifests, coverage, fresh label-blind reruns, a fresh rerun with every evaluated subject's events after its latest prediction time rewritten (predictions must be identical up to floating-point rounding, relative 1e-12), split canaries and zero-shot task binding. | Detect broken persistence, label leakage, information from after the prediction time and transductive fitting through the real lifecycle. |
53
+ | `test_null_world_predictions_are_at_chance` | Runs each completed non-zero-shot profile on a null world (homogeneous Poisson events; the label, any event in `(T, T + ln 2 / rate]`, is independent of the history) and applies a one-sided Mann-Whitney test, one key per held-out subject, at `alpha = 1e-3`. | End-to-end smoke alarm for temporal leaks that training learned to exploit, such as a forward time gap to the next real event. `run_e2e` must accept the `null_world` dataset with its test settings. |
53
54
  | `test_completed_algorithm_has_a_completed_report` | Validates report evidence for every completed profile. | Prevent incomplete profiles from masking unsupported completion claims. |
54
55
  | `test_algorithm_yaml_is_a_meds_dev_descriptor` | Checks each profile descriptor's required structure. | Catch packaging errors before integration. |
55
56
  | `test_slurm_dry_run_is_non_mutating` | Runs every profile's launcher with example inputs, checks the file inventory is unchanged and all commands are listed. | Inspect execution plans without submitting work; this checks file creation/removal, not changes to existing file contents. |
@@ -123,6 +124,19 @@ canonical and is rendered in the template documentation rather than copied into
123
124
  | `test_nn_config_requires_explicit_training_settings` | Rejects missing learning rate/batch size and checks classical config independence. | Do not invent universal training defaults or require neural settings for classical algorithms. |
124
125
  | `test_repository_records_nn_settings_from_config_file` | Dispatches with a file override and checks resolved saved config and manifest. | Ensure experiment settings actually reach the algorithm and persisted provenance. |
125
126
 
127
+ ### test_temporal.py
128
+
129
+ [Source](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/tests/test_temporal.py)
130
+
131
+ | Test | What it checks | Why it exists |
132
+ |---|---|---|
133
+ | `test_null_world_shape` | Builds a null world and checks one key per held-out subject, two per training subject, prevalence near 0.5 and records that run past the label horizon. | Keep held-out keys independent and record ends uninformative, so the chance-level test is exact. |
134
+ | `test_causal_scores_are_at_chance_and_leaky_scores_are_caught` | Scores keys by hours since the last event (causal) and by hours to the next event (a NOAH-style forward-gap leak). | Show that the chance-level check passes a causal score and fails a leaky one. |
135
+ | `test_perturbation_keeps_history_and_rewrites_only_indexed_futures` | Compares histories up to every indexed time, the rewritten future, the vocabulary and untouched training subjects. | Guarantee the future-blind rerun changes nothing an honest algorithm may read. |
136
+ | `test_future_blind_rerun_passes_causal_and_fails_leaky` | Runs the future-blind rerun on the causal and the leaky toy algorithm. | Show that any dependence on the future fails without a statistical threshold. |
137
+ | `test_mann_whitney_is_calibrated_and_handles_ties` | Checks the rejection rate under the null with heavy ties, constant scores, perfect separation and one-class input. | Keep the chance-level test's false-positive rate at `alpha`. |
138
+ | `test_perturbation_keeps_tie_order_and_never_copies_objects` | Rewrites a future next to ties at one time and an object-link row. | MEDS orders ties by row and objects are single acquisitions; reordering or duplicating either would fail honest algorithms. |
139
+
126
140
  ### test_conformance.py
127
141
 
128
142
  [Source](https://github.com/McDermottHealthAI/meds-algorithm/blob/main/tests/test_conformance.py)
@@ -14,6 +14,7 @@ from meds_algorithm import (
14
14
  )
15
15
 
16
16
  from .assertions import assert_prediction_keys, read_predictions
17
+ from .temporal import assert_future_blind_pipeline, assert_same_predictions
17
18
 
18
19
 
19
20
  def _strip_labels(labels_dir: Path, destination: Path, splits) -> Path:
@@ -64,6 +65,9 @@ def assert_profile_run(result, *, profile, run_e2e, fitted_codes, tmp_path):
64
65
  assert_prediction_keys(artifacts[prediction_step], result.labels_dir, result.splits)
65
66
 
66
67
  assert_label_blind_pipeline(result, profile=profile, run_e2e=run_e2e, tmp_path=tmp_path)
68
+ # Temporal cutoff (CONTRACT section 8): rewriting every evaluated subject's events after its latest
69
+ # prediction time must leave every prediction unchanged.
70
+ assert_future_blind_pipeline(result, profile=profile, run_e2e=run_e2e, tmp_path=tmp_path)
67
71
 
68
72
  # Absence of transductive fitting (SPEC 2.1): codes that occur only in tuning or held-out subjects must
69
73
  # not be part of anything the algorithm fitted.
@@ -124,31 +128,14 @@ def assert_label_blind_pipeline(result, *, profile, run_e2e, tmp_path):
124
128
  prediction = blind.artifacts[expected_steps[-1]]
125
129
  assert_prediction_keys(prediction, result.labels_dir, result.splits)
126
130
  # Do not require the evaluation-only boolean_value on a deliberately unlabelled run.
127
- import polars as pl
128
-
129
131
  from ..data.index import read_index
130
132
  from ..evaluation.predictions import check_decoded
131
133
 
132
134
  blind_predictions = read_predictions(prediction, require_truth=False)
133
135
  check_decoded(read_index(result.labels_dir, result.splits), blind_predictions)
134
- keys = ["subject_id", "prediction_time"]
135
- probability = "predicted_boolean_probability"
136
- decisions = "predicted_boolean_value" in original.columns
137
- columns = [*keys, probability, *(["predicted_boolean_value"] if decisions else [])]
138
- # Explicit comparison instead of polars.testing.assert_frame_equal, whose tolerance keywords were
139
- # renamed (rtol/atol -> rel_tol/abs_tol) within the supported polars>=1 range.
140
- try:
141
- a = original.select(columns).sort(keys)
142
- b = blind_predictions.select(columns).sort(keys)
143
- except pl.exceptions.ColumnNotFoundError as error:
144
- raise AssertionError("Label-blind predictions lack a column of the original run") from error
145
- same = (
146
- a.select(keys).equals(b.select(keys))
147
- and ((a[probability] - b[probability]).abs() <= 1e-8 + 1e-6 * b[probability].abs()).all()
148
- and (not decisions or a["predicted_boolean_value"].equals(b["predicted_boolean_value"]))
136
+ assert_same_predictions(
137
+ original,
138
+ blind_predictions,
139
+ message="Predictions changed when forbidden labels were removed; fix leakage or make the "
140
+ "conformance fixture reproducible with the recorded seed",
149
141
  )
150
- if not same:
151
- raise AssertionError(
152
- "Predictions changed when forbidden labels were removed; fix leakage or make the "
153
- "conformance fixture reproducible with the recorded seed"
154
- )
@@ -19,10 +19,11 @@ from .assertions import assert_prediction_keys, read_predictions
19
19
  from .cases import AlgorithmCase
20
20
  from .end_to_end import assert_profile_run
21
21
  from .reports import assert_implementation_report
22
+ from .temporal import assert_chance_level, build_null_world_dataset
22
23
 
23
24
 
24
25
  class AlgorithmConformanceTests:
25
- """Eight shared acceptance checks, executed against the downstream algorithm."""
26
+ """Nine shared acceptance checks, executed against the downstream algorithm."""
26
27
 
27
28
  @pytest.fixture
28
29
  def completed_profile(self, algorithm_case: AlgorithmCase, profile):
@@ -61,6 +62,23 @@ class AlgorithmConformanceTests:
61
62
  tmp_path=tmp_path,
62
63
  )
63
64
 
65
+ def test_null_world_predictions_are_at_chance(
66
+ self, algorithm_case: AlgorithmCase, completed_profile, tmp_path
67
+ ):
68
+ """Temporal cutoff: with a future independent of the past, held-out AUROC must be at chance."""
69
+ if completed_profile.startswith("zero_shot_"):
70
+ pytest.skip("null world: zero-shot profiles need a task; the future-perturbation rerun covers it")
71
+ world = build_null_world_dataset(tmp_path / "null-world", seed=0)
72
+ result = algorithm_case.run_e2e(
73
+ tmp_path / "null-world-run",
74
+ profile=completed_profile,
75
+ seed=0,
76
+ external_meds_dir=world.meds_dir,
77
+ external_labels_dir=world.labels_dir,
78
+ splits=["held_out"],
79
+ )
80
+ assert_chance_level(result, alpha=1e-3)
81
+
64
82
  def test_completed_algorithm_has_a_completed_report(self, algorithm_case: AlgorithmCase):
65
83
  report = (algorithm_case.root / "IMPLEMENTATION_REPORT.md").read_text(encoding="utf-8")
66
84
  assert_implementation_report(report, algorithm_case.profiles, algorithm_case.stub_profiles)