Timeline visualisation for CSV data and Prometheus test files
Project description
timelineviz
Timeline visualisation for CSV data and Prometheus test files.
Features
- Plot event timelines from CSV / DataFrame timestamp data
- Long-format logs — one timestamp column across many rows, with optional filters on level / event type (incident-style timelines)
- Handle time gaps with broken timeline display
- Auto-detect timestamp columns based on naming patterns
- Visualise Prometheus
promtoolunit-test files — series values, eval checkpoints, and alert checks on a relative time axis - Customisable colour schemes
- CLI and Python API
- Optional next step: use saved PNGs (plus your CSV or milestone list) as input to multimodal / image-generation LLMs to produce executive-style infographics — see below
Installation
pip install timelineviz
# or with uv
uv add timelineviz
For development:
git clone https://github.com/garrywilliams/timeline_viz.git
cd timeline_viz
make install
# or: uv pip install -e ".[dev]"
Run make or make help for tests, builds, and other tasks. Details: DEVELOPING.md.
Quick Start
CSV / DataFrame Timelines
# Auto-detect timestamp columns
timelineviz data.csv --detect-timestamps --output-dir timelines
# Specify columns explicitly
timelineviz data.csv --timestamp-columns created_at updated_at completed_at
from timelineviz import plot_timeline, plot_multiple_timelines
import pandas as pd
df = pd.read_csv("data.csv")
# Single entity
plot_timeline(df.iloc[0],
timestamp_columns=['created_at', 'updated_at', 'completed_at'],
entity_id="12345")
# Multiple entities
plot_multiple_timelines("data.csv",
timestamp_columns=['created_at', 'updated_at'],
id_column='entity_id',
output_dir="timeline_images")
Event log (long format)
Use this when each row is one event and times live in a single column (typical logs). Optionally keep or drop rows using another column (for example level or event_type) so you can focus on an incident and ignore noise.
timelineviz examples/incident_log.csv --event-log --log-time-column ts \
--log-label-column message --log-filter-column level \
--log-include ERROR WARN --output-dir timelines --no-show
from timelineviz import plot_event_log_timeline
plot_event_log_timeline(
"incident.csv",
timestamp_column="ts",
label_column="message",
filter_column="level",
include_values=["ERROR", "WARN"],
output_file="incident_timeline.png",
show_plot=False,
)
A small sample file is in examples/incident_log.csv.
The diagram below is from that sample, using the CLI flags above (ERROR and WARN rows only, message as the label):
Prometheus Test Timelines
Visualise promtool unit-test YAML files — see series values change over time, where evaluations happen, and when alerts fire.
timelineviz my_rules_test.yml --promtest
timelineviz my_rules_test.yml --promtest --output-dir images --no-show
from timelineviz import parse_promtest_file, plot_promtest
groups = parse_promtest_file("my_rules_test.yml")
plot_promtest(groups, output_file="promtest_timeline.png")
Charts are self-documenting — each subplot shows the metric name and raw notation, value labels appear at transition points, eval/alert vertical lines are labelled, and a legend strip at the bottom explains all marker types.
Full guide: PROMTEST.md — notation reference, worked examples, and all parameters.
How It Works
CSV Timelines
Wide format (default): each entity is a row; timestamps live in separate columns (for example created_at, updated_at). Those columns become labelled points on one timeline per entity.
Long format (plot_event_log_timeline / --event-log): many rows share one timestamp column; each row is one point. Filters apply before plotting.
In both cases, when time gaps exceed a threshold, the timeline is broken into segments with slash markers indicating the breaks.
Promtest Timelines
Prometheus test files define metric series as values over discrete time steps (e.g. one value per minute). The library:
- Parses the YAML and expands the compact notation (
1+2x5→1, 3, 5, 7, 9, 11) - Plots each
input_seriesas a step chart on its own subplot - Draws vertical markers at
eval_timecheckpoints - Shows alert check points with firing/pending status
- Labels the x-axis with relative time offsets (
0s,1m,2m, …)
Optional break_gap_minutes / CLI --promtest-break-gap: when gaps between anchors (0, series end, each eval/alert time) exceed that many minutes, the chart splits into multiple horizontal panels with slash markers—same idea as CSV threshold_days breaks. See PROMTEST.md and examples/promtest_time_breaks.yml.
From chart output to executive infographics
timelineviz is built for faithful, technical timelines (PNG from the CLI or output_file= in Python). For stakeholder decks, board summaries, or comms, you can treat that output as source material for a second step: a multimodal or image-focused LLM (any tool that accepts an image plus a long text brief—e.g. Nano Banana or similar) together with:
- The exported PNG (or a screenshot of the figure)
- Your structured facts: ordered milestones, dates, short business descriptions, KPIs, risks, and the story you want told
- A detailed creative prompt (audience, tone, layout, colour rules, and what not to invent)
The model can redesign the information as an infographic while you verify dates, labels, and numbers against your data. The sample below is an illustrative executive layout (sample healthcare journey) produced from that kind of workflow—not something timelineviz renders by itself.
Example only: narrative layout, icons, and insight rail were generated for communication design; always validate facts against your source CSV and plots.
API Reference
CSV Mode
| Parameter | Description |
|---|---|
timestamp_columns |
Columns containing timestamp data to visualise |
id_column |
Column that uniquely identifies each entity |
threshold_days |
Time gap (in days) that triggers a timeline break |
entity_name |
Type name for titles (e.g. "Patient", "Order") |
label_mappings |
Custom display names for timestamp columns |
color_scheme |
Dictionary of colour overrides |
Promtest Mode
| Parameter | Description |
|---|---|
figsize |
Figure dimensions (width, height) in inches |
title |
Custom figure title |
color_scheme |
Override colours (see PROMTEST.md) |
output_file |
Save to PNG |
dpi |
Resolution (default 150) |
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timelineviz-0.3.0.tar.gz.
File metadata
- Download URL: timelineviz-0.3.0.tar.gz
- Upload date:
- Size: 825.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dfc135dea9ab64a2b10e8c493a15d18119ba6e089537472c7e3722a5ee6c30e
|
|
| MD5 |
20e8a3b1ad121252389a9d52867221bc
|
|
| BLAKE2b-256 |
224f9c39ddfc1d246b4a0ba14b28c5795ce16f06f6df95a460aa93540ac251bc
|
File details
Details for the file timelineviz-0.3.0-py3-none-any.whl.
File metadata
- Download URL: timelineviz-0.3.0-py3-none-any.whl
- Upload date:
- Size: 45.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc28d481c6f0f01a879c1e78c5ec037ff08353fc33dc0953f1c0b891201870b
|
|
| MD5 |
3279b90bd3b985fd913e70c421dee8c6
|
|
| BLAKE2b-256 |
77cc15e2987fe2f2a6fb31e3c5e414480933835f20dde0cef0261fa61da82ffb
|