Overview
Theschemas module defines all data structures used in Timepoint Pro. Built on SQLModel (Pydantic + SQLAlchemy), these schemas serve as:
- ORM models (database tables)
- Validation schemas (type checking)
- API specs (FastAPI endpoints)
schemas.py
Enums
ResolutionLevel
Entity resolution levels for heterogeneous fidelity (M1). Values:TemporalMode
Different causal regimes for temporal reasoning (M17). Values:FidelityPlanningMode
How fidelity is allocated across timepoints. Values:TokenBudgetMode
How token budget is enforced. Values:Core Entities
Entity
Core entity model with resolution levels and metadata. Schema:human: Human entitiesanimal: Animals (M16)building: Buildings (M16)object: Objectsabstract: Concepts (M16)
Timepoint
Temporal event with causal chain. Schema:ExposureEvent
Knowledge exposure tracking (M3). Schema:witnessed: Directly observedlearned: Taught or studiedtold: Communicated by another entityexperienced: Personally experiencedinitial: Starting knowledge (from scene specification)
Tensors
TTMTensor
Timepoint Tensor Model - context, biology, behavior. Schema:PhysicalTensor
Physical state - age, health, pain, mobility. Schema:CognitiveTensor
Cognitive state - knowledge, emotions, energy. Schema:Dialog
DialogTurn
Single turn in a dialog conversation. Schema:DialogData
Structured dialog with metadata. Schema:Dialog (Database)
Persisted dialog conversation. Schema:Relationships
RelationshipMetrics
Quantified relationship metrics. Schema:RelationshipTrajectory
Relationship evolution over time (M13). Schema:Prospection (M15)
Expectation
Entity’s expectation about future event. Schema:ProspectiveState
Entity’s forecasts and expectations. Schema:Timelines (M12)
Timeline
Timeline with branching support. Schema:Intervention
Counterfactual modification. Schema:BranchComparison
Timeline comparison results. Schema:Animistic Entities (M16)
AnimalEntity
Schema:BuildingEntity
Schema:AbstractEntity
Schema:Scene Entities (M10)
EnvironmentEntity
Schema:AtmosphereEntity
Schema:CrowdEntity
Schema:Convergence
ConvergenceSet
Cross-run causal graph comparison. Schema:LLM Schemas
EntityPopulation
LLM response for entity population. Schema:ValidationResult
LLM validation response. Schema:Best Practices
- Use type hints for all fields
- Provide defaults for optional fields
- Use Field() for constraints and metadata
- Index foreign keys for performance
- Use JSON columns for flexible metadata
- Validate with Pydantic before database insertion
- Use enums for constrained string values
- Track run_id for convergence analysis
- Set created_at/updated_at for temporal tracking
- Use SQLModel properties for computed fields
Related
- Storage - Database operations
- LLM Client - LLM integration
- Orchestrator - Scene compilation
- Workflows - Entity training

