Timepoint Data Format (TDF) is the standardized interchange format used across all Timepoint AI services. Every Clockchain node can be exported as a TDF record, enabling seamless data exchange with Flash, Pro, SNAG Bench, and Proteus.
TDF is designed for machine consumption with full temporal-spatial addressing, provenance tracking, and content-addressable deduplication.
Provenance tracks the origin and confidence of each record:
class TDFProvenance: generator: str # Service that created this record confidence: float # Quality score (0.0-1.0) run_id: str # Simulation or generation batch ID flash_id: str # Reference to Flash scene (if applicable)
def export_node_as_tdf(node_dict: dict) -> TDFRecord: """Convert a DB node dict to TDF for API export.""" record = from_clockchain(node_dict) # Map clockchain-specific fields to provenance if "source_run_id" in record.payload: run_id = record.payload.pop("source_run_id") if run_id: record.provenance.run_id = run_id record.payload.pop("tdf_hash", None) record.tdf_hash = record.compute_hash() return record
@router.post("/ingest/tdf")async def ingest_tdf( records: list[dict], gm: GraphManager = Depends(get_graph_manager),): node_count = 0 for raw in records: record = TDFRecord(**raw) node_id, attrs = tdf_to_node_attrs(record) await gm.add_node(node_id, **attrs) node_count += 1 return {"ingested_nodes": node_count}
The tdf_to_node_attrs helper (app/core/tdf_bridge.py:48) extracts the node ID and flattens the TDF record into Clockchain’s internal format:
def tdf_to_node_attrs(record: TDFRecord) -> tuple[str, dict]: """Extract node_id and flat attrs from a TDFRecord.""" attrs = dict(record.payload) # Map provenance back to clockchain columns if record.provenance.confidence is not None: attrs["confidence"] = record.provenance.confidence if record.provenance.run_id is not None: attrs["source_run_id"] = record.provenance.run_id if record.provenance.flash_id is not None: attrs["flash_timepoint_id"] = record.provenance.flash_id attrs["tdf_hash"] = record.tdf_hash attrs["created_at"] = record.timestamp.isoformat() return record.id, attrs