Unified Table Validation#

Source: examples/unified_table_validation.py

Introduction#

Show how lightly structured transcript rows can be normalized into the unified table contract with deterministic mapper functions.

Technical Implementation#

  1. Start from rows with speaker instead of canonical actor fields.

  2. Derive actor_id and event_type using mapper callbacks.

  3. Validate the resulting rows against the unified-table contract.

 1from __future__ import annotations
 2
 3import design_research_analysis as dran
 4
 5
 6def main() -> None:
 7    """Run a simple table validation workflow."""
 8    rows = [
 9        {
10            "timestamp": "2026-01-01T10:00:00Z",
11            "text": "we should decompose the mechanism",
12            "speaker": "alice",
13        },
14        {
15            "timestamp": "2026-01-01T10:00:01Z",
16            "text": "let's test that with a quick mock",
17            "speaker": "bob",
18        },
19    ]
20
21    rows = dran.derive_columns(
22        rows,
23        actor_mapper=lambda row: row["speaker"],
24        event_mapper=lambda _row: "utterance",
25    )
26    report = dran.validate_unified_table(rows)
27    print(report.to_dict())
28
29
30if __name__ == "__main__":
31    main()

Expected Results#

Run Command

PYTHONPATH=src python examples/unified_table_validation.py

Prints a validation report dictionary with required/recommended field checks and warnings for missing recommended columns.

References#

  • docs/unified_table_schema.rst