Skip to main content

Timeline visualisation for CSV data and Prometheus test files

Project description

timelineviz

PyPI version Python License: MIT

Timeline visualisation for CSV data and Prometheus test files.

Example Timeline

Features

  • Plot event timelines from CSV / DataFrame timestamp data
  • Handle time gaps with broken timeline display
  • Auto-detect timestamp columns based on naming patterns
  • Visualise Prometheus promtool unit-test files — series values, eval checkpoints, and alert checks on a relative time axis
  • Customisable colour schemes
  • CLI and Python API

Installation

pip install timelineviz

# or with uv
uv add timelineviz

For development:

git clone https://github.com/garrywilliams/timeline_viz.git
cd timeline_viz
uv pip install -e ".[dev]"

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")

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")

Promtest Example

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

Timestamps are plotted as labelled points along a horizontal axis. 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:

  1. Parses the YAML and expands the compact notation (1+2x51, 3, 5, 7, 9, 11)
  2. Plots each input_series as a step chart on its own subplot
  3. Draws vertical markers at eval_time checkpoints
  4. Shows alert check points with firing/pending status
  5. Labels the x-axis with relative time offsets (0s, 1m, 2m, …)

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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timelineviz-0.1.0.tar.gz (241.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timelineviz-0.1.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file timelineviz-0.1.0.tar.gz.

File metadata

  • Download URL: timelineviz-0.1.0.tar.gz
  • Upload date:
  • Size: 241.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for timelineviz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4272277d957b78ce348108206d47ca576a0fd50c2ba0abc272dd1891b70957e1
MD5 404562101bbe301e49e492874eb27743
BLAKE2b-256 004c9d4d930fb4c8aba1c632f34e186cab48e766037c5926212a66e03d60f764

See more details on using hashes here.

File details

Details for the file timelineviz-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for timelineviz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fde7cc619f4ffcbcb49ae22eba494bb459057bb48d2aa780f802d34128c9199c
MD5 45e605e29908949ff92971dc1fda4b8a
BLAKE2b-256 31253cff06952417ea127e28b169f1c60589ec30154bb74f407bcd5b4bed8573

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page