import { ValueTypeOf, option } from '@elaraai/east'; import { Experiment } from '@elaraai/e3-ui/internal'; import { HelpId } from './help.js'; /** The complete, honest experiment result. */ export type ResultValue = ValueTypeOf; /** The staged experiment config. */ export type ConfigValue = ValueTypeOf; /** A named configuration — a vetted question + scope + optional precomputed answer. */ export type ConfigurationValue = ValueTypeOf; /** A confidence interval. */ export type Ci = ValueTypeOf; /** The adjusted (like-for-like) effect + CI. */ export type AdjustedValue = ValueTypeOf; /** One confounder's before-adjustment imbalance. */ export type BalanceValue = ValueTypeOf; /** The propensity-overlap diagnostic. */ export type OverlapValue = ValueTypeOf; /** The robustness summary. */ export type RefutationValue = ValueTypeOf; /** The unobserved-confounder sensitivity (tipping) curve. */ export type SensitivityValue = ValueTypeOf; /** The ALE dose-response curve. */ export type DoseValue = ValueTypeOf; /** The honesty verdict — only `not_estimable` carries a reason. */ export type VerdictValue = ValueTypeOf; export type VerdictTag = VerdictValue['type']; /** A committed journal row. */ export type JournalRowValue = ValueTypeOf[number]; /** Optional per-column display metadata, keyed by column name. */ export type ColMeta = ValueTypeOf; /** A column the surface can frame over — name + coarse type family. */ export interface Column { name: string; kind: 'boolean' | 'integer' | 'float' | 'string' | 'datetime' | 'other'; } export interface VMVerdict { tag: VerdictTag; tone: string; label: string; } export interface VMConfounder { col: string; reason: string; imbalance: number; level: string; tone: string; } export interface VMSpec { treatment: string; treatmentKind: string; outcome: string; outcomeKind: string; comparison: string; confounders: VMConfounder[]; suggestion: string; method: string; target: string; dataLabel: string; } export interface VMBalance { col: string; treated: number; control: number; display: string; frac: number; tone: string; } export interface VMAnswer { treatment: string; outcome: string; unit: string; naive: number; naiveLo: number; naiveHi: number; effect: number; lo: number; hi: number; clear: boolean; flip: boolean; cautious: boolean; nTotal: bigint; nTreated: bigint; nControl: bigint; nCompared: bigint; nDropped: bigint; balance: VMBalance[]; } /** A refusal zone (the engine returned `adjusted = none`). */ export interface VMRefusal { kind: 'positivity' | 'not_estimable'; title: string; body: string; evidence: { label: string; value: string; }[]; } /** The propensity-overlap diagnostic (always derivable; the centrepiece of a * positivity refusal, a small diagnostic card otherwise). */ export interface VMOverlap { treated: number[]; control: number[]; commonSupportFrac: number; positivityOk: boolean; supportLabel: string; } export interface VMRefuteCheck { name: string; desc: string; value: string; passed: boolean; tip: option; help: HelpId; } export interface VMRefute { checks: VMRefuteCheck[]; sens: VMSensitivity | null; } export interface VMSensitivity { lo: number[]; mid: number[]; hi: number[]; xTicks: string[]; yTicks: string[]; } export interface VMDoseMark { at: number; label: string; tone: string; help: HelpId; } export interface VMMarginal { label: string; value: number; frac: number; } export interface VMDose { feature: string; outcome: string; lo: number[]; mid: number[]; hi: number[]; xTicks: string[]; yTicks: string[]; marks: VMDoseMark[]; recoLabel: string; recoEffect: number; recoLo: number; recoHi: number; tradeoff: string; marginal: VMMarginal[]; } export interface VMJournalRow { treatment: string; outcome: string; confounders: string; effect: string; verdict: string; verdictTone: string; who: string; when: string; preset: option; } declare const fmt: (x: number) => string; declare const signed: (x: number) => string; declare const cap: (s: string) => string; declare const unitOf: (meta: ColMeta | undefined, col: string) => string; export interface ExperimentView { spec: VMSpec; verdict: VMVerdict | null; answer: VMAnswer | null; refusal: VMRefusal | null; overlap: VMOverlap | null; refute: VMRefute | null; dose: VMDose | null; journal: VMJournalRow[] | null; } /** * Derive the full view-model from the staged config, the bound data's columns * and the (possibly absent) single experiment result. * * @param config - The staged {@link ConfigValue}. * @param ranConfig - The config that produced `result` (the result deck reads this so its * strings never drift ahead of the numbers on a live edit before the next Run). * @param cols - The bound dataset's columns (name + type family). * @param result - The experiment result, or `null` until the first Run settles. * @param journal - Committed rows, or `null`. * @param meta - Optional per-column display metadata. * @param dataLen - Row count of the bound dataset (for the header label). * @param now - "Now" for relative journal timestamps (injected for determinism). */ export declare function deriveView(config: ConfigValue, ranConfig: ConfigValue, cols: Column[], result: ResultValue | null, journal: JournalRowValue[] | null, meta: ColMeta | undefined, dataLen: number, now: Date): ExperimentView; /** Decoded `ExperimentDesignType` (the `design` function's result). */ export type DesignValue = ValueTypeOf; export interface VMDesignOption { label: string; nTotal: number; nTreated: number; nControl: number; treatedShare: number; } export interface VMDesignMatch { col: string; frac: number; tone: string; display: string; } export interface VMDesign { /** Verdict-framed eyebrow headline. */ headline: string; rationale: string; /** The recommended (first) option — the KPI + split meter read from this. */ primary: VMDesignOption; /** Alternate split options (rows under the primary). */ alternates: VMDesignOption[]; /** Categories to match the arms on, with imbalance bar widths from the result. */ matchOn: VMDesignMatch[]; /** Power curve: total-N → chance of detecting (0..100), with target + "you're here". */ curve: { mid: number[]; xTicks: string[]; marks: VMDoseMark[]; }; /** Signed target effect with unit, e.g. "+5.2 MPa". */ targetLabel: string; targetPctLabel: string; /** create_control → frame the split as a hold-back; no current-power marker. */ holdback: boolean; /** non_identifiable_positivity → point at the overlap chart. */ showOverlap: boolean; /** Effect too faint to size sanely — the head-count is a capped sentinel. */ faint: boolean; } /** Design value → the "Validate" tab view-model (numbers → recipe + chart). */ export declare function deriveDesign(d: DesignValue, result: ResultValue | null, ranConfig: ConfigValue, meta: ColMeta | undefined): VMDesign; export { fmt, signed, cap, unitOf }; //# sourceMappingURL=derive.d.ts.map