Parent: #9
Finding
Document anchoring in the smartphrase layer is carried by a single field — sapRef on study-graph concepts — and concepts are only one of the four binding kinds a phrase instance can use. Everything the prose asserts that does not route through a concept binding has no typed path back to the SAP text that grounds it.
This surfaced in a full-study encoding exercise against the methods_02 artefacts (Transformation Library v0.7, Method schema v0.9.1): a 2×2 crossover SAP encoded end-to-end as 96 phrase-template instances (85 analyses + 11 derivations), with a viewer that highlights each instance's sapRef quotes in the source document. Method phrases visibly never highlighted anything; a systematic audit showed the method case is just the most visible member of a class.
Audit (all 96 instances)
1. Bindings by kind — three of four have no document path
| Binding kind |
Uses |
Path to SAP text |
concept |
400 |
✅ via the bound concept's sapRef |
method |
89 |
✗ resolves into the library; the library wall (correctly) forbids study text |
output |
85 |
✗ output classes are library entities too |
value |
74 |
✗ raw configuration values ("95") — yet "95% confidence intervals" is a sentence in the SAP |
2. Fixed-text phrases — no bindings, so nothing to anchor through. Seven phrases, 156 uses, whose entire text is a claim about what the SAP says (e.g. "adjusting for period", "with a random participant effect", "with follow-up time as an offset"). Each mirrors a specific SAP sentence; none can cite it.
Together: 404 of ~800 phrase uses — about half the smartphrase spans in any generated sentence — have no corresponding anchor in the source document.
3. Entity classes beyond phrases
- Estimands: 0 of 40 carry a
sapRef. Their ranks and ICE scopes are encoded straight from the SAP's estimands section — exactly the text a reviewing statistician wants to check — and nothing quotes it. (The existing demo study graphs embed section numbers informally in estimand labels, as strings.)
- Instances: 0 of 96. The section reference lives untyped inside the instance label (
"… (SAP 15.10.3)"), so tooling has to regex it out.
- Trace templates anchor to datasets/variables — a different axis, by design; no issue there.
Root cause
sapRef is a property of the concept entity, when document grounding is really a property of the study-side use. The boundary is right in principle — library entities (methods, output classes, templates) are study-agnostic and must not carry study text (acdc_method.yaml: "Methods MUST NOT reference clinical or analysis concepts") — but the anchor field was attached to one entity class on the study side rather than to the use itself.
Evidence the gap forces bad workarounds: the encoding exercise ended up smuggling the SAP's model-choice sentence into the proposed method's description field — study text inside a library entity, the wrong side of the very wall the model draws — because the quote had nowhere typed to go.
Requirement (in the spirit of the parent issue: requirement, not solution)
Every assertion the generated prose makes about the study — the choice of method, a configuration value, a summary measure, a fixed methodological qualifier, an estimand's scope — should be traceable to the document text that grounds it, with the same fidelity sapRef already gives concepts. The traceability-to-data claim (#9 claim 2) has a missing twin: traceability to the source document.
Candidate direction (design input to weigh, not a constraint)
One change appears to close the whole class without touching the library wall: allow sapRef on the phrase instance (the {phrase, bindings} object in the study graph — already study-side). That covers method, value, output and fixed-text uses uniformly, and lets a concept-bound use carry a use-specific quote where the concept's own quote is too generic. Two smaller companions:
sapRef on estimands (study entities, same footing as concepts);
- a typed
sectionRef on instances, replacing the label-embedded "(SAP n.n)" convention.
Precedence when both exist (instance-level vs concept-level sapRef) is a design decision to record at that point.
Parent: #9
Finding
Document anchoring in the smartphrase layer is carried by a single field —
sapRefon study-graph concepts — and concepts are only one of the four binding kinds a phrase instance can use. Everything the prose asserts that does not route through a concept binding has no typed path back to the SAP text that grounds it.This surfaced in a full-study encoding exercise against the
methods_02artefacts (Transformation Library v0.7, Method schema v0.9.1): a 2×2 crossover SAP encoded end-to-end as 96 phrase-template instances (85 analyses + 11 derivations), with a viewer that highlights each instance'ssapRefquotes in the source document. Method phrases visibly never highlighted anything; a systematic audit showed the method case is just the most visible member of a class.Audit (all 96 instances)
1. Bindings by kind — three of four have no document path
conceptsapRefmethodoutputvalue2. Fixed-text phrases — no bindings, so nothing to anchor through. Seven phrases, 156 uses, whose entire text is a claim about what the SAP says (e.g.
"adjusting for period","with a random participant effect","with follow-up time as an offset"). Each mirrors a specific SAP sentence; none can cite it.Together: 404 of ~800 phrase uses — about half the smartphrase spans in any generated sentence — have no corresponding anchor in the source document.
3. Entity classes beyond phrases
sapRef. Their ranks and ICE scopes are encoded straight from the SAP's estimands section — exactly the text a reviewing statistician wants to check — and nothing quotes it. (The existing demo study graphs embed section numbers informally in estimand labels, as strings.)"… (SAP 15.10.3)"), so tooling has to regex it out.Root cause
sapRefis a property of the concept entity, when document grounding is really a property of the study-side use. The boundary is right in principle — library entities (methods, output classes, templates) are study-agnostic and must not carry study text (acdc_method.yaml: "Methods MUST NOT reference clinical or analysis concepts") — but the anchor field was attached to one entity class on the study side rather than to the use itself.Evidence the gap forces bad workarounds: the encoding exercise ended up smuggling the SAP's model-choice sentence into the proposed method's
descriptionfield — study text inside a library entity, the wrong side of the very wall the model draws — because the quote had nowhere typed to go.Requirement (in the spirit of the parent issue: requirement, not solution)
Candidate direction (design input to weigh, not a constraint)
One change appears to close the whole class without touching the library wall: allow
sapRefon the phrase instance (the{phrase, bindings}object in the study graph — already study-side). That coversmethod,value,outputand fixed-text uses uniformly, and lets a concept-bound use carry a use-specific quote where the concept's own quote is too generic. Two smaller companions:sapRefon estimands (study entities, same footing as concepts);sectionRefon instances, replacing the label-embedded"(SAP n.n)"convention.Precedence when both exist (instance-level vs concept-level
sapRef) is a design decision to record at that point.