Porting guide: derived variables belong in the datamodule, base bindings in the report - #20
Merged
Merged
Conversation
…ngs in the report Two gaps the TECO port would have hit. First, the Step 3 mapping table read as if every source variable needed a predicate, which pushes a port toward inventing predicates for derived quantities (ratios, severity scores) — those match nothing, so the column is all-zero and the model is silently blind to a variable the report claims it has. Predicates are deliberately *base* quantities; derivation from them is what datamodule.py is for, and porting a derived variable that way is a `ported` ledger row, not `adapted`. Second, nothing required the port to write down which concepts the model needs or how they were bound. Step 1 now enumerates the input variable list (base vs derived) before any code and prescribes the binding workflow — search every MEDS-DEV dataset's predicates.yaml, reuse upstream names where they exist, and flag each missing binding as locally written, contributed upstream, or absent from the dataset. Step 5 gains a required-concepts table whose matched-event counts are copied from the artifact manifest's featurization.match_counts rather than self-reported, and Step 7 gains the checks, including that no base concept has zero matches. Also drops a duplicated `model architecture` row introduced when the featurization rows were added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #19 (the featurization backend), addressing two gaps a real port would hit. Docs only —
template/docs/PORTING-A-MODEL.md.jinja, all changes inside thedata_backend == 'custom_featurization'branch, so themtdrender is untouched.Derived variables belong in the datamodule. The Step 3 mapping table read as if every source variable needed a predicate, which pushes a port toward inventing predicates for derived quantities (SF ratio, severity scores) — those match nothing, so the column is all-zero and the model is silently blind to a variable the report claims it has. Predicates are deliberately base quantities; deriving from them in
datamodule.pyis the intended flexibility, and porting a derived variable that way is aportedledger row, notadaptedoromitted. The only real finding is a base variable the dataset does not record.Required predicates get written down, with evidence. Nothing previously required a port to state which concepts the model needs or how they were bound:
predicates.yaml(not just the target — another dataset still tells you the ecosystem's name for a concept), reuse upstream names, and flag each gap as locally written / contributed upstream (preferred: it is per-dataset knowledge) / not recorded by the dataset.featurization.match_countsrather than self-reported.Also drops a duplicated
model architecturerow that #19 introduced into the Step 3 table.Test plan
uv run pytest tests/ -q— 85 passedmtdrender contains zero featurization mentions, no stray blank lines from the new conditional blocks, EOF intactruff check/ruff format --checkclean🤖 Generated with Claude Code