Legal Tools
Sign in

Technical Showcase · How the AI reads time

How Timeline knows when things happened.

A full walkthrough of deterministic date hints, routed LLM extraction, legal deadline detection, live SSE updates, and DOCX/ICS export.

12+ date formats
5 event types
3 flow stages
3 engine routes

Architecture

One extraction flow. Three transparent stages.

Timeline first gathers deterministic date hints, sends the document through one routed structured extraction flow, then PHP filters, scores, computes deadlines, and prepares exports.

Step 1 · PHP / regex

Detect date hints before the model

Before any model call, PHP scans the full input for dates matching 12+ Norwegian formats and normalises them to ISO 8601 where possible:

  • dd.mm.yyyyYYYY-MM-DD
  • d. månedsnavn yyyy → resolved calendar date
  • Diary-format lines (starting with a date + colon) → auto-tagged as events
  • Two-digit years → always interpreted as 20YY

Normalised anchors are added to the extraction prompt to reduce hallucinated or misread dates. They are hints, not a separate AI result.

Step 2 · routed LLM extraction

Route, extract & classify

The selected route reads the document alongside the date hints. For every temporal reference it returns a structured JSON event object with deadline fields:

  • date — resolved ISO date, or verbatim string if unresolvable
  • date_typeabsolute | relative | recurring | conditional | period
  • confidencehigh | medium | low
  • actor — attributed entity (from source text, not inferred)
  • description — one-sentence event summary
  • source_excerpt — verbatim text fragment (max 200 chars)
  • is_deadline / deadline_kind — explicit legal deadline markers when present

The prompt explicitly instructs the model not to invent dates or actors not present in the source. Longer inputs are chunked server-side and recombined into the same schema.

Step 3 · PHP post-processor

Filter, compute deadlines & assemble

PHP applies all active filters and derived deadline logic before returning the result:

  • Focus filter — strips events not matching the requested focus mode (deadlines / hearings / CPS)
  • Confidence filter — removes LOW-confidence events if requested
  • Background filter — strips background/narrative events if unchecked
  • Date-type filter — strips relative/recurring events if unchecked

The post-processor then builds deadlines[], the what_remains_uncertain list, and the next_practical_step recommendation.

Date recognition

12+ Norwegian date formats, all recognised.

Norwegian legal documents use a wide variety of date notations. Timeline recognises these deterministically before the model sees the text, then asks the model to resolve the remaining contextual references.

Format Example Notes
dd.mm.yyyy 30.07.2015 Standard Norwegian numeric
dd.mm.yy 09.04.25 Two-digit year → always 20YY
d. månedsnavn yyyy 3. mars 2024 Written month in bokmål/nynorsk
d. månedsnavn 15. januar Year inferred by proximity scanning
yyyy-mm-dd 2024-03-12 ISO 8601
månedsnavn yyyy mars 2024 Month + year only
yyyy 2024 Year-only reference
Season + year høsten 2023 Seasonal reference → Q3/Q4
Diary-format line 18.09.2025: Møte avholdt Date + colon → auto-tagged as event
Relative reference tre uker etter vedtaket Anchored to nearest resolved event
Recurring pattern hver mandag Classified as recurring
Period / range fra mars til juni 2024 Yields start_date + end_date

Classification schema

Five event types. Three confidence levels.

date_type values

date_type Definition Example
absolute A specific, resolvable calendar date 30.07.2015 → 2015-07-30
relative A date expressed relative to another event tre uker etter vedtaket
recurring A pattern that repeats on a schedule each Monday, every 6 months
conditional A date contingent on a condition being met if no response within 14 days
period A date range or duration with start and end fra mars til juni 2024

confidence levels

confidence Meaning Visual in timeline
high Date is explicitly and unambiguously stated in the source text Green badge
medium Date is inferred, approximate, or stated with slight ambiguity Amber badge
low Date is implied, undated, or extracted from a degraded/ambiguous passage Grey badge

Actor attribution rules

Rule Example
Named entity in the same sentence “Trude [saksbehandler] ringte 14. mars” → actor: Trude
Role label without a name “Barnevernet fattet vedtak” → actor: Barnevernet
No clear attribution in sentence actor: [unattributed]
Document-level default If no per-event actor, defaults to the document sender/issuing body

Engines

Three routes, one structured output.

Quick, Standard, and Deep return the same JSON schema, so the post-processor handles them identically. Route choice affects speed, quality, credit cost, and fallback reporting only.

Engine Model Latency Best for
Quick nova-lite (self-hosted GPU via LiteLLM) ~10-25 s Fast drafts and shorter documents where speed matters most.
Standard ★ Claude Haiku 4.5 (Amazon Bedrock EU; gpt-4o-mini only if Bedrock is disabled) ~20-45 s Default route for most legal documents; balanced speed, quality, and cost.
Deep Claude Sonnet 4.6 (Amazon Bedrock EU) ~45-90 s Dense or complex cases with many actors, overlapping events, or weak source quality.

Live updates & export

See progress as it happens. Export to Word or calendar.

SSE + DOCX + ICS

SSE streaming + DOCX/ICS export

Timeline uses Server-Sent Events (SSE) to stream live status messages to the browser as extraction runs, including preparation, extraction, parsing, and final assembly.

Once extraction completes, export a formatted .docx with labelled events and source excerpts, or download an .ics calendar file for dated events and deadlines. DOCX files are assembled directly from OOXML via PHP ZipArchive.

Server-Sent Events OOXML / .docx iCalendar / .ics ZipArchive live progress Save to My Docs

Privacy & security

Your documents never leave your session.

Privacy by design

  • All uploaded files are extracted to text in memory using PHP's in-process file handlers. The raw binary is never written to disk on the server.
  • Session context (pasted text, uploaded content, extracted timeline events) is scoped to your authenticated session and discarded when the session ends.
  • Model routing is explicit: Quick uses self-hosted nova-lite through LiteLLM; Standard and Deep use Amazon Bedrock EU when enabled, with the existing routed cloud fallback if Bedrock is disabled.
  • External model calls happen only for the extraction flow. Uploaded binaries are never stored by the tools app, and extracted text is processed in-session.
  • Telemetry logged: tool name, requested/effective engine, model/deployment, focus mode, event count, deadline count, credits, and latency. No document text, case references, actor names, or extracted events are logged.

See it work on your case.

Available to Do Better Norge members with transparent routing, credit estimates, and process-and-forget handling.

Sign in to use Timeline → Register free User guide