Skip to content

Atlas: first pass of the Timebase Atlas data source - #1

Merged
charlfourieflow merged 23 commits into
mainfrom
feature/atlas-datasource
Nov 24, 2026
Merged

charlfourieflow merged 23 commits into
mainfrom
feature/atlas-datasource

Conversation

@charlfourieflow

Copy link
Copy Markdown
Contributor

First pass of a Grafana data source for Timebase Atlas, next to the Historian plugin. It shows the entities of an Atlas information model, their current values, and the relationships between them.

It uses only the Atlas /api/v1 REST API and read-only Cypher. It does not use the i3X API or the internal SignalR value hub.

Query What it does
Graph Whole domain, or 1-4 relationships around an instance, for the Node Graph panel. Node rings by data quality or entity type; lines by containment/other or by relationship type (key in the editor); optional relationship-name dots; node pop-up with values and Explore links
Values One instance, nested instances, or a whole type; one row per property or one row per instance. Compound properties (e.g. MaintainX LiveAsset) are split into readable parts
Cypher Read-only Cypher; dashboard variables are passed as Cypher parameters; table or node graph output

Also in this PR:

  • Browse modal for instances (nested by containment, as in the Atlas Instances view) and for entity types
  • Dev provisioning (data source atlas-dev, secret from an environment variable) and a demo dashboard
  • atlas-ci.yml / atlas-build.yml (build, lint, test, package) and atlas-release.yml (atlas-v* tags; pre-release while 0.x)
  • Root README lists the plugin

Tested against a local Atlas 2.0.0 stack (cesmii-workshop and chamdor domains) in Grafana 13.3: every query type, the browse modals and the node links in the browser. Locally: typecheck, lint, 12 frontend tests, golangci-lint (0 issues), Go tests, all-platform build and packaging pass.

Known gaps, filed on Atlas:

  • No history: there is no history route on /api/v1 (flow-software/Timebase#2394)
  • /values drops non-TVQ compounds, so the plugin reads values through Cypher (flow-software/Timebase#2395)
  • Cypher n.entityLabel is always null (flow-software/Timebase#2396)

Values update on panel refresh; there is no live push, because Atlas's LIVE switch uses the internal SignalR hub.

🤖 Generated with Claude Code

charlfourieflow and others added 23 commits November 16, 2026 16:08
A Grafana backend data source for Timebase Atlas that uses only the
Atlas /api/v1 REST API and read-only Cypher (no i3X, no SignalR hub).

- Graph: whole domain or 1-4 hops around an instance for the Node Graph
  panel; quality or entity-type node colours; lines by containment/other
  or by relationship type with a key; optional relationship-name dots;
  node pop-up with values and Explore links.
- Values: one instance, nested instances or a whole type; one row per
  property or per instance; compound properties split into parts.
- Cypher: dashboard variables passed as Cypher parameters; table or
  node graph output.
- Browse modal for instances (nested by containment, as in Atlas) and
  entity types.
- Dev provisioning with a demo dashboard; CI workflow (atlas-ci.yml).

No history yet (flow-software/Timebase#2394).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Atlas serves history through Cypher (UNWIND a live property, time window
in a WITH ... WHERE, pushed down to the source), so the datasource reads
it there instead of waiting for a REST route (flow-software/Timebase#2394
closed in favour of this).

- History query: one instance, nested instances or a type; one or more
  live properties; raw, or minute/hour/day buckets with avg and optional
  min/max (Auto picks from the panel range). Text and boolean properties
  are read raw. Series carry instance/property labels; alerting enabled.
- The MATCH always names the type: with a bare (n) Atlas 2.0.0 unwinds
  only the current value. Buckets use bare units only, because
  relative(ts, "5m") is read as an offset.
- Cypher: $from/$to filled from the panel time range; ISO timestamp
  columns become time fields.
- Property picker resource, docs, changelog (0.2.0 unreleased), demo
  dashboard History panels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The History editor no longer asks for Read / instance / properties in three
steps. One modal shows the containment tree with each instance's live
properties under it: tick an instance for all its live values, or single
properties, with a button to tick everything nested. Ids and $variables can
still be typed ("$machine-Production/FeedRate").

- Query field `selection` ({instance, property?}); older scope/properties
  queries still run, and one-instance ones convert in the editor.
- Tree resource carries each instance's live properties (from the read it
  already did); the separate properties resource is gone.
- Notices for picks that are not found or have no live value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- One checkbox per row: it picks the instance and everything nested under
  it with live values (dash when partly picked). Replaces the separate
  "tick nested" button.
- Record properties (a compound with its own Timestamp, e.g. MaintainX
  LiveAsset / LiveOpenWorkOrders on CNC01) are listed and read raw, one
  column per part. Live-checked: CNC01 LiveAsset gives its 2026-11-06 row.
- Grafana's Checkbox never clears the DOM indeterminate flag, so the row
  box is keyed by state.
- Series chips wrap inside the editor width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- "Edit as Cypher" on a History selection writes one typed read per entity
  type and property, joined with UNION ALL (live-checked on Atlas 2.0.0),
  returning entity, property, time, value. It reads the browse tree on click
  for types and live properties; text, boolean and record values are listed
  in a comment and left out. Variables give a clear message instead.
- Cypher "Time series" format: splits long rows into one series per
  combination of the text columns, sorted by time.
- $bucket is filled with the builder's bucket unit for the range, so Auto
  aggregation carries over (relative(ts, $bucket) works live).
- Node graph style options hidden for table and time series output; the
  disabled-button tooltip now says why per query type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bucket averages hide short peaks and stops. Bucketed History reads now
carry each bucket's min and max by default (includeMinMax unset = on) and
the plugin styles them as a shaded band in the line's colour: no line, no
legend entry, still in the tooltip. Cypher "Time series" results with min
and max columns get the same band.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The min/max band (493cac3) was too busy. Auto now draws one line per
series: the panel range is cut into maxDataPoints/3 slices, each slice
draws its average, and its min or max is added at its own time when it
lies further from the average than the series' typical spread (median
slice range). Noise stays smooth; stops and spikes keep true values.
Atlas supplies raw values up to 3 h (unchanged when they fit), then the
finest of minute/hour/day buckets within a 60k-row budget. Minute, Hour
and Day stay plain averages with optional min/max series (off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One selection, picked in the browse modal, shown as Current values
(rows or columns table) or as a Trend over the time range. The backend
reads Current for a selection (whole instances, or only the picked
properties), keeping pick order. Older Values queries of one instance
open as a selection; nested/type queries still run and are marked.
TypeField is no longer used.

Fixes found while testing:
- Auto Trend of a text property whose current value is empty (looks
  numeric) got Atlas 500 from avg(); bucketed reads now fall back to raw.
- Auto Trend repeated a series when its first buckets had no value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Selection picks can now be "an instance with everything nested under it"
(scope nested) or "every instance of a type" (scope type, Types view in
the modal, or type:Name in the text box). Both resolve against the
instance tree when the query runs, so new instances are included. Ticking
a row with nested instances makes a nested pick; unticking part of it
turns it into single picks. Chips can switch an instance or $variable to
include everything nested. Older Values/History queries (instance,
nested, type) now open as the matching selection, so the legacy notice
is gone. Edit as Cypher covers both Data modes (Current: MATCH (n:Type)
for a whole type, otherwise ids).

The "Only with live values" switch is replaced by an Instances | Types
view switch. Timebase colours (tokens.css: Timebase Blue, Lucky Green,
Vivid Orange, Lucky Blue) for selected rows, tags, chips and property
kind icons; Timebase logo in the modal title. Grafana components keep
the Grafana theme.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kinds were guessed from the current value, so a TVQ with an empty value
(quality No data) showed as "unknown" and text properties could be sent
to avg(). The plugin now reads GET .../entity-types (cached 60 s per
world) and resolves a property's kind from the type's propertyPins, then
the property's TVQ Value fieldTypeOverride (or record compound range),
walking parent types. Open types fall back to the current value; if the
endpoint fails the plugin logs once per TTL and falls back too. Used for
the picker icons and for whether Trend buckets a property.

Live (cesmii-workshop): 146 number, 10 text, 8 record, 0 unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Trend averages (Auto slices and Minute/Hour/Day buckets) weigh each value
  by how long it held, as Timebase Explorer does. Exact from raw values
  (Atlas returns the value before the window first) up to 3 h or 100k
  values, otherwise from Atlas minute buckets; a notice says when fixed
  buckets fall back to plain averages. Nulls leave their time out and break
  the line.
- Units on Trend series from the instance's UOM (atlas-common Tag pattern).
- Dashboard variables from a Selection in the Select modal (instance ids or
  property names); $variables in the property part of a pick.
- Demo dashboard: status state timeline, $machines/$prop variables, hourly
  time-weighted FeedRate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An instance like $machines-Production becomes
n.entityId IN [m IN $machines | m + "-Production"], typed by the variable's
current instances; a property variable gets one read per number property,
switched on by "FeedRate" IN $prop (Atlas answers n[$prop] wrongly).
Single-value variables are wrapped in a list. Current selections too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Instance variables listed at the top of the tree with their first
  instance as the example; picks under it are saved as "$machines, nested,
  only CNCProduction" (new pick field nestedType, resolved by containment
  and type in the backend and the browser), so no id spelling is assumed.
- Property variables ($prop) listed with the properties they can name.
- A $ button on chips offers the variables that fit an existing pick.
- Demo dashboard panels use the modal-made picks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eries

- Nested picks with a variable ("every CNCProduction under $machines")
  become MATCH (m)-[:<containment>*1..N]->(n:Type) WHERE m.entityId IN
  $machines, plus a read for the variable's own instances (no zero-length
  match in Atlas). Live-checked: same history as a match by id.
- Fix: expandSelection dropped the scope of picks it cannot resolve, so such
  picks were written as reads of the variable's own type (CNCMachine
  PartCount: no rows). Properties a type lacks are now left out.
- Time series format: no rows is a notice, not "needs a timestamp column".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Trend plots a record's number parts (CNC01 LiveAsset.MxLocationId ...),
but the Cypher conversion left records out, so series disappeared on
switching. The tree resource now lists each record's parts with their kind,
and the conversion writes one raw read per number part
(UNWIND n.LiveAsset AS v ... v.MxLocationId AS value). Live-checked: the
Cypher gives the same four series as the Trend for CNC01.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Start at: Select button, the pick as a chip with a $ suggestion
  ("Use $machine instead of CNC02"), dashboard variables listed first in the
  modal, Timebase title and selection colours.
- A multi-value start variable (sent comma-separated) gives one graph around
  all its instances; live-checked CNC01,CNC02 -> 9 nodes.
- Edit as Cypher keeps a start variable as a parameter instead of writing
  a.entityId = "$machine".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Relationship-name nodes need the nodes frame's color field; with Colour
None the instances then had an empty colour, which Node Graph draws as no
ring. They now get a neutral grey (#9FA7B3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Time-weight option on Cypher time series (Auto, Minute, Hour, Day) runs
the returned raw values through the Trend's own weighting. Edit as Cypher
writes raw reads and sets it from the aggregation, so switching to Cypher no
longer changes the panel. Live: identical points on CNC01-SpindleMotor RPM
over 6 hours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…riables

- Graph Relationships modal counts each type around the start instance
  (within its depth) or in the whole domain; new relationship-counts resource.
- Trend Quality is kept with its series instead of drawn as a line: shown as
  Good / Uncertain / Bad in tooltips and as a table column. In Auto every
  point has a quality (worst in its slice; held values keep theirs).
- Selection variables open on Types; Values = Instances hides properties and
  lets any instance be picked; saved instance variables ignore properties.
- Enumerations, relationship-type and enumeration-member variables.
- Version 0.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@charlfourieflow
charlfourieflow merged commit 1a02f36 into main Nov 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant