graphs

package
v0.0.56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

README

api/sinks/postgres/graphs

Database queries that produce data pre-formatted for chart rendering. Rather than returning raw rows, each query shapes its output into structures with pre-serialized label and data arrays ready to be dropped into Chart.js templates.

Currently provides four queries: current service pass/fail status per team and service as a matrix (used for the scoreboard), cumulative points per team bucketed by timestamp over the full competition history (used for a line chart), total checks passed per team (used for a bar chart standings view), and historical uptime percentage per team per box/service combination (used for a heatmap).

Documentation

Overview

Package graphs contains database functions for generating visualizations. These are relatively slow functions that do a lot of construction and transformation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeatmapData

type HeatmapData struct {
	// list of "boxid-serviceid"
	XLabels template.JS
	// list of team labels "team xx"
	YLabels template.JS
	// the datapoints, a list of objects containing x, y, and uptime percentage v.
	DataPoints template.JS
}

HeatmapData contains the rendered strings required for the heatmap graph template.

func GetHeatmapData

func GetHeatmapData(ctx context.Context, db *pgxpool.Pool) (*HeatmapData, error)

GetHeatmapData returns the template data needed to render a heatmap chart. data contains rendered json strings. each cell value is the historical uptime percentage for that team/box/service combination.

type ScoreboardData

type ScoreboardData struct {
	// list of "boxid-serviceid"
	XLabels template.JS
	// list of team labels "team xx"
	YLabels template.JS
	// the datapoints, a list of objects containing x, y, and some values.
	DataPoints template.JS
}

ScoreboardData contains the rendered string required for the scoreboard graph template.

func GetScoreboardData

func GetScoreboardData(ctx context.Context, db *pgxpool.Pool) (*ScoreboardData, error)

GetScoreboardData returns the template data needed to render a scoreboard chart. data contains rendered json strings.

type ScoresData

type ScoresData struct {
	Labels   template.JS
	Datasets template.JS
}

ScoresData returns the template data needed to render the final scores length

func GetScoresData

func GetScoresData(ctx context.Context, db *pgxpool.Pool) (*ScoresData, error)

GetScoresData contains the data required to render a line chart with all team scores.

type StandingsData

type StandingsData struct {
	// list of team labels "team xx"
	Labels template.JS
	// checks passed per team, parallel to Labels
	Data template.JS
}

StandingsData contains the rendered strings required for the standings graph template.

func GetStandingsData

func GetStandingsData(ctx context.Context, db *pgxpool.Pool) (*StandingsData, error)

GetStandingsData returns the template data needed to render a current standings bar chart. data contains rendered json strings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL