On this page
- Projects, Identifiers & Document Limits
- Sheet Sections & Sheet Families
- — Sheet Families (family_anchor_sheet_id)
- Reactive DAG & Recalculation Lifecycle
- Non-Destructive Cell Exclusions & Provenance
- Session Undo/Redo & Named Checkpoints
- — Bounded Session Undo/Redo
- — Named In-File Checkpoints (NamedCheckpoint)
- Number Formatting & P-Value Conventions
- Persisted Analysis Settings (AnalysisSpec)
Concepts & Document Architecture
CurveBook stores an entire statistical and graphing study inside a single deterministic project (ProjectDocument) organized into five typed workspace sections, connected by a reactive directed acyclic graph (DAG), and protected by non-destructive cell exclusions, bounded session undo/redo, and explicit schema versioning.
Projects, Identifiers & Document Limits
A ProjectDocument pairs a project title, persistent analysis/workspace metadata, optional checkpoints, and an ordered collection of typed sheets. All structural sizes obey explicit upper bounds enforced during editing and archive validation:
| Limit Constant | Value | Scope |
|---|---|---|
CURRENT_SCHEMA_VERSION | 7 | Active project document JSON schema version |
MAX_SHEETS_PER_PROJECT | 500 | Maximum sheets across all five navigator sections in one project |
MAX_ROWS | 1,000,000 | Maximum rows per individual data table |
MAX_DATA_SETS | 1,024 | Maximum dataset/group/variable columns per data table |
MAX_SUBCOLUMNS | 512 | Maximum replicate subcolumns per dataset (RawReplicates(n)) |
MAX_SHEET_CELLS | 30,000,000 | Maximum total dense cells (rows * cols * subcols) in one table |
MAX_PROJECT_CELLS | 50,000,000 | Maximum total cells across all data sheets in one project |
MAX_TITLE_BYTES | 4,096 | Maximum UTF-8 byte length for project or sheet titles |
MAX_SHEET_ID_BYTES | 256 | Maximum UTF-8 byte length for a SheetId |
MAX_CHECKPOINTS_PER_PROJECT | 32 (creation) / 64 (archive ceiling) | project.createCheckpoint allows up to 32 per project; archive/loader validation accepts up to 64 |
Every sheet carries a stable, non-whitespace SheetId (distinct across the project) and a mutable display title.
Sheet Sections & Sheet Families
CurveBook organizes sheets into five canonical SheetSection navigator folders:
| Section | Sheet Type | Role in the Workspace |
|---|---|---|
| Data | DataSheet | Typed data grid holding one of the eight table archetypes, row titles, excluded-cell masks, exclusion provenance notes, calculated-variable formulas, and linked data regions. |
| Info | InfoSheet | Free-form notes plus typed key/value experiment constants (Text, Number, Boolean), including standard metadata keys (ExperimentDate, Experimenter, Protocol, ProjectCode, NotebookId, LotNumber, Instrument, Notes). Can be linked upstream via HookSource parameters. |
| Analyses | ResultSheet | Multi-tab statistical, transform, simulation, or curve-fitting output derived from an upstream DataSheet (or analyzable upstream ResultSheet), accompanied by diagnostic checklists (QOL-7), hookable scalars, curve overlays, and optional floating_notes. |
| Graphs | GraphSheet | Publication graph specification (GraphSpec) referencing one or more upstream DataSheets and optional ResultSheet overlays (fitted curves, comparison brackets, compact letter display, live TeX equation boxes). |
| Layouts | LayoutSheet | Multi-panel physical page composition (LayoutSpec, up to 64 LayoutItem panels) arranging GraphSheets, live ResultSheet tables, embedded raster images, and supporting text/badges with physical paper sizes and journal column-width presets. |
Sheet Families (family_anchor_sheet_id)
Each sheet tracks its lineage to a root DataSheet via family_anchor_sheet_id, allowing downstream ResultSheets, derived DataSheets (from transforms), GraphSheets, and LayoutSheets to be inspected together or cloned coherently via sheet.duplicateFamily and sheet.clonePipeline (see Command Reference).
Reactive DAG & Recalculation Lifecycle
Dependencies between sheets form a strict directed acyclic graph (DAG) evaluated by curvebook-engine (crates/engine/src/dag.rs):
InfoSheet (HookSource constants) ──┐
DataSheet (raw observations) ├──► Formula (= Calculated Variables)
├──► LinkedDataRegion (paste / transform links)
├──► ResultSheet (Transform / Stats / Fit) ──► HookSource scalars
└──► GraphSheet (series + fit overlays + CLD/TeX) ──► LayoutSheet
- Cycle detection: Formula circularity, linked-region loops (
detect_link_cycles), and cyclicHookSourceparameter bindings are rejected withErrorCode::CycleDetectedbefore committing edits or running recalculation. - Dirty propagation & topological order: Editing a cell, toggling an exclusion, updating an
InfoSheetconstant, or modifying anAnalysisSpecmarks downstream dependents dirty and recalculates them in deterministic topological order (project.recalculate). - Freezing (
sheet.freeze/sheet.unfreeze): Setsfrozen: boolon a sheet (DataSheet,ResultSheet,GraphSheet,LayoutSheet). A frozenDataSheet(frozen: true) rejects direct mutations withErrorCode::FrozenSheet; a frozenResultSheetretains its snapshot instead of recomputing when upstream data change. ResultStatuslifecycle: EveryResultSheetreports one of three statuses:Dirty: Upstream inputs orAnalysisSpecparameters changed and recalculation is pending.UpToDate: Computed tabs, scalars, pairwise comparisons, fitted curves, and checklist reflect current upstream inputs without error.Failed { code, message }: Most recent recalculation could not succeed for current inputs (e.g., all rows excluded or singular model);lookup_scalarreturnsNonewhile failed so invalid results never propagate through hooks. When valid upstream data are restored, recalculation resumesUpToDateresults automatically.
Non-Destructive Cell Exclusions & Provenance
Every numeric or text cell stores excluded: bool independently of value: CellValue. Marking a cell excluded:
- Preserves the underlying raw numeric or text value in memory,
.curvebookarchives, and.curvebook.d/sheet CSVs (written with a leading*prefix such as*12.4whenparse_asterisk_exclusionsis active). - Excludes the observation from descriptive summaries, statistical tests, curve fits, transforms, and plotted points/error bars, and omits it from selection Quick Statistics.
- Propagates as missing in
=Calculated Variables. - Supports optional structured provenance tags via
DataSheet::exclusion_notes: Vec<CellExclusionNote>(QOL-3), storing(coord, reason_tag, note, timestamp_utc)(table.excludeCellsWithReasonandtable.exclusionAuditReport) for reproducible audit trails without touching hot numerical loops.
Session Undo/Redo & Named Checkpoints
Bounded Session Undo/Redo
Every mutating engine command executes inside Session (crates/engine/src/lib.rs) as an atomic undoable step (edit.undo, edit.redo), subject to three simultaneous memory-safety caps:
| Undo Bound | Value | Purpose |
|---|---|---|
MAX_UNDO_ENTRIES | 64 | Maximum undo steps retained in memory per open session |
MAX_UNDO_CELL_BUDGET | 25,000,000 | Cumulative table cell count cap across retained undo snapshots |
MAX_UNDO_CHECKPOINT_BYTES_BUDGET | 16,777,216 (16 MiB) | Byte budget for full serialized snapshots in the undo stack |
Undo/redo history lives only in the active session and is intentionally not written inside .curvebook archives. Crash resilience between saves is handled separately by the WAL CrashRecoveryJournal.
Named In-File Checkpoints (NamedCheckpoint)
For persistent milestone snapshots across sessions, ProjectDocument supports named in-file checkpoints (project.createCheckpoint, project.listCheckpoints, project.restoreCheckpoint, project.deleteCheckpoint, up to 32 created per project via project.createCheckpoint, with crates/format permitting up to 64 on archive validation). Each NamedCheckpoint stores an id, human-readable name, optional note, UTC timestamp, and a complete validated JSON snapshot of the project at creation time (subject to MAX_ARCHIVE_FILE_BYTES = 128 MiB on restore). Restoring a checkpoint creates a single undoable action in the live session.
Number Formatting & P-Value Conventions
- Data & Tick Formatting (
LocaleNumberPolicy,AxisTickFormat,TickLabelFormat): Graphs and tables separate stored IEEE-754f64precision from display formatting.LocaleNumberPolicycontrols decimal separators (.vs,) and thousands grouping, while numeric axis ticks (AxisTickFormat) supportDecimal,PowerOfTenSuperscript,ScientificE,Antilog, andEngineeringSi(withTickLabelFormataddingCategorical(CategoricalTickSource)) without rounding underlying computed data. - P-Value Display (
PValueFormat): Stored perAnalysisSpec(curvebook-math):- Exact numeric formats:
FourDecimal(default, floor< 0.0001, up to****),Apa(.123, floor< .001, up to***),Nejm(0.123, floor< 0.001, up to***), andCustom { decimals, scientific_below }(decimalsin1..=15with optional positive scientific-notation cutoff). - Formatting affects presentation only; multiplicity procedures and hypothesis decisions operate on full unrounded IEEE-754 probabilities.
- Exact numeric formats:
Persisted Analysis Settings (AnalysisSpec)
Every ResultSheet embeds the complete AnalysisSpec that generated it, recording:
id,title, andsource_sheet_idkind: AnalysisKindand its method-specific option struct (test selection, tails, pairing, sphericity/REML df method, multiplicity procedure, weighting scheme, fit method, parameter rules, or power targets)selected_data_sets: Vec<usize>(empty selects all compatible columns/datasets)confidence_level: ConfidenceLevel(continuous percentage(0, 100), defaulting to95%)p_value_format: PValueFormat
Because AnalysisSpec travels inside both .curvebook / .curvebook.d/ projects and .cbtemplate reusable templates, re-running (analysis.run), modifying parameters (analysis.updateParams), or retargeting to new experimental data (analysis.retargetData) preserves every statistical choice deterministically. See Command Reference, Automation: MCP, and Automation: CLI for programmatic parameter schemas.