Technical Showcase · How the AI reads time
A full walkthrough of deterministic date hints, routed LLM extraction, legal deadline detection, live SSE updates, and DOCX/ICS export.
Architecture
Timeline first gathers deterministic date hints, sends the document through one routed structured extraction flow, then PHP filters, scores, computes deadlines, and prepares exports.
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.yyyy → YYYY-MM-DDNormalised anchors are added to the extraction prompt to reduce hallucinated or misread dates. They are hints, not a separate AI result.
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 unresolvabledate_type — absolute | relative | recurring | conditional | periodconfidence — high | medium | lowactor — attributed entity (from source text, not inferred)description — one-sentence event summarysource_excerpt — verbatim text fragment (max 200 chars)is_deadline / deadline_kind — explicit legal deadline markers when presentThe 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.
PHP applies all active filters and derived deadline logic before returning the result:
The post-processor then builds deadlines[], the what_remains_uncertain list, and the next_practical_step recommendation.
Date recognition
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
| 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 | 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 |
| 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
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
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.
Privacy & security
Privacy by design
nova-lite through LiteLLM; Standard and Deep use Amazon Bedrock EU when enabled, with the existing routed cloud fallback if Bedrock is disabled.Available to Do Better Norge members with transparent routing, credit estimates, and process-and-forget handling.