Dokumentation · Arkitektur og beslutninger
Phase 2 – Build specification: analysis first, then several accounts
Status: version 1.1, 23 November 2026. Written by worker elo-a3-phase-2-specification (Claude · Fable) on
the brief orchestration/tasks/a3-phase-2-specification.md, after the owner's first look at the pages of phase 1
on his own data. Version 1.1 applies the static read reviews/architecture/A3-agy.md (A3v-01…18) with the
lead's rulings (brief orchestration/tasks/a3f-phase-2-fixes.md); the last section says what was done.
Precedence. docs/architecture/phase-1.md stays the specification of everything it describes; this document
adds to it, and changes only the sentences listed in §9. Where this document and docs/architecture/solution.md
differ, this document wins: the epics B21 to B46 of solution.md §10.2 are not this plan. An epic of phase 2 is
built from this document, phase-1.md and the research they cite.
0. Reading guide
Who reads what. Every builder: §0, §1 and the section "Disputed". Then the sections of the epic, named in its row of §7.2.
Conventions. Those of phase-1.md §0. A bare "§2" is a section of this document; "P1 §9.3" is a section of
phase-1.md; "S §5.6" of solution.md; "R2 §3.4.1" of a research document; "manual §10" of
docs/design/notation-manual.md; "A3v-04" a finding of the static read. [LF] marks a sentence that leans on
a fact the lead verified on 23 November 2026 (the brief's §3, and the lead's two answers about
DeclarationGridmix of that morning): nobody re-verified it for this document. "Root" is an E17 metering point
that is its own root; "the selection" is the set of roots a page's figures are made of. Epics of phase 2 are
numbered B51 to B68 (wave A) and B71 to B76 (wave B); B21 to B46 are taken by solution.md.
The rulings of the lead that are built in (the brief's §4): two waves; cost is the energy bought at the day-ahead price, without tariffs, taxes and VAT; the third card is cost and coverage is a status line; the sources are location-based; nothing derived is stored in wave A; a dimension is offered only when the data holds more than one value of it; the rules of phase 1 are not reopened. One ruling was disputed in part, and the lead accepted the dispute: the section "Disputed".
Given, not specified here: B20 (orchestration/tasks/b20-heatmap-kpi-cards.md): the heat map of weekdays by
hours of the day on the consumption page, with its query, and the smaller cards. B20 holds the migrations 0188
and 0189; phase 2 starts at 0190.
1. Scope of each wave, and what is not built
1.1 Wave A: analysis, on the architecture as it stands
One install, one local user, one account (P1 §1.2). Five things the owner asked for:
| # | What | The owner's point | Section |
|---|---|---|---|
| A1 | The energy bought from the grid, sold to the grid and the net of the two, as three figures | 2 | §3.1 |
| A2 | The purchase and the sale valued at the day-ahead price; cost is the third card, coverage a status line | 1, 2 | §3.2, §5.1 |
| A3 | The grid's mix in the hours of the purchase: how the electricity in the grid was produced then, in named groups | 3 | §3.3, §5.4 |
| A4 | Two periods compared, with the variance by month, by weekday and by hour of the day | 5 | §3.4 |
| A5 | A selection over what master data holds, beside the address | 5 | §3.5, §5.5 |
1.2 Wave B: several accounts
| # | What | The owner's point | Section |
|---|---|---|---|
| B1 | The install on a second machine with another token, from docs/operations.md alone | 4 | §6.2 |
| B2 | More than one Eloverblik token in one install; each token belongs to a company, a company has one or more | 5 | §6.3 |
| B3 | 500 metering points and six years, generated, measured; the query that breaks the budget first is named | 3 | §6.4 |
| B4 | What the measurement demands: named, and specified only after it | 3 | §6.5 |
Wave B assumes that the owner alone looks at the data, on his own machine (§6.1; question 1 of §8).
1.3 Not built in phase 2
| Not built | Why |
|---|---|
| House, car and solar panels told apart | No series holds it. The owner's tree is a parent E17 and three children, D15, D07 and D06; the parent's series equals D07's hour by hour; solar production consumed behind the meter is in no series and the charger has no metering point [LF]. What exists is bought, sold and net (§3.1) |
| Self-consumed production (E02), total consumption (E05), a figure for a production point (E18) | E02 needs a production series (S §2.3). What an E18's series holds under hourly net settlement is not known before a business login has been read (question 4 of §8). An E18 root is listed, opens on D1, and is in no figure |
Tariffs, taxes, subscriptions, VAT, a supplier's margin; DatahubPricelist; the bill | Ruling 2. The full price is S §5.6 and needs the charge links and a bill (question 3 of §8) |
| The municipality, yearly and market-based methods; guarantees of origin | Unchanged from P1 §1.1 |
| A hierarchy above the metering points, tags, allocations; geography finer than the price area | The selection of §3.5 is over master data only; finer geography waits for a company account (§3.5) |
| Login, roles, row-level security, the sealed credential store, audit events | Needed only when somebody else than the owner looks (§6.1) |
| Any stored emission, cost or mix fact; a result cache | Ruling 5. Decided by the measurement of §6.4 and by nothing else |
| The load duration curve, exports, anomalies, notifications | Not asked for |
| The split of a cost or emission variance into effects other than volume and price (§3.2) | Not asked for |
Disputed
**Ruling 4 names two candidate datasets, DeclarationProduction and ProductionConsumptionSettlement. This
document chooses a third, DeclarationGridmix.** The rest of ruling 4 is kept: location-based, weighted by the
consumption of each hour, a few named groups, and no share called "green".
| Dataset | What it is | Why it is or is not the source |
|---|---|---|
DeclarationGridmix | "How the consumption in a bidding zone (price area) is covered by production and imports, hour by hour, and per technology" (its metadata, docs/sources/energi-data-service/metadata/DeclarationGridmix.meta.json): per hour, price area, ConnectedArea and ReportGrpCode a share in parts per million | Chosen. It is the mix of what was consumed in the price area, imports included, which is what "in the hours the selection consumed" asks for. It is the dataset of Energinet's own recipe and of Eloverblik's report (R2 §3.4.1 steps 8 and 9; R3 §3.3.2), so the owner's report is a check on the result (§3.3). It carries the versions of the declaration the emission factors come from, and its newest hour is the same [LF]. solution.md chose it (S §2.6, fx.mix_hour) |
DeclarationProduction | The production inside the price area, per production type and allocation method | Not the consumption: no import. Energinet's own comment on it: "Only declaration of production, not to be used for green accounting purposes" [LF]. A complete 125 % declaration is its 125% rows plus its All rows (R2 §2.2.5): a trap the chosen dataset does not have |
ProductionConsumptionSettlement | Physical production by class of plant, and the exchange per border | "Central power" is coal, gas and biomass in one column; the exchange has no source at all. It cannot say how the electricity was produced |
What the lead saw of the chosen dataset on 23 November [LF], and what the design takes from it: it is alive (PT1H, the columns of §2.3); a complete hour of DK1 has 25 rows (20 October 2026, Initial) and 32 rows (11 June 2025, Final) and its shares sum to 999 989 and 999 981; the newest hours, of 4 November 2026 and Initial, have 9 to 16 rows that sum to between 188 823 and 477 852. So the presence of rows says nothing: §3.3 tests the sum of every hour.
2. Data
2.1 The new sources
All three are datasets of Energi Data Service and are loaded by the loader of P1 §8, made to serve any dataset
by B51: timezone=UTC, the UTC key column, explicit sort, limit=0 with a time window, the row budget of
17 500 rows per call, only a complete response applied, an unknown column kept in extras, a missing expected
column stops the dataset, the metadata read at each run. Both price areas are loaded, as the factors are; the
requests filter PriceArea to DK1 and DK2.
| Dataset | Feeds | Rows a day | First load |
|---|---|---|---|
Elspotprices (PT1H, no longer updated; its last record of DK1 is HourUTC 2025-09-30T21:00 [LF]) | price.spot, dataset 1 | 2 × 24 = 48 | 2020-12-31T23:00Z to 2025-09-30T22:00Z: 1 734 local days, one of them the 23-hour day of 2025 and none its 25-hour day, so 41 615 hours and 83 230 rows; windows of 364 days: 5 calls, once |
DayAheadPrices (PT15M, updated daily; its first record of DK1 is TimeUTC 2025-09-30T22:00 [LF]) | price.spot, dataset 2 | 2 × 96 = 192 | From 2025-09-30T22:00Z; windows of 91 days (17 472 rows): 5 calls on 23 November 2026 |
DeclarationGridmix (PT1H) | fx.mix_hour | 2 × 24 × the rows of an hour: 1 200 at 25 rows, 1 536 at 32 [LF], 2 832 at the 59 rows of R2's largest sample | From 2020-12-31T23:00Z, newest first; windows of 5 days (14 160 rows at 59 rows an hour), halved when a response reaches the budget: 431 calls of data on 23 November 2026, and 15 of metadata (each slice reads the metadata once: B51, B53) |
The jobs, one module each in elo_worker/jobs/; the slots are in Europe/Copenhagen:
| Job | Slot | Window |
|---|---|---|
eds-prices | Daily 14:10 | DayAheadPrices: the last 7 local days to the end of tomorrow (tomorrow's prices are published about 13:00, R2 §2.5.1), 1 call |
eds-prices-monthly | The 2nd of each month, 03:20 | DayAheadPrices from the later of the seam and 1 January of the previous year |
eds-mix | Daily 04:45 | The last 14 local days, 3 calls |
eds-mix-weekly | Sunday 05:15 | The last 120 days, 24 calls |
eds-mix-monthly | The 2nd of each month, 03:40 | From 1 January of the previous year, about 140 calls on 2 December 2026 |
The first load has no job of its own, as the factors' has none (P1 §8): a run of a dataset's daily job that
finds the dataset loaded from later than its first hour goes on with the first load after its own window.
eds-prices loads Elspotprices first, then the history of DayAheadPrices. A person re-pulls a dataset with
python -m elo_worker.eds repull <dataset>.
What the mix costs: a first load of a little over seven hours of the lane, 24 minutes each Sunday, about two hours and twenty minutes each month, and about 3 million rows (§2.3). The mix's schedule is coarser than the factors' rolling 120 days a day (P1 §8), because a day of the mix is ten to twenty times a day of the factors: a mix row revised between two Sundays is up to seven days stale, and the page states the versions it rests on (§3.3).
2.2 One pace for the service
**Decision: every call to Energi Data Service, of every dataset, the metadata calls included, reserves its start
in one row, ingest.service_pace, and the starts are at least ELO_EDS_SPACING_S (60) seconds apart. A 429
cools the whole service down, not one dataset.** Reason: the service answered 429 after about ten requests in a
minute from this address, and allows it about two a minute [LF]; R2 §1.6 had measured independent limits per
dataset, which no longer holds. One call a minute leaves the address's other request to a person or a second
checkout. Rejected: a pace per dataset (two loaders back to back send two calls within seconds).
| Rule | Detail |
|---|---|
| Reservation, completion, recovery | As P1 §8 and docs/declarations.md ("Pace", "Across a restart"), on the one row: next_start_at, cooldown_until, cooldown_level, in_flight. The pace columns of ingest.dataset_state are no longer read. ELO_EDS_SPACING_S is a setting of the migrate step (1 to 3600), which installs it in ingest.pace_setting at every make up, so that every process reads one value (B51f, B51v-05; it was to be a setting of the worker's environment). One call of any process holds the service's turn (an advisory lock) from its reservation to its completion |
| The lane | Every Energi Data Service job runs in the worker's declaration lane (P1 §1.2): one at a time |
| Slices | A job applies at most 30 windows, then queues its successor and ends. The successor carries the slot, the slice's number and the next window, under the dedup key <kind>:<slot>:<slice> (the scheduler's own key is <kind>:<slot>), with run_after the instant it is queued. The queue takes the due job with the earliest run_after, so a daily job whose slot opened during a slice runs before that slice's successor. A slot is covered by its first slice. A retried attempt of a slice skips the windows an earlier attempt of the same job applied (B53). A job that reloads (a monthly re-pull, the mix's weekly run) runs only on a dataset that is loaded from its first day; otherwise it ends at once without a call, its slot covered (awaiting_first_load): the first load is the daily job's alone (B53, the lead's ruling of 23 November: on the first make up the monthly job would else claim the lane before the daily one) |
| Order of a first load | The mix newest first, so that the newest months have a mix after the first slice. An hour not yet loaded is pending (§3.3), never wrong |
2.3 Tables
Each table is created by the epic of its row; no other epic creates a table of this section.
| Table | Grain / PK | Columns | Epic |
|---|---|---|---|
ingest.service_pace | PK service smallint CHECK (service = 3) (3 is Energi Data Service, as raw.fetch.source); one row | next_start_at ts, cooldown_until ts NULL, cooldown_level smallint, in_flight bool (a bool, as ingest.dataset_state.in_flight of migration 0080: the service has one kind of call) | B51 |
price.spot | PK (price_area char(3), interval_start ts) | resolution smallint (60 or 15), dataset smallint (1 Elspotprices, 2 DayAheadPrices), dkk_per_mwh num(14,6) NOT NULL (SpotPriceDKK, DayAheadPriceDKK), eur_per_mwh num(14,6) NULL, retrieved_at ts, meta_updated_at ts, fetch_id bigint, generated bool, extras jsonb. The seam is a check of the table: (interval_start < '2025-09-30 22:00+00' AND dataset = 1 AND resolution = 60) OR (interval_start >= '2025-09-30 22:00+00' AND dataset = 2 AND resolution = 15); the start is a multiple of the resolution | B52 |
price.spot_history | PK (price_area, interval_start, superseded_at ts) | The superseded or vanished row, generated included, and cause smallint (1 changed, 2 vanished) | B52 |
fx.mix_hour | PK (price_area char(3), hour_utc ts, connected_area text, report_grp_code text) | share_ppm int (as delivered, with its sign), share_mwh num(14,6), co2_emission_kg num(16,6), report_grp text (the name as delivered; never a key, R2 §2.2.4), version smallint (1 Initial, 2 Preliminary, 3 Final), retrieved_at ts, meta_updated_at ts, fetch_id bigint, generated bool, extras jsonb. No history table (§2.4) | B53 |
ref.mix_group | PK group_code text | name_da, name_en, sort smallint, renewable_share num(3,2), nuclear bool. The eight rows of §3.3 | B53 |
ref.mix_code | PK report_grp_code text | group_code (→ ref.mix_group), name_da, source text. The 17 codes of R2 §2.2.4 | B53 |
ref.code, list connected_area | (P1 §3.3) | DK1 Vestdanmark, DK2 Østdanmark, DE and GE Tyskland, NO and NO2 Norge, SE, SE3 and SE4 Sverige, NL Holland, GB Storbritannien: the codes of R2 §2.2.4, of the saved samples and of the lead's two hours [LF] | B53 |
ingest.dataset_state | (P1 §3.2) | Three more rows; loaded_from moves back as a first load proceeds | B52, B53 |
elo_worker writes price.* and fx.mix_hour; elo_api has SELECT. Size: price.spot is 83 230 rows and
192 a day; fx.mix_hour at 30 rows an hour and area is 2 × 30 × 24 × 2 153 days = 3.1 million rows, about
0.5 GB with its key.
The seam. The two price datasets meet at 2025-09-30T22:00Z (local midnight of 1 October 2025): the last
hour of Elspotprices covers 21:00Z to 22:00Z and the first quarter of DayAheadPrices starts at 22:00Z
[LF]. Each loader discards rows on the other side of the seam, and the check refuses them: "no gap and no
double hour" is a property of the table. A row whose DKK price is null is not stored and is counted by
make status; its interval has no price (§3.2).
2.4 Late and corrected data
Decision: a reload of a window is the truth about that window, for every dataset. A key the response no
longer holds is removed; ops.data_version is incremented once when anything changed; the next query shows the
new figure (P1 §9.1).
| Data | A changed or vanished row | What a revision changes on a page |
|---|---|---|
| Prices | Goes to price.spot_history first, with its cause, as P1 §8 has it for factors. A day-ahead price is not meant to change after it is published: a history row is a thing to look at, and make status counts them | The cost of that interval |
| The mix | The rows of an hour and price area are replaced as a set, in the window's transaction. No history is kept. Reason: every hour's set changes at least twice (Initial, Preliminary, Final), which would triple the largest table of the install for a question nobody asks before a period is locked. Phase 3's lock needs the history (S §2.6); it is added then | The sources of that hour; an hour can become complete or stop being complete (§3.3) |
| Readings, factors | Unchanged from phase 1 | – |
make status (P1 §6.5) gains, per new dataset: loaded from and through, the newest hour, the pace's cooldown,
stopped or not, unknown columns. For the prices: the expected intervals without a price inside the loaded range
(an hour is expected before the seam, a quarter from it) and the history rows. For the mix: the hours that are
not complete (§3.3) by version, the newest complete hour, rows with a negative share, and the report group
codes and connected areas the reference tables do not know.
2.5 Generated data for the demo and for CI
The demo organisation and CI need prices and a mix and never call Energi Data Service (P1 §8, N5). The
generator elo_devtools.synth makes both extracts in the loader's file format, for the demo organisation's
period, DK1 and DK2, from the organisation's seed. They are generated at load and are not committed (the mix
extract would be about 600 000 rows); a test asserts that the same seed gives the same bytes. make demo, the
demo load and CI generate and load them through the loader's file mode with raw.fetch.source = 9, so every
row is marked generated: B52 wires the prices and B53 the mix into the three. The extracts hold the cases the
rules need:
| Extract | Cases |
|---|---|
| Prices | Hourly before the seam and quarter-hourly from it; negative prices; an hour with one of its four quarters missing; a null price; no price for the last two days of the period |
| Mix | Every code of ref.mix_code at least once and one unknown code; imports (ConnectedArea other than the price area) and one unknown connected area; complete hours whose shares sum to between 999 950 and 1 000 000; Initial hours at the end of the period that sum to less than half; an hour with no rows; an hour with a negative share; versions by the age of the hour, as the factor extract |
3. Calculation
Every rule of this section exists twice, as SQL (what runs) and as pure Python in elo_core (what a reviewer
reads), and a test asserts that both give the same result to the last decimal, as P1 §9.1 has it.
Exactness. The rule of docs/emission.md holds: every operation is +, − or × on exact decimals; a
conversion is a multiplication (× 0.001, × 0.25), never a division by a power of ten. This section has two
divisions, and each says its order, its scale and its rounding: a ratio (K03, a share) is one division of two
exact sums, rounded to 9 decimals where it is made, as docs/queries.md has it for every ratio; the source
energy of §3.3 step 2 is one division with a rule for its residual.
3.1 Bought, sold, net
**Decision: three measures, each a series or a difference that is named. Nothing is netted that is not called net.**
| Measure | Danish label | What it is | Polarity |
|---|---|---|---|
| E01 | Elforbrug fra nettet | The root's own series (P1 §3.3). For the owner's tree it is the energy bought from the grid: the parent equals the D07 child hour by hour [LF] | −1 |
| E03 | El leveret til nettet | The series of the selected roots' children of role 3 (D06, ref.mp_type). A root without such a child has none: "unavailable", never zero | 0 |
| ENET | Netto fra nettet | E01 − E03, from the two figures as shown. Negative when more was sold than bought | 0 |
Rules: the frontier stays the roots' (P1 §2): a preset period ends there for all three measures, and an export
series that lags its root shows it in its own coverage and expected range (P1 §10.2), which E03 has like E01,
with the quality contributions and the like-for-like variance, computed on its own series (in energy.split,
which reads the readings; overview.months and development.series read ts.day_load and carry the total
variance alone for E01 and E03, as phase 1's E01 does: B54v-03). ENET is a figure only
where both parts are (an export child without data makes the bucket no_data, never E01 alone: B54v-01); its variance is the difference of the two total variances and is named total; it has no
like-for-like variance. Emissions (G01) and the sources (§3.3) are those of E01 alone: selling does not lower
Scope 2 (P1 §9.2; R3 E03 "never offset"). The label of E01 changes from "Elforbrug" to "Elforbrug fra nettet"
on every page (§9).
3.2 Cost
**Decision: the cost of an interval is kWh × DKK per MWh × 0.001, at the day-ahead price of the metering
point's price area on that local day (core.mp_geo), in DKK, without tariffs, taxes and VAT; every label says
"til spotpris" and every page that shows it says "uden tariffer, afgifter og moms".** The DKK column of the
dataset is used as delivered; from 1 February 2025 Energinet computes it from the EUR price by Danmarks
Nationalbank's rate [LF], and the note of the page says so. Rejected: converting EUR ourselves (a second
exchange rate source for the same number).
| Measure | Danish label | What it is | Unit | Polarity |
|---|---|---|---|---|
| K01 | Elkøb til spotpris | Σ of the cost of the intervals of E01 | DKK | −1 |
| K02 | Elsalg til spotpris | The same over the intervals of E03 | DKK | 0 |
| KNET | Netto til spotpris | K01 − K02, from the two figures as shown; never in place of K01. A figure only where both are; it carries the caveats of both | DKK | −1 |
| K03 | Gennemsnitlig spotpris for købet | K01 ÷ the kWh of the priced intervals of E01; no figure (i.r.) when that energy is zero | DKK/kWh | 0 |
The price of an interval (calc.spot_price(price_area, interval_start, resolution); source: R2 §2.5.1 and
§4.2 rule 3):
| Reading | Price rows | The interval's price |
|---|---|---|
| Hourly, before the seam | Hourly | The row of its hour |
| Quarter-hourly, before the seam | Hourly | The row of its hour: a quarter takes its hour's price, as it takes its hour's factor (P1 §2) |
| Quarter-hourly, from the seam | Quarter-hourly | The row of its own quarter |
| Hourly, from the seam | Quarter-hourly | The mean of the four quarters of its hour, (p₁ + p₂ + p₃ + p₄) × 0.25. All four are needed: with fewer the hour has no price |
An hourly reading is never split into quarters (P1 §2 "nothing is split"). So the same energy costs differently as one hourly value and as four quarters; that is the data's resolution, not an error, and the worked example shows it.
Negative prices are kept as they are: an interval's cost can be negative and sums are signed. A relative
variance whose reference is zero or negative is i.r. (manual §3), K03's included. Nothing is clamped at zero.
Intervals without a price follow the rule of the pending factor (P1 §9.3), applied to a second input:
| Figure | Intervals used | What the page says |
|---|---|---|
| K01, K02 | Those with a price. An interval without one contributes energy and no cost; it is never read as free. A priced quarter keeps its cost when another quarter of its hour has none | "x % af købet (n timer) har endnu ingen pris" for K01, "x % af salget (n timer) …" for K02: x by energy, n the hours with at least one interval without a price, counted per metering point when several are selected, as h, H and phase 1's pending hours are (B56) |
| K03 | Cost and energy of the priced intervals only | The note of K01 |
| The variance of K01, K02 and K03 to the comparison period | Only matched hour cells: eligible by P1 §9.3 (complete readings) and with a price for every interval of the hour, on both sides. K03's two sides are the matched cost ÷ the matched energy of each | "Sammenlignet over h af H timer"; the cells left out for a missing price are counted in excluded_price |
| The same when no cell is matched | – | i.r. with the reason (missing_readings, no_price, no_counterpart, no_data), never −100 % |
| A metering point without a price area | – | Ikke tilgængelig, reason no_price_area |
A price has no version: a cost is provisional only where its reading is estimated (A03), by the quality contributions of P1 §10.2.
The variance of K01 is split into a volume and a price effect, over the matched cells, at the hour's grain
whatever the resolution of either side. Per cell and side: q the hour's energy, c the hour's cost (the sum
of its intervals' costs), P the hour's price (its row before the seam, the mean of its four quarters from
it). volume = (q_AC − q_CP) × P_CP × 0.001 and price = (c_AC − c_CP) − volume. Their sum is the cell's
variance by construction. No price is a quotient of cost and energy, so an hour of zero energy on either side
has its effects like any other. For an hour read hourly on both sides the price effect is
q_AC × (P_AC − P_CP) × 0.001; for an hour read in quarters it also holds what the quarters' own prices add
over the hour's mean.
Worked example (one root in DK1, after the seam; prices in DKK per MWh).
| Interval | Reading | Price rows | Price used | Cost |
|---|---|---|---|---|
| Hour 1, hourly reading | 2 kWh | quarters 800, 1 000, 1 200, 1 000 | mean 1 000 | 2 × 1 000 × 0,001 = 2,00 |
| Hour 2, hourly reading | 3 kWh | quarters −100, −100, −100, −100 | −100 | −0,30 |
| Hour 3, hourly reading | 1 kWh | quarters 900, 900, 900 and one missing | none | no cost |
| The export child, one quarter of hour 1 | 1 kWh | its quarter: 1 200 | 1 200 | 1,20 (K02) |
K01 = 2,00 − 0,30 = 1,70 DKK over 5 priced kWh; "17 % af købet (1 time) har endnu ingen pris" (1 of 6 kWh). K03 = 1,70 ÷ 5 = 0,34 DKK/kWh. K02 = 1,20 DKK, shown apart; KNET = 0,50 DKK, labelled net. Had hour 1 been read as quarters of 0,2, 0,4, 0,8 and 0,6 kWh, its cost would be 0,16 + 0,40 + 0,96 + 0,60 = 2,12 DKK. Effects: a matched cell with 2 kWh at 1 000 in the comparison period and 3 kWh at 800 now costs 2,40 against 2,00: volume (3 − 2) × 1 000 × 0,001 = +1,00, price 0,40 − 1,00 = −0,60.
3.3 Sources: the grid's mix in the hours of the consumption
**Decision: the sources of a selection are the rows of DeclarationGridmix for each UTC hour and the metering
point's price area on that local day, applied to the E01 of that hour (a quarter takes its hour's rows), and
only for hours whose mix is complete.** It is one calculation for every method: the mix has no allocation
method (R2 §2.2.4).
| Step | Rule | Source |
|---|---|---|
| 1 Complete hour | An hour and price area is complete when it has rows, none of them with a negative share or with no share or no version (the loader stores NULL where the service delivers none: B53), and 999 900 ≤ Σ share_ppm ≤ 1 000 100. Otherwise the hour is pending for the sources (afventer elmix): it contributes consumption and no source; it is never read as a mix of what happens to be there | Complete hours were 11 and 19 short of 1 000 000, incomplete ones at most 477 852 [LF]; "Summen af PPM er 1.000.000 for et prisområde per time" (R2 §2.2.4) |
| 2 Source energy | Per price area and complete hour, with q the selection's energy of that hour (summed first, §4), S the hour's Σ share_ppm and s a group's: q × s ÷ S, the exact quotient rounded half away from zero to 9 decimals. Both implementations compute it in integers, so that neither chooses a scale: with q in Wh, (2 × q × s × 10⁶ + S) div (2 × S) in units of 10⁻⁹ kWh. The residual q − Σ of the groups is added to the hour's largest group, the lowest sort among equals: the groups of an hour then sum to q exactly. The groups in two levels (B78): the hour is split into its families first (ref.mix_group.family: the eight groups before B78, gas and coal_oil the family fossil; a family's s the Σ of its groups', its order the lowest sort of its groups), the residual to the largest family; then each family into its groups from the smallest up, each q × (its s + the smaller groups' s) ÷ S less q × (the smaller groups' s) ÷ S by the same integer formula, so that the family's groups add to its energy and the largest takes its rounding. A family of one group is that group." Step 3's "eight groups" and the worked example's "fossil 0,4" become "nine groups" and "gas 0,4 (coal and oil 0)". "Øvrige Rounded once per hour on the selection's sum, the sources of two selections do not add to the ninth decimal: a figure is computed for its selection | R2 §3.4.1 step 8, whose 1 000 000 is this sum less rounding |
| 3 Groups | Each ReportGrpCode belongs to one group by ref.mix_code (below). A code the table does not know goes to other, counts as not renewable, and is reported by make status: no energy is dropped. The key is the code, never the name: FossilGas and Fossil gas, Offshore and WindOffshore both occur [LF] | R2 §2.2.4: "bør anvendes som en parameterfil" |
| 4 Renewable energy (E07) | Σ group energy × the group's renewable_share | Energinet's rule, below |
| 5 Shares | E11a = E07 ÷ the consumption of the complete hours; E11b = (E07 + nuclear) ÷ the same. Sum first, divide last | R2 §3.4.1 step 9; R3 §3.3.4 rule 2 |
| 6 Origin | Step 2 with the connected areas in place of the groups (the residual to the largest, the lowest code among equals). A connected area ref.code does not know keeps its energy under its own code, is shown as that code and is reported by make status | R2 §3.4.1 step 8 |
| 7 Status and basis | The status of an hour's consumption is the first that applies: noPriceArea; pending (no rows, or not complete); otherwise the lowest version of its rows (initial, preliminary, final). basis=final uses complete hours of version Final only (P1 §9.3); the status shares do not change with the basis | – |
| Group | Danish | Codes | renewable_share |
|---|---|---|---|
wind | Vind | R18 Offshore, R19 Onshore | 1 |
solar | Sol | R16 | 1 |
hydro | Vandkraft | R11x | 1 |
biomass | Biomasse | R01, R01-1 Biogas, R01-2 Halm, R01-3 Træ | 1 |
waste | Affald | R17 | 0,55 |
nuclear | Atomkraft | R14 | 0 (nuclear true) |
gas | Naturgas | R04x Naturgas | 0 |
coal_oil | Kul og olie | R05x Kul, R02 Brunkul, R06x Olie | 0 |
other | Øvrige | R15x Anden VE, R20 Anden produktion, R21 Lager | 0 |
The source for calling a group renewable is Energinet's own formula for the report "Dit klimaaftryk": "VE-andel uden atomkraft = (Vind + Sol + Vandkraft + Biomasse + 55 % × Affald) / den totale forbrugssum", and "55 % af elproduktion ved afbrænding af affald, beregnes som VE" (R2 §3.4.1 step 9; R3 §3.2). R15x is not in Energinet's numerator and stays out, so that the report is reproduced; R20 and R21 count as not renewable, the conservative choice (R3 §3.3.2). The 0,55 and the mapping are rows of two tables, not code.
Figures and what they rest on.
| Figure | Hours used | What the page says |
|---|---|---|
| Group energy, origin energy, E07 | Complete hours under the basis | n counts hours per metering point when several are selected, as h and H do (B58). With basis=best: "x % af forbruget (n timer) har endnu intet fuldstændigt elmix". With basis=final: "x % af forbruget (n timer) er uden for det endelige elmix" |
| E11a, E11b of one period | The same, numerator and denominator | The same note |
| The variance of E11a, E11b and of a group's share to the comparison period, in percentage points | Only matched hour cells: eligible by P1 §9.3 and complete under the basis on both sides | "Sammenlignet over h af H timer"; cells left out for the mix are counted in excluded_mix |
| A period, or a bucket, with no complete hour | – | Ikke tilgængelig, reason no_mix; never a share of zero |
| Mix status | – | Shares of the period's consumption by the statuses of step 7 |
The wording, and what Energinet's sentence means for it. The sentence stands on a dataset this design does not use, and it names the mistake to avoid: reading a declaration of the grid as an account of one's own green electricity. The mix is the price area's, in the hours the consumption lay in; it is nobody's purchase. So:
| Rule | Text |
|---|---|
| The measures are called | "Elmix", "kilder"; E07 "VE i nettets elmix" (kWh); E11a "VE-andel i nettets elmix, uden atomkraft"; E11b "… med atomkraft" |
| Never in a fixed text: a label, a message's sentence, a tooltip, a file name | grøn, din vedvarende, neutral, 100 % (manual §17). A share that is 100 % is a formatted number, not a text |
| Title line 2 of the page | "Elmix, andel af elforbruget fra nettet i %, lokationsbaseret, time, prisområde"; the table view gives the kWh |
| A fixed caveat under the title, on every page and card that shows a share | "Elmixet er nettets blanding i prisområdet i de timer, hvor forbruget lå. Det dokumenterer ikke køb af vedvarende el: det kræver oprindelsesgarantier." (R3 §2.4.4, §3.3.3: renewable under a market-based method needs a contractual attribute) |
| The note at the foot | "Kilde: Energinet (www.energidataservice.dk). VE-andelen er beregnet efter Energinets regel: vind, sol, vandkraft, biomasse og 55 % af affald." Generated rows are never attributed to Energinet (docs/queries.md, factorSource) |
| Polarity | E11a and E11b +1 (manual §3); a group's energy and share 0: no source is drawn as better or worse |
Worked example (one root in DK1, two hours).
| Consumption | Rows of the hour | Sources | |
|---|---|---|---|
| Hour 1 | 4 kWh | sum 1 000 000: wind 500 000, solar 100 000, biomass 100 000, waste 100 000, nuclear 50 000, natural gas 100 000, R20 50 000 | wind 2,0, solar 0,4, biomass 0,4, waste 0,4, nuclear 0,2, fossil 0,4, other 0,2 kWh: together 4,0 |
| Hour 2 | 6 kWh | 9 rows, sum 480 000, Initial | none: pending |
Consumption 10 kWh; "60 % af forbruget (1 time) har endnu intet fuldstændigt elmix". E07 = 2,0 + 0,4 + 0,4 + 0,55 × 0,4 = 3,02 kWh. E11a = 3,02 ÷ 4 = 75,5 %; E11b = 3,22 ÷ 4 = 80,5 %. Not 30,2 %: the pending hour is outside numerator and denominator.
Validation. report.footprint (P1 §9.4) gains the blocks the report has and phase 1 could not compute (§4).
The lead runs make validate against the owner's reports with a mix snapshot of the same day
(tools/snapshot_declarations.py, the same evidence rule) and records per block "match" or the residual,
without figures. It also answers R2's open question 2, second half: whether the price-area report uses this
dataset or DeclarationTransmissionGridmix.
3.4 Two periods compared
**Decision: the comparison period is an earlier period that takes its length from the period. cmp is py
(the previous year), pp (the period immediately before), from:<date> (an earlier period that starts on that
day) or none.** Reason: a variance between periods of free lengths is mostly the calendar (31 days against 28
are 10 % by themselves). Rejected: two free ranges (question 2 of §8).
cmp | The comparison period | Days correspond | Code |
|---|---|---|---|
py | P1 §2 and docs/queries.md "The previous year": unchanged | By month and day | PY |
pp, the period is whole calendar months | The same number of whole months immediately before | By the position of the month and the day of the month | PP |
pp, any other period | The same number of local days immediately before | By offset: day k with day k | PP |
from:<date>, the period is whole months and the date a first of a month | The same number of whole months from that date | As pp for whole months | PP |
from:<date>, otherwise | The same number of local days from that date | By offset | PP |
Rules:
- The period is resolved first (a preset against the frontier, P1 §2), then the comparison from the
resolved days; "whole calendar months" is said of the resolved days. With a preset,
from:<date>is the day the comparison starts and the period's length decides where it ends. - The comparison period ends before the period starts, otherwise 422
comparison_not_earlier. This is said ofppandfrom:<date>.pyis phase 1's comparison and stays as it was: a period of more than a year overlaps its own previous year and is answered, as phase 1 answers it (B55, the lead's ruling of 23 November). - Months of unequal length follow the rule
docs/queries.mdhas for February ("The previous year"), with "the last day of February" read as "the last day of the month": the last day of a period's month corresponds to the same day of the comparison's month and to every later day of it (30 April to 30 and 31 March), and a period day beyond the comparison month's length holds no comparison day (29 to 31 March against February). So every comparison day is counted in one bucket at every grain, and the buckets add up to the period. - Hour cells correspond by the corresponding day (the same day of the month, or the same offset), the clock hour and the occurrence (P1 §2); a cell without a counterpart is unmatched.
- Everything phase 1 says of the previous year holds for a comparison of any kind: the like-for-like
variance over matched cells with
hofH(P1 §9.3), the total variance beside it and named apart, the comparison's own days named on every row (cp_from,cp_to). - By offset the weekdays of the two sides differ unless the offset is a multiple of seven days; the page says by how many days.
The variance by month is the series of the page (development.series, overview.months): bucket by
bucket, the like-for-like variance and the total variance. It is additive: the buckets' variances sum to the
period's.
The variance by weekday and by hour of the day is a difference of means, not of matched cells. Reason: the same date a year earlier is another weekday, so matched cells would set a Thursday against a Wednesday. The 168 cells of B20's heat map (weekday by clock hour) are computed for the comparison period by the same rule as for the period:
| Figure | Rule |
|---|---|
| Which hours count | Hours eligible by P1 §9.3; for K01 also priced, for G01 also with a factor (the lead's ruling to B20 of 23 November) |
| A cell | Per selected root the mean of its own eligible hours of the class; the selection's cell is the sum of the roots' means. A cell carries roots and rootsExpected, rootHours and rootHoursExpected (the same ruling) |
| The margins: 7 weekdays, 24 hours | By the same rule: per root the mean of its own hours of the weekday or the clock hour (Σ energy ÷ hours, never a mean of cell means), summed over the roots; returned by the query, not made by the page |
| A cell's or a margin's variance | The difference of the two sums over the roots that have a mean on both sides (rootsMatched), in the measure's unit per hour, and relative to the comparison's sum over those roots. A root with a mean on one side only is in that side's cell and not in the variance: it is never a rise or a fall of its whole mean. i.r. where no root has both |
| What the page shows of it | The roots and hours behind both sides, in the tooltip and the table view. A cell or margin whose rootsMatched is below the roots of either side carries the missing symbol |
| Measures | E01, E03, G01, K01 |
It is not additive, and the page does not pretend it is: the heat map of the variance and its two margins answer "at which hours of which days", the month series answers "how much".
Worked example. Like for like, pp by offset, one root, the period one day of 24 hours, the comparison the
day before: hour 08 has 4 kWh against 3, hour 09 has 5 kWh against a missing value, the other 22 hours are equal
at 1 kWh. H = 24, h = 23, excluded_readings = 1; the like-for-like variance is 4 − 3 = +1 kWh over 23 hours
(26 against 25 kWh), the total variance 31 − 25 = +6 kWh over all hours, named apart. By class, over three
weeks on each side: root A's Mondays' hour 08 has 4 and 6 kWh and one missing value in the period (mean 5,0
over 2 hours) and 3, 3 and 6 kWh in the comparison (mean 4,0 over 3 hours). Root B has a mean of 2,0 in the
period and no eligible hour of the class in the comparison. The period's cell is 7,0 and the comparison's 4,0;
the variance is 5,0 − 4,0 = +1,0 kWh per hour, +25 %, over 1 of 2 roots, and the cell carries the missing
symbol.
3.5 The selection
**Decision: a selection is a filter over the roots by dimensions, combined with the list of points; a dimension is a classification of the point, never a fact about the customer; it is offered only when the roots the database holds have more than one value of it** (ruling 6). Within a dimension the chosen values are alternatives, across dimensions all must hold, and a list of points narrows further.
A point's value is that of its current master data version and current price area, for every period. The
history of a point's class is not followed. This is the selection only: every calculation keeps reading the
price area valid on each local day (docs/emission.md), so a point that changed area is selected by today's
area and priced, mixed and factored by each day's.
| Field (the brief's §3) | Class | Why |
|---|---|---|
type_code (key type) | Dimension | E17 or E18. A figure is made of the E17 roots of the selection (§4) |
The account's company (key company) | Dimension, from B74 (§6.3) | The owner's own label of a token, never a CVR number. Wave A neither offers nor resolves it |
Price area (area) | Dimension | The geography every figure depends on |
Net settlement group (net) | Dimension | Tells points with own production from those without |
Settlement method (settle), reading occurrence (read), asset type (asset), physical status (status) | Dimension | Code lists with Danish names in ref.code (migration 0003); each answers "which kind of point" |
Tax reduction (heat) | Dimension | A flag, not a code: "Elvarme (reduceret afgift)" and "Uden", named by the query |
| Sub type, connection type, unit, product, capacity, grid area, parent, root | Not a dimension; shown on D1 | They describe the wiring or are one value in practice; the grid area is 45 codes without a name a reader knows |
| Postcode, city, municipality | Never for a private or unclassified account. For an account classified as a company: after wave B (§6.5) | They are stored also for a protected address (P1 §3.3 withholds street, number, floor, room, location and the DAR reference only), so a group of one would show what N4 withholds |
| Street and the rest of the address, alias, meter number | Never | One value per point: the list of points shows them under N4, a filter adds nothing |
| Consumer CVR, data access CVR, supplier, supplier start, consumer start, grid operator | Never | The customer's identity and contracts; the catalogue refuses a query that names them (docs/queries.md, "What may leave the database") |
A point without a value has the value "ikke oplyst", which counts as a value. For the owner's install, with one root, no dimension is offered and the selection shows the address, as today: that is the rule working, and §8 says so to the owner.
4. Serving
The contract of P1 §10.1 to §10.3 holds for every query: named and parameterised, one read-only transaction, figures and variances as columns, no arithmetic in a page, the grain rules, the row budget. No page epic writes SQL.
Parameters, new or widened.
| Parameter | Values | Where |
|---|---|---|
sel | An object of dimension key → list of values (§3.5). An unknown key or a value of the wrong form is 422; a value no point has selects nothing. A selection by sel without an E17 root answers empty, reason no_consumption_point; an E18 named in mp keeps phase 1's 422 not_a_consumption_root | overview.cards, overview.months, overview.mp_variance, development.series, the heat map query, energy.split, mix.structure, mix.series; combined with mp. No other query takes it |
cmp | py, pp, from:<date>, none (§3.4) | Every query that takes cmp |
measure | E01, E03, ENET, G01, K01, K02, KNET | overview.months, development.series; the heat map query takes E01, E03, G01, K01 |
by | source, origin | mix.structure |
The comparison's columns have one name in every query: cp… (cp, cp_from, cp_to, cp_matched,
delta_cp, delta_cp_pct, delta_cp_total, strip_delta_cp_pct, …), phase 1's py… columns included: B66
renames them, with the web's readers and docs/queries.md, before the comparison is widened. A column names
its role (AC, CP, ΔCP, ΔCP %); the scenario code is said once per response, in
comparison: {kind, code, from, to}, with kind py, pp or from and code PY or PP, absent with
cmp=none; the page prints ΔPY or ΔPP from it. runner.py builds basis.matched for every comparison
(today: if values.get("cmp") == "py").
The response (P1 §10.2) also gains in basis: price ({priced, unpriced, noPriceArea}, shares of the
period's energy) and priceSource (generated, energinet, mixed, none) on every response that carries a
cost; mixStatus ({final, preliminary, initial, pending, noPriceArea}, §3.3 step 7) and mixSource on every
response that carries sources. Both sources cover every row the response rests on, the comparison period's
included, as factorSource does. The counts of the cells a comparison left out are the columns excluded_price
and excluded_mix beside phase 1's excluded_readings and excluded_factor, in the figure columns of every
row that has a like-for-like variance; basis.matched carries them as excludedPrice and excludedMix, as it
carries the other two.
The queries. "Budget" says what counts against ELO_ROW_BUDGET (P1 §10.3): the reading rows of the series
a query reads, over the period and the comparison period's own days.
| Query | Page | Parameters | Grain | Returns | Budget |
|---|---|---|---|---|---|
meta.context (changed) | all | – | – | Also dimensions: for each offered dimension its key, Danish label and values with name and number of roots; and hasExport, whether a root has a child of role 3 | No readings |
meta.selection (new; B67a, the lead's ruling of 23 November for B60's title line) | all | mp, sel | – | One row, roots: the number of E17 roots the selection and the list of points select (every E17 root with neither). A selection without one answers empty, no_consumption_point | No readings |
overview.cards (changed) | X1 | p, mp, sel, m, gwp, basis, cmp | The period | Two more rows, K01 and K03, with the figure columns of the other rows, the strip of K01, and for K01 volume_effect and price_effect (§3.2). The COVERAGE row stays, for the status line (§5.1) | Roots, both periods |
overview.months, development.series (changed) | X1, A1 | + sel, measure widened | Month; day or month | The measure with the comparison and both variances (E01, E03 and ENET: the total variance alone, §3.1); for K01 the two effects per bucket | E01, E03 and ENET read ts.day_load: none. G01, K01: roots, both periods. K02, KNET: also the export children |
overview.mp_variance (changed) | X1 | + sel, cmp widened | A root | Unchanged but for the names | As today |
energy.split (new) | A1 | p, mp, sel, cmp | The period: one row per figure, bought, sold, net | Energy and cost of each row: figure, comparison, total variance, like-for-like variance with h and H (none for net), quality contributions, reasons. An unavailable figure has no row (docs/queries.md): without an export child among the selected roots the response is the bought row | Roots and export children, both periods |
| The heat map query of B20 (changed) | A1 | + sel, measure, cmp | 168 cells, 7 + 24 margins | A second set of the same cells and margins for the comparison period, the variance of each with rootsMatched (§3.4) | Roots (for E03 the export children), both periods |
mix.structure (new) | A4 | p, mp, sel, basis, cmp, by | The period: one row per group (8), in the order of ref.mix_group.sort, or per connected area, by energy with the largest first and the lower code among equals | Energy, share of the consumption of the complete hours, the comparison's share, the variance in percentage points over matched cells; in the first row's basis_* columns E07, E11a, E11b with their variances, the pending energy and hours. unavailable, no_mix, when no hour is complete | Roots, both periods |
mix.series (new) | A4 | p, mp, sel, basis, cmp, g (day, month) | Day or month | E11a, E11b, the energy per group, the consumption and the pending energy per bucket, with the comparison and the variance of the two shares; NULL shares, reason no_mix, for a bucket with no complete hour | Roots, both periods |
mp.cost_intervals (new) | D1 | p, mp (one point of any tree), g (hour, quarterHour) | Interval, at most 750 | Per interval: kWh, quality, the price used, its resolution (60, 15, or the mean of four), price_generated, the cost, or afventer pris. A point that is not chartable as a load (D15, D04) answers unavailable, not_a_load | The window's readings of the point |
report.footprint (changed) | validation | – | – | Further rows, in the columns it has: renewable_share_ex_nuclear and renewable_share_with_nuclear (a fraction, with its numerator in amount and the consumption of the complete hours in per_kwh), source:<group_code> for each of the eight groups and origin:<connected_area> for each area with energy (kWh). complete is true when every hour with a quantity has a complete mix; reason gains pending_mix and no_mix. max_rows goes from 10 to 60 | As today |
How the sources and the cost stay inside the budget. A query never joins a reading row to the mix rows of its hour (about 30 to 1). It first sums the selection's energy per price area and UTC hour, which is exact because the mix is the same for every point of an area, and joins that sum to the mix: at most 2 × 8 784 hours a year meet their rows. Cost is summed per price area, interval start and resolution in the same way. The like-for-like comparison decides eligibility per metering point and hour before the sum (P1 §9.3).
5. Pages
Every rule of P1 §11.1 for every page holds, and the manual decides the notation; §9 lists the sentences of P1 §11.1 that change. A fourth page is needed, for the sources (§5.4): they are a structure with a duty of wording of its own, and they share no axis with the consumption page. Cost needs no page: it is a card, a measure of the consumption page and a tier of the point's page.
5.1 X1 Overblik
| Part | Change |
|---|---|
| The three cards | Elforbrug fra nettet (E01), Scope 2 el (G01), Elkøb til spotpris (K01). The cost card's narrowing line is the "uden …" sentence of §3.2, its note the average price K03 and, when a price is missing, the caveat of §3.2. The cards are B20's smaller ones |
| Coverage is a status line (ruling 3) | Manual §7 already gives coverage its place: a caveat under the title, before the first figure. It is the first caveat of X1 and of A1: "Datadækning 99,8 % · mangler 14 t · mangler mest: <punkt>, 36 t", with the missing symbol when anything is missing, and the point's name opens D1 for it, as the card did (lowest_mp_id). It has no variance and no strip. A coverage with nothing expected reads Ikke tilgængelig (P1 §10.2) |
| The chart per month, the drill | For the measure of the chosen card, K01 included |
| The message | Gains one sentence on cost when K01 is a figure; built from columns (P1 §11.1) |
| Sold energy | Not on X1: its place is A1 |
5.2 A1 Forbrug
| Part | Change |
|---|---|
| The measure switch | E01, E03, ENET, G01, K01. E03 and ENET are offered when hasExport |
Købt, solgt, netto (energy.split) | A structure chart of the rows the query returns, on the page's scale of the unit: the figure with the comparison behind it, the absolute and the relative variance; in kWh, and in kr. when the measure is K01. Asked for and shown when hasExport. Net stands after a gap, last |
| The comparison | The filter row's control "Sammenlign med": Sidste år · Forrige periode · Periode fra <dato> · Ingen. The third title line names both periods with their dates and the scenario code |
| The heat map with a comparison | A switch above B20's heat map: the period's means, or the variance to the comparison: page colour at zero, the two impact colours by the measure's polarity, intensity in equal classes (manual §10), with the 7 weekday and the 24 hour margins as variance bars beside and above it, on the page's scale of the unit. No message from the variance when either period holds fewer than two weeks of data |
| The price effect and the volume effect | When the measure is K01 and a comparison is chosen: two variance bars and their sum in bold (manual §12, "Variance bars"), on the scale of the cost |
5.3 D1 Målepunkt
A switch above the tiers: Udledning (the three tiers of phase 1) or Pris: consumption per interval, the
price used as a thin line with its zero line (a negative price lies below it), the cost per interval as columns
(a negative cost points down); an interval without a price is an empty band with afventer pris. The interval
table gains the price and the cost. For an export child and for a production point the cost tier is the value
of the series at the spot price, labelled so. Emissions stay the root's (docs/pages.md).
5.4 A4 Elmix (new; #/elmix)
The question: what was the grid's mix in the price area in the hours the selection's consumption lay in, and is it changing?
| Part | Content |
|---|---|
| Message, titles | By §3.3's wording rules; the fixed caveat first among the caveats, then the pending share and the mix status |
Sources (mix.structure, by=source) | A structure chart of the nine groups (eight before B78) in the query's order, the same on every visit: the share as a bar of a ratio with the comparison behind it, the variance in percentage points, the energy in the table view. The two shares E11a and E11b as two figures above it |
The share over time (mix.series) | E11a per month or day with the comparison and the variance in percentage points; the provisional part by mixStatus in the caveat, as the heat map does (manual §10: a mark too small to hatch) |
Origin (mix.structure, by=origin) | A second structure chart, in the query's order: the areas in which the grid's mix of those hours was produced, each with its Danish name and its code ("Sverige (SE4)"), or its code alone where it has no name |
| No ΔPL, no target, no leaf | Manual §15, §17 |
5.5 The selection and the comparison in the shell
The filter row keeps the list of points and gains one control per offered dimension, each a list of its values
with the number of roots, several values at a time. The address holds every filter (P1 §11.1): a dimension as
f.<key>=<values>, the comparison as cmp. A filter in the address is always shown as active, also when its
dimension would not be offered any more; "Nulstil filtre" clears dimensions, points and the comparison's date.
A reader who picks a comparison that does not end before the period gets the two swapped where the swapped pair
is valid; otherwise the comparison is not asked for and the control says "Sammenligningsperioden skal ligge før
perioden". The first title line names the selection in words ("DK1, nettoafregningsgruppe 6: 14 målepunkter").
The key gains PP, ΔPP and the unit kr.
6. Wave B
6.1 Which parts of the identity design wave B needs
Part of solution.md | When the owner alone looks at several customers' data on his own machine | Only when a customer logs in, or the stack leaves loopback |
|---|---|---|
| Several source accounts, one pace, one token-call spacing (S §3.3) | Needed: §6.3 | – |
| Where a refresh token lives (S §8.1) | A file per account in the private state directory (§6.3): the protection .env and the access token have today (P1 §12.1, N9) | The sealed box, with the API holding the public key only: it exists for a token entered through a page of an exposed API |
| Keycloak, sessions, CSRF (S §8.2) | Not needed: no second user. The local mode's guards stay (P1 §12.1) | Needed |
| Roles and grants (S §8.2) | Not needed | Needed |
| Row-level security (S §8.3) | Not needed. The seam stays: elo_api is NOBYPASSRLS and sets app.user_id (P1 §1.2) | Needed, with auth.user_mp |
| Audit events | Not needed: one actor | Needed |
| The allowlist, no names stored (P1 §7) | Holds unchanged for every account | Holds |
| Removal of one account's data (S §8.5) | Needed: the owner now holds other people's data and must be able to give one customer's back by deleting it (§6.3) | Needed |
Customers who log in themselves are not this phase unless the owner says so (question 1 of §8).
6.2 A second machine with another token (B1)
A single other token needs nothing new in the code: it is phase 1's install. What docs/operations.md lacks
for it, and B71 adds:
| Lacking | Why it matters on the second machine |
|---|---|
The install without a capture: make up with the token, and the first load by the backfill job | The page's only path goes through the capture, which exists to keep 2021 (P1 §6.4); a new token after 31 December 2026 has nothing to keep that the first load does not read. The live first load by the worker has run on generated data only |
What a token of a business login looks like: many points, points without children, monthly-read points (not loaded, P1 §4.5), points without a price area and make set-price-area for many | The owner's token is a private person's with one tree |
How long a first load takes for n points, and what make status shows meanwhile | P1 §6.6 gives the owner's numbers only |
Linux, tried: the tools, the docker group, the systemd unit | "Not tried" today |
The Colima DNS workaround (orchestration/WORKERS.md), where it is needed | Without it the first make up cannot pull an image |
That the two machines share nothing: no token, no data/, no database is copied; each machine has its own token from eloverblik.dk; the same public address shares Energi Data Service's budget (§2.2) | A copied .env would put one token on two machines |
A check before the first call, make doctor: the tools and their versions, Docker reachable, the checkout under the home directory, .env present with mode 0600 and one line, the state directory's start check | Each was found by failing in B19's trial |
6.3 Several tokens in one install (B2)
**Decision: an account is one refresh token; a company has one or more accounts; the first account stays the
token of .env, and every further token is a file in data/state/tokens/, written by make token-add.**
Reason: no token enters the database, as in phase 1; the state directory is already private and mounted by the
worker alone (N9). Rejected for this phase: the sealed store (§6.1); several variables in .env (a token's
label and company would have to live in a variable's name).
| Rule | Detail |
|---|---|
| The token files are secrets | The start check (P1 §5.2, N9) treats every data/state/tokens/*.token and every per-account access-token file as it treats the two token files of today: mode 0600, no ACL entry, this user's, or the mode refuses to start |
make token-add LABEL=<label> PARTY=company|private [COMPANY="<name>"] | Runs on the host after the start check; reads the token from standard input, never from an argument or the environment, and never prints it. The label matches [a-z0-9][a-z0-9-]{0,30} and is not env. It reads exp and tokenType only and refuses another token type, and refuses a token whose fingerprint is that of another token file or of the .env token. It writes <label>.token by the private atomic replacement of the access-token file, with its frame hygiene (elo_sources.eloverblik.token, replace_atomically(private=True)), and <label>.json (party kind, company name) |
| The company's name | COMPANY is taken only with PARTY=company. For a private account no free text is stored: its company's name is the label |
| A worker without the real token | A worker started with an empty ELOVERBLIK_REFRESH_TOKEN (make demo, the demo load, make load-capture, the capture rehearsal) never reads data/state/tokens/, and its first log line says so |
| The worker at its start | For the .env token and each token file: the fingerprint is compared with ingest.source_account (P1 §5.2 step 0). A new label makes an account and, for a new name, a company; a known label with a new fingerprint is a new credential generation of the same account |
| Storage | core.company (PK company_id int; name text unique). ingest.source_account gains company_id int NOT NULL and a unique label; the .env account has the label env, and its company is named "Egen konto", or by ELO_COMPANY_NAME when ELO_ACCOUNT_PARTY_KIND is 1. ingest.account_mp (PK (account_id, mp_id); first_listed_at ts, last_listed_at ts): which account lists which point |
| Pace | One ingest.pacer row for all accounts: one request in flight, one spacing, one token-call spacing (P1 §5.2). An access-token file per account. A batch holds chunks of one account (P1 §6.1) |
| Runs | The daily and weekly run take the accounts in the order of account_id, each as P1 §6.5; the backfill takes due chunks of any account, newest first. An invalid account stops its own jobs only |
| A point two accounts list | It belongs to the account that listed it first (core.metering_point.account_id) and is fetched with that account's token only; the other listing is a row of ingest.account_mp, reported by make status |
| The pages | meta.context returns the accounts with company, state and days left; account.state is the worst of them and the notice names the company ("Selskab A: nyt token nødvendigt"). The state multiple_accounts no longer exists. company becomes a dimension (§3.5) |
| Party kind | Set at make token-add. Beyond the company's name it changes nothing that is stored in this phase: no person's name is stored for any account (P1 §7) |
| The capture tool | Unchanged: it serves the .env token |
| The demo | The generator gains a second company with its own account, so that the company dimension and the account notice are tested and seen in make demo |
make account-remove LABEL=<label> runs as elo_owner (the worker's role may not delete readings, P1
§3.4), after a confirmation and with the worker stopped, in one transaction, then the files:
| Step | Detail |
|---|---|
| What goes | The account's rows in ts.*, core.mp_version, core.mp_geo, ingest.chunk, ingest.mp_state, ingest.account_mp, then its core.metering_point rows; raw.payload and raw.fetch_item by the point and by the fetch's account (a list response is of no point); what ops.job, ops.job_run and ingest.capture_import hold of the account; the account, and a company left without one; ops.data_version is raised. Then <label>.token, <label>.json and the account's access-token file |
Its raw.fetch rows are deleted | Reason: they hold internal IDs and times only, but they are the record of calls made with a token that is now gone, about points that no longer exist; "nothing of the account is in the database" can be checked, "nothing personal is" cannot. The pacing history they would serve lives in ingest.pacer |
| A point two accounts list | Its data go with the account it belongs to, when that is the one removed: the other account's next run finds the point new and loads it under its own token. Nothing fetched with a removed token stays. When the removed account is the other lister, only its ingest.account_mp row goes |
LABEL=env | Refused, with the sentence: the first account is removed with the database, by make purge (P1 §12.1), after its line is taken out of .env |
| What it says at the end | What it cannot reach: the owner's own copies and backups |
6.4 The measurement at 500 metering points (B3)
The measurement comes first: no fact is stored and no aggregate built before B73 has reported (ruling 5).
| Aspect | Detail |
|---|---|
| The organisation | Generated, in a database of its own: 500 metering points over the six years 2021 to 2026 (2 191 days). 420 roots, 360 hourly and 60 quarter-hourly; 20 of the hourly roots carry the three children of the owner's tree (D15 and D07 hourly, D06 quarter-hourly); 20 quarter-hourly roots carry a D06. That is 400 hourly and 100 quarter-hourly series: 400 × 2 191 × 24 + 100 × 2 191 × 96 = 42.1 million readings; both price areas; factors, prices and mix generated (§2.5) |
| The load | A bulk path of the generator, as elo_owner, in that database only; make verify (P1, B08a) on a sample of series shows that summaries and hashes are those ts.apply_day would have written |
| What is predicted | A year of the 420 roots at hour level is 360 × 8 760 + 60 × 35 040 = 5.26 million reading rows, above ELO_ROW_BUDGET (2 000 000) before the comparison is counted: every figure made from readings (G01, K01, the sources, the like-for-like variances, the heat map) answers too_large_for_grain for all roots beyond about four and a half months, and beyond about two with a comparison. E01 by day or month reads ts.day_load and should hold |
| What is measured | For every query of every page: the seconds, warm, as elo_api through HTTP, the median and the slowest of five; for the periods 30d, ytd, 12m and the six years; for the selections all roots, a list of 100 roots, one price area and one root; with the comparison py and none; with the row budget on, and with it off to show what it protects against. Also: the load rate, the size of every table and index, the daily run's row updates, make status |
| The verdict | A query breaks when the default view of its page (ytd, all roots, py) answers too_large_for_grain or does not answer within the API's timeout (30 s, docs/queries.md). The report names the query that breaks first as the number of roots grows (the measurement is repeated at 50, 150 and 420 roots), and for each broken query what would hold it: a higher budget, a stored fact and its grain, a different grain of the page |
| The record | docs/adr/ADR-004-scale-at-500.md, with every number and the lead's decision. No statement about scale is made in the README or the documentation before it exists |
6.5 What follows the measurement (B4): named, not specified
| Named | Decided by |
|---|---|
| Stored facts for what ADR-004 names: the candidates are the day and month facts of S §2.7 for emissions, cost and sources, and a stored matched measure (P1 §1.4) | ADR-004 |
| A point picker with search, a ranking with a remainder row (manual §12), paging | The number of points; needed from a few dozen |
Geography as dimensions (municipality, postcode, city) for company accounts, with ref.municipality | §3.5; question 5 of §8 |
| A read of a real business login, read-only, with a report of what differs from the owner's tree (S §10.2, B28) | Question 4 of §8 |
| Several requests in flight (P1 §1.4, first row) | The latency the first loads of B71 and of a business login measure |
| A figure for production points (E18) and self-consumption | The business login's report |
7. Delivery
7.1 Rules for every epic
Those of P1 §13.1: naming, the definition of done, generated data only for a worker, sizes S and M. Further:
- A worker's acceptance criteria need no owner's data, no real token and no second machine. What runs on those is the lead's, in the column "The lead's validation", recorded without figures; an epic is merged on its criteria and the phase exits on the validations (§7.4).
- An epic brings the documents of what it changes up to date:
docs/queries.md(every epic that changes a query),docs/pages.md(every page epic),docs/declarations.mdanddocs/daily-run.md(B51, B52, B53, B76),docs/time-rules.mdanddocs/emission.md(B55: the correspondence, and the comparison parameter ofcalc.emission_matched),docs/operations.md(B71, then B52 and B53 for the jobs, B72, B75), and two new pages,docs/cost.md(B56) anddocs/mix.md(B58). - A new query's response is declared column by column as the privacy guards require (
docs/queries.md); every epic that reads time runs its tests underTZ=UTCandTZ=America/Los_Angeles; no epic calls Energi Data Service or Eloverblik.
7.2 The epics
Wave A, in an order they can merge.
| Epic | Scope | Acceptance criteria | The lead's validation | Depends on | Owns | Size | Agent · model · effort | Review |
|---|---|---|---|---|---|---|---|---|
| B51 One pace, a loader for any dataset | §2.2; the loader of P1 §8 driven by a description of a dataset (key columns, value columns, table, set or row replacement); slices; a first load inside the daily job | Against a local replay server: the last call of one dataset's job and the first call of another's are at least 60 s apart; a 429 answered to one dataset delays the next call of every dataset by its Retry-After plus 10 s; a job given 31 windows applies 30 and queues its successor under a dedup key the scheduler's own does not collide with, and a daily job due meanwhile runs before that successor; the tests of the declaration loader pass unchanged in their assertions | On the owner's stack after the merge: raw.fetch holds no two calls to the service within a minute over a day | – | ingest.service_pace; elo_worker/eds/, elo_worker/queue.py, schedule.py while it runs; migrations 0190–0194 | M | Claude · Opus · high | Codex high |
| B54 The selection in the contract | §3.5, §4: sel, the function that resolves it, meta.context.dimensions and hasExport, the E03 and ENET measures from ts.day_load. Not the company dimension | On the demo organisation: meta.context offers a dimension exactly when the roots hold two or more values of it, and none in a database with one root; sel with an unknown key, company among them, is 422; two values of one dimension select the union and two dimensions the intersection, and mp narrows further; a selection by sel of E18 roots only answers empty with no_consumption_point, and an E18 in mp answers 422 not_a_consumption_root; a query that does not take sel answers 422 to it; no query file names a field the specification's selection table calls "never" (the catalogue's refusal test lists them); E03 of a root without an export child is unavailable, not zero | – | B20 (merged) | The catalogue, runner.py, budget.sql, queries/meta/; migrations 0195–0199 | S | Claude · Sonnet · high | Codex high |
| B52 Spot prices | §2.1, §2.3, §2.4 for the two price datasets; the jobs eds-prices and eds-prices-monthly; the generated extract of §2.5 and its loading by make demo, the demo load and CI; the lines of make status | On the generated extract, without a network call: the local days 30 September and 1 October 2025 of DK1 each have 1 440 priced minutes and no interval twice; the table refuses an hourly row at 2025-09-30T22:00Z and a quarter row before it; a null price is not stored and is counted by make status, which expects hours before the seam and quarters from it; a negative price is stored with its sign; a changed price leaves a history row with cause 1 and raises ops.data_version once; after make demo every row of price.spot is generated and no call was made | The first load on the owner's stack: 10 calls; make status shows no expected interval without a price | B51 | price.*; the worker's status.py, schedule.py, the generator, the demo load, the Makefile and the CI workflow, while it runs; migrations 0200–0209 | M | Claude · Sonnet · high | Codex high |
| B66 One name for the comparison | §4: the columns py… of every query of phase 1 renamed cp…, the roles CP, ΔCP, ΔCP %, the response's comparison block, runner.py's condition; the web's readers; docs/queries.md | Its first commit is a fixture: the answers of every query of phase 1 on the demo organisation, for a fixed list of parameters, cmp=py and cmp=none. After the rename every answer equals the fixture, value for value, under the new names; no query, reader or document holds a py-named comparison column; the web's unit tests and the Playwright suites of the three pages pass | – | B54 | The catalogue, runner.py, the web app's src/shared/, docs/queries.md; migrations 0210–0214 | S | Claude · Sonnet · medium | Agy |
| B53 Grid mix | §2.1, §2.3, §2.4 for the mix; the three reference seeds; the jobs eds-mix, eds-mix-weekly, eds-mix-monthly; the generated extract and its loading by make demo, the demo load and CI; the lines of make status | On the generated extract, without a network call: a reload of a window in which an hour has fewer rows leaves exactly the response's rows for that hour; an hour absent from a reload is removed; the 17 codes map to the 8 groups of the specification's table; an unknown code, an unknown connected area and a negative share are stored and listed by make status, which counts the hours that are not complete by version; the first load proceeds newest first and resumes after a kill without asking a window twice; after make demo every row of fx.mix_hour is generated and no call was made | The first load on the owner's stack; the lead records from which day the hours are complete, by version | B52 | fx.mix_hour, ref.mix_group, ref.mix_code; the files B52 held; migrations 0215–0224 | M | Claude · Sonnet · high | Codex high |
| B55 Comparison periods | §3.4 without the heat map: cmp widened, the correspondence by offset and by whole months, the matched functions and the bucket functions taking any comparison, the row budget's comparison days | SQL equals the Python reference on the demo organisation for pp and from: over a period that holds both clock-change days, and over April against March and March against February: every comparison day is in one bucket by day and by month, and the buckets' variances sum to the period's; with cmp=py every answer equals B66's fixture; a comparison that does not end before the period is 422 comparison_not_earlier, with a preset too; one hour missing on the comparison side gives h = H − 1 and a variance over the other cells, never the whole hour's energy; the row budget counts the comparison's own days | – | B66 | The catalogue, runner.py, budget.sql; migrations 0225–0239 | M | Claude · Opus · high | Codex x |
| B67 The heat map's comparison | §3.4: the second set of cells and margins, the variance over the roots with a mean on both sides | On the demo organisation, SQL against the Python reference: the period's cells equal B20's; a root with a mean on one side only is in that side's cell and not in the variance, and rootsMatched says so; a cell with no root on both sides is i.r.; the margins are sums over the roots of each root's own mean, not means of cells; a period with both clock-change days counts the repeated hour twice and the missing hour not at all | – | B55, B20 | The heat map query; the catalogue while it runs; migrations 0240–0244 | S | Claude · Opus · high | Codex high |
| B56 Cost calculation | §3.2: calc.spot_price, the cost of an interval, the matched comparison with a price on both sides, the two effects at the hour's grain; the Python reference; golden cases | The worked example of the specification's cost section, figure by figure, as golden cases: 2,00, −0,30, no cost for the hour with three quarters, 1,70, 0,34, 2,12 for the quarters, effects +1,00 and −0,60; an hour of four quarters against one hourly value, and an hour of zero energy on either side, have two effects that sum to the cell's variance; SQL equals the reference on the demo organisation to the last decimal, with no division but K03's; an hourly reading before the seam, a quarter before it, a quarter after it and an hour after it each take the price the specification's table names | – | B52, B55 | New files only: elo_core/cost.py, its SQL functions, docs/cost.md; migrations 0245–0254 | M | Claude · Opus · high | Codex x |
| B57 Cost in the aggregate queries | §4: K01 and K03 in overview.cards, the cost measures in overview.months and development.series, the basis.price block, excluded_price | Through HTTP on the demo organisation: every response with a cost names basis.price and priceSource, the comparison period's rows included, and generated prices are never energinet; a period whose last two days have no price returns the cost of the priced intervals, the unpriced share and hours, and a variance over matched cells with excluded_price above zero; K03 is i.r. when no priced interval has energy; the two effects of every bucket sum to its like-for-like variance; a query above the row budget answers too_large_for_grain | The owner's stack shows the cost card's query answering; no figure recorded | B56 (after B67 in its lane) | The catalogue, runner.py, budget.sql; migrations 0255–0264 | M | Claude · Sonnet · high | Codex high |
| B68 The split and the point's cost | §4: energy.split, mp.cost_intervals | Through HTTP on the demo organisation: energy.split returns three rows for a selection with an export child, with net = bought − sold in energy and in cost, and the bought row alone for one without; KNET is no figure where either part is none; mp.cost_intervals returns 745 hours for 1–31 October 2026, the mean of four as the price of an hourly interval after the seam, afventer pris for an interval without a price, and unavailable with not_a_load for a D15 | – | B57 | The catalogue, budget.sql; queries/energy/, queries/mp/; migrations 0265–0269 | S | Claude · Sonnet · high | Codex high |
| B58 Sources calculation | §3.3: completeness, source energy with its residual, groups, E07, E11a, E11b, origin, status, the matched comparison with a complete mix on both sides; the Python reference; golden cases | The worked example of the specification's sources section as golden cases: 3,02 kWh, 75,5 %, 80,5 %, and the pending hour outside numerator and denominator; an hour summing to 999 899 is pending, one summing to 999 900 is complete, and one with a negative share is pending whatever its sum; for an hour whose shares sum to 999 989 the groups sum to the hour's energy exactly, the residual in the largest group; SQL equals the reference on the demo organisation to the last decimal; a selection in both price areas equals the sum of its two halves; under basis=final a complete Preliminary hour is outside the figures and its status share is unchanged | – | B53, B55 | New files only: elo_core/mix.py, its SQL functions, docs/mix.md; migrations 0270–0279 | M | Claude · Opus · high | Codex x |
| B59 Queries of the sources | §4: mix.structure, mix.series, the basis.mixStatus block, excluded_mix, the mix blocks of report.footprint | Through HTTP on the demo organisation: mix.structure returns the eight groups in the order of ref.mix_group.sort, whose energy sums to the consumption of the complete hours and whose shares sum to 1; by=origin sums to the same energy, largest first, an unknown area under its code; a period that ends in incomplete Initial hours reports them as pending; a period with no complete hour answers unavailable with no_mix; the variance of E11a is over matched cells, with excluded_mix; generated rows are never energinet; the sum per price area and hour is a materialised step of the query before the mix is joined, asserted on the function's text; a year of every root of the demo organisation with its previous year answers within 10 s in CI; report.footprint returns the named mix rows | The owner's reports with a mix snapshot of their day: per block "match" or the residual | B58 (after B68 in its lane) | The catalogue, runner.py; queries/mix/, queries/report/; migrations 0280–0284 | M | Claude · Sonnet · high | Codex high |
| B60 Shell II | §5.5: the dimension controls, the comparison control with its date, the address, the first and third title lines, kr. in the formatting module, PP in the key | Web unit tests and Playwright on the demo organisation at 390 and 1 280 px: a dimension chosen round-trips through the address and narrows every figure of the page; a dimension the data does not offer is absent, and a filter in the address is shown as active all the same; "Nulstil filtre" clears dimensions, points and the comparison date; cmp=pp and a chosen date round-trip; a comparison picked later than the period is swapped where the swapped pair is valid, and otherwise not asked for, with the control's sentence; the code printed is the response's comparison.code; 1.234,50 kr. and −0,34 kr./kWh come from the one module | – | B54, B55 | web/packages/shell, the app's src/shared/ | M | Claude · Sonnet · high | Agy |
| B61 Pages X1 and A1: cost, coverage line, the split | §5.1; §5.2 without the heat map's variance | Playwright on the demo organisation through Caddy at 390 and 1 280 px in the three themes, without console errors or horizontal overflow: the third card is "Elkøb til spotpris" with "uden tariffer, afgifter og moms" and no card shows coverage; the coverage line is the first caveat of both pages and opens D1 for the point it names; a period with unpriced hours shows their share and hours; "Købt, solgt, netto" is shown exactly when a selected root has an export child, and net stands last; the label "Elforbrug fra nettet" stands wherever "Elforbrug" stood; the notation block of the manual's checklist (§18) passes by script | The owner's stack is shown to the owner with its address | B57, B68, B60 | The directories of the two pages | M | Claude · Sonnet · high | Agy |
| B62 A1: two periods on the heat map | §5.2: the variance heat map with its margins, the effect bars | Playwright and unit tests on the demo organisation, under both test time zones: the variance view draws 168 cells in the two impact colours by the measure's polarity with the page colour at zero, and its legend gives the class limits; a cell and a margin without a root on both sides read i.r., and one that rests on fewer roots than a side holds carries the missing symbol; pointer, keyboard and the table view give both sides with their roots and hours; with fewer than two weeks in either period there is no message from the variance; the two effect bars and their bold sum equal the query's three columns; at 390 px the page does not scroll sideways | – | B61, B67 | The heat map component; the A1 directory after B61 | M | Claude · Opus · high | Codex high |
| B64 D1: price and cost | §5.3 | Playwright on the demo organisation: the switch shows three tiers on one time axis with a negative price below the zero line and a negative cost pointing down; an interval without a price is an empty band with afventer pris; an hourly interval after the seam shows the mean of four as its price; the table has price and cost in kr. from the one formatting module; the clock-change days keep 23 and 25 intervals | – | B68, B60 | The point page's directory | S | Claude · Sonnet · high | Agy |
| B63 Page A4 Elmix | §5.4, with the wording rules of §3.3 | Playwright on the demo organisation at 390 and 1 280 px in the three themes: the fixed caveat is the first caveat, word for word; no fixed text of the page's strings module contains grøn, din vedvarende, neutral or 100 % (a unit test over the module); title line 2 names a share in % and the table view gives kWh; the eight groups stand in the query's order with the comparison behind and the variance in percentage points; a period with pending hours shows their share and hours, and one with no complete hour Ikke tilgængelig; generated data are not attributed to Energinet; the checklist's notation block passes by script | – | B59, B60 | The new page's directory, the route | M | Claude · Sonnet · high | Agy |
| B65 Design application II | The changed pages and the new one brought to docs/design/direction.md | Every line of the manual's checklist (§18) is true for the four pages, the first block by script; axe reports no serious finding; screenshots at 390 and 1 280 px in the three themes are under docs/build/B65/ | The lead reviews the screenshots and shows them to the owner | B61, B62, B63, B64 | The app's direction.css | M | Claude · Fable · high | The lead; then the owner's view |
Wave B. B71 can start at once, beside B51.
| Epic | Scope | Acceptance criteria | The lead's validation | Depends on | Owns | Size | Agent · model · effort | Review |
|---|---|---|---|---|---|---|---|---|
| B71 A second machine | §6.2: the live first load without a capture, make doctor, docs/operations.md | On the demo source with a real stack: make up on an empty database loads the organisation by the backfill job alone, and make status shows the progress; make doctor fails with one named reason for each of: a missing tool, Docker not reachable, a checkout outside the home directory, .env with mode 0644, .env with two lines | A machine that never held the repository, from the page alone, with another token: the pages show that token's points, and the page's list "Not tried" names only what was not | – | docs/operations.md, a new module of elo_devtools, the Makefile while it runs | S | Claude · Sonnet · high | Agy |
| B72 Token files and accounts | §6.3: the start check for the token files, make token-add, core.company, the account's columns, ingest.account_mp, the worker's accounts at its start, the worker without the real token | The start check refuses, in each mode, a tokens/*.token and a per-account access-token file of mode 0640 or with an ACL entry; make token-add given the token on standard input writes a 0600 token file and its .json, prints no token, and the process list and the captured logs hold none; it refuses a label env, a label with / or .., a wrong token type, a fingerprint another file or .env holds, and COMPANY with PARTY=private; a token replaced under a known label raises that account's generation only; a worker started with an empty token variable beside a sentinel token file never opens it and says so in its first line | – | – (after B53 in its lane) | core.company, ingest.account_mp; statedir.py, token.py, elo_devtools/state_dir.py, the Makefile while it runs; migrations 0285–0294 | M | Claude · Opus · high | Codex x |
| B76 Several accounts running | §6.3: the shared pace, the runs per account, a point two accounts list, make status per account, the second company of the demo | On the demo source: two accounts load side by side and no two calls of either are closer than the spacing, token calls included (PT-02 and PT-13 with two accounts); a second account's invalid token stops its jobs and not the first's; a point listed by two accounts is fetched under the first only, has one row of ingest.account_mp per lister and is reported by make status; make demo holds two companies | With a second real token, when the owner has one: both accounts' daily runs succeed | B72 | The worker's Eloverblik runtime and jobs, status.py, the generator; migrations 0295–0299 | M | Claude · Opus · high | Codex x |
| B73 The measurement at 500 points | §6.4 | docs/adr/ADR-004-scale-at-500.md holds every number the specification's measurement table asks for, at 50, 150 and 420 roots, the query that breaks first, and for each broken query what would hold it; make verify passes on the sampled series of the bulk load; the measurement is one command that a second run repeats within a tenth of its seconds | The lead decides the remedy in the ADR | B59 | New files only: the generator's bulk module, the measurement tool, the ADR; migrations 0300–0304 only if the bulk path needs one | M | Claude · Opus · high | Codex high |
| B74 Accounts on the pages | §6.3: meta.context with the accounts, the notice per company, the company dimension in sel and in the shell | On the demo with two companies: the dimension "Selskab" is offered and narrows every figure; with one company's token invalid the notice names that company and the other's figures stand; with both valid no notice; the state multiple_accounts is returned by no query | – | B54, B76, B60 (after B59 in its lane) | The catalogue, runner.py, queries/meta/; the shell's notice; migrations 0305–0309 | S | Claude · Sonnet · high | Codex high |
| B75 Removing an account's data | §6.3: make account-remove | On the demo with two companies and sentinel values in one account's master data: after the command no row of any table refers to the account, raw.fetch included, a search of every table and stored body finds no metering point ID, address or sentinel of it, its .token, .json and access-token file are gone, ops.data_version is higher, the other company's figures are what they were to the last decimal, and make verify passes; a point both accounts list is gone with its owner and is loaded again by the other's next run; LABEL=env is refused with the sentence that names make purge; without the confirmation nothing changes; with the worker running the command refuses | – | B76 | A new module of elo_devtools, the Makefile while it runs; migrations 0310–0314 | S | Claude · Opus · high | Codex x |
7.3 Ownership, migrations, order
Blocks of migration numbers are in the tables: from 0190, ascending in the order the epics can merge; an epic stays inside its block, the lead sets the parent revision when merging, CI fails on two heads (P1 §13.3). An epic creates only the tables of its "Owns".
A shared file has one holder at a time. The files several epics change are named in "Owns" with "while it runs" or held by a chain; the lead starts an epic only when the one before it in its lane has merged. Three lanes, so at most three workers at once:
| Lane | Shared files | Order |
|---|---|---|
| The worker and the tools | The worker's status.py and schedule.py, the generator, the demo load, the Makefile, the CI workflow, the state directory's modules | B51 beside B71 → B52 → B53 → B72 → B76 → B75 |
| The named queries | The catalogue, runner.py, budget.sql | B54 → B66 → B55 → B67 → B57 → B68 → B59 → B74 |
| The web app | web/packages/shell, src/shared/, the A1 directory | B60 → B61 → B62 → B65; B64 and B63 beside B62, each in a directory of its own |
B56, B58 and B73 own new files only and run beside any lane, each after what it depends on. Across the lanes the column "Depends on" decides: B66 waits for nothing but B54, B60 for B55, B61 for B68, B63 for B59.
7.4 Exit of phase 2
Wave A:
- On his own data the owner sees the cost of his purchase at the spot price as the third card, the energy bought, sold and net, the grid's mix in the hours of his purchase with the wording of §3.3, and two periods compared by month and by weekday and hour. 2. The mix figures agree with his Eloverblik report on a snapshot of its day, or the residual is recorded and the lead has decided what follows (B59's validation). 3. The same pages pass on the generated organisation in CI, the selection by dimensions among them (the owner's install, with one root, offers none).
Wave B:
- A machine that never held the repository runs the product with another token from
docs/operations.mdalone. 5. Two tokens of two companies run in one install, and one company's data can be removed. 6. ADR-004 names the query that breaks first at 500 metering points, and the lead has decided the remedy; the remedy is the first epic of the next plan.
8. For the owner
| # | Question | Recommendation | Until it is answered, the specification assumes |
|---|---|---|---|
| 1 | Skal dine kunder selv kunne logge ind og se deres data, eller ser du alene på kundernes data på din egen maskine? | You alone, in this phase. Customers who log in need login, roles, row-level security and a sealed token store: a phase of its own | You alone, on loopback (§6.1) |
| 2 | Må sammenligningsperioden altid have samme længde som perioden (hele måneder mod hele måneder, ellers samme antal dage)? | Yes. March against February works as whole months, with the three extra days named; two free ranges would show a variance that is mostly the calendar | Yes (§3.4) |
| 3 | Omkostningen er nu kun spotprisen. Skal den fulde pris (tariffer, afgifter, abonnementer) være det næste, og kan du give en regning for en måned med sommertidsskift? | Spot price now; the full price after wave B, with one bill to check it against (P1 §14 row 5) | Spot price only, and every label says so (§3.2) |
| 4 | Har dine kunder ét token for hele selskabet (erhvervslogin) eller flere, har de produktionsmålepunkter (E18), og må et af deres tokens læses én gang, skrivebeskyttet, på din maskine? | Yes to one read of a friendly customer's token before anything is said about scale: the generated 500 points show the load, not what a real company's master data looks like | Generated data only; E18 points in no figure (§1.3, §6.5) |
| 5 | Udvalget tilbyder målepunktstype, selskab, prisområde, nettoafregningsgruppe, afregningsform, måleinterval, anlægstype, tilslutningsstatus og elvarme, hver kun når data har mere end én værdi. Kommune og by kun for erhvervskonti, senere. Mangler du en? | The list as it is. With your own single consumption point none is offered: the address is the whole selection | The list of §3.5 |
Two answers the owner asked for, which need no decision. "Kan jeg filtrere i children?": the three children cannot tell house, car and panels apart, because no meter measures them [LF]; they give bought, sold and net, which wave A shows. "Min grønne andel?": the page gives the renewable share of the grid's mix in the hours of your purchase, by Energinet's rule; it is called that, and not green, because it documents no purchase of renewable electricity (§3.3).
9. The sentences of phase-1.md that change
Each is changed by the epic named, in the change that builds it; the lead writes the new sentence into
phase-1.md when the epic merges.
| # | Where | The sentence today | Becomes | Epic |
|---|---|---|---|---|
| 1 | §1.2, the jobs table; the worker row | The declaration's two jobs run in a lane of their own | Every Energi Data Service job runs in that lane, in slices; the five jobs of §2.1 | B51–B53 |
| 2 | §1.3, settings and commands | The settings and the commands of phase 1 | adds ELO_EDS_SPACING_S 60 (a setting of migrate, installed in the database) and ELO_COMPANY_NAME; make doctor, token-add, account-remove | B51, B71, B72, B75 |
| 3 | §2, row "Comparison with the previous year" | The only comparison | One of three kinds; the others correspond by offset or by whole months (§3.4) | B55 |
| 4 | §3.2, ingest.dataset_state | next_start_at, cooldown_until are the pace of a dataset | They are no longer read; the pace is ingest.service_pace (§2.2) | B51 |
| 5 | §3.2, ingest.source_account | "one row in phase 1" | One row per token, with company_id and a unique label; ingest.account_mp beside it (§6.3) | B72 |
| 6 | §3.3, last paragraph | "Children are loaded and shown on D1 with their role" | adds: the export child's series is the measure E03, shown beside E01 and subtracted from it only in the figure named net (§3.1) | B54 |
| 7 | §5.2, /token answers 401, 403 or 50001 | "The account becomes invalid; Eloverblik jobs stop" | That account's jobs stop | B76 |
| 8 | §8, row "Pace" | "At most one data call per dataset per minute, reserved in ingest.dataset_state.next_start_at" | At most one call to the service per ELO_EDS_SPACING_S, reserved in ingest.service_pace (§2.2) | B51 |
| 9 | §9.3, calc.emission_matched(…, cmp_date_from, …) and calc.consumption_matched | Cells correspond by month, day, clock hour and occurrence | The correspondence is a parameter; py keeps this rule | B55 |
| 10 | §9.4, row "Not in phase 1" | "Renewable share, source and origin splits, the municipality report" | The municipality report only; the others are rows of report.footprint (§4) | B59 |
| 11 | §10.1, parameters | cmp (py, none); mp; measure (E01, G01) | cmp gains pp and from:<date>; sel beside mp on the queries of §4; the measures of §4 | B54, B55, B57 |
| 12 | §10.2, "A column also names its scenario code (AC, PY) or variance (ΔPY, ΔPY %)" | The code is a property of the column | A column names its role (AC, CP, ΔCP, ΔCP %); the response's comparison names the code; the comparison's columns are cp… (§4) | B66 |
| 13 | §10.2, the response | basis has factorStatus and matched | adds price, priceSource, mixStatus, mixSource; matched gains excludedPrice, excludedMix | B57, B59 |
| 14 | §10.3, row "Row budget" | "Σ over its series of days × points a day" (with a comparison, the previous year: docs/queries.md) | The series a query reads, export children included where it reads them, over the period and the comparison period's own days | B55, B57, B68 |
| 15 | §10.4, meta.context; overview.cards; overview.months, development.series; overview.mp_variance; report.footprint | "the account's MPs as a plain list"; four rows; the measures E01 and G01; the previous year; the blocks of phase 1 | adds the dimensions and hasExport; six rows; the measures of §4; any comparison; the mix rows | B54, B55, B57, B59 |
| 16 | §10.4, the account's state | One account's state (and multiple_accounts in docs/queries.md) | The worst state of the accounts, named by company (§6.3) | B74 |
| 17 | §11.1, X1 | "Three plain cards (D15): Elforbrug, Scope 2 el … Datadækning"; "the coverage card → D1" | Elforbrug fra nettet, Scope 2 el, Elkøb til spotpris; coverage is the first caveat and opens D1 (§5.1) | B61 |
| 18 | §11.1, A1 | "The heat map and the load duration curve of the prototype are phase 2" | Coverage is its first caveat too; the heat map is B20's, with a variance view (§5.2); the load duration curve is not built | B61, B62 |
| 19 | §11.1, D1 | "three tiers on one time axis, consumption per interval, the emission factor, emissions per interval" | A switch between those and consumption, price and cost (§5.3) | B64 |
| 20 | §11.1, row on polarity | "consumption, emissions and intensity −1, coverage +1" | adds: cost −1, a price 0, energy sold and net 0, the renewable share +1 (manual §3) | B57, B59 |
| 21 | §11.1, "The three pages" | Three pages | Four: A4 Elmix (§5.4) | B63 |
| 22 | §12.1, rows "Refresh token" and "Access token" | "Only in the owner's git-ignored .env"; one access-token file | The first in .env, every further one a 0600 file in data/state/tokens/; an access-token file per account | B72 |
| 23 | §12.1, row "State directory" | The directory holds the two access-token files, the egress ownership and the handoff record | adds tokens/, whose .token files and the per-account access-token files the start check holds to the rule of a secret (§6.3) | B72 |
| 24 | §12.1, rows "Personal data" and "Retention" | "Phase 1's only account is a private person's"; kept until make purge | Several accounts, each with a party kind; one account's data is removed by make account-remove, the first account's by make purge (§6.3) | B72, B75 |
Outside phase-1.md: docs/queries.md, "The previous year", is read for every comparison with the rule of
§3.4 for months of unequal length (B55), and loses the state multiple_accounts (B74). For the lead under D8:
the manual's §2 defines PP as "the period of the same length immediately before"; it becomes "an earlier period
that takes its length from the period: by default the one immediately before; where the reader chose its start,
the third title line gives its dates" (§3.4). The manual's §10 describes the heat map of days by hours; the
weekday by hour form is B20's to add there.
The static read A3v: what was done
All 18 findings were accepted by the lead, with rulings (orchestration/tasks/a3f-phase-2-fixes.md).
| Finding | What was done | Where |
|---|---|---|
| A3v-01 tokens | The token files are secrets of the start check; the label's form, the private atomic write, the refusal of a known fingerprint; a worker without the real token never reads tokens/; no free-text name for a private account; the row for "State directory" | §6.3, B72, §9 row 23 |
A3v-02 make account-remove | Runs as elo_owner; removes all three files, the raw rows by the fetch's account, the job and capture rows; raw.fetch rows deleted, with the reason; env refused; the rule for a point two accounts list; ingest.account_mp | §6.3, B75 |
| A3v-03 exact decimals | × 0.001 and × 0.25; the source energy as one integer division with a stated rounding and a rule for the residual; ratios at 9 decimals | §3 "Exactness", §3.2, §3.3 step 2, B56, B58 |
| A3v-04 comparison | Months of unequal length by the rule of February; one name cp… and the code once per response, in an epic of its own; the swap only where valid; from: with a preset | §3.4, §4, §5.5, B66, B55, B60, §9 rows 12, 14 |
A3v-05 company | The dimension is B74's; sel on eight named queries; an E18 in mp keeps its 422, a selection by sel answers empty; B73 measures a list of 100 roots and needs no company | §3.5, §4, §6.4, B54, B74, B73 |
| A3v-06 shared files, migrations | Phase 2 starts at 0190, blocks ascending, B73's after B72's; three lanes with one holder of each shared file; B52 before B53, B57 before B58 | §0, §7.2 "Owns", §7.3 |
| A3v-07 mixed resolutions | The effects at the hour's grain, with the hour's own price and no quotient, so that zero energy needs no rule of its own. This departs from the advice's "cost ÷ energy" to keep A3v-03 | §3.2, B56 |
| A3v-08 | 83 230 rows; the five jobs with their slots; the first load inside the daily job; the successor's dedup key and run_after; expected intervals on both sides of the seam; generated on the history table; the rows for P1 §1.3 and §3.2 | §2.1, §2.2, §2.3, §2.4, §9 rows 2, 4 |
| A3v-09 missing prices | "af salget" for K02; hours with an unpriced interval counted as hours; K03 and KNET where a part is missing | §3.2 |
| A3v-10 mix status | The order of the statuses; the note under basis=final; no_mix; a negative share | §3.3 steps 1 and 7, §4, §2.4 |
| A3v-11 wording | The three English sentences; E07's Danish name; the title in %; the list a test can hold | §1.1, §3.3, §5.4, §7.4, B63 |
| A3v-12 connected areas | The seeded codes; an unknown code kept and reported; the order of by=origin | §2.3, §3.3 step 6, §4, §5.4 |
| A3v-13 contract | The rows of §9; the frontier stays the roots'; energy.split returns rows for figures only; the footprint's rows and max_rows; mp.cost_intervals for any point; asset type from ref.code, tax reduction a flag | §3.1, §3.5, §4, §9 rows 14, 15, 19 |
| A3v-14 sizes | B55 and B67; B72 and B76; B57 and B68; B64 depends on B60 | §7.2 |
| A3v-15 unbuilt | B52 and B53 wire make demo, the demo load and CI; each document has its epic; the rows for A1 and D1 | §2.5, §7.1, §9 rows 18, 19 |
| A3v-16 criteria | B66's first commit is the fixture B55 is tested against; B59 has a ceiling and a test on the query's text; a column for the lead's validation | §7.1, §7.2 |
| A3v-17 names | excluded_price and excluded_mix as columns, camel case in basis.matched; in_flight bool on purpose | §2.3, §4 |
| A3v-18 current and daily area | Said once: the selection by today's area, every calculation by each day's | §3.5 |
| The lead's own (05:48) | A cell of several roots, the margins, and the variance over the roots with a mean on both sides | §3.4, B67, B62 |
One ruling could not be written as given: A3v-16 asks B59 for "a ceiling in seconds from P1 §10.3", and P1 §10.3 sets a budget of rows, not of seconds. B59's criterion is 10 s, a third of the API's timeout; the lead may set another number.
Kilde: docs/architecture/phase-2.md i løsningens
repository.