meds-algorithm-template 0.4.0a1__tar.gz → 0.4.0a2__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 (83) hide show
  1. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/.github/workflows/ci.yml +5 -0
  2. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/.github/workflows/publish.yml +5 -0
  3. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/.gitignore +3 -0
  4. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/PKG-INFO +123 -42
  5. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/README.md +122 -41
  6. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/RELEASING.md +19 -15
  7. meds_algorithm_template-0.4.0a2/TESTING.md +131 -0
  8. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/copier.yml +1 -1
  9. meds_algorithm_template-0.4.0a2/docs/assets/prompt-builder.css +19 -0
  10. meds_algorithm_template-0.4.0a2/docs/assets/prompt-builder.js +166 -0
  11. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/concepts.md +5 -5
  12. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/core-package.md +4 -4
  13. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/examples/manual-supervised.sh +2 -2
  14. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/faq.md +2 -2
  15. meds_algorithm_template-0.4.0a2/docs/hooks.py +31 -0
  16. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/index.md +10 -6
  17. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/manual-example.md +1 -1
  18. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/migration-v4.md +13 -5
  19. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/profiles.md +28 -7
  20. meds_algorithm_template-0.4.0a2/docs/prompt-builder.md +86 -0
  21. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/reference/api.md +5 -0
  22. meds_algorithm_template-0.4.0a2/docs/reference/tests.md +3 -0
  23. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/running.md +11 -5
  24. meds_algorithm_template-0.4.0a2/docs/testing.md +10 -0
  25. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/workflow.md +25 -9
  26. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/zero-shot.md +5 -5
  27. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/mkdocs.yml +14 -5
  28. meds_algorithm_template-0.4.0a2/package-lock.json +532 -0
  29. meds_algorithm_template-0.4.0a2/package.json +13 -0
  30. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/pyproject.toml +2 -2
  31. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/scripts/check_release.py +4 -3
  32. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/AGENTS.md.jinja +5 -0
  33. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/README.md.jinja +26 -4
  34. meds_algorithm_template-0.4.0a2/template/algorithms/{% yield profile from profiles %}{{ profile }}{% endyield %}/model.yaml.jinja +39 -0
  35. meds_algorithm_template-0.4.0a2/template/configs/runs/run.yaml.jinja +27 -0
  36. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/docs/IMPLEMENTATION_GUIDE.md.jinja +19 -2
  37. meds_algorithm_template-0.4.0a2/template/docs/TESTING.md +54 -0
  38. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/pyproject.toml.jinja +3 -3
  39. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/slurm/job.sbatch.jinja +2 -2
  40. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/slurm/submit.sh.jinja +1 -1
  41. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/src/{{ algorithm_slug }}/__main__.py.jinja +9 -1
  42. meds_algorithm_template-0.4.0a2/template/tests/conftest.py.jinja +31 -0
  43. meds_algorithm_template-0.4.0a2/template/tests/test_conformance.py +7 -0
  44. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/tests/test_primary_behavior.py.jinja +0 -4
  45. meds_algorithm_template-0.4.0a2/tests/prompt_builder.test.cjs +148 -0
  46. meds_algorithm_template-0.4.0a2/tests/test_docs.py +45 -0
  47. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/tests/test_profiles.py +41 -10
  48. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/tests/test_render.py +17 -9
  49. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/tests/test_typed_execution.py +44 -1
  50. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/uv.lock +23 -6
  51. meds_algorithm_template-0.4.0a1/docs/hooks.py +0 -11
  52. meds_algorithm_template-0.4.0a1/template/algorithms/{% yield profile from profiles %}{{ profile }}{% endyield %}/model.yaml.jinja +0 -39
  53. meds_algorithm_template-0.4.0a1/template/tests/test_contract.py.jinja +0 -15
  54. meds_algorithm_template-0.4.0a1/template/tests/test_end_to_end.py.jinja +0 -13
  55. meds_algorithm_template-0.4.0a1/template/tests/test_meds_dev_e2e.py.jinja +0 -45
  56. meds_algorithm_template-0.4.0a1/template/tests/test_mimic_demo_e2e.py.jinja +0 -49
  57. meds_algorithm_template-0.4.0a1/template/tests/test_operations.py.jinja +0 -49
  58. meds_algorithm_template-0.4.0a1/template/tests/test_report.py.jinja +0 -9
  59. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/.gitattributes +0 -0
  60. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/.github/workflows/docs.yml +0 -0
  61. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/LICENSE +0 -0
  62. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/reference/architecture.md +0 -0
  63. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/reference/manifest.md +0 -0
  64. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/reference/spec.md +0 -0
  65. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/releasing.md +0 -0
  66. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/docs/shared-package-assessment.md +0 -0
  67. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/src/meds_algorithm_template/__init__.py +0 -0
  68. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/src/meds_algorithm_template/cli.py +0 -0
  69. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/.copier-answers.yml.jinja +0 -0
  70. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/.github/workflows/ci.yml +0 -0
  71. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/.gitignore +0 -0
  72. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/IMPLEMENTATION_REPORT.md.jinja +0 -0
  73. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/SPEC.md +0 -0
  74. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/requirements.txt.jinja +0 -0
  75. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/scripts/github-sync.sh.jinja +0 -0
  76. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/slurm/config.sh.jinja +0 -0
  77. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/src/{{ algorithm_slug }}/__init__.py.jinja +0 -0
  78. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/src/{{ algorithm_slug }}/config.py.jinja +0 -0
  79. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/src/{{ algorithm_slug }}/{{ algorithm_slug }}.py.jinja +0 -0
  80. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/tests/__init__.py +0 -0
  81. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/template/tests/e2e.py +0 -0
  82. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/tests/test_generator.py +0 -0
  83. {meds_algorithm_template-0.4.0a1 → meds_algorithm_template-0.4.0a2}/tests/wheel_smoke.py +0 -0
@@ -14,6 +14,11 @@ jobs:
14
14
  - run: uv sync --group dev
15
15
  - run: uv run ruff check src tests scripts docs/hooks.py
16
16
  - run: uv run ruff format --check src tests scripts docs/hooks.py
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: "24"
20
+ - run: npm ci --ignore-scripts
21
+ - run: npm test
17
22
  - run: uv run pytest -q
18
23
  - run: uv build
19
24
  - run: uvx --from 'twine>=6' twine check --strict dist/*
@@ -41,6 +41,11 @@ jobs:
41
41
  - run: uv sync --locked --group dev --group docs
42
42
  - run: uv run ruff check src tests scripts docs/hooks.py
43
43
  - run: uv run ruff format --check src tests scripts docs/hooks.py
44
+ - uses: actions/setup-node@v4
45
+ with:
46
+ node-version: "24"
47
+ - run: npm ci --ignore-scripts
48
+ - run: npm test
44
49
  - run: uv run pytest -q
45
50
  - run: uv run mkdocs build --strict
46
51
  - run: uv build
@@ -37,3 +37,6 @@ lightning_logs/
37
37
  mlruns/
38
38
  wandb/
39
39
  site/
40
+
41
+ # Documentation JavaScript tests
42
+ node_modules/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: meds-algorithm-template
3
- Version: 0.4.0a1
3
+ Version: 0.4.0a2
4
4
  Summary: A minimal, contract-first Copier template for MEDS algorithm repositories.
5
5
  Project-URL: Repository, https://github.com/McDermottHealthAI/MEDS_algorithm_template
6
6
  Project-URL: Documentation, https://McDermottHealthAI.github.io/MEDS_algorithm_template/
@@ -25,8 +25,8 @@ This repository is a self-contained [Copier](https://copier.readthedocs.io) temp
25
25
  contract-first MEDS algorithm repositories.
26
26
 
27
27
  Shared contracts and the canonical specification live in
28
- [`meds-algorithm`](https://github.com/McDermottHealthAI/meds-algorithm). This template and generated projects pin
29
- `meds-algorithm==0.4.0a4` from PyPI.
28
+ [`meds-algorithm`](https://github.com/McDermottHealthAI/meds-algorithm). Generated repositories pin its PyPI release
29
+ `meds-algorithm==0.4.0a5` for reproducible installations.
30
30
  The core owns the reusable infrastructure and conformance helpers; generated repositories import it directly.
31
31
 
32
32
  The template fixes the external contract—MEDS input, six algorithm profiles and standard arguments, typed
@@ -52,10 +52,10 @@ uv run --group docs mkdocs serve
52
52
 
53
53
  The installable `meds-algorithm-template` command uses the matching `v<package-version>` tag from this
54
54
  GitHub repository. It needs Git and network access; it does not bundle a second copy of the template.
55
- Install and run the generator with:
55
+ Install the pinned generator with:
56
56
 
57
57
  ```bash
58
- uvx --from 'meds-algorithm-template==0.4.0a1' meds-algorithm-template ../my-meds-algorithm --trust
58
+ uvx --from 'meds-algorithm-template==0.4.0a2' meds-algorithm-template ../my-meds-algorithm --trust
59
59
  ```
60
60
 
61
61
  Use `--defaults --data-file answers.yaml` for unattended generation. The answers file records the
@@ -113,7 +113,7 @@ so the command remains usable if formatting/bootstrap tasks are added later.
113
113
  For example, `algorithm_slug=retain algorithm_class=RETAIN` generates `retain/retain.py` containing
114
114
  `RETAIN`, plus `retain/config.py` containing `RETAINConfig`. Import them with
115
115
  `from retain import RETAIN, RETAINConfig` (or `from retain.retain import RETAIN`). The installed
116
- `retain` and `meds-algorithm` commands share the same dispatcher. Use the core runner for Python
116
+ `retain` command is the algorithm's CLI; each algorithm has its own command, so several can share an environment. Use the core runner for Python
117
117
  execution so direct imports retain the same validation/publication path as the CLI.
118
118
 
119
119
  Profiles are `supervised`, `finetune`, `probe`, `zero_shot_direct`, `zero_shot_materialized`, and
@@ -132,7 +132,7 @@ passthrough this needs.
132
132
  ```bash
133
133
  cd ../my-meds-algorithm
134
134
  uv sync --extra test
135
- uv run meds-algorithm commands
135
+ uv run my-meds-algorithm commands
136
136
  uv run pytest -rs
137
137
  ```
138
138
 
@@ -152,29 +152,75 @@ A completed implementation removes each profile from `STUB_PROFILES` only after
152
152
  <!-- --8<-- [start:implementation-prompt] -->
153
153
  ## Copyable algorithm-implementation prompt
154
154
 
155
- Use this after rendering a repository. Replace all placeholders before sending it to a coding agent.
156
- The full-data evaluation may target any suitable MEDS dataset (for example, MIMIC-IV or NWICU); the
157
- provided `real_data` test remains the MIMIC-IV demo smoke test.
155
+ Use the [interactive prompt builder](https://McDermottHealthAI.github.io/MEDS_algorithm_template/prompt-builder/)
156
+ or fill in the fields below. The agent inspects sources and selects profiles before generating a new
157
+ local or GitHub repository. The builder runs locally in your browser; it does not launch an agent.
158
+ The provided `real_data` test remains the MIMIC-IV demo smoke test, independent of supplied evaluation tasks.
158
159
 
159
160
  The prompt adapts [Ponytail's implementation principles](https://github.com/DietrichGebert/ponytail/blob/main/skills/ponytail/SKILL.md)
160
161
  to scientific algorithm development. It works with Claude and other coding agents without installing a plugin.
161
162
 
162
163
  ```text
163
- Based on the following source:
164
-
165
- <PAPER_PATH_OR_URL_AND_OR_REPOSITORY_PATH_OR_URL>
166
-
167
- implement the algorithm in the generated MEDS algorithm repository at:
168
-
169
- <GENERATED_REPOSITORY_PATH>
170
-
171
- For the full-data run, target this dataset in MEDS format (name, revision, and location):
172
-
173
- <TARGET_DATASET_NAME_REVISION_AND_MEDS_PATH>
174
-
175
- Use this dataset-specific shared task bundle if already available:
176
-
177
- <FULL_DATA_WORK_DIR_OR_NOT_YET_AVAILABLE>
164
+ Implement a MEDS algorithm from the following inputs.
165
+
166
+ Paper(s), supplementary material and versions:
167
+ <PAPER_REFERENCES_OR_NOT_SUPPLIED>
168
+
169
+ Code/repository source(s), revisions, configurations and checkpoints:
170
+ <CODE_REFERENCES_OR_NOT_SUPPLIED>
171
+
172
+ Destination (a NEW local repository or a NEW GitHub repository, including visibility):
173
+ <NEW_REPOSITORY_DESTINATION>
174
+
175
+ Local working directory for the new repository:
176
+ <NEW_LOCAL_REPOSITORY_PATH>
177
+
178
+ Profile selection (automatic, or an explicit list of one or more profiles):
179
+ <PROFILE_SELECTION>
180
+
181
+ Dataset context (name, revision and MEDS path, if available):
182
+ <DATASET_CONTEXT_OR_NOT_SUPPLIED>
183
+
184
+ Already prepared evaluation tasks (labels location, task-config location, bundle revision and
185
+ optional task subset; or explicitly not supplied):
186
+ <PREPARED_TASK_BUNDLE_OR_NOT_SUPPLIED>
187
+
188
+ Work scope (implementation/local tests, also MEDS-DEV integration, or preparation for full evaluation):
189
+ <WORK_SCOPE>
190
+
191
+ Additional implementation constraints:
192
+ <ADDITIONAL_CONSTRAINTS_OR_NONE>
193
+
194
+ Inspect the supplied sources before generating the repository. If both paper and code are provided,
195
+ compare them, record discrepancies and identify which behavior is implemented; do not silently assume
196
+ one always overrides the other. If only a paper is provided, distinguish source-backed choices from
197
+ necessary assumptions. If only code is provided, inspect its revision, configuration and checkpoint
198
+ requirements; do not claim fidelity to an unavailable paper.
199
+
200
+ For automatic profile selection, choose one or more profiles supported by documented source behavior:
201
+ supervised, finetune, probe, zero_shot_direct, zero_shot_materialized or predict_only. Record evidence for
202
+ each choice and proceed when the evidence is clear. Do not add speculative capabilities merely because
203
+ a profile exists. For an explicit list, implement that scope; report material incompatibilities before
204
+ implementing unsupported behavior, and do not silently replace or expand it. Shared methods may be
205
+ implemented once through multiple profile inheritance when their semantics match, or through separate
206
+ classes with shared components. Each selected profile gets its own MEDS-DEV YAML and acceptance tests.
207
+
208
+ Generate the new repository with the MEDS algorithm template at
209
+ https://github.com/McDermottHealthAI/MEDS_algorithm_template using a reviewed immutable revision, and
210
+ record it in .copier-answers.yml. Pass the selected profiles explicitly; do not accidentally accept the
211
+ single-profile default. Never overwrite an existing local directory or GitHub repository. For a local
212
+ destination, initialize Git without creating a remote. For a GitHub destination, create the specified
213
+ repository with the specified visibility and connect the local checkout; report missing access without
214
+ changing the destination or visibility. Respect any more specific workspace repository-routing rules.
215
+
216
+ Supplied evaluation tasks are already prepared: use their labels and task configs as fixed inputs.
217
+ Verify their dataset/revision, task identities, splits, prediction times and consistency before use.
218
+ An optional task subset selects only tasks already present in that bundle. Do not generate new tasks,
219
+ extract new labels, relabel examples or silently modify the task definitions. Use supplied indices or
220
+ read only the supplied prediction keys through the core index reader; evaluation outcomes must never
221
+ enter scoring. Zero-shot profiles additionally require executable task criteria and matching predicates.
222
+ If the bundle is not supplied, continue implementation and synthetic tests; report evaluation as
223
+ pending. An incomplete bundle blocks only the dependent evaluation, not unrelated implementation.
178
224
 
179
225
  Read AGENTS.md, SPEC.md, README.md, and docs/IMPLEMENTATION_GUIDE.md in the generated repository
180
226
  completely before writing code. Inspect the paper, supplementary material, source repository,
@@ -183,7 +229,17 @@ source.
183
229
 
184
230
  Apply the Ponytail principle of the smallest complete change: implement the complete source-defined
185
231
  algorithm with the least additional infrastructure. Check meds-algorithm, existing algorithm-family code,
186
- standard libraries and installed dependencies before creating helpers. Keep shared fixes in their
232
+ standard libraries and installed dependencies before creating helpers. If the source ships an installable
233
+ package or executable, depend on it pinned to the exact reviewed revision and call it; write only contract
234
+ glue (label-free preprocessing, cohort/key adaptation, explicit key association, coverage). Install it in the
235
+ algorithm environment; if it breaks meds-algorithm within core's declared dependency ranges, fix core. For a
236
+ genuine conflict with core, run the source as an external executable from a separate environment that the
237
+ algorithm package creates and manages (committed lockfile, built at install or first use, digest recorded in
238
+ manifests; MEDS-DEV installs only requirements.txt). Reimplement only when the source cannot run even in
239
+ isolation or its code cannot meet the contract even with glue, and record why in IMPLEMENTATION_REPORT.md;
240
+ local hardware alone is not a reason, since CPU or other hardware is acceptable.
241
+ Choose an algorithm_slug that does not shadow the source's distribution or import name (for example
242
+ genhpf_meds, not genhpf), so both can be installed together. Keep shared fixes in their
187
243
  owning package; do not copy core utilities into the algorithm repository. Avoid speculative wrappers,
188
244
  configuration options and compatibility layers. Trace affected commands, callers, fixtures and
189
245
  documentation, and finish all required changes. Simplicity must preserve scientific fidelity, temporal
@@ -216,7 +272,7 @@ Implement explicit payload compatibility checks. Prediction outputs contain keys
216
272
  only the runner attaches evaluation truth after scoring. Demonstrate that saved configuration and requests
217
273
  can be reloaded in a fresh process and executed without an earlier call on the same algorithm instance.
218
274
 
219
- Preserve the selected algorithm profile and standardized command arguments, MEDS input boundary, artifact
275
+ Preserve all selected algorithm profiles and standardized command arguments, MEDS input boundary, artifact
220
276
  manifest envelopes, MEDS-DEV model.yaml interface, and final MEDS prediction output. Intermediate payload
221
277
  formats and execution mechanisms are algorithm-owned: choose whatever preprocessing, featurization, framework,
222
278
  batching or non-batching strategy, external executable, storage format, and algorithm architecture most
@@ -238,7 +294,8 @@ external_index_dir. Never build, filter, or extend the cohort, and read the inde
238
294
  meds_algorithm.read_index. Reuse an existing aces-to-<algorithm> adapter for this algorithm if one exists;
239
295
  otherwise write one on aces-relaxations, pinned to an exact version: reject tasks that are not future-only
240
296
  or are degenerate, normalize, then apply only the approximations and assumptions the algorithm's query
241
- language forces. Publish relaxations.yaml with every step, and report per task whether the answer is exact.
297
+ language forces. Publish relaxations.yaml with each zero-shot prediction artifact, and report per task whether
298
+ the answer is exact.
242
299
  A materialized algorithm evaluates the task on generated futures instead and needs no relaxation beyond
243
300
  sampling. Follow the shape for the selected profile in docs/IMPLEMENTATION_GUIDE.md.
244
301
  Do not omit source behavior because it is inconvenient for a fixture; adapt the implementation or fixture
@@ -246,14 +303,24 @@ instead.
246
303
 
247
304
  Record every material source element as ported, adapted, or omitted, with evidence and justification, in
248
305
  IMPLEMENTATION_REPORT.md. Implement every selected typed algorithm method, finalize the implementation-specific
249
- command strings in model.yaml, and implement tests/e2e.py. Keep STUB_PROFILES = set(PROFILES) until the actual selected
250
- algorithm profile completes and produces standards-conformant predictions.
306
+ command strings in model.yaml, and implement tests/e2e.py. Configure representative config instances
307
+ in tests/conftest.py. Keep TestConformance inheriting the shared meds-algorithm acceptance suite;
308
+ do not copy its test bodies or override its checks to suppress failures. Remove each profile from STUB_PROFILES only
309
+ after that profile completes and produces standards-conformant predictions; complete every selected profile.
251
310
 
252
- Then run:
311
+ Always run:
253
312
 
254
313
  uv run pytest -rs
314
+
315
+ If the selected scope includes MEDS-DEV integration or full-evaluation preparation, also run:
316
+
255
317
  uv run pytest -m meds_dev -rs
256
318
 
319
+ For implementation/local-tests scope, finish with implementation and local validation evidence. For
320
+ MEDS-DEV integration scope, finish after its integration evidence. Report unavailable dependencies or
321
+ adapters explicitly; do not weaken tests. The following demo and full-data stages apply only when the
322
+ selected scope is preparation for full evaluation; selecting that scope is not execution approval.
323
+
257
324
  Complete the pre-demo sections of IMPLEMENTATION_REPORT.md and ask for human review of source fidelity,
258
325
  predicate interpretation, and the proposed MIMIC-IV demo execution. Only after approval, run:
259
326
 
@@ -264,20 +331,24 @@ Update IMPLEMENTATION_REPORT.md with the demo cohort, final-output coverage, pre
264
331
  environment, wall time, peak process-tree PSS/RSS, GPU measurements when available, failures, and fixes.
265
332
  Ask for a second human review before launching the selected full dataset through the repository's SLURM
266
333
  interface. Review target-dataset compatibility, access, and resources separately from the MIMIC-IV demo.
267
- Use a shared, reviewed task bundle for the target dataset, built once upstream: clinical tasks defined in
268
- ACES and extracted with the ACES package, or randomly sampled code-by-horizon tasks (generated with
269
- https://github.com/florian6973/meds-random-task-sampler and selected with https://github.com/florian6973/meds-task-selection).
270
- It must contain each task's definition and its generated index/labels; zero-shot algorithms also need each
271
- task's ACES criteria. If a compatible bundle is not yet available, report that blocker before the
272
- full-data run. Record the dataset name/revision, predicate provenance, bundle location, the commit of the
273
- tool that built it, and a digest of its task definitions. Keep the bundle external to Git. Commit and push the implementation,
274
- configuration, and report-so-far; run the cluster job from that exact clean commit. After the authorized
275
- run, complete the report with full-data evidence, scientific deviations, and known limitations, then
276
- synchronize structured results through the GitHub workflow. Treat
334
+ Use the supplied, already prepared task bundle for the selected dataset. It must contain task configs,
335
+ per-task labels/keys and split assignments; zero-shot runs additionally require the original ACES criteria
336
+ and matching predicates. Do not generate or extract replacement evaluation tasks. Canonical synthetic
337
+ fixtures and the built-in MIMIC-IV demo smoke task remain separate from this supplied evaluation bundle. If the bundle is absent
338
+ or inconsistent, report the evaluation blocker and the exact missing inputs.
339
+ Record the dataset name/revision, predicate provenance, bundle location, supplied bundle revision and
340
+ available upstream build provenance, and a digest of its task definitions. Keep the bundle external to Git.
341
+ Commit the implementation, configuration and report-so-far; push when a remote is configured. Run the
342
+ cluster job from that exact clean commit. After the authorized run, complete the report with full-data evidence, scientific deviations, and known limitations, then
343
+ synchronize structured results through the GitHub workflow when the destination has a GitHub remote.
344
+ For a local-only repository, retain the committed report and run evidence locally. Treat
277
345
  docs/IMPLEMENTATION_GUIDE.md as the authority for the ordered gates and their evidence.
278
346
  ```
279
347
  <!-- --8<-- [end:implementation-prompt] -->
280
348
 
349
+ See [the test catalogue](TESTING.md) for each template test and its purpose; generated repositories
350
+ include `docs/TESTING.md` describing every acceptance test.
351
+
281
352
  ## Test tiers in a generated repository
282
353
 
283
354
  ```bash
@@ -347,5 +418,15 @@ repositories. Files under `template/` are the generated payload; root tests
347
418
  validate that payload without imposing a algorithm implementation.
348
419
 
349
420
  Profile selection and the distinct version 4 step names are described in [profiles](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/profiles.md).
350
- See the [software contract](https://github.com/McDermottHealthAI/meds-algorithm/blob/v0.4.0a4/src/meds_algorithm/CONTRACT.md), [migration guide](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/migration-v4.md),
421
+ See the [software contract](https://github.com/McDermottHealthAI/meds-algorithm/blob/v0.4.0a5/src/meds_algorithm/CONTRACT.md), [migration guide](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/migration-v4.md),
351
422
  and [shared-package assessment](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/shared-package-assessment.md).
423
+
424
+ ## Changes
425
+
426
+ ### 0.4.0a2 (2026-11-03)
427
+
428
+ - Generate projects using the published `meds-algorithm==0.4.0a5` dependency.
429
+ - Inherit shared acceptance tests and keep algorithm-specific adapters and scientific tests local.
430
+ - Add the optional Hydra profile runner, local subprocess and Submitit execution, and resolved dry-run plans.
431
+ - Add the implementation prompt builder and reorganize documentation, including typed request UML and test guides.
432
+ - Use each algorithm's own executable name. Conformance and orchestration remain optional extras.
@@ -12,8 +12,8 @@ This repository is a self-contained [Copier](https://copier.readthedocs.io) temp
12
12
  contract-first MEDS algorithm repositories.
13
13
 
14
14
  Shared contracts and the canonical specification live in
15
- [`meds-algorithm`](https://github.com/McDermottHealthAI/meds-algorithm). This template and generated projects pin
16
- `meds-algorithm==0.4.0a4` from PyPI.
15
+ [`meds-algorithm`](https://github.com/McDermottHealthAI/meds-algorithm). Generated repositories pin its PyPI release
16
+ `meds-algorithm==0.4.0a5` for reproducible installations.
17
17
  The core owns the reusable infrastructure and conformance helpers; generated repositories import it directly.
18
18
 
19
19
  The template fixes the external contract—MEDS input, six algorithm profiles and standard arguments, typed
@@ -39,10 +39,10 @@ uv run --group docs mkdocs serve
39
39
 
40
40
  The installable `meds-algorithm-template` command uses the matching `v<package-version>` tag from this
41
41
  GitHub repository. It needs Git and network access; it does not bundle a second copy of the template.
42
- Install and run the generator with:
42
+ Install the pinned generator with:
43
43
 
44
44
  ```bash
45
- uvx --from 'meds-algorithm-template==0.4.0a1' meds-algorithm-template ../my-meds-algorithm --trust
45
+ uvx --from 'meds-algorithm-template==0.4.0a2' meds-algorithm-template ../my-meds-algorithm --trust
46
46
  ```
47
47
 
48
48
  Use `--defaults --data-file answers.yaml` for unattended generation. The answers file records the
@@ -100,7 +100,7 @@ so the command remains usable if formatting/bootstrap tasks are added later.
100
100
  For example, `algorithm_slug=retain algorithm_class=RETAIN` generates `retain/retain.py` containing
101
101
  `RETAIN`, plus `retain/config.py` containing `RETAINConfig`. Import them with
102
102
  `from retain import RETAIN, RETAINConfig` (or `from retain.retain import RETAIN`). The installed
103
- `retain` and `meds-algorithm` commands share the same dispatcher. Use the core runner for Python
103
+ `retain` command is the algorithm's CLI; each algorithm has its own command, so several can share an environment. Use the core runner for Python
104
104
  execution so direct imports retain the same validation/publication path as the CLI.
105
105
 
106
106
  Profiles are `supervised`, `finetune`, `probe`, `zero_shot_direct`, `zero_shot_materialized`, and
@@ -119,7 +119,7 @@ passthrough this needs.
119
119
  ```bash
120
120
  cd ../my-meds-algorithm
121
121
  uv sync --extra test
122
- uv run meds-algorithm commands
122
+ uv run my-meds-algorithm commands
123
123
  uv run pytest -rs
124
124
  ```
125
125
 
@@ -139,29 +139,75 @@ A completed implementation removes each profile from `STUB_PROFILES` only after
139
139
  <!-- --8<-- [start:implementation-prompt] -->
140
140
  ## Copyable algorithm-implementation prompt
141
141
 
142
- Use this after rendering a repository. Replace all placeholders before sending it to a coding agent.
143
- The full-data evaluation may target any suitable MEDS dataset (for example, MIMIC-IV or NWICU); the
144
- provided `real_data` test remains the MIMIC-IV demo smoke test.
142
+ Use the [interactive prompt builder](https://McDermottHealthAI.github.io/MEDS_algorithm_template/prompt-builder/)
143
+ or fill in the fields below. The agent inspects sources and selects profiles before generating a new
144
+ local or GitHub repository. The builder runs locally in your browser; it does not launch an agent.
145
+ The provided `real_data` test remains the MIMIC-IV demo smoke test, independent of supplied evaluation tasks.
145
146
 
146
147
  The prompt adapts [Ponytail's implementation principles](https://github.com/DietrichGebert/ponytail/blob/main/skills/ponytail/SKILL.md)
147
148
  to scientific algorithm development. It works with Claude and other coding agents without installing a plugin.
148
149
 
149
150
  ```text
150
- Based on the following source:
151
-
152
- <PAPER_PATH_OR_URL_AND_OR_REPOSITORY_PATH_OR_URL>
153
-
154
- implement the algorithm in the generated MEDS algorithm repository at:
155
-
156
- <GENERATED_REPOSITORY_PATH>
157
-
158
- For the full-data run, target this dataset in MEDS format (name, revision, and location):
159
-
160
- <TARGET_DATASET_NAME_REVISION_AND_MEDS_PATH>
161
-
162
- Use this dataset-specific shared task bundle if already available:
163
-
164
- <FULL_DATA_WORK_DIR_OR_NOT_YET_AVAILABLE>
151
+ Implement a MEDS algorithm from the following inputs.
152
+
153
+ Paper(s), supplementary material and versions:
154
+ <PAPER_REFERENCES_OR_NOT_SUPPLIED>
155
+
156
+ Code/repository source(s), revisions, configurations and checkpoints:
157
+ <CODE_REFERENCES_OR_NOT_SUPPLIED>
158
+
159
+ Destination (a NEW local repository or a NEW GitHub repository, including visibility):
160
+ <NEW_REPOSITORY_DESTINATION>
161
+
162
+ Local working directory for the new repository:
163
+ <NEW_LOCAL_REPOSITORY_PATH>
164
+
165
+ Profile selection (automatic, or an explicit list of one or more profiles):
166
+ <PROFILE_SELECTION>
167
+
168
+ Dataset context (name, revision and MEDS path, if available):
169
+ <DATASET_CONTEXT_OR_NOT_SUPPLIED>
170
+
171
+ Already prepared evaluation tasks (labels location, task-config location, bundle revision and
172
+ optional task subset; or explicitly not supplied):
173
+ <PREPARED_TASK_BUNDLE_OR_NOT_SUPPLIED>
174
+
175
+ Work scope (implementation/local tests, also MEDS-DEV integration, or preparation for full evaluation):
176
+ <WORK_SCOPE>
177
+
178
+ Additional implementation constraints:
179
+ <ADDITIONAL_CONSTRAINTS_OR_NONE>
180
+
181
+ Inspect the supplied sources before generating the repository. If both paper and code are provided,
182
+ compare them, record discrepancies and identify which behavior is implemented; do not silently assume
183
+ one always overrides the other. If only a paper is provided, distinguish source-backed choices from
184
+ necessary assumptions. If only code is provided, inspect its revision, configuration and checkpoint
185
+ requirements; do not claim fidelity to an unavailable paper.
186
+
187
+ For automatic profile selection, choose one or more profiles supported by documented source behavior:
188
+ supervised, finetune, probe, zero_shot_direct, zero_shot_materialized or predict_only. Record evidence for
189
+ each choice and proceed when the evidence is clear. Do not add speculative capabilities merely because
190
+ a profile exists. For an explicit list, implement that scope; report material incompatibilities before
191
+ implementing unsupported behavior, and do not silently replace or expand it. Shared methods may be
192
+ implemented once through multiple profile inheritance when their semantics match, or through separate
193
+ classes with shared components. Each selected profile gets its own MEDS-DEV YAML and acceptance tests.
194
+
195
+ Generate the new repository with the MEDS algorithm template at
196
+ https://github.com/McDermottHealthAI/MEDS_algorithm_template using a reviewed immutable revision, and
197
+ record it in .copier-answers.yml. Pass the selected profiles explicitly; do not accidentally accept the
198
+ single-profile default. Never overwrite an existing local directory or GitHub repository. For a local
199
+ destination, initialize Git without creating a remote. For a GitHub destination, create the specified
200
+ repository with the specified visibility and connect the local checkout; report missing access without
201
+ changing the destination or visibility. Respect any more specific workspace repository-routing rules.
202
+
203
+ Supplied evaluation tasks are already prepared: use their labels and task configs as fixed inputs.
204
+ Verify their dataset/revision, task identities, splits, prediction times and consistency before use.
205
+ An optional task subset selects only tasks already present in that bundle. Do not generate new tasks,
206
+ extract new labels, relabel examples or silently modify the task definitions. Use supplied indices or
207
+ read only the supplied prediction keys through the core index reader; evaluation outcomes must never
208
+ enter scoring. Zero-shot profiles additionally require executable task criteria and matching predicates.
209
+ If the bundle is not supplied, continue implementation and synthetic tests; report evaluation as
210
+ pending. An incomplete bundle blocks only the dependent evaluation, not unrelated implementation.
165
211
 
166
212
  Read AGENTS.md, SPEC.md, README.md, and docs/IMPLEMENTATION_GUIDE.md in the generated repository
167
213
  completely before writing code. Inspect the paper, supplementary material, source repository,
@@ -170,7 +216,17 @@ source.
170
216
 
171
217
  Apply the Ponytail principle of the smallest complete change: implement the complete source-defined
172
218
  algorithm with the least additional infrastructure. Check meds-algorithm, existing algorithm-family code,
173
- standard libraries and installed dependencies before creating helpers. Keep shared fixes in their
219
+ standard libraries and installed dependencies before creating helpers. If the source ships an installable
220
+ package or executable, depend on it pinned to the exact reviewed revision and call it; write only contract
221
+ glue (label-free preprocessing, cohort/key adaptation, explicit key association, coverage). Install it in the
222
+ algorithm environment; if it breaks meds-algorithm within core's declared dependency ranges, fix core. For a
223
+ genuine conflict with core, run the source as an external executable from a separate environment that the
224
+ algorithm package creates and manages (committed lockfile, built at install or first use, digest recorded in
225
+ manifests; MEDS-DEV installs only requirements.txt). Reimplement only when the source cannot run even in
226
+ isolation or its code cannot meet the contract even with glue, and record why in IMPLEMENTATION_REPORT.md;
227
+ local hardware alone is not a reason, since CPU or other hardware is acceptable.
228
+ Choose an algorithm_slug that does not shadow the source's distribution or import name (for example
229
+ genhpf_meds, not genhpf), so both can be installed together. Keep shared fixes in their
174
230
  owning package; do not copy core utilities into the algorithm repository. Avoid speculative wrappers,
175
231
  configuration options and compatibility layers. Trace affected commands, callers, fixtures and
176
232
  documentation, and finish all required changes. Simplicity must preserve scientific fidelity, temporal
@@ -203,7 +259,7 @@ Implement explicit payload compatibility checks. Prediction outputs contain keys
203
259
  only the runner attaches evaluation truth after scoring. Demonstrate that saved configuration and requests
204
260
  can be reloaded in a fresh process and executed without an earlier call on the same algorithm instance.
205
261
 
206
- Preserve the selected algorithm profile and standardized command arguments, MEDS input boundary, artifact
262
+ Preserve all selected algorithm profiles and standardized command arguments, MEDS input boundary, artifact
207
263
  manifest envelopes, MEDS-DEV model.yaml interface, and final MEDS prediction output. Intermediate payload
208
264
  formats and execution mechanisms are algorithm-owned: choose whatever preprocessing, featurization, framework,
209
265
  batching or non-batching strategy, external executable, storage format, and algorithm architecture most
@@ -225,7 +281,8 @@ external_index_dir. Never build, filter, or extend the cohort, and read the inde
225
281
  meds_algorithm.read_index. Reuse an existing aces-to-<algorithm> adapter for this algorithm if one exists;
226
282
  otherwise write one on aces-relaxations, pinned to an exact version: reject tasks that are not future-only
227
283
  or are degenerate, normalize, then apply only the approximations and assumptions the algorithm's query
228
- language forces. Publish relaxations.yaml with every step, and report per task whether the answer is exact.
284
+ language forces. Publish relaxations.yaml with each zero-shot prediction artifact, and report per task whether
285
+ the answer is exact.
229
286
  A materialized algorithm evaluates the task on generated futures instead and needs no relaxation beyond
230
287
  sampling. Follow the shape for the selected profile in docs/IMPLEMENTATION_GUIDE.md.
231
288
  Do not omit source behavior because it is inconvenient for a fixture; adapt the implementation or fixture
@@ -233,14 +290,24 @@ instead.
233
290
 
234
291
  Record every material source element as ported, adapted, or omitted, with evidence and justification, in
235
292
  IMPLEMENTATION_REPORT.md. Implement every selected typed algorithm method, finalize the implementation-specific
236
- command strings in model.yaml, and implement tests/e2e.py. Keep STUB_PROFILES = set(PROFILES) until the actual selected
237
- algorithm profile completes and produces standards-conformant predictions.
293
+ command strings in model.yaml, and implement tests/e2e.py. Configure representative config instances
294
+ in tests/conftest.py. Keep TestConformance inheriting the shared meds-algorithm acceptance suite;
295
+ do not copy its test bodies or override its checks to suppress failures. Remove each profile from STUB_PROFILES only
296
+ after that profile completes and produces standards-conformant predictions; complete every selected profile.
238
297
 
239
- Then run:
298
+ Always run:
240
299
 
241
300
  uv run pytest -rs
301
+
302
+ If the selected scope includes MEDS-DEV integration or full-evaluation preparation, also run:
303
+
242
304
  uv run pytest -m meds_dev -rs
243
305
 
306
+ For implementation/local-tests scope, finish with implementation and local validation evidence. For
307
+ MEDS-DEV integration scope, finish after its integration evidence. Report unavailable dependencies or
308
+ adapters explicitly; do not weaken tests. The following demo and full-data stages apply only when the
309
+ selected scope is preparation for full evaluation; selecting that scope is not execution approval.
310
+
244
311
  Complete the pre-demo sections of IMPLEMENTATION_REPORT.md and ask for human review of source fidelity,
245
312
  predicate interpretation, and the proposed MIMIC-IV demo execution. Only after approval, run:
246
313
 
@@ -251,20 +318,24 @@ Update IMPLEMENTATION_REPORT.md with the demo cohort, final-output coverage, pre
251
318
  environment, wall time, peak process-tree PSS/RSS, GPU measurements when available, failures, and fixes.
252
319
  Ask for a second human review before launching the selected full dataset through the repository's SLURM
253
320
  interface. Review target-dataset compatibility, access, and resources separately from the MIMIC-IV demo.
254
- Use a shared, reviewed task bundle for the target dataset, built once upstream: clinical tasks defined in
255
- ACES and extracted with the ACES package, or randomly sampled code-by-horizon tasks (generated with
256
- https://github.com/florian6973/meds-random-task-sampler and selected with https://github.com/florian6973/meds-task-selection).
257
- It must contain each task's definition and its generated index/labels; zero-shot algorithms also need each
258
- task's ACES criteria. If a compatible bundle is not yet available, report that blocker before the
259
- full-data run. Record the dataset name/revision, predicate provenance, bundle location, the commit of the
260
- tool that built it, and a digest of its task definitions. Keep the bundle external to Git. Commit and push the implementation,
261
- configuration, and report-so-far; run the cluster job from that exact clean commit. After the authorized
262
- run, complete the report with full-data evidence, scientific deviations, and known limitations, then
263
- synchronize structured results through the GitHub workflow. Treat
321
+ Use the supplied, already prepared task bundle for the selected dataset. It must contain task configs,
322
+ per-task labels/keys and split assignments; zero-shot runs additionally require the original ACES criteria
323
+ and matching predicates. Do not generate or extract replacement evaluation tasks. Canonical synthetic
324
+ fixtures and the built-in MIMIC-IV demo smoke task remain separate from this supplied evaluation bundle. If the bundle is absent
325
+ or inconsistent, report the evaluation blocker and the exact missing inputs.
326
+ Record the dataset name/revision, predicate provenance, bundle location, supplied bundle revision and
327
+ available upstream build provenance, and a digest of its task definitions. Keep the bundle external to Git.
328
+ Commit the implementation, configuration and report-so-far; push when a remote is configured. Run the
329
+ cluster job from that exact clean commit. After the authorized run, complete the report with full-data evidence, scientific deviations, and known limitations, then
330
+ synchronize structured results through the GitHub workflow when the destination has a GitHub remote.
331
+ For a local-only repository, retain the committed report and run evidence locally. Treat
264
332
  docs/IMPLEMENTATION_GUIDE.md as the authority for the ordered gates and their evidence.
265
333
  ```
266
334
  <!-- --8<-- [end:implementation-prompt] -->
267
335
 
336
+ See [the test catalogue](TESTING.md) for each template test and its purpose; generated repositories
337
+ include `docs/TESTING.md` describing every acceptance test.
338
+
268
339
  ## Test tiers in a generated repository
269
340
 
270
341
  ```bash
@@ -334,5 +405,15 @@ repositories. Files under `template/` are the generated payload; root tests
334
405
  validate that payload without imposing a algorithm implementation.
335
406
 
336
407
  Profile selection and the distinct version 4 step names are described in [profiles](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/profiles.md).
337
- See the [software contract](https://github.com/McDermottHealthAI/meds-algorithm/blob/v0.4.0a4/src/meds_algorithm/CONTRACT.md), [migration guide](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/migration-v4.md),
408
+ See the [software contract](https://github.com/McDermottHealthAI/meds-algorithm/blob/v0.4.0a5/src/meds_algorithm/CONTRACT.md), [migration guide](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/migration-v4.md),
338
409
  and [shared-package assessment](https://github.com/McDermottHealthAI/MEDS_algorithm_template/blob/main/docs/shared-package-assessment.md).
410
+
411
+ ## Changes
412
+
413
+ ### 0.4.0a2 (2026-11-03)
414
+
415
+ - Generate projects using the published `meds-algorithm==0.4.0a5` dependency.
416
+ - Inherit shared acceptance tests and keep algorithm-specific adapters and scientific tests local.
417
+ - Add the optional Hydra profile runner, local subprocess and Submitit execution, and resolved dry-run plans.
418
+ - Add the implementation prompt builder and reorganize documentation, including typed request UML and test guides.
419
+ - Use each algorithm's own executable name. Conformance and orchestration remain optional extras.