DEV Community

Cover image for How We Built an AI-Powered Legal Timeline Generator
Alex for Momen

Posted on

How We Built an AI-Powered Legal Timeline Generator

TL;DR: At Hack the Law Cambridge, we built an AI-powered Event Timeline Generator using Momen, ChatGPT-4o, and Gemini 2.5—no code required. It extracts events from legal text, detects conflicts between witness statements, and visualizes everything in a timeline. This post breaks down the full architecture so you can reverse engineer it yourself.


⚖️ The Legal Pain Point: Reconstructing Timelines from Testimonies

Litigation teams often spend hours parsing through witness statements, deposition transcripts, and contradictory accounts to rebuild a factual timeline. It's manual, high-stakes, and prone to human error.

So we asked: Can we automate this?


🛠️ The Tool: AI-Powered Timeline Generator (Demo App)

We built this app for:

  • 🧑‍⚖️ Litigation associates
  • 🧑‍💼 Paralegals
  • 🧑‍💻 Legal tech teams

Core Features:

  • Upload or paste raw text (statements or transcripts)
  • AI extracts events and timestamps
  • AI detects and highlights contradictions
  • Interactive timeline view with source quotes
  • Structured database for case history

🚫 Why Not Just Use ChatGPT?

Sure, you can paste text into ChatGPT—but legal workflows need:

  • Structure
  • Repeatability
  • Traceability
  • Collaboration

That’s why we used Momen, a no-code platform where you can build full-stack apps with backend logic, UI, databases, and AI agents.


⚙️ How It Works (Full Stack Breakdown)

🧩 Database Schema

We created 6 interrelated tables:

  • Statement
  • Timeline_event
  • Conflict
  • Event_evidence
  • Event_in_conflict
  • Analysis (parent record for each case)

🧠 Two AI Agents:

  1. timeline_extractor (ChatGPT-4o)

    → Parses each statement, extracts events, timestamps, witnesses

  2. conflict_detector (Gemini 2.5)

    → Compares statements and flags conflicting events


🔁 Actionflows = No-Code Backend Logic

process_statements

  • Triggered when user clicks “Generate Timeline”
  • Creates an analysis_id
  • Saves input statements
  • Calls insert_events for each statement

insert_events

  • Calls timeline_extractor
  • Saves structured events to timeline_event table

insert_conflicts

  • Triggered when user clicks “Detect Conflicts”
  • Calls conflict_detector
  • Stores results in Conflict and Event_in_conflict tables

🖼️ Frontend (Also No Code)

Built using Momen’s visual UI components:

  • Text inputs for witness statements
  • Button to trigger timeline generation
  • Interactive timeline list view (subscribed to timeline_event)
  • Sidebar to show conflict details

💡 Conflicting events show in red, with side-by-side quote comparison.


🚀 Timeline: Built in 2 Days

Even under hackathon time pressure, the app:

  • Parsed multi-page legal text
  • Built a timeline in under 30 seconds
  • Flagged conflicts with full traceability

📉 Total cost? ~$99 (includes both LLM agents + infra).


🔍 Want to Reverse Engineer It?

You can explore the full setup—database, agents, and Actionflows—here:

👉 Reverse engineer the full Momen build (view-only link)

Yes, you can view every detail of how it works.

For a more detailed breakdown, check it here


🧭 What’s Next?

Because it’s built with Gemini 2.5 (multi-modal), future versions could:

  • Analyze deposition videos or CCTV
  • Merge transcripts + video into one timeline
  • Integrate with document management systems

Drop questions or ideas in the comments!

Top comments (0)