Eloverblik

Dokumentation · Siderne

The demo organisation and the demo source (B04b)

The generator elo_devtools.synth is the only source of metering data for tests, CI and make demo. It invents an organisation, Vesterfjord Kommune, and answers as DataHub would, through the demo source elo_sources.demo.DemoSource, a MeteringSource of §5.1. Nothing is stored: every value is a function of the seed, the metering point, the interval and the revision clock, the instant at which the organisation is looked at. Same seed, same instant: same bytes, whatever was asked before.

from elo_devtools.synth import Organisation
from elo_sources.demo import DemoSource, Fault

org = Organisation()                    # seed 20261113, anchor 13 November 2026
source = DemoSource(org, clock=lambda: some_utc_instant, faults=[...])
case = org.cases()["withdrawn_day"]     # metering point, days and instants of a case

Sites and metering points

Six sites, 18 trees, 22 metering points, all IDs in 579999… (site s, root r, child c: 579999 + s·10000 + r·100 + c in 12 digits). The anchor is the demo's today: the frozen factor extract and the relative registrations (AT-08, AT-10) are made for it. The clock can be set to any instant; data exists from 2019 on and the API's window (1 January of the current year − 5) limits what is readable.

SiteMetering pointsCases
1 Rådhuset (DK1, grid area 131)The L1 tree: E17 hourly with D15, D07 (hourly) and D06 (quarter-hourly)DST days; the design's gap (14 hours missing on 3–4 November 2026, the next 36 estimated); a correction inside 14 days; a late day; a withdrawn position; a withdrawn day that never comes back (RT-06 to RT-09); a day withdrawn for five days and then delivered again with new values (RT-10, RT-18); qualities A01, A02, A03, A05; AT-09
2 Fjordskolen (131)E17 quarter-hourly with a D06 child; a hallMissing quarters; a day delivered as 96 quarters and later as 24 hours (RT-01); the hall switches from hourly to quarter-hourly on 1 July 2025 (UT-05)
3 Plejecenter Solbakken (344)Main meter; kitchenTwo access periods (two items per ID, RT-12); relation lost 5–8 October 2026 and restored; kitchen: duplicate (RT-24), conflicting (RT-19 b) and mixed-resolution (RT-19 c) periods of one day, conflicting items on one day (RT-19 a), protectedName not sent
4 Svømmehallen (DK2, 740)Main meter in MWH; heat pump in KWT with an unknown grid area; outdoor lightingRT-17; the lighting is read monthly (P1M) before March 2026 (UT-01, a window that cuts a month gets a partial period: UT-04), March is first monthly then hourly, the calendar read 97 % of the hourly total (UT-02: a changed total), April first hourly then monthly (UT-03), June carries a profiled PXD series beside the hourly one (UT-06)
5 Teknisk Gård (131)Five metersAT-01 to AT-05
6 Idrætshal Nord (344)Five metersAT-06 (also a protected address), AT-07 (moved out), AT-08, AT-10, AT-11

The revision clock

A day's readings arrive between 06:00 and 10:00 local time, typically 2–4 days after the day, sometimes 5–10 (a late day). On about 3 % of the days of the meters with texture, some hours are first delivered estimated (A03) and later corrected (A04, other values): four corrections in five within the 14 days the daily run looks back, one in five later. The named cases add revisions at fixed instants (org.cases()[name].at, org.events(root, day)). Every revision takes effect at its own instant and at no other: a texture correction that comes first never triggers a named event early, and a named event never ends an unrelated estimate.

Access (§6.3)

A time series request is answered per metering point by the strictest reading of R1 §6.6: a window not wholly inside a readable range is refused with 30018; inside one, it answers 10000 with the delivered days, or 30015 when none has arrived. A window that ends on or before the API's window start answers 30017. Without a relation (before registration, or while lost) every window answers 20010. A malformed or unknown ID answers 20003, 20004 or 20008. A request is refused as a whole with 400 and the code in a ProblemDetails body when dateFrom is after today (30000), not before dateTo (30001, 30002), dateTo after tomorrow (30003), or the period is longer than 730 days or empty once dateTo is moved back to today (30014).

Faults

Fault adds what no organisation does by itself: a whole request answered 429, 503, 400 (with a code) or nothing at all (status=0), with Retry-After as seconds or an HTTP-date; an item answering a given code for one metering point (a daily item that answers 30015 or 20012); an item passed through a function (a malformed period, RT-20). Each fault can be limited to a clock interval and a number of calls. Every call is recorded in DemoSource.log.

Every row of the test tables

COVERAGE in tools/tests/test_synth_organisation.py names, for every row of the test tables of docs/architecture/phase-1.md (RT, UT, CT, AT, PT, LT), how its input is supplied: a named case, a native situation, a Fault recipe or a capture, each with the test that asserts it (the recipes are the tests named test_recipe_…: copy them), or the epic that builds it around any response (process kills, database state, the pacer, the egress, tokens). The gate reads the row IDs from the specification itself: a row added there and missing here fails CI.

Charges and master data

The charges have the documented shape, codes and placement (national subscription and tariffs on the E17 parent, the electricity tax on the D15 child, the grid subscription and 24-position tariff on the D07 child, none on the D06): price IDs, period types and the TSO's GLN are the contract's codes. The names, amounts and dates are invented constants (NATIONAL_SUBSCRIPTION, NATIONAL_TARIFFS, TAX_TARIFF, GRID_* in organisation.py) and are not Energinet's or a grid company's prices. make synth-provenance compares every value of the demo's master data and charges with the saved samples and fails on any equal value that is not a code; it reads docs/sources/eloverblik/samples/ and runs locally only, never in CI.

The frozen factor extract (§8)

make factor-extract writes fixtures/factors/DeclarationGridEmission/ from the same seed: one gzip file per Danish calendar month from January 2021 to November 2026, in the format of tools/snapshot_declarations.py, with _meta.json. DK1 and DK2, the three allocations, 144 rows a day; Final before 1 September 2026, Preliminary to 27 October, Initial after; no rows for 11 and 12 November (pending). The values are generated (whole grams per kWh for CO2, a daily and seasonal shape with a random level per day): _meta.json and every file say so and name the seed. CI checks that the committed files have the content of a fresh run.

A demo capture

elo_devtools.synth.capture.write_demo_capture(directory) writes a capture of the demo source in the format of docs/capture-format.md: tiling only, one request per chunk, no edge search and no retries. It is for replay tests; the capture tool is B06b's.

Kilde: docs/demo-organisation.md i løsningens repository.