Converts spec rows into a per-variable list of schema fields (dataset, variable, label, type, origin, derivation, source pointers). No patient data ever enters the context. The dataset field lets the model emit the correct target-dataset token for non-ADSL specs; without it the model can only guess (and copies the system prompt's ADSL example), so [align_batch()] rejected those batches (finding F-06).
Examples
ctx <- build_context(spec_variables(mock_spec_adsl(), "ADSL"))
ctx$STUDYID$derivation
#> [1] "Copied directly from DM.STUDYID"