Dokumentation · Beregningerne
The named queries (B15)
POST /api/query/{id} with {"params": {...}} runs one named query of docs/architecture/phase-1.md §10.4 and answers
with the response of §10.2. The runner, the catalogue and the SQL are in services/api/src/elo_api/analytics/
(catalog.yaml and queries/); the runner and catalogue are adapted from S&OP's analytics module without audiences
(services/api/VENDORED.md). A page contains no SQL and no arithmetic beyond formatting: every figure, variance and
ratio is a column of a query. Nothing is cached; every request runs its query. report.footprint is B12b's (below, and
docs/validation.md).
The guard of the local mode (Host, X-Elo-Client: web, elo_api.guard) comes before any route. The body is JSON, at most
16 KiB, nested at most 8 deep; the parameters are {"params": {...}} and nothing else.
Parameters (§10.1)
| Parameter | Meaning | Values | Default |
|---|---|---|---|
p | the period | 2026-01-01..2026-03-31, one day 2026-03-29, or a preset ytd, mtd, 7d, 30d, 12m that ends at the frontier of the selection | required where a query has a period |
mp | metering points | a list of mp_id (the database's integer key, never a GSRN) | the account's E17 roots. A figure's query takes E17 roots only (422 not_a_consumption_root: a parent and its children are never added, L2); the mp.* queries take exactly one point of the tree |
sel | the selection (B54, phase 2 §3.5) | an object of dimension key (company, type, area, net, settle, read, asset, status, heat) to a list of values; {} is no selection. Taken by overview.cards, overview.months, overview.mp_variance, development.series, consumption.weekday_hours, meta.selection (B67a), mix.structure and mix.series (B59), mix.profile (M4) and mix.hours (M5a), always beside mp; no other query takes it | none: every E17 root. See "The selection" below |
m | method | the codes of ref.method that are available (LB-PA-125, LB-PA-200, and from B83 LB-MU-125, the municipality method; LB-MU-200 is reserved and 422 invalid_parameter until its row is made available). A method that is offered is answered (B84): every query that takes m answers under LB-MU-125 with ok, empty or unavailable and a reason the pages can say (below, "The municipal split in the queries"), never a 422 and never the price-area figure under the municipal method's name | the first of meta.context's methods: the install's default (B93) |
gwp | GWP set | the codes of ref.gwp_set | AR5 |
basis | data basis | best, final | best |
cmp | comparison (B55, phase 2 §3.4) | py (the previous year), pp (the period immediately before), from:YYYY-MM-DD (an earlier period that starts on that day, 2015–2040), none. See "The comparison" below | py; none for consumption.weekday_hours (B67: its comparison is a second picture the page asks for) |
g | grain | auto, quarterHour, hour, day, month (mix.series has day and month; mix.hours has hour alone, so its window is at most 31 days by the 750 points: 32 days are 422 grain_too_fine) | auto |
by | the parts of the sources' structure (B59) | source (the nine groups of ref.mix_group), origin (the connected areas); mix.structure and mix.hours (M5a: the origin of one hour is by=origin over the same window) only (422 unknown_parameter elsewhere) | source |
blocks | the blocks of report.footprint (B59f) | all (phase 1's eight and the sources), emissions (phase 1's eight alone: calc.mix_buckets is not called, the answer carries no basis.mixStatus or mixSource, and the row budget is 5 300 000); report.footprint only (422 unknown_parameter elsewhere). Until B88, a municipal method with blocks=all (and so without blocks) is 422 invalid_parameter: the sources under the municipal split are not answered, and the price area's are never given under its name | all |
measure | measure | E01 consumption from the grid, E03 delivered to the grid, ENET E01 − E03, G01 Scope 2 emissions, K01 the cost of the purchase at the day-ahead price, K02 the same of the sale, KNET K01 − K02 (B57). overview.months and development.series take all seven; consumption.weekday_hours takes E01, E03, G01 and K01 (B67, B57; ENET, K02 and KNET are 422 invalid_parameter there, as K03, a card and no measure, is everywhere). See "E03 and ENET", "Cost in the queries" and "The heat map's comparison" below | E01 |
An unknown parameter, and a parameter another query takes and this one does not, is 422 unknown_parameter, never
ignored. A malformed value is 422 invalid_parameter, a missing one 422 missing_parameter, a metering point that does not
exist 422 unknown_metering_point, a first day after the last 422 invalid_period. The days a period may name are those of
ref.calendar_day, 2015–2040. Errors are {"error", "reason", "detail"?}: fixed texts and parameter names, never a figure.
An unknown parameter's name is returned in detail only when it is a plain name (a letter, then up to 31 letters, digits or
_); the client's other text is never sent back. A key repeated in the body (two p, two params) is 422
invalid_request ("a key is repeated in the body"), never the last one kept.
The response (§10.2)
{ "queryId": "development.series", "columns": [...], "rows": [...], "grain": "month", "state": "ok",
"reason": "...", "method": {"code": "LB-PA-125", "geography": "price_area", "gwp": "AR5", "co2eBasis": "gases", "dataBasis": "best"},
"comparison": {"kind": "py", "code": "PY", "from": "2025-01-01", "to": "2025-03-31"},
"basis": {"dataThrough": "2026-11-12", "frontierState": "ok", "coverage": 0.998,
"factorStatus": {"final": 0.0, "preliminary": 0.71, "initial": 0.21, "pending": 0.08, "noPriceArea": 0.0, "noMunicipality": 0.0},
"factorSource": "generated", "matched": {"hours": 7512, "hoursInPeriod": 7680, "excludedReadings": 96,
"excludedFactor": 72, "reason": null}, "boundary": "physical"},
"scale": {"kWh": {"max": 1234.5}}, "truncated": false, "dataVersion": 4711, "calcVersion": "1.0.0" }
- One transaction. Each request is one
REPEATABLE READread-only transaction as the one local user, so every figure, the basis block and the data version come from one state of the data. It runs without JIT (SET LOCAL jit = off, B57): the functions the queries call are planned without it (B77), and a statement of several CTEs over them is estimated abovejit_above_cost(a function's rows are guessed at 1 000 each) and was compiled for seconds (2.4 s of the 4.1 s KNET took by month on the demo organisation); the setting ends with the transaction. It is every query's, not the cost's alone. - Columns name type (
int,number,text,date,instant,bool,json), unit, polarity (−1 consumption, emissions and intensity; +1 coverage; 0 neither) and role (AC,CP,ΔCP,ΔCP %: the comparison period, and the variances to it; B66). A column never names the comparison's code (PY): the response says it once, incomparison. The units of a card differ by row (kWh, g CO2e, g CO2e/kWh, share), so such a column hasunitFrom: "unit"andpolarityFrom: "polarity": the row's own.scaleis the maximum of each unit over the whole result. - No binary float between a stored value and the JSON (
jsonout.py). Anumericleaves as the number it is, digit for digit (2.500,100040.50000000000000), never with an exponent; integers above 2⁵³ − 1 leave as strings; a Python float in a response is a defect that fails where it is made. Ratios (delta_cp_pct, shares, intensities) are divisions ofnumeric, rounded to 9 decimals where they are made; a percentage is a fraction (−0.062 is −6.2 %), as the charts take it. state:ok;empty(nothing stored for the selection; a preset with no frontier isempty, reasonno_data);unavailablewith areason;too_large_for_grain(reasonrow_budget). An unavailable figure is never a zero and has no rows. Reasons:no_price_area,no_factor, and under a municipal method (B84)no_municipality,municipality_not_loadedandno_local_share,no_price(B57: a cost with no priced interval),no_mix(B59: sources with no hour whose mix is complete under the basis),no_comparison,no_data,no_export(E03, ENET, K02 and KNET without an export child),not_a_load(B68:mp.cost_intervalsof a point that is not chartable as a load, D15 or D04).emptyhas the reasonsno_dataandno_consumption_point(a selection without an E17 root).- Refusals are HTTP errors with one body,
{"error", "reason", "detail"?}, never cached and never with a figure: 404unknown_query; 413too_large(a body above 16 KiB); 415unsupported_media_type; 422invalid_request,missing_parameter,unknown_parameter,invalid_parameter,invalid_period,grain_too_fine,unknown_metering_point,not_a_consumption_root,comparison_not_earlier(apporfrom:comparison that does not end before the period starts: "cmp: the comparison period must end before the period starts", detailcmp) (all before a reading is read); 503query_timeout("the query took too long"): a late answer, the data are fine and the same request may be answered later. It is the API's statement timeout (30 s, SQLSTATE 57014) and also its transaction timeout (60 s, 25P04) and idle-in-transaction timeout (30 s, 25P03), which end the connection: PostgreSQL closes the session with a FATAL error and asyncpg reports a closed connection caused by it, which the route finds down the error's chain, never in its text (B77; it answered 500 before, ADR-004 §4.2). When the timeout is not the error itself but down its chain, the route writes a second warning line with the chain's class names (InterfaceError <- ConnectionDoesNotExistError <- TransactionTimeoutError), nothing of their messages, so that a defect the timeout follows is seen (B77f). A FATAL that arrives between two statements leaves no SQLSTATE (asyncpg drops it when no statement waits): the closed connection is all the route sees, and it answers 500. 500query_failedis everything else: a defect, logged by its SQLSTATE or as an exception, never sent. - Every response that carries emissions (
overview.cards,mp.emission_intervals, andoverview.months,development.seriesandconsumption.weekday_hourswithmeasure=G01) hasmethod(method code,geography(price_areaormunicipality, B84), GWP set, data basis) and inbasisfactorStatus(Q04: the shares of the period's consumption by factor version, never used to draw a mark; B84:noMunicipalityis a share like the others, 0 under a price-area method; the six add to 1),factorSourceandboundary: "physical". A response without emissions has none of them. - Generated factors are marked generated in every response and never attributed to Energinet:
basis.factorSourceisgenerated,energinet,mixedornone, over every factor the response rests on, the comparison's included (Energinet's factors this year and generated ones a year earlier aremixed, B15v2-03);mp.emission_intervalshasfactor_generatedper row. The responses never say "Energinet" themselves; B16a's page writes "Kilde: Energinet" only forenerginet. - Every response that carries sources (
mix.structure,mix.series,mix.profile,mix.hours,report.footprint: B59, M4, M5a) has inbasismixStatus({final, preliminary, initial, pending, noPriceArea}, the shares of the period's consumption by the status of its hour's mix, phase 2 §3.3 step 7: the same under either basis;nullwhere the period has no consumption) andmixSource(generated,energinet,mixedornone, over every mix row the response rests on, the comparison's included; **generated rows are neverenerginet**). See "The sources in the queries" below. truncatedis true when a query had more rows than its cap (max_rowsin the catalogue).basisalso hasdataThrough,frontierState(ok,low_coverage,no_data) andcoverageof the selection's frontier (§2,calc.frontier, withELO_FRONTIER_THRESHOLDandELO_FRONTIER_LOOKBACK_DAYS);dataThroughis null,frontierStateisno_dataandcoverageabsent without an active series, and also when no day of the look-back has a minute with a quantity (0 % coverage is no data, not "data through" an empty day, B15v-08); a preset then answersemptywithno_data.
meta.context and the accounts' states (N6)
Rows are the metering points of every account (mp_id, type, alias, address, parent_mp_id). methods and gwpSets list
codes, the first the default. B93: methods stays the list of codes of the available methods, the install's default first
(ref.method.is_default, then by method_id; ELO_DEFAULT_METHOD, LB-PA-125 unless set, is installed by migrate and refuses the
start when it is not an available method), and a request without m is answered by that first one. Beside it methodInfo has one
object per listed method, in the same order: {"code", "geography" (price_area or municipality), "allocation" (1 or 2), "name" (the Danish name of ref.method)}. The shell groups its method control by geography. B54: dimensions lists the dimensions the roots fall into more than one value of, and
hasExport says whether an E17 root has a child of role 3 (below, "The selection"). B74: accounts lists the accounts with
their company, state and days left (below, "The accounts").
B100: product is {"version"}: the release that answers (ELO_VERSION, which the image sets from the tag, X.Y.Z; 0.0.0+dev for a
build without one). It reads no table. The pages' footer says "Version X.Y.Z", and "Udviklingsversion" for any version that begins 0.0.0.
readingSource (B15b, B16av-12, B15bx-01) says where the stored readings came from, from what the database records about its
loads and never from an environment variable or a metering point's number. Each day of readings points at the response that is its
evidence (raw.fetch, source): 1 Eloverblik, 9 the generated demo, 8 the replay of a capture. A replay is not Eloverblik by
being a replay: it persists the origin the capture records about where it was made (raw.fetch.origin, migration 0184,
allowlist eloverblik / generated; elo_worker.replay.capture_origin): a capture made at the API's address (manifest.json
api_base_url) is eloverblik, one made at another recorded address (a rehearsal; the generator's capture, which records
http://generated.invalid/…) is generated, one that records none, and every fetch of an earlier load, has no origin: not known.
The value set:
readingSource | When |
|---|---|
generated | every load is generated: source 9, or a replay with origin generated |
eloverblik | every load is Eloverblik's: source 1, or a replay with origin eloverblik |
mixed | both of those (a database holds the demo's data or the owner's, never both, so it is a fault that is shown) |
unknown | any load has no recorded origin (a replay without one), alone or beside known ones: a page never claims an exclusive origin the database does not record for every load |
none | no recorded load behind any day |
The API's role reads nothing in raw: three booleans leave through calc.reading_source() (0183, replaced in 0184, SECURITY DEFINER,
no row of raw.fetch and no count). The pages' source line says "genererede data (demo), ikke fra Eloverblik" for generated, and
for unknown "målinger af ikke registreret oprindelse", which names neither origin; the response never says "Eloverblik" itself. account is {state, tokenExpiresInDays}, read from ingest.source_account, ingest.token_notice and ingest.mp_state afresh by every
request; the comparison with 60 days is made in the query. tokenExpiresInDays is the whole local days from today to the day the
refresh token expires (null when it is not known). From B74 account is the install's state: the worst of the accounts' states
(phase-2.md §6.3), with that account's days; the state multiple_accounts of phase 1 no longer exists and no query returns it.
The accounts (B74)
accounts is a list with one entry per account, in the order of account_id, each {company, state, tokenExpiresInDays}: the
company is the name of the account's company, the label the owner gave it (core.company.name: for a private account, which
stores no free text, that is the account's label, and then it is the company's name), the state is the account's own and
tokenExpiresInDays its days left. Nothing else of an account leaves: no label as such, no fingerprint, no token file, no
generation, no error code, and nothing of a row of ingest.token_notice but that it exists. A database without an account row has
account {state: "no_account", tokenExpiresInDays: null} and accounts: [] (status 200, never a 500).
An account's state is the first that applies:
| Account state | When |
|---|---|
token_needed | the account is invalid (status 3), its refresh token has expired, or the worker may not call with it: a row of ingest.token_notice names the account (its token file refused or gone, B76); the row's text is never read |
no_access | none of the account's own metering points (core.metering_point.account_id) can be read: every one has current_access FALSE (not known is not "no", B19). With several accounts (B74f) only an account that owns points can be no_access: an account added a minute ago, whose first list has not run, owns none, and an account whose every listed point another account listed first (B76) owns none either; each is ok, and make status says what waits. One account alone keeps phase 1's rule word for word: no point it can read is no_access |
token_expiring | the token expires in 60 days or less (60 is expiring, 61 is ok) |
ok | otherwise, also with no expiry known |
The install's account.state is that of the most urgent account, in the order token_needed, no_access, token_expiring, ok; among
equals the account whose token expires first, then the lowest account_id; the days are that account's. Besides, no_account
is the state of a database with no account row. The state of an account changes no figure: the other companies' figures
stand (the pages name the company, docs/pages.md).
The selection (B54)
sel is an object of dimension key → list of values: the roots a figure is made of are the E17 roots that have, for every
key given, one of the values listed (alternatives within a key, all keys must hold), and mp, when given, narrows them further.
The keys are those of calc.root_dimensions() (migrations 0195 and 0305), which classifies a root by its current master data version
and its current price area (the latest-started core.mp_geo period) 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.
| Key | Dimension | A value is | Named from |
|---|---|---|---|
company | company (B74, label "Selskab") | the id of the company of the account that owns the root (core.metering_point.account_id; a root a second account lists as well stays with its owner): the digits of core.company.company_id, never a CVR number, a token's label or a fingerprint | core.company.name: the label the owner gave the company ("Egen konto" for the .env account) |
type | type | E17, E18 | ref.mp_type.name_da |
area | price area | DK1, DK2 | ref.price_area.name_da |
net | net settlement group | the code (0, 1, …) | ref.code list net_settlement_group |
settle | settlement method | D01, E02 | ref.code list settlement_method |
read | reading occurrence | PT1H, PT15M | ref.code list meter_reading_occurrence |
asset | asset type | the code | ref.code list asset_type |
status | physical status | the code | ref.code list physical_status |
heat | tax reduction | true (Elvarme (reduceret afgift)), false (Uden) | fixed in providers/dimensions.sql |
A root with no value (no master data version, or the field not stated) has the value unknown, named "ikke oplyst", which
counts as a value in sel and in the counts below. A value is 1 to 32 letters or digits; a dimension key and values are never
echoed in an error. A stored code outside that form (master data does not constrain these columns) is classified as
unknown, so a page is never offered a value that the contract then refuses. A root of status 4 (invalid ID) is in no
dimension's count and no selection, as meta.context's list leaves it out. sel: null is absent, as null is for every
optional parameter; {} is no selection too.
- 422
invalid_parameter(detailsel): a body that is not an object; an unknown key (company, the id of a company, is a key since B74; the address, the customer, the supplier and every other field of the "never" rows of the specification's table, are not keys); a value that is not a list of 1 to 50 plain codes. A value no point has selects nothing and is not an error (a company's id no root has, and a company's name, which is no value: letters and digits only, never the name). - A selection without an E17 root (
type: ["E18"]alone, an unknown value, an empty intersection) answersstateempty,reasonno_consumption_point, no rows. An E18 named inmpkeeps phase 1's 422not_a_consumption_root, with or withoutsel. The check ofmpcomes first. - A query that does not take
selanswers 422unknown_parameter, as for every parameter a query does not take. - The runner resolves
selandmponce, withcalc.select_roots(sel, mp)(providers/selection.sql), into the roots it binds as:mp_ids; the frontier, the row budget and every query then read that list, so a figure of the selection is the sum over those roots and nothing in a query file names a dimension. The catalogue refuses a file of the selection (the three providers and the SQL of every query that takessel) that names a field the specification calls never: the customer's CVR numbers, supplier, supplier start, consumer start and grid operator, the address (street, number, floor, room, postcode, city, municipality), the alias and the meter number.
meta.context adds two members to the response:
{ "dimensions": [ { "key": "area", "label": "Prisområde",
"values": [ {"value": "DK1", "name": "Vestdanmark", "roots": 3},
{"value": "DK2", "name": "Østdanmark", "roots": 1} ] } ],
"hasExport": true }
A dimension is offered only when the roots hold two or more values of it (unknown is one): in a database with one root
dimensions is []. The counts are of every root the database holds, of any type (the type dimension offers E18 when there
is one), the values stand largest first with "ikke oplyst" last, and the dimensions in the order of the table above (the company first, the widest cut). company is offered only with more than one company (the rule of every dimension), so the owner's install, one company, offers none; with two it is offered with each company's name and number of roots and narrows every figure of a query that takes sel. The default selection, none, is every E17 root of every company, as for every dimension. hasExport
is whether an E17 root (of mp, when mp is given) has a child of role 3.
meta.selection: how many roots the selection holds (B67a)
meta.selection answers one row, roots: the number of E17 roots that sel and mp select, taken as every query of the
selection takes them (the runner resolves them with calc.select_roots(sel, mp); queries/meta/selection.sql counts the same
roots). With neither, every E17 root. It is what the shell's title line names (B60): a page never counts the roots itself. It
takes mp and sel only: a period, a comparison, a measure or a grain is 422 unknown_parameter. **A selection without an E17
root** (an empty intersection, a value no point has, type: ["E18"] alone) answers state empty, reason
no_consumption_point, no row, as every query of the selection; an E18 in mp is 422 not_a_consumption_root. It reads no
reading, has no row budget and carries no figure: a count of the database's keys, with no identifier of a point, a meter or a
person in it. Tests: services/api/tests/test_queries_b67a.py (through HTTP on the demo organisation).
E03 and ENET
overview.months and development.series take measure E03 and ENET besides E01 and G01 (phase 2 §3.1). Both read
ts.day_load: no reading, no row budget, no emission, no factor.
- E03 is the series of the selected roots' children of role 3 (D06), summed over the selection, per bucket, with the
comparison, the variance and the quality contributions of its own series (
calc.consumption_buckets(…, p_export => true), migration 0196: the rows are still the root's). Polarity 0. An export series that lags its root shows it in its own missing minutes and expected range, ascalc.series_expectedis per series. **On these two queries, which readts.day_load, E01 and E03 carry the total variance only**, as phase 1's E01 does:delta_cpequalsdelta_cp_total, and the matched columns are NULL. The like-for-like variance of E03 (hour cells of both periods) isenergy.split's (B68, "The split: bought, sold and net"). - An export child with no series yet (registered, nothing of it read) is not "no export child": E03 answers its buckets with
no value (
acNULL, reasonno_data, stateok), and ENET keeps E01's buckets with no value and the same reason: it never falls back to E01 alone and never loses E01's buckets.no_exportis a selection with no export child registered at all. - ENET is E01 − E03 from the two figures as shown: E01 of every selected root minus E03 of the export children among them.
A bucket or comparison is NULL unless both parts are there, never E01 alone; it is negative when more was delivered than
bought. Its variance is the difference of the two total variances (net of the period minus net of the comparison is
exactly that), named total:
delta_cpanddelta_cp_totalhold the same figure, andac_matched,cp_matchedand the matched hours are NULL. The quality minutes are the two series' added, NULL (not 0) where neither leg expects any (undercmp=none, on 29 February, outside both expected ranges), as E01's and E03's are; the provisional amount is the net of the two provisional parts, and the figure isprovisionalwhere either part is. - No export child among the selected roots is
stateunavailable,reasonno_export, no rows: never a zero. A selection in which only some roots have an export child gives E03 of those, and ENET as E01 of all of them minus that. - The heat map query takes
measureE01,E03andG01(B67): "The heat map's comparison" below. Its E03 reads the export children's readings (calc.export_readings), notts.day_load, and its row budget counts their rows.
Grain and budget (§10.3)
g=auto is the finest grain the query has with at most 750 points per series: mp.series, mp.emission_intervals and
mp.cost_intervals (quarterHour, hour): quarter-hours up to 7 days (676 points when the window holds 25 October), hours up to 31 days (745 for
1–31 October 2026); development.series (day, month): days up to 750 days, months beyond; overview.months is by
month. A window no grain of the query fits is 422 grain_too_fine, like an explicit finer grain, with
detail: {grain, maxPoints, longestWindow: {from, to}} (the longest window from the first day that the grain allows).
Nothing is thinned. A grain the query does not have is 422 invalid_parameter.
Interval series have one row per interval of the window (23/24/25 hours, 92/96/100 quarters), NULL quantity and NULL quality with
stored: falsewhere nothing is stored, so that a gap is drawn as a gap;expectedsays whether an interval that is not stored is a gap at all (below, "Which intervals are expected"). At hour grain a quarter-hourly series is the sum of its quarters (an hour with fewer than four quarters that have a quantity is A05 with the sum it has, an hour with none is A02 with NULL; otherwise the worst quality of its quarters). At quarter-hour grain an hourly series is returned at its own resolution (resolution60): nothing is split, and its gaps are hours too (a gap has the resolution of the series' day,ts.day_load.resolution, or of its nearest day with one when the day has none, or the grain when that is longer, B15v-10), so a window does not mix resolutions only because of its gaps. A window that mixes resolutions is therefore one of rows of differentresolution; B18 shows it as power (kW) in the consumption tier.Row budget: before a query that reads readings runs, its reading rows are counted from the day summaries (
ts.day_load.points, equal to the rows of the day, R5), over the period and, with a comparison, over **the comparison period's own days** (B55, phase 2 §9 row 14), the two summed apart as the query reads them apart: withpporfrom:the comparison is as long as the period, so the count is about the period's twice over (a day of 23 or 25 hours on one side makes the difference); withpyover more than a year the days the two ranges share are read twice and counted twice (the union was counted before B55). Above the query's budget the answer istoo_large_for_grain. Consumption by day or month readsts.day_loadand is not affected.The budget is a number per query (B77, ADR-004 §9): the catalogue entry's
row_budget, and 2 000 000 where it names none. The rule: a query whose default view (ytd, all roots,cmp=py) the measurement shows running into the API's 30 s timeout below the default budget gets the number of rows at which it is refused first, with a margin for a busier machine: refused, never run into the timeout. A query that holds inside the timeout well beyond the default gets a higher number, up to where it still does. So:Query Budget Why overview.cards1 200 000 (B57; B77's 1 500 000 before the cost was added) B57: extrapolated from the demo by the ratio of the cards' seconds, 3.44 s to 4.51 s for ytd(1.31): 1.57 M ÷ 1.31, rounded down to a hundred thousand; to be measured at 50 and 80 roots (ADR-004, item 4). B77: its default view ran into the 30 s timeout at 81 roots, inside 2 000 000. B77 measured it with the budget off at 50 and 80 roots (18.2 s for 1 064 064 rows; 28.0–29.0 s for 1 674 336): 27 s, nine tenths of the timeout, at 1.57–1.62 M rows by the load of the shared machine; the lower, rounded down to a hundred thousandconsumption.weekday_hoursE01, E036 000 000 inside the timeout to 420 roots for ytdand12m(ADR-004 §6: 12.95 s forytdat 420 roots with the budget off; six years of 80 roots, 5.6 M rows, 14.7 s). Measured without a comparison: with one (B67) both periods count, so the same number admits about half the roots or days; E03 counts the export children's rowsconsumption.weekday_hoursG012 000 000 as the other queries of G01: it reads the emission rows ( calc.emission_intervals, a factor per interval), which ran past the timeout at 3.3 M rows onoverview.months(ADR-004 §4.2); on the demo G01 took 4 to 5 times E01's time (B67's report). A budget by measure (B67f, B67v-02)report.footprintby blocks(B59f):all(the default) 1 400 000;emissions5 300 000B59: with the sources the footprint also asks the mix twice (by source and by origin), and a year of the demo's 18 roots (167 681 reading rows) takes 3.14 s through HTTP on analysed tables, 18.7 µs a row (16.6 µs on an earlier run; its phase-1 rows alone 6.5 µs: calc.footprint1.09 s);blocks=emissionstakes 1.15 s, 6.9 µs a row, and does not call the function. The rate includes the mix's fixed cost, so it is an upper bound; 27 s, nine tenths of the timeout, at 1.45 M rows, rounded down to 1 400 000 forall. Extrapolated from the demo, to be measured at 50 and 80 roots (ADR-004, item 4). The lead's ruling (B59f): the budget is by the value ofblocks, so that what B77f admitted for the emissions is still admitted for them:ytdof 80 roots (837 168 rows) by both, six years of 50 roots (3 575 712 rows) byemissionsalone,ytdof 150 roots (1 666 512 rows) and of 420 (4 694 400) byemissionsalone. B77f's reasoning for the 5 300 000 follows.ytdand12mof 420 roots inside the timeout in phase 1ytdand12mof 420 roots inside the timeout to 31 December (5.0 µs a row: 23.5 s for 4 694 400 rows ofytdon 22 November, 26.3 s for the 5 256 000 of12m, ADR-004 §6). A row of a long period costs more (the factors of more hours): six years cost 7.2 µs a row (25.70 s for 3 575 712 rows at 50 roots), so 30 s at about 4.2 M rows, and six years of 80 roots (5 626 488 rows) ran past the timeout. So six years of about 59 to 75 roots is admitted and runs into the timeout (about 70 000 rows a root for six years: 30 s at 59 roots, the budget at 75), and answers 503query_timeout; from 75 roots on it is refused (B77f)mix.structure,mix.series,mix.profile(M4: one call of the function by the grainhour, the same reads asmix.series),mix.hours(M5a: one call by the grainutc_hourover at most 31 days, no comparison; on the analysed demo a week of the 18 roots and 31 days are measured besidemix.seriesindocs/build/M5a-report.md)2 000 000 (the default; B59) the mix reads what G01 reads (the roots' series over the period and the comparison's own days: readings: always), at less time a row: a year of the demo's 18 roots against its previous year takes 2.0 s by source and 2.5 s by origin (mix.structure) and 2.0 s by month and 2.1 s by day (mix.series; B59f's final run) through HTTP on analysed tables, where the emissions took 2.7 s (B58's call to the functions; B59's test prints the times). G01's number holds inside the timeout (ADR-004 §1), so the mix, which costs less a row, takes it, the default, not measured at 50 and 80 roots (ADR-004, item 4): a query that calls the function twice would read the readings twice, and neither doesoverview.monthsanddevelopment.series(G01, and K01, K02, KNET from B57)2 000 000 (the default) inside the timeout up to the default (ADR-004 §1); the cost measures read what G01 reads and take less time a row (B57: K01 1.2 s, KNET 1.6 s, G01 2.7 s for a year of the demo by month) overview.mp_varianceby measure (R1f, P1): E01 2 000 000, G01 2 000 000 (1 500 000 under a municipal method: the factor 0.75, P1), K01 2 000 000 P1: calc.emission_buckets reads by the hour (migration 0441: the price area once per point and day, the factor row once per area and hour, the readings aggregated per point and hour before any join; every figure unchanged). At the same 50 roots' year, the two functions interleaved, three rounds, on a machine at load 46 to 74: R1f's 42.9 – 59.9 s, 0441's 9.9 – 13.6 s, 8.3 – 11.4 µs a row (200 roots' year: 36.5 – 48.4 s, 7.4 – 9.8 µs; R1f's 28.0 µs below was measured at a lower load). 27 s at the worst rate is 2.37 M rows; G01 takes the default, about 23 s at that rate, so 50 roots' year (1 191 360 rows) and 200 roots' month (418 690) are admitted and 200 roots' year (about 4.9 M) is refused. The municipal branch takes 1.31 to 1.36 times the price area's seconds (the demo's year, interleaved), so the entry's factor is 0.75 (B84's 0.83 was the view's 1.20 times). docs/build/P1-report.md, section 4. R1f before it: R1 called the functions once per root, a floor of 25 to 110 ms a call however short the period, which no row count bounds: the default admitted G01 requests that ran past the timeout (one month of 420 roots, about 0.6 M rows, extrapolated by the read to 47 s). R1f reads once withp_per_mpand measured it at 50 synthetic roots (the bulk generator in a scratch stack; 12 months against the previous year, 1 191 360 rows; in the database, a loaded machine): G01 33.4 s, 28.0 µs a row; K01 12.7 s, 10.7 µs a row (the per-root calls 51.0 s and 24.3 s). 27 s, nine tenths of the timeout, is 960 000 rows for G01, rounded down with room for the consumption read beside it; K01 holds at the default (2.5 M rows at its rate); E01 reads what it read before R1. The cost now grows with the rows read, not with the roots: a short period of many roots costs what its rows cost (docs/build/R1-report.md, R1f)
| energy.split (B68, B68f) | 1 000 000 | it reads what KNET reads, the roots' series and the export children's, both periods (providers/budget.sql counts it as KNET: the catalogue's budget_measure), and reads them twice with a comparison: once for the cost (calc.cost_buckets) and once for the energy's like-for-like cells (calc.consumption_matched, B68f). The provider counts each reading row once, so the number is KNET's 2 000 000 halved: a year of the demo's 18 roots with the previous year (437 085 rows) takes 3.1 s, 7.2 µs a row, KNET 1.5 s, 3.5 µs a row ("Cost after B68"), so 1 000 000 is about 7 s of 30, as KNET's 2 000 000 is. Without a comparison the second scan does not run (calc.consumption_matched returns at once) and the budget is conservative; not measured at 50 or 80 roots |
Not shown to answer inside 30 s under load (P1, P1v-01, P1v-02): the cards' 1 200 000 and overview.mp_variance G01's 2 000 000. The cards at 1 191 360 rows (a year of 50 bulk roots or 68 hourly ones, against the previous year): 35.5 – 55.9 s in the database at load 34 – 80 (P1's report, section 4), cancelled at 30 s in 3 of 3 rounds at load 24 – 35 (the read, P1v), and 34 roots (595 680 rows) cancelled at load 86 – 90; their edge is not known. G01's ranking at its largest admitted request (114 hourly roots' year, 1 997 280 rows): 15.8 – 20.2 s at load 24 – 41, 18.7 – 25.0 s beside a second such request, 27.2 s at load about 96 (P1v); P1 measured 9.9 – 13.6 s for 1 191 360 rows at load 46 – 74. These loads were other workers' runs on a shared machine, so no budget was changed from them: python -m elo_devtools.budget_edge (make budget-edge) measures the largest request each budget admits (its rows, seconds and temporary blocks) for the lead to run on a quiet machine and set the numbers from. Such a request writes temporary files: about 1 GB for G01's at 2 000 000 rows (124 491 blocks written, work_mem 4 MB), and the API's five connections may run five at once; no temp_file_limit is set (P1's report, section 4, has the recommendation).
B84: under a municipal method the budget of a response that carries emissions is its number times the entry's municipal_budget_factor
(0.90 for overview.cards, 0.83 for overview.months and development.series, 0.82 for the heat map's G01, 0.69 for report.footprint), rounded down
to a hundred thousand: "The municipal split in the queries" below has the measurement.
ELO_ROW_BUDGET, when it is set, is every query's budget instead: one number for all, as a test or the measurement's
"budget off" (B73's tool) sets it. A set value replaces a query's own number upward too: ELO_ROW_BUDGET=2000000
takes the cards' guard (1 500 000) away, and lowers the heat map and the report to 2 000 000. The variable is for a
measurement; it is set nowhere in the stack's configuration.
Which intervals are expected (B15b)
An interval after a series' data-through date, or before the first day the API can serve for it, is not "missing". Every
coverage figure counts missing among the expected intervals only; mp.series and mp.emission_intervals say, per interval,
whether it is expected, and per series where the expected range starts and ends. Nothing that is missing inside the range
disappears by this. The rule is calc.series_expected (migration 0182), one range of local days per series:
| Rule | |
|---|---|
From (expected_from) | the earlier of ingest.mp_state.readable_from (the first day the API can serve, §6.3) and the series' first stored day (what every figure counted from since B15v2-05: a stored day before readable_from counts). NULL when both are NULL: the series has no range |
To (expected_to), a metering point that is valid (status 1 and current access not false, the series' own or else its root's; not known, or no ingest.mp_state row, is valid, because only the daily run writes current_access: after a first load or a capture an unknown would read every point as ended at its last stored day, and a stalled series would never become missing) | the greater of the series' own last stored day (ts.day_load with points) and the day before the daily run's window starts, today − DAILY_WINDOW_DAYS − 1 (elo_core.plan.tiling, 14: the runner passes it, :daily_window_days). The days the daily run still asks for (from today − 14) are expected through the series' own last day only, so a child that lags its parent is "not yet delivered", not missing; a day older than the window that is still not stored is missing |
| To, a metering point that is not valid | its last stored day, or the day the database records that it ended when that is later: no longer listed (status 2) the local day of core.metering_point.last_seen_at, no current access (status 3) ingest.mp_state.daily_ok_through (the last day the daily request was answered); the days between are missing. The database records nothing for an invalid ID (status 4) or a point with status 1 and current access false: the last stored day |
today is the server's, the local day in Europe/Copenhagen of the request's clock, injected by the runner: it is not a
parameter (a client that sends today gets 422 unknown_parameter, as for any unknown one). The day a series is expected through
changes at Danish midnight, not at the process's or the client's.
An interval's not_expected_reason is before_readable (before expected_from, or the series has no range), not_yet_delivered
(after expected_to on a valid point) or ended (after expected_to on a point that is no longer valid); NULL when it is
expected. A stored interval is always expected (the range reaches both its first and its last day).
| Case | Rule applied | Test (test_queries_b15b.py) |
|---|---|---|
| A new series: first data on 5 June, readable from 5 June | 1–4 June are before_readable, not missing; from the 5th they are expected | test_a_new_series_is_expected_from_its_first_readable_or_first_stored_day |
A stored day before readable_from (a relation lost and anchored anew) | the range starts at the stored day | test_a_stored_day_before_the_readable_day_is_still_expected |
| A hole between two stored days | inside the range: missing | test_a_hole_between_two_stored_days_stays_missing |
A refused window (a chunk outside or not_available) | by position: between served days it is inside the range and missing (the API served on both sides; mp.ingestion reports the refusal); before the first readable day it is before_readable | test_a_refused_window_is_missing_inside_the_range_and_not_expected_outside_it |
| The newest 14 days | after the series' own last stored day and inside the daily window (30 October to today, on 13 November): not_yet_delivered; up to the day before it: missing | test_the_newest_days_are_not_yet_delivered_and_older_ones_are_missing (the boundary day is held to today − DAILY_WINDOW_DAYS, the first day the daily run asks for) |
| A parent with children | each series is expected through its own last day inside the window: a child a few days behind is not yet delivered; a child that stopped before the window is missing from its last day to the day before the window | test_a_child_that_lags_its_parent_is_not_yet_delivered_and_one_that_stopped_is_missing |
| Ingestion has failed for 10 days on a valid point | not yet delivered until its day is older than the window (the 15th day after it), then missing; the pages do not read as complete meanwhile (they say "Målinger forventet til og med <expected_to>" and the not-yet-delivered share; "Data til og med" is the frontier's phrase alone) | test_ingestion_that_has_failed_for_days_is_not_yet_delivered_until_the_window_has_passed |
| An ended one: not valid | through its last stored day; or through the day the database records, the days between missing; afterwards ended | test_an_ended_series_is_expected_to_its_last_stored_day_or_the_day_the_database_records |
Access not known (status 1, no mp_state row or current access NULL, as after a first load or a capture) | valid: not yet delivered inside the daily window, missing once older, never ended | test_a_point_whose_access_is_not_known_is_valid_so_a_stalled_series_becomes_missing |
| A period wholly outside every range, or a series with no range | zero expected minutes: coverage is NULL (i.r., reason not_expected), never 100 % | test_zero_expected_minutes_is_no_coverage_never_100_percent |
Aggregates. consumption_buckets counts a series-day's minutes as expected only inside the range. What is outside it is its own
quantity, never silent: ac_not_expected_minutes and cp_not_expected_minutes (and ac_not_yet_delivered_minutes, the part of
the first that a valid point may still deliver, and ac_outside_range_minutes, the rest of it: before the first readable day or after
the point's data ended, computed in SQL as not expected minus not yet delivered so that no page counts the pending days twice,
B15bx-03). For every aggregate the minutes of its days over the selected series are **stored
- missing + not expected** (
test_the_minutes_of_a_period_are_stored_missing_and_not_expected).overview.cardssays inexpected_to(COVERAGE row) the latest end of the selected ranges. A series with no range at all (both ofreadable_fromand a first stored day NULL) has no end either:expected_fromandexpected_toare both NULL, on its interval rows and in the card'sexpected_to(B15bx-02).ac_missing_minutesis NULL when nothing is expected (it was NULL before for a selection without a series).
What does not change. The eligibility of §9.3 and every emission figure (calc.emission_buckets, calc.emission_matched)
read readings, not expectations: the golden cases (test_like_for_like_case_through_overview_cards, B12a's M_01…M_16) and
test_emission.py pass unchanged. report.footprint keeps its expected_hours and complete: they say whether the readings of the
asked period are complete (a report period reaching past the data is not complete), not a coverage figure.
The comparison's names (B66)
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, delta_cp_total_pct, strip_delta_cp, strip_delta_cp_pct and the cp_… quality
columns (cp_solid_amount, cp_provisional_amount, cp_missing_minutes, cp_incomplete_minutes,
cp_pending_factor_minutes, cp_not_expected_minutes). Phase 1 named them py…; B66 renamed them, with the figures
unchanged: services/api/tests/test_queries_b66.py asks every query of the catalogue, with cmp=py and cmp=none, and
compares each answer value for value with the answers written before the rename (tests/fixtures/b66_before.json), the
names of the one a mapping in the test. The columns of the functions calc.consumption_buckets, calc.emission_buckets,
calc.consumption_matched and calc.previous_year_buckets (B55: calc.comparison_buckets) were renamed with them
(migration 0210); the rule of the previous year (calc.previous_year_date, calc.previous_year_last) is unchanged.
A column names its role, the response its code. A column is AC, CP, ΔCP or ΔCP % (the scenario of its entry in
columns). A response to a query that takes cmp carries, with a comparison, the block
"comparison": {"kind": "py", "code": "PY", "from": <first day>, "to": <last day>}: kind is the comparison asked for (py,
pp or from), code what a page prints in the place of CP (PY for py, PP for pp and from:), from and to
the comparison's own first and last day (calc.comparison_period of the resolved period, below: for py the previous year
of the period's first day and the last previous-year day of its last). The block is
absent when there is no comparison to name: with cmp=none, in the response of a query that takes no cmp, when a preset
period cannot be resolved (empty, no_data: no day to count back from) and when the selection selects no point (empty,
no_consumption_point): the days of the comparison are worked out only for a period that is known. cmp omitted is cmp=py,
but on consumption.weekday_hours, where it is cmp=none (B67: the heat map without a comparison is B20's, value for value).
basis.matched is there with every comparison.
The comparison (B55)
The comparison period is an earlier period that takes its length from the period (phase 2 §3.4): a variance between
periods of free lengths would be mostly the calendar. cmp is one of:
cmp | The comparison period | Days correspond | Code |
|---|---|---|---|
py | the previous year, below ("The previous year"), unchanged | by month and day | PY |
pp, the period whole calendar months | as many whole months immediately before | by the position of the month and the day of the month | PP |
pp, any other period | as many local days immediately before | by offset: day k with day k | PP |
from:<date>, the period whole months and the date a first of a month | as many whole months from that date | as pp for whole months | PP |
from:<date>, otherwise | as many local days from that date | by offset | PP |
- The period is resolved first (a preset against the frontier), 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. - A
pporfrom:comparison ends before the period starts, otherwise 422comparison_not_earlier, decided by the runner on the resolved days before any SQL of the query runs (the day before the period is the last a comparison may hold).ppalways does;pyis phase 1's previous year and is not refused: **apyof more than a year compares with its previous year all the same, and the two overlap** (2024–2025 against 2023–2024: 2024 is on both sides, read and counted in the row budget on each), as before B55. - Months of unequal length, for every kind (the rule of February of "The previous year" with "the last day of February"
read as "the last day of the month"): by months a comparison day counts in the period day with its day of the month, and the
last day of a period's month also takes every later day of the comparison's month (30 April: 30 and 31 March; 28 February
2026 of a quarter against October to December: 28, 29 and 30 November); a period day beyond the comparison month's length
holds no comparison day (29 to 31 March against a February of 28 days:
cpandcp_fromNULL,reasonno_counterpartby day). By offset every comparison day has its own period day. So every comparison day is counted in one bucket at every grain, and the buckets add up to the period; the period's comparison is the comparison period whole, the row'scp_fromandcp_toits own days. - Hour cells (the like-for-like variance) correspond by the corresponding day (the same day of the month, or the same
offset), the clock hour and the occurrence; a cell without a counterpart is unmatched, never moved to a neighbour: 31 March
against April, 29 to 31 March against February, the second 02:00 of a 25-hour day against a day of 24 hours and the 02:00
of a 24-hour day against the 23-hour day. Everything the previous year has holds for every kind: the like-for-like variance
over matched cells with
hofHand its reasons, the total variance beside it and named apart. - 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 (B60, from
comparison.fromand the period).
Where it is computed. calc.comparison_period(cmp, from, to, cmp_date) resolves a comparison into its first and last day
and a shift: whole months (py 12) or days, never both; the Python reference is elo_core.comparison, which
services/api/tests/test_queries_b55.py holds it to. The functions the queries call (calc.consumption_buckets,
calc.consumption_matched, calc.emission_buckets) take the comparison as their parameters p_cmp (py, pp, from,
none) and p_cmp_date (the date of from:); calc.emission_matched, which no query calls, takes it as cmp (py, pp,
from; not none) and its first day cmp_date_from (docs/emission.md). Each reads the comparison's own days, count a comparison day in
greatest(day + shift, first day) and key its hour cells by day + shift where that is the same day of the month; with
py (a shift of 12 months) every expression gives what phase 1's gave, and B66's fixture holds every answer to it.
calc.comparison_buckets gives each bucket's comparison days (cp_from, cp_to). calc.consumption_matched has a seventh,
defaulted, parameter p_export (B68f, migration 0265: the export children's series, for energy.split's sold); calc.consumption_matched,
calc.emission_buckets and calc.emission_matched refuse a pp or from: comparison that does not end before the period by
themselves (22023); calc.consumption_buckets and calc.comparison_buckets do not, and rely on their caller (the runner's
422 comes first).
The previous year
One rule, for a period and for every bucket (the lead's ruling on B15v2-01): **days correspond by month and day, and the last day of February corresponds to the last day of February.** The previous year of a day is the same month and day one year earlier, except at the end of February:
| Day | Its previous year |
|---|---|
| 28 February of a year whose previous year is a leap year (28 February 2025) | 28 and 29 February of that year (28–29 February 2024) |
| 29 February (29 February 2028) | 28 February of the year before (28 February 2027) |
| 28 February of a leap year (28 February 2028) | 28 February of the year before (28 February 2027) |
| 28 February of any other year (28 February 2027) | 28 February of the year before (28 February 2026) |
| Every other day | the same month and day one year earlier |
A period's previous year is the union of its days' previous years: from calc.previous_year_date of its first day to
calc.previous_year_last of its last. So the previous year of 2025 is the whole of 2024, to the last decimal what the page
shows for 2024; the previous year of February 2025 is the whole of February 2024, whether February is the period, a row of
overview.months or development.series, or a month of a card's strip (one figure for one month); the one-day period 28
February 2025 compares with two days; 29 February 2024 alone compares with 28 February 2023, and 29 February–31 March 2024
with 28 February–31 March 2023.
In buckets each previous-year day counts once, so the buckets add up to the period at every grain: in the bucket of its
own month and day a year later, 29 February in that of 28 February, and a day before the period's first day (28 February,
for a period from 29 February) in the first bucket. One day is the previous year of two: 28 February 2027 is that of 28 and
of 29 February 2028. Counted once, it is in the bucket of 28 February when the period holds that day; in a series by day that
holds both, 29 February then holds no previous-year day (cp NULL, cp_from NULL, reason no_counterpart), and as the
first day of a period it holds 28 February 2027.
Every row with a previous-year value names the previous year's own days (B15v2-02): cp_from and cp_to, the first and
last previous-year day the row holds, inclusive (a card and overview.mp_variance: the period's), NULL with cmp=none and
where the row holds none. A page marks a row whose previous year holds more or fewer days than the row ("inkl. 29.
februar") from these two dates alone, with no calendar rule of its own.
Only the like-for-like variance (G01, G16) drops hour cells without a counterpart (29 February, the DST hours), and its
count says so: hours_in_period − matched_hours − excluded_readings − excluded_factor cells have none. So in a leap
year a card's total variance and its like-for-like variance differ; both are returned, named apart: delta_cp_total (and
delta_cp_total_pct) is ac − cp over all days of both ranges, delta_cp is the variance the card shows (like-for-like for
G01 and G16, equal to delta_cp_total for E01 and coverage).
A month figure is the sum of the period's local days of that month, so the first and last month of a period are partial.
The figures
- Consumption (E01) is the E17 root's own series, from
ts.day_load. A bucket with no stored quantity is NULL, never zero. A variance against a missing or zero previous year is NULL (i.r., never −100 %). - Quality contributions (A3x-11), every row of an aggregate query, for AC and CP:
solid_amount+provisional_amount= the total (exactly). Consumption: provisional is the estimated kWh (A03). Emissions: an interval's amount is provisional when its reading is estimated or its factor is not Final, counted once: 1 kWh at 100 g (Final) with 1 kWh at 900 g (preliminary) is 90 % provisional while Q04 says 50 %.missing_minutes= the expected minutes of the series-days (inside the series' expected range) minus the minutes with a quantity (no value, or A02);incomplete_minutes= A05;pending_factor_minutes= stored quantity with a price area and no factor yet (emissions only).provisionalis true when more than 1 % of the figure is provisional. - Emissions (G01) are the sum of CO2e of the intervals that have a factor under the basis; pending hours contribute
consumption and no emission (§9.3), counted in
pending_hours,pending_kwhandpending_share. - Like-for-like variance (G01 and the intensity) uses only matched hour cells (the comparison of
calc.emission_buckets, the bucket form of B12a'scalc.emission_matched):matched_hoursofhours_in_period,excluded_readings,excluded_factor. Where none is matched the variance is NULL withreasonone of **missing_readings,no_factor,no_data,no_counterpart. The **total consumption variance (E01'sdelta_cp) is not restricted to matched cells; where the comparison has no value it is NULL withmissing_readings,no_counterpartwhen the row holds no comparison day (cp_fromNULL), andno_datasays that the period itself has none. - Like-for-like variance of consumption (B15b, B16av-01):
overview.cards(the E01 row) andoverview.mp_variance(per point) also return the consumption of both periods over the matched cells only: the hour cells of §9.3 that are eligible on both sides (the hour's stored intervals cover exactly its 60 minutes, each with a quantity, none A02 or A05), with **no factor** needed, ascalc.consumption_matched(0180; the comparison a parameter since 0225) counts them:ac_matched,cp_matched,matched_hours(h),hours_in_period(H, the cells with a quantity in the period) andexcluded_readings, anddelta_matched,delta_matched_pct(9 decimals, NULL whencp_matchedis not above zero). Where no cell is matched they are NULL withmatched_reason:no_data(no cell has a quantity in the period),no_counterpart(29 February, the DST hours),missing_readings; never −100 %. The total variance (delta_cp,delta_cp_total) keeps its name and meaning. The rank ofoverview.mp_variancefollows the absolutedelta_matched, then the absolutedelta_cp, NULLs last. Without a comparison (cmp=none) none is read. Both reads are planned without nested loops and JIT, like the emission comparison. - The ranking follows the chosen card (R1, the owner's word of 29 November 2026):
overview.mp_variancetakesmeasure(E01, the default,G01orK01, the cards of X1; any other value is 422) withm,gwpandbasis, and answers for that measure, each like for like per point by its card's rule: E01 as above (mp_variance.sql); G01 bycalc.emission_bucketsand K01 bycalc.cost_buckets, the functions the cards read, called **once over the selection's roots withp_per_mp** (R1f, migration0440_ranking_per_point: every figure grouped per point as well as per bucket, the whole period as one bucket, one row per root;mp_variance.g01.sql,mp_variance.k01.sql). The roots are the consumption read's, named, never NULL. The functions match every hour cell per root, so a point's figures are those a call with that root alone gives (R1f compared every column of the 18 demo roots under three methods,pyandpp: equal), a point's matched cells are the card's cells of that root and **the points'delta_matched,matched_hours,hours_in_period,ac_matchedandcp_matchedsum to the card's** like-for-like variance (G01's and K01'sdelta_cp, E01'sdelta_matched) and counts, exactly: no rounding comes before the sum (test_r1_ranking_follows_card.py, the demo, three methods,pyandpp). The columns keep the ranking's names for every measure:delta_cpis the total (ac - cp, all days: the card'sdelta_cp_totalfor G01 and K01),delta_matchedthe like-for-like one. The hours without a factor (G01,excluded_factor) or a price (K01,excluded_price) are inhours_in_periodand not inmatched_hours, as on the card, so they count towards the page's mark by the 1 % rule. Nothing matched is NULL withmatched_reason(no_factorandno_pricebeside the consumption's three), never −100 % and never zero. A root with consumption and no figure of the measure (no price area, no factor, no price at all) hasacNULL withreason(calc.emission_reason/calc.cost_reason, the cards' rules); a root without consumption hasacNULL and noreason(mangler). The minutes (missing, incomplete, not expected) are the root's consumption's for every measure, as on the cards. The response carries the method and the factor status for G01 (the provider's over the selection, asbasis_from_rowsis not used: the rows are per root), and for K01 the price block of the selection: the sums of the roots' period blocks, the shares made from those sums at 9 decimals and the matched block's reason bycalc.cost_buckets' rule over the summed counts (equal to the months' and the cards' block, a test). Cost (R1f, the one call; R1's per-root calls in brackets): in the database, the demo's 12 roots with readings, interleaved under the same load: 12 months G01 4.4 s (4.4 s), K01 1.7 s (2.4 s); 1 January to 7 November G01 3.4 s (4.1 s), K01 2.0 s (2.8 s); one month G01 0.30 s (1.38 s), K01 0.14 s (0.28 s); seven days G01 0.17 s (0.93 s), K01 0.05 s (0.36 s). At 50 synthetic roots 12 months G01 33.4 s (51.0 s), K01 12.7 s (24.3 s). **The row budget is by measure** ("Row budget" above): 2 000 000 for each, G01 1 500 000 under a municipal method (P1; R1f's G01 900 000 was set for the function before migration 0441). P1 (0441: calc.emission_buckets reads by the hour, every figure unchanged), interleaved with R1f's function, best – worst of three at load 40 to 75: the demo's 12 months G01 1.8 – 3.3 s (6.4 – 7.2 s); at 50 synthetic roots 12 months 9.9 – 13.6 s (42.9 – 59.9 s), one month 1.0 – 1.9 s (3.3 – 6.1 s), seven days 0.24 – 0.75 s (1.0 – 1.4 s); at 200 roots one month 2.0 – 2.7 s (11.6 – 19.3 s); the figures of every case indocs/build/P1-report.md, section 4. The budget bounds the rows a request reads, and with one read per measure the time follows the rows; it did not bound R1's per-root calls, whose floor per root made a short period of many roots cost more than its rows (R1v-03). - The intensity (G16) of a period is Σ CO2e ÷ Σ kWh over the intervals that have a factor, 9 decimals; a zero denominator is
NULL, and
pending_kwh/pending_sharesay how much consumption was left out. - "No price area" is said from the area valid on each local day of the period (
core.mp_geo; the latest-started row decides when rows overlap), not from today's: the view reads it per interval. An interval of an MP without an area is neither pending nor a zero emission;factorStatus.noPriceAreais its share of consumption. A response isunavailable(no_price_area) when every reading of the period lacks one,no_factorwhen there is a price area and no factor; a card says it per row (reason), so that consumption stays a figure beside it. - Coverage is the minutes with a quantity over the expected minutes (the frontier, §2, is the days up to yesterday; the expected minutes of a series are those of its expected range: "Which intervals are expected"). Nothing expected is no coverage (NULL), never 100 %.
- Which stored days count (B15v2-05): every stored day, the same for consumption, coverage and emissions. A metering
point's days before
ingest.mp_state.readable_fromthat are stored (a relation lost and anchored anew, §6.3) count in every figure; the expected minutes of a series run from the earlier ofreadable_fromand its first stored day. - Cards (
overview.cards): six rows,E01,G01,G16,K01,K03(B57: "Cost in the queries"),COVERAGE, each withstrip_months(the months of the period) andstrip_delta_cp_pct(the monthly variance, an array of numbers and nulls). TheCOVERAGErow (B15b item 2, B16av-14) has its strip too:strip_months, andstrip_delta_cp, the coverage of each month minus that of the comparison days the month holds (withpythe same month of the previous year), a difference of two shares (0.05 is 5 percentage points, asdelta_cpof the same row), never a percentage of a percentage; NULL for a month that expects no minute, and the whole column NULL without a comparison. The other rows havestrip_delta_cpNULL, and the coverage rowstrip_delta_cp_pctNULL. - The point that lowers coverage (B15b item 4, the coverage card's drill of §11.1): the
COVERAGErow also haslowest_mp_id, the E17 root with the most missing expected minutes in the period (the larger gap, the smaller key on a tie), withlowest_mp_missing_minutesand its ownlowest_mp_coverage(9 decimals). NULL when no root misses a minute (a card for one complete root has none) and on the other rows. Missing is what it is in every coverage figure (ac_missing_minutes: expected minus minutes with a quantity). The point's series is the root's own consumption series, which D1 opens formpalone (seriesis for the members of the tree).
The weekday-hour cells (B20)
consumption.weekday_hours (page A1 Forbrug, the heatmap) returns 199 rows told apart by kind: the 168 cells (weekday,
ISO, Monday 1 to Sunday 7, and clock_hour 0-23 of the local day, Europe/Copenhagen), the 7 weekday margins (the 24 hours of a
weekday; clock_hour NULL) and the 24 hour margins (a clock hour over the 7 weekdays; weekday NULL). ac is the **mean
of the measure** (E01: consumption in kWh) of that hour on that weekday over the days of the period that have the hour with data;
kwh is B20's column, the same where the measure is in kWh and NULL for G01, kept until the page reads ac (B62). It takes p,
mp (E17 roots) and sel (B54), no grain: a g is 422; measure, cmp, m, gwp and basis from B67 (next section, which also
says what ac is for E03 and G01). A figure no root has an hour for has ac and kwh NULL
and roots 0, never a zero; a period in which no hour counts has no row at all (state empty, never 168 cells of zero).
- The unit is the (root, hour), as in phase 1's like-for-like figures: the local hour of the interval's start of one selected
root, the hour of a quarter-hourly series the sum of its quarters. It is eligible when it is complete by the rule of §9.3 without
a factor (
calc.consumption_matched): its stored intervals cover exactly its 60 minutes once, each with a quantity, none of quality A02 or A05. An hour with a quarter missing is not a mean of anything and is left out. These are the hours the page's other consumption figures rest on, nothing else. - The rule for several roots (the lead's ruling): for each selected root its own mean over its own eligible hours of the cell
(the sum of their energy over their number); the figure of the selection is the sum of the roots' means. A root with no
eligible hour in the cell adds nothing, and the row says so:
roots(how many contributed),roots_expected(the selected roots with any eligible hour in the period),root_hours(h) androot_hours_expected(H:roots_expectedtimes the hours the cell would hold had every hour data),min_root_hours(the fewest hours of a contributing root). A root that began mid-period or lacks a month does not take its hours from the others'. With one root the cell is that root's mean. - The margins are made by the same rule from their own hours: per root the sum of its energy over the number of its hours of the margin, then summed over the roots. They are not made from the cells, whose means would weigh a cell of one hour like one of forty.
- The clock changes (§2,
docs/time-rules.md): on the 25-hour day the repeated hour is clock hour 2 again, so two hours of the same cell (and two inroot_hours_expected); the 23-hour day has no clock hour 2, so that weekday's cell of hour 2 has one hour fewer. - The frontier (§2): the period ends where the other figures end. A preset ends at the frontier; an explicit range that
reaches past it is cut at it (
date_toof every row says where the period ended), so that no cell counts an hour after it. The response'sbasiscarries the frontier as everywhere (dataThrough,frontierState,coverage). data_days(the same on every row) is the number of local days with at least one eligible hour: the page's message is made only from a period of at least 14 of them.- A second period is the comparison of B67 (next section): the same function computes both sides in one call.
- Cost: reads the hourly (or quarter-hourly) rows of the period once (with a comparison, those of the comparison's own days
once more), like
calc.consumption_matched; the row budget of §10.3 counts them (readings: always). Planned without nested loops and JIT.
The heat map's comparison (B67)
consumption.weekday_hours takes cmp (every kind of B55: py, pp, from:<date>, none; default none), measure
(E01, E03, G01; default E01) and, for G01, m, gwp and basis (phase 2 §3.4, §4). **It is not the like-for-like
comparison:** no cell of the period is matched to a cell of the comparison (the same date a year earlier is another weekday, so
matched cells would set a Thursday against a Wednesday). The comparison period's 168 cells and 31 margins are computed **by B20's
rule over the comparison's own days**, and the variance of each is a difference of means:
| Figure | Rule |
|---|---|
| Which hours count | Eligible by §9.3 (above). E01 the roots' own series. E03 the series of the roots' export children (role 3, D06), each counted for its root: a child's hour is tested on its own, and the root's hour counts when every export child of the root that has a reading on that side has it eligible; its amount is their sum. A root without an export child has no mean, and a selection with none is unavailable, no_export. G01 the CO2e (g) of the roots' hours whose readings are eligible and which have a factor for every interval, under m, gwp, basis (the lead's ruling to B20); the response carries method and the factor status, and no factor at all is unavailable, no_factor |
| A side's cell or margin | B20's: per root the mean of its own eligible hours of the cell (a margin: of the weekday or the clock hour, Σ amount ÷ hours, never a mean of cell means), summed over the roots that have one. The period's in ac and B20's columns (roots, roots_expected, root_hours, root_hours_expected, min_root_hours, data_days); the comparison's in cp, cp_roots, cp_roots_expected, cp_root_hours, cp_root_hours_expected, cp_min_root_hours, cp_data_days, each side by its own days: the repeated hour of a 25-hour day counts twice in its clock hour and the missing hour of a 23-hour day not at all, on whichever side the day falls |
| The variance | Over the roots that have a mean on both sides (roots_matched): ac_matched and cp_matched, the sums of those roots' period and comparison means; delta_cp = ac_matched − cp_matched (6 decimals, per hour, in the row's unit) and delta_cp_pct = delta_cp ÷ cp_matched (9 decimals, NULL when cp_matched is not above zero), both from the unrounded sums. A root with a mean on one side only is in that side's figure and not in the variance: never a rise or a fall of its whole mean. No root on both sides is roots_matched 0 and the variance NULL (i.r.) |
| What the page reads | Both sides with their roots and hours, and roots_matched: a cell or margin whose roots_matched is below roots or cp_roots carries the missing symbol (B62 draws it) |
- The amount is
ac, as every query names it (§4), and takes its unit and polarity from the row:unitiskWh(E01, E03) org CO2e(G01),polarity−1 (E01, G01) or 0 (E03, as B54's E03).cp,ac_matched,cp_matchedanddelta_cpare in the same unit, per hour.kwhis B20's column, kept for B20's page and B66's fixture until the page readsac(B62):acwhere the unit is kWh (E01, E03), NULL for G01 (a column named kwh never holds g CO2e; the lead's ruling, B67f). - G01's basis:
method, and inbasisfactorStatusof the period as the cells are made of it (ending at the frontier) andfactorSourceover every factor the response rests on, the comparison's included (mixedwhere one side's factors are Energinet's and the other's generated; B67v-01). Both come from the function's own read of the emission rows, so they are read once (columnsbasis_*after the catalogue's, which the runner reads and never sends); an answer with no row takes them from the factor status provider over the same days. Nomatchedblock: the variance is over roots with a mean on both sides, not over matched hours. A direct call with a method that is not available, an unknown GWP set or basis is 22023, ascalc.emission_buckets(B67v-03). - The comparison's days: those of
cmpfor the period as the cells are made of it, ending at the frontier (calc.comparison_periodofdate_from..date_to); every row names them incp_fromandcp_to. The response'scomparisonblock is the runner's, of the period as asked (B55): the two differ only when an explicit range reaches past the frontier and is cut.comparison_not_earlieris decided on the period as asked, before any SQL. cmp=none(the default) answers what B20 answered, value for value (B66's fixture,test_queries_b67.pyandtest_queries_b66.py): thecp…columns,cp_from,cp_toand the variance NULL, nocomparisonblock.- Not additive: a variance of means is not a share of the period's variance; the heat map of the variance and its two margins answer "at which hours of which days", the month series "how much".
- The row budget counts both periods (the roots' rows; for E03 the export children's), as for every query that takes
cmp; it is by measure, 6 000 000 for E01 and E03 and 2 000 000 for G01 (the budget table above). The measurement tool (scale.py) counts the same rows. - Where it is computed:
calc.weekday_hour_cells(mp_ids, from, to, cmp, cmp_date, measure, method_id, gwp_set, basis)(migration 0240, replacing 0188/0212's three-parameter function: a call with three is E01 without a comparison, as before), withcalc.export_seriesandcalc.export_readings(0240) for E03 beside B77'scalc.selection_readingsandcalc.emission_intervals. The Python reference iselo_core.weekday_hours.
The worked example (§3.4, its second half), the first test of the reference
(libs/core/tests/test_weekday_hours_reference.py) and of the query (services/api/tests/test_queries_b67.py): over three weeks
on each side (pp by offset: 1–21 June 2026 against 11–31 May), 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 ac 7,0 (roots 2), the comparison's cp
4,0 (cp_roots 1); roots_matched 1, ac_matched 5,0, cp_matched 4,0, delta_cp +1,0 kWh per hour, delta_cp_pct 0,25;
1 of 2 roots, so the cell carries the missing symbol. B's 2,0 is in the period's cell and in no variance.
Cost in the queries (B57)
Cost is the energy bought at the day-ahead price of the metering point's price area on its local day, in DKK, **without tariffs,
taxes and VAT** (phase 2 §3.2; docs/cost.md is the calculation). Three queries carry it, beside the emissions they already carry:
| Where | What |
|---|---|
overview.cards | Two more rows, K01 (Elkøb til spotpris, DKK, polarity −1) and K03 (the average spot price of the purchase, DKK/kWh, polarity 0), with the figure columns of the other rows, the strip of each, and for K01 volume_effect and price_effect. The COVERAGE row stays: the pages show it as a status line (B61). The rows are in the order E01, G01, G16, K01, K03, COVERAGE |
overview.months, development.series | measure K01, K02 (Elsalg til spotpris: the same over the selected roots' export children, each priced by its own price area; polarity 0) and KNET (Netto til spotpris, polarity −1: a lower net cost is better, §3.2's table; ENET is 0) by month, and K01, K02, KNET by day or month on the series, each with the comparison and the variances |
consumption.weekday_hours | measure=K01: the cost per hour, the 168 cells and 31 margins, with the comparison (B67): "The heat map's K01" below |
Every cost figure is a column of calc.cost_buckets (B56; migration 0245), called once per grain the query needs (the cards once
by month, summed; a series once for its own grain; K02 and KNET a second time over the export children). A query divides only
where this document allows it: a share at 9 decimals (basis.price, unpriced_share) and a relative variance, never a cost;
K03's one division is calc.cost_ratio, B56's.
- K01 is Σ the cost of the intervals of E01 that have a price; K02 the same over the intervals of E03. An interval without
a price contributes energy and no cost, never a zero (§3.2):
unpriced_kwh,unpriced_hours(metering-point hours, aspending_hourscounts: two points with the same unpriced hour are 2) andunpriced_share(a fraction of the figure's energy) say how much, for the note "x % af købet (n timer) har endnu ingen pris". A figure with no priced interval is NULL withreasonno_price(no_price_areawhen every reading of the period lacks a price area,no_datawith no reading); the cards say it per row, a series and the heat map as a whole response (unavailable), as G01 does for a factor. - The reason a cost row gives is decided in one place (
calc.cost_reason, migration 0257, B57f), the same for K01, K02, KNET and the cards' K01 and K03, in this order: for the period's side, no reading (no_data), then no price area for all of the energy (no_price_area), then no price (no_price); then, with a comparison, for its side, no comparison day (no_counterpart), no reading (missing_readings), no price area, no price; then the variance's own reason, the calculation's (a cell left out for a reading or a price; none where cells are matched). KNET applies it to its two legs together: no reading on either leg, no price area for all of either leg's energy, no price on either. So a comparison whose readings are complete and whose prices are absent isno_pricefor the three (KNET saidmissing_readingsbefore B57f); **a bucket of 0,000 kWh in an area without a price isno_price**, neverno_price_area(the energy "without an area" is a sum that is NULL unless an interval without an area has a quantity, so 0 = 0 no longer says it); a figure that is 0 has a cost and no missing-price reason: K01 of a point with prices and no energy is 0, its K03 isi.r.with no reason, as G16 is for no energy. The response of a heat map with no row takes its price status fromproviders/price_status.sqlwith the comparison (B57v-02), so thatpriceSourcecovers both sides as it does with rows. - KNET is K01 − K02 from the two figures as shown, never in place of K01: NULL where either is,
no_datawhere either has no stored quantity. Like ENET it has the total variance only:delta_cpanddelta_cp_totalhold the difference of the two total variances, the matched columns,excluded_priceand the effects are NULL (a like-for-like variance of the net would be of two different sets of cells). It carries the caveats of both:unpriced_kwhandunpriced_hoursare the two series' added,unpriced_sharetheir share of the two series' energy together, and its price block is over the union of both calls' rows. - K03 is K01 over the energy of the priced intervals of E01, 9 decimals; NULL (
i.r.) when that energy is not above zero. Its comparison and variance are those of the matched cells:ac_matchedandcp_matchedare the matched cost over the matched energy of each side,delta_cptheir difference.volume_effectandprice_effectare NULL on every row but K01's. - The variance of K01 and K02 is like for like (as G01's): only the hour cells that are eligible by §9.3 and have a price for
every interval of the hour on both sides, the same cells on both.
matched_hoursofhours_in_period(h of H, "Sammenlignet over h af H timer"),excluded_readings(the cells left out for a missing or incomplete reading) and the newexcluded_price(left out for a missing price),ac_matchedandcp_matched(what the variance is made of),delta_cpanddelta_cp_pct.delta_cp_totalisac − cp, all days of both ranges. Where no cell is matched the variance is NULL (i.r.) withreasonmissing_readings,no_price,no_dataorno_counterpart, never −100 %. - A relative variance is
i.r.when its reference is zero or negative, for K01 and K02 as for K03 (§3.2, manual §3):delta_cp_pctis NULL whencp_matchedis not above zero,delta_cp_total_pctwhencpis not. A comparison that cost −1,00 has a variance (+3,40: 2,40 against −1,00) and no percentage. Nothing is clamped at zero; sums are signed. - The two effects of K01's variance (
volume_effect,price_effect) are summed over the matched cells at the hour's grain, whatever the resolution of either side: volume = (q_AC − q_CP) × P_CP × 0,001, price = (c_AC − c_CP) − volume. **They sum todelta_cpexactly**, per bucket and for the card; the month rows' effects add up to the card's, and the month rows' costs to the card's cost (the cards add the months of the same call). The worked example of §3.2 (2 kWh at 1 000 DKK/MWh against 3 kWh at 800) is +1,00 and −0,60, summing to the variance of 0,40;test_queries_b57.pyholds it through HTTP. - Quality:
ac_solid_amount+ac_provisional_amount=ac, where the provisional part is the cost of the intervals whose reading is estimated (A03): a price has no version (§3.2).provisionalis true when more than 1 % of the figure, by absolute value, is provisional. The missing, incomplete and not-expected minutes are those of the consumption series the figure is made of (KNET: of both).
basis.price and priceSource are on every response that carries a cost (the cards, overview.months and
development.series with K01, K02 or KNET, and the heat map with K01), the comparison period's rows included, as
factorStatus and factorSource are:
"basis": { "price": {"priced": 0.833333333, "unpriced": 0.166666667, "noPriceArea": 0},
"priceSource": "generated",
"matched": {"hours": 7512, "hoursInPeriod": 7680, "excludedReadings": 96, "excludedPrice": 72, "reason": null} }
priceis the shares of the period's energy that are priced, unpriced (a price area and no price) and without a price area, eachp_…_kwh ÷ p_kwhat 9 decimals; a wholly priced period is{priced: 1, unpriced: 0, noPriceArea: 0}, never null; **null where the period has no energy**. ForKNETit is the shares of the two series' energy together.priceSourceisgeneratedwhen a price behind the response is generated and none is Energinet's,energinetthe other way,mixedwith both (Energinet's prices this year and generated ones a year earlier, say) andnonewith neither. **Generated prices are neverenerginet**; the response never says "Energinet" itself, B61's page writes "Kilde: Energinet" only forenerginet.basis.matched: on the cards the block stays G01's (hours, hoursInPeriod, excludedReadings, excludedFactor) and gainsexcludedPricefrom K01 (the one count G01 has not); each card row carries its own figure's counts in its columns. Onoverview.monthsanddevelopment.serieswithK01orK02the block is that measure's:hours,hoursInPeriod,excludedReadings,excludedPriceandreason, and noexcludedFactor; withKNETand the heat map there is none. The cards carrymethod(they carry emissions); a response that carries only a cost has none.unavailable: a series or a heat map whose period has no priced interval at all answersunavailablewithno_price(orno_price_area), no rows;K02andKNETover a selection with no export child answerunavailable,no_export, asE03andENETdo. The cards keep their rows: a K01 with no price is a row with itsreason, beside the consumption.
The heat map's K01. consumption.weekday_hours takes measure=K01 (calc.weekday_hour_cells, migration 0255): the amount is
the cost in DKK, unit DKK, polarity −1, kwh NULL (a column named kwh never holds DKK). **An hour counts when its readings are
eligible (§9.3) and every interval of it has a price**, the rule B20's ruling gave G01 a factor; an hour of four quarters costs what
its quarters cost (the worked example's 2,12), so the cells are the cost figures of calc.cost_buckets, hour by hour, and an hour
read hourly from the seam needs all four quarter prices. The comparison and the variance are B67's (over the roots with a mean on both
sides). basis.price and priceSource come from the statement's own read, so the readings are read once; no matched block.
The row budget (docs/queries.md "Grain and budget"; a number per query, by measure where one query serves several): K01 reads
what G01 reads (the roots' series over the period and the comparison's own days); K02 reads the export children's series, KNET both
(providers/budget.sql counts them by measure). The cost measures of overview.months and development.series are 2 000 000,
G01's number, the default: K01 costs less a row than G01 (1.2 s against 2.7 s for a year of the demo's 18 roots by month, KNET 1.6 s, the
cost's two calls being one of 1.2 s and one of 0.4 s over the export children's few rows), so what holds for G01 holds for them;
E01, E03 and ENET are never budgeted. The heat map's K01 is 2 000 000 as G01's (0.85 s against 1.02 s for a year). **The cards'
number is lowered from 1 500 000 to 1 200 000**: they now read the cost beside the emissions, and ytd takes 4.51 s where it took
3.44 s (a year 5.06 s against 4.07 s; ratio 1.31), so B77's 27 s, nine tenths of the timeout, at 1.57–1.62 M rows becomes 1.2 M rows
(1.57 M ÷ 1.31, rounded down to a hundred thousand). It is extrapolated from the demo by the ratio of the cards' seconds, not
measured at 50 and 80 roots: that measurement is the lead's (ADR-004, item 4) and may move the number.
The split: bought, sold and net (B68, B68f)
energy.split (A1, p, mp, sel, cmp; no grain, no measure) answers one row per figure: bought, sold and net, in that
order (phase 2 §3.1, §4). Each row has its energy (columns kwh_…) and its cost (dkk_…: the energy at the day-ahead
price of the point's price area, without tariffs, taxes and VAT, §3.2), with the comparison, the variances and the quality. It
calculates nothing: the energy is calc.consumption_buckets of the period (the day summaries, as the E01 card and E03 by month have
it: the split's bought equals the E01 card digit for digit, sold E03's), its like-for-like variance is the E01 card's own
(calc.consumption_matched, with p_export for sold), and the cost, its like-for-like variance and the unpriced energy come from
one call of calc.cost_buckets per side at the period's grain (B56, docs/cost.md).
| Row | Energy | Cost | Polarity (kwh_polarity, dkk_polarity) |
|---|---|---|---|
bought | E01: the selected roots' own series | K01 | −1, −1 |
sold | E03: the series of the roots' children of role 3 (D06), each priced by its own price area | K02 | 0, 0 |
net | bought − sold, from the two figures as shown | KNET: the same in cost | 0 (ENET), −1 (KNET) |
- Which rows. Without an export child among the selected roots the response is
okwith theboughtrow alone: an unavailable figure has no row, never a zero (stateunavailableis for a response with no figure at all). With an export child the response has all three. The rows come from the cost's side, which has one per side, so a selected root that has no series yet (registered, nothing read) keeps itsboughtrow andnet: rows with no figure andkwh_reason,dkk_reasonno_data, neversoldalone and, without an export child, never no row where the cards answer a row (B68f, B68v-01). **An export child that is registered and has no reading** givessoldandnetrows with no figure andno_data: net is never bought alone (B54v-01). - Net is a difference of two figures as shown, in energy and in cost, and no figure where either part is none (where
sold's cost has no price at all,net's cost is none withdkk_reasonno_priceand its energy is still a figure). Its variance is the difference of the two total variances (net of the period minus net of the comparison is exactly that) and is named total (kwh_delta_cp_total,dkk_delta_cp_total): net has no like-for-like variance, so its…_matched,…_delta_cp,…_delta_cp_pctand its seven counts (kwh_matched_hours,kwh_hours_in_period,kwh_excluded_readings,dkk_matched_hours,dkk_hours_in_period,dkk_excluded_readings,dkk_excluded_price) are NULL. Its quality minutes and its unpriced energy and hours are the two series' added, its provisional part is the net of the two, and it is provisional where either part is. - One figure has one like-for-like variance on every page (B68f).
bought's like-for-like variance of the energy is the E01 card's own:calc.consumption_matched, the hour cells eligible by their readings alone (complete readings on both sides, §9.3), sokwh_delta_cpis the card'sdelta_matchedfor the same request;sold's is the same rule over the export children's series (p_export, migration 0265, whichcalc.weekday_hour_cellshas had for E03 since B67: each export child's hour is tested on its own, and the root's hour is complete when every export child it has among that side's readings has it complete; the amount is their sum; the Python reference iselo_core.consumption). A row has two sets of counts, each named for its figure: the energy's (kwh_matched_hoursofkwh_hours_in_period,kwh_excluded_readings) and the cost's (dkk_matched_hoursofdkk_hours_in_period,dkk_excluded_readings,dkk_excluded_price); "Sammenlignet over h af H timer" is said once per figure. The cost's cells are those that also have a price for every interval on both sides, so where an hour has no price the energy's variance keeps its cell and the cost's leaves it out, counted indkk_excluded_price(a period whose last day has no price:bought'skwhvariance equals the E01 card's, and itsdkkvariance is over fewer hours). The total variance (…_delta_cp_total) is over all days of both ranges and does not depend on a price. Where no cell is matched the like-for-like variance is NULL (i.r.) with the reason, never −100 %; a relative variance is NULL when its reference is zero or negative (manual §3). - Reasons.
kwh_reasonis the E01 card's (no_data,missing_readingswhere the comparison has no figure, then the variance's ownno_data,no_counterpart,missing_readings).dkk_reasoniscalc.cost_reason's (0257), the one rule of K01, K02 and KNET: no reading, then no price area for all the energy (the function's ownp_all_without_area, never "0 kWh is all of 0 kWh"), then no price; the period's side and then the comparison's; net's over both legs together, no reading on either first (B68v-04, -05). - The unpriced caveat of the cost:
unpriced_kwh,unpriced_hours(metering-point hours, aspending_hourscounts) andunpriced_share(a fraction of the row's energy; net: of both series' energy together): "x % af købet (n timer) har endnu ingen pris". - Columns carry their unit (
kWh,DKK,h,min,fraction) and, where it is the figure's,polarityFrom: "kwh_polarity"or"dkk_polarity"(one polarity per figure, on every row); the response'sscaleis the maximum of each unit over the rows, so the page draws energy and cost on their own scales. basis.priceandpriceSourceare over the union of both calls' rows, as KNET's (the shares of the two series' energy together: a wholly priced response is{priced: 1, unpriced: 0, noPriceArea: 0}); there is nobasis.matched(each row has its own counts) and nomethod.comparisonis the response's block as everywhere (kind,code,from,to), absent withcmp=none.- The row budget is the roots' reading rows plus the export children's, over the period and the comparison's own days, summed
apart: the catalogue gives the query
budget_measure: KNET, so thatproviders/budget.sqlcounts it as the measure it reads like (the query has nomeasureparameter). 1 000 000: with a comparison the split reads each of those rows twice (the cost and the energy's like-for-like cells), so KNET's 2 000 000 is halved (see the budget table).selandmpas every query of the selection; an E18 or a child inmpis 422not_a_consumption_root.
Tests: services/api/tests/test_queries_b68.py and test_queries_b68f.py (B68f: the energy's variance is the card's where the last
days have no price; calc.consumption_matched with p_export against elo_core.consumption; a root with no series; the polarity and
the counts per figure; the reasons) (the worked example of §3.2: bought 6 kWh and 1,70 DKK, sold 1 kWh and 1,20 DKK, net
5 kWh and 0,50 DKK; the sold row's own like-for-like variance; net with none; no export child; an export child with no reading; an
unpriced sale; the budget; and the demo organisation against B56's reference and against the queries beside it).
The point's cost: mp.cost_intervals (B68)
mp.cost_intervals (D1, p, mp exactly one point of any tree, g hour or quarterHour) has the rows of mp.series (one per
interval of the window, a gap where nothing is stored, with stored, expected and its reason: "Which intervals are expected") with
the price used and the cost of each row, from calc.cost_intervals (B56): it calculates nothing. A root of either type, a
child (the export child D06, the import child D07) named directly: each is priced by its own price area on the interval's local day
(phase 2 §3.2), and a D06's series is the value of what was sold, at the spot price.
- At most 750 intervals, as
mp.series: hours up to 31 days (745 hours for 1–31 October 2026, the 25-hour day of 25 October among them, for a point read hourly and for one read in quarters), quarters up to 7 days;g=autois the finest the window fits; otherwise 422grain_too_fine;dayandmonthare 422invalid_parameter. - A point that is not chartable as a load (
ref.mp_type.chartable_as_loadfalse: D15, D04) answersunavailable,not_a_load, no rows, before anything is read (the catalogue'sloads_only; the providermps.sqlsays which points are loads). - The price used (
dkk_per_mwh, DKK per MWh as delivered; negative prices are kept) is the interval's: at the **hour's grain the hour's own priceP**: its row before the seam (price_resolution60,price_rows1), **the mean of its four quarters from the seam (15, 4)** for an hourly reading and for the hour of quarters alike, none with fewer; as stored (quarterHour) a quarter's own (15, 1; before the seam its hour's row, 60, 1).price_generatedsays the price rows used are generated, never Energinet's.price_areais the area valid on the local day (NULL: none). - The cost (
cost_dkk) is the sum of the costs of the row's intervals, each at its own price: an hour of four quarters can cost other thankWh × P(the worked example's hour 1 read as 0,2, 0,4, 0,8 and 0,6 kWh costs 2,12, not 2,00 for 2 kWh at 1 000 DKK per MWh); an hour whose fourth quarter has no price has noPand keeps the cost of its three priced quarters. It may be negative and is NULL for a gap and where no interval has both a quantity and a price.afventer prisis the columnprice_pending: a stored interval with a quantity and a price area and no price; a gap is "mangler" (storedfalse) and never pending, and an interval without a price area has a NULLprice_areaand is neither.unpriced_kwhis the energy of the row's intervals with a price area and no price. basis.priceandpriceSourceare the point's own over the window (calc.cost_point_status: the shares of its energy that are priced, unpriced and without a price area; the source of the prices behind it), the same on every row, taken by the runner from the first row and never sent (PRICE_COLUMNS). A point with no stored interval has no row:empty,basis.pricenull,priceSourcenone. There is nomethod, no comparison and no row budget (750 points).
Tests: test_queries_b68.py (the worked example through HTTP: 2,00, −0,30, no price for the hour of three quarters, 2,12 for the
quarters, the export child's 1,20; the 745 hours; D15 and D04; the grains; and, on the demo organisation, every row of a week over
the seam equal to B56's reference elo_core.cost.cost_series_intervals).
The sources in the queries (B59)
The sources are the grid's mix in the hours of the consumption (phase 2 §3.3; docs/mix.md is the calculation and the wording).
The four queries of A4 (mix.structure, mix.series, mix.profile, mix.hours) and the footprint carry them. Every figure is a column of calc.mix_buckets (B58), called once for the grain the
query needs (report.footprint twice, by source and by origin); a query divides only where this document allows it: the pending
share at 9 decimals and the variance in percentage points, never a source energy or a share of one.
| Query | Page | Parameters | Rows |
|---|---|---|---|
mix.structure | A4 | p, mp, sel, basis, cmp, by | by source: the nine groups in the order of ref.mix_group.sort (B78: gas "Naturgas" and coal_oil "Kul og olie" where fossil stood), a group without energy a row of zero (0.000000000), never a missing row; by origin: every connected area with energy, the largest first, the lower code among equals, an area ref.code does not know under its own code (known false, name NULL) |
mix.series | A4 | p, mp, sel, basis, cmp, g (day, month) | one row per day or month: E11a and E11b, the energy and share of each group in groups (the order of sort) with the comparison's energy and share on the comparable hours (M1f: cp_kwh_matched, cp_share_matched, the matched cells, as the variance) and over all its own hours (cp_kwh_all, cp_share_all, drawn nowhere in the form), NULL, never zero, where those hours have no mix, the consumption, the consumption of the complete hours, the pending energy and hours, the share of each side's mix that is not final (ac_provisional_share, cp_provisional_share), the comparison's, the two variances in percentage points |
mix.profile | A4 | p, mp, sel, basis, cmp | one row per clock hour 00 to 23 of the local day over the period, always 24 (M4: calc.mix_buckets by the grain hour): mix.series' figures of a bucket by the class of the hour's own clock hour, the hours of the class (hour_count: the 25-hour day's 02A and 02B two observations of 02, the 23-hour day none; hour_repeated, hour_absent: the days it occurs twice and not at all, what the page names under the axis, manual N29) and the means per hour of the day profile (ac_kwh_per_hour, ac_mix_kwh_per_hour, groups[].kwh_per_hour: each energy over hour_count, 9 decimals, half away from zero); a class with no hour has reason no_hour |
mix.hours | A4 | p (at most 31 days), mp, sel, basis, by, g (hour) | one row per hour of the window's local days in time order (M5a: calc.mix_buckets by the grain utc_hour): hour_utc, local_date, clock_hour and occurrence (the short day has 23 rows and no 02; the long day 25, 02A and 02B occurrence 1 and 2, manual N29), the consumption, the consumption in the figures, E11a, E11b, the pending energy, the energy without a price area, ac_provisional_share, and parts (by=source the nine groups, by=origin every connected area with energy in the window: part, name, known, kwh, share); an hour whose mix is pending keeps its row, its consumption known and its parts NULL, reason no_mix (emission_state: rows: a window whose every hour is pending is answered hour by hour, never unavailable as a whole); no comparison |
- What is in the figures: the hours whose mix is complete under the basis (§3.3 step 1; under
basis=finalFinal ones only).ac_kwh,ac_share(÷ the consumption of those hours, 9 decimals) and the energy of the groups sum to that consumption; the nine rounded shares sum to 1 within the rounding (at most 4,5 × 10⁻⁹). The pending energy is the consumption of the hours with a price area that are not in the figures:basis_pending_kwh,basis_pending_hours(metering-point hours: two roots with the same pending hour are 2, as forpending_hoursof G01 and K01) andbasis_pending_share(÷ the consumption, 9 decimals) for the note "x % af forbruget (n timer) har endnu intet fuldstændigt elmix" (basis=final: "er uden for det endelige elmix"). - The first row's
basis_*columns ofmix.structurecarry E07 (basis_e07_kwh), E11a, E11b, the comparison's E11a and E11b and the variances of the two shares (basis_delta_e11a_pp,basis_delta_e11b_pp), the consumption and the consumption of the complete hours, and the pending energy, share and hours.basis_provisional_shareandbasis_cp_provisional_share(M4f) are the share of the period's (the comparison's) consumption in the figures whose mix is Preliminary or Initial, over the same base as theac_provisional_shareof every bucket ofmix.seriesand every class ofmix.profile(so the period bar of "Hver kilde for sig" is hatched on the columns' base; the status line'smixStatusis over all the consumption with a price area, a different base); 0 underbasis=final, NULL with no hour in the figures. They are on every row (the period's values, as thep_columns of the other queries are), so that a page reads them from the first row and a row dropped by a page cannot take them away. - The variance in percentage points is
(share − the comparison's share) × 100of the two matched sharescalc.mix_bucketsreturns, exact, over the matched hour cells only: eligible by §9.3 and in the figures on both sides (matched_hoursofhours_in_period, "Sammenlignet over h af H timer";excluded_readings, and the newexcluded_mixfor the cells left out because the mix of either side's hour is not in the figures). A share of 9 decimals gives a difference of at most 7, so the product needs no rounding;round(…, 9)is written so that a change of scale cannot add digits.delta_cp_ppof a group and the variance of E11a and E11b are NULL where no cell is matched, withreason(no_data,missing_readings,no_mix,no_counterpart), never −100 pp.ac_shareandcp_shareare over each side's own hours in the figures and are not what the variance is made of:ac_matched_shareandcp_matched_shareare. unavailable,no_mix: a period with consumption and no hour in the figures answersunavailablewith no row, for both queries and bothby(no_price_areawhen every hour of it lacks a price area; the rule of the footprint's reasons below). A share is never zero for want of a mix. A period with nothing stored isempty,no_data. Inmix.seriesa bucket with no complete hour in a period that has some has NULL shares and NULL energy ingroups,reasonno_mixand its consumption (the bucket is drawn as a gap, as a day without a factor is); it saysno_price_areaonly when it has energy and all of it lacks a price area (a bucket of 0,000 kWh saysno_mix: 0 = 0 of the energy "without an area" is no area at all, B59v-02). A period whose hours are in the figures and whose parts have no energy (byorigin, 0,000 kWh: no area has any) answersokwith no row, as bysourceanswersokwith its nine rows of zero (B59v-01).basis.matchedon a response with a comparison:{hours, hoursInPeriod, excludedReadings, excludedMix, reason?}, the period's own block (excludedMixbesideexcludedReadings; noexcludedFactor, noexcludedPrice), there whenevercomparisonis, also in a response with no row (B59v-01: the provider of the status takes the comparison as the queries do).comparisonis as for every query.basis.mixStatusandmixSourceare made asbasis.priceandpriceSourceare (B57): the five status shares arecoalesce(p_final_kwh, 0),p_preliminary_kwh,p_initial_kwh,p_status_pending_kwhandp_no_price_area_kwheach ÷p_kwhat 9 decimals wherep_kwh > 0(a period wholly Final is{final: 1, …0}, never NULL), the same under either basis;mixSourceisgenerated,energinet,mixedornonefromp_any_generatedandp_any_realover both sides, so Energinet's rows this year and generated ones a year earlier aremixed, and generated rows are neverenerginet. A response with no row (nothing stored, or byoriginno area with energy) has them fromproviders/mix_status.sql, the same call with the comparison (B59v-01: with'none'it left the comparison's side out ofmixSourceandbasis.matchedout of the response, as the factors' and the prices' providers once did;test_queries_b59.pywalks every query that carries a source and takescmp).- The sum per price area and hour is a materialised step of
calc.mix_buckets(sums AS MATERIALIZED, B58), joined to the mix, which is one row per price area and hour, only after it is made: a reading is never joined to its hour's 30 rows (§4). The queries read the readings through that function alone (readsof both iscalc.mix_buckets(),ref.mix_groupandref.codefor the names), andtest_queries_b59.pyasserts it on the function's text. - Names:
nameisref.mix_group.name_da(Vind, Sol, …) or the connected area'sref.code.name_da(Sverige, Tyskland, …), NULL for an area the table does not know. The key is the code, never the name. The measures are called "Elmix" and "kilder" (docs/mix.md, "The wording"): no column, reason or message names a sourcegrøn. - Time and budget: a year of every root of the demo organisation (18 roots, 496 096 readings) against its previous year,
through HTTP, on tables analysed as the product's loader leaves them, **2.0 s by source, 2.5 s by origin, 2.0 s by month and 2.1 s by
day** (B59f's final run; 1.7 to 2.2 s on the first) (
test_queries_b59.pyfails above 10 s, a third of the API's timeout, and prints the time). The row budget of both is the default, 2 000 000, G01's (table above).
report.footprint's sources (B59, the rows after the eight of phase 1; max_rows 10 became 60). Two calls of the function
with no comparison, by=source and by=origin, so that the readings are read twice (a validation can afford it; a page could not,
and the pages take one call):
block | unit | value | amount (amount_unit) | per_kwh |
|---|---|---|---|---|
renewable_share_ex_nuclear | fraction | E11a, 9 decimals | E07 (kWh) | the consumption of the complete hours |
renewable_share_with_nuclear | fraction | E11b, 9 decimals | E07 + nuclear (kWh) | the same |
source:<group_code>, the nine in sort order (B78: source:gas and source:coal_oil in the place of source:fossil) | kWh | the group's energy | the same (kWh) | – |
origin:<connected_area>, each area with energy, the largest first | kWh | the area's energy | the same (kWh) | – |
- The split these rows are (B78): Eloverblik's "Prisområde". In the words the pages use: "Elmixet følger Eloverbliks
geografiske opdeling »Prisområde«. Rapporten »Dit klimaaftryk« lavet med opdelingen »Kommune« viser andre andele, fordi den
først medregner kommunens egen vedvarende produktion." A report made with "Kommune" is no target for these rows (
docs/mix.md). - A figure that has no complete hour is NULL (never zero) with
reasonno_mix; the origin rows are then none. completeis true when the readings are complete (covered_hours = expected_hours, as for every block) and some hour is in the figures and none is pending (pending_hours, here the hours with a price area and no complete mix under the basis) and none lacks a price area.reason, the first that applies, as the emission blocks' precedence:no_data; with no hour in the figuresno_price_area(every hour lacks an area) orno_mix;missing_readings;no_price_area;pending_mix. A mix row'sno_price_area_hoursis the footprint's own count (it does not depend on a factor: the same on every row but consumption),factor_hoursis NULL.- The response carries
basis.mixStatusandmixSourcebesidefactorStatusandfactorSourcewhereblocksisall(mixes: blocks).blocks=emissionsanswers phase 1's eight rows alone, equal to the first eight of the default's: the constant filter on the two calls of the function is false, so the function is never executed (test_queries_b59.pycounts its calls: two withall, none withemissions), and the row budget is the one B77f set for those rows, 5 300 000; with the sources it is 1 400 000 (the budget table above). A caller that wants only the emissions, the validation of them among them, sendsblocks=emissions; the default is the report with its sources, so thatmake validatereads what it read and the sources besides. - The validation tool (
elo_devtools.validate footprint) reads the blocks it knows by name; seedocs/build/B59-report.mdfor what it needs to learn the new ones.
report.footprint (B12b)
The blocks of Eloverblik's climate report "Dit klimaaftryk" (§9.4; L2) for a period, the selected E17 roots and one method,
GWP set and data basis: one row per block, in the report's units. It takes p, mp (roots only), m, gwp and basis,
and no comparison or grain (422 unknown_parameter). No page shows it; make validate asks it through the application.
block | unit | value | amount (amount_unit) | per_kwh |
|---|---|---|---|---|
consumption | kWh | Σ every stored quantity of the period | the same (kWh) | – |
emissions | kg CO2e | emissions excluding losses: Σ CO2e × 0.001 | Σ CO2e (g CO2e) | – |
distribution_loss | kg CO2e | Σ CO2e × (DFactor − 1) × 0.001 | (g CO2e) | – |
transmission_loss | kg CO2e | Σ CO2e × (TFactor − 1) × 0.001 | (g CO2e) | – |
biogenic | kg CO2 | Σ (CO2origin − CO2) × kWh × 0.001, the consumption's only (R2 §3.4.1 step 7) | (g CO2) | – |
co2_intensity | g/kWh | amount ÷ per_kwh, 9 decimals | Σ CO2 (g) | Σ kWh with a factor |
ch4_intensity | mg/kWh | the same | Σ CH4 (mg) | the same |
n2o_intensity | mg/kWh | the same | Σ N2O (mg) | the same |
local_energy (B84, municipal methods only) | kWh | Σ q × R × 0.01 of the intervals that have both inputs, exact | the same (kWh) | – |
- Every emission sum is over the intervals that have a factor under the basis (§9.2, §9.3): a total in kg is the exact sum in g times 0.001, never rounded; an intensity is rounded to 9 decimals like every ratio, and its row carries the exact numerator and denominator, so that a comparison at any precision never rests on the rounded quotient. A figure without a factor behind it is NULL, never zero. The renewable share, the source and the origin splits are rows after these eight (B59, "The sources in the queries" above).
- What a figure rests on, in MP-hours:
expected_hours(the selected roots × the hours of the period's local days, 23, 24 or 25 a day),covered_hours(hours whose stored intervals cover exactly the hour, whatever their quality: an A02 hour is the source's own "missing" and is delivered), and on the emission rowsfactor_hours,pending_hoursandno_price_area_hours.completeis true when every hour has its readings and, for an emission block, every hour with a quantity has a factor and a price area (under a municipal method also a municipality and a share, B84).reason:no_data,no_factor,no_price_area,missing_readings,pending_factor,zero_consumption; under a municipal method alsono_municipality,municipality_not_loaded(hours of a wanted municipality outside the setting's list, §2.2) andpending_share(hours of a wanted municipality with no share, beforepending_factor); a figure that no hour is in has the cause that holds the largest share of the consumption ("The municipal split in the queries").local_energyis the ninth block and a block of the municipal methods only, returned withblocks=emissions(a price-area method answers its eight, as before). - The response carries
method,basis.factorStatus,basis.factorSource(generated factors are never Energinet's) andboundary, from the query's own rows (basis_from_rows); there is nomatchedblock. - From
calc.footprint(migration 0140): one read of the period's emission rows, then only groupings; planned without nested loops and without JIT, so the plan does not depend on statistics (B15v2-07). It does not usecalc.emission_matchedorcalc.emission_buckets: a footprint compares nothing. Measured in the test of the demo organisation (18 roots,docs/build/B12b-report.md): a year of every root 1.7 s never analysed and 1.8 s analysed; a day of one root 0.8 s (the hash of the factor table, whatever the period).
The municipal split in the queries (B84)
docs/architecture/municipality-method.md §5, without the sources (B88's) and without B93's list of methods (above, meta.context). B83
computes the figures of LB-MU-125; B84 makes every query that takes m answer under it. **Nothing of the price-area methods
changes**: services/api/tests/test_queries_b66.py compares every answer of the catalogue under LB-PA-125 with the frozen fixture, value
for value, but for the members named here (_b84_part).
- The response.
methodhasgeography(price_areaormunicipality).basis.factorStatushasnoMunicipality, a share of the period's consumption like the others (0 under a price-area method; the six add to 1): a point-hour with a price area and no wanted municipality, which has no figure under the method and is never given the price area's. It holds the hours ofmunicipality_not_loaded(a usable code that the setting's list leaves out: decided from the setting, never from what is loaded);pendingholds the hours ofno_local_share(a wanted municipality and no usable share for the hour: the last ten days, a first load under way). The runner reads the three shares throughBASIS_COLUMNS(basis_no_municipality,basis_municipality_not_loaded,basis_no_local_share, after the matched block) andproviders/factor_status.sql. basis.factorSourcecovers the share rows too: under a municipal method the runner askscalc.share_source(mp_ids, period, comparison)(migration 0345) whether a share of the wanted municipalities of the selected roots, in the hours of the period or of its comparison, is generated and whether one is Energinet's, and adds both to the factors' own. A generated share is never Energinet's: Energinet's factors beside generated shares aremixed. It is a bound, never narrower than what the figure rests on (it also holds a share of an hour in which no root has a quantity); the function returns no code.- The reason of a figure that no point-hour is in (
stateunavailablewith areason; on the cards the reason of the G01 row; onreport.footprintthereasonof the emission blocks).no_datafirst, as before (nothing stored). Otherwise **under a price-area method phase 1's rule**:no_price_areawhen every reading lacks a price area, elseno_factor; **under a municipal method the cause that holds the largest share of the period's consumption**, a tie in the orderno_price_area,no_municipality,municipality_not_loaded,no_local_share,no_factor. A selection or bucket without energy (every reading 0,000 kWh: no cause holds an amount above zero) has its reason from the hours' causes instead, by their counts and the same rules in the same order (calc.emission_reason_hours, 0346; B84v-01); under a price-area method the answer is phase 1's. One function holds the rules,calc.emission_reason(0345;docs/storage.md): the cards, G01's two queries and the footprint call it, and the runner calls it for the response-level reason, so that they cannot differ. A selection of which a part has figures answers with that part's figures and the shares of the rest infactorStatus: it is no reason, and the pages say both.
| Query | Under LB-MU-125 |
|---|---|
overview.cards | The G01 row gains local_kwh (the energy that the municipality's own renewable production covered, the exact sum of q × R × 0.01 over the intervals that have both inputs) and local_share (that over the consumption of the intervals with both inputs, 9 decimals); NULL on every other row and under a price-area method, and NULL, never zero, where no hour has a figure. G16 is the intensity per kWh of the consumption (Σ amount ÷ Σ q, §2.3), as before |
overview.months, development.series (G01), consumption.weekday_hours (G01) | Computed by the method; the reasons above; noMunicipality in the status. The heat map's cells are the hours that have both inputs |
mp.emission_intervals | Per interval also re_share_pct, local_kwh, grid_kwh and pending_reason (no_price_area, no_municipality, municipality_not_loaded, no_local_share, no_factor; NULL when the interval has a figure); NULL under a price-area method, where pending says it. The code of the municipality is in no column. A root with no figure at all is unavailable with its reason and no rows, as a root without a price area always was |
report.footprint | The eight blocks by §2.3 and a ninth, local_energy (kWh, the exact Σ q × R × 0.01), returned with blocks=emissions. blocks=all (and so no blocks) is 422 invalid_parameter until B88: the sources of the municipal split are not answered, and the price area's are never given under its name. complete also needs a municipality and a share for every hour with a quantity; reason gains no_municipality, municipality_not_loaded and pending_share (hours of a wanted municipality with no share), the last before pending_factor |
The factor on the budget (§5, ADR-004). A query's entry may carry municipal_budget_factor (above 0, at most 1; 1 where absent):
under a municipal method (or geo=municipality, B88) a response that carries emissions has the budget it has (its own number, or the
default 2 000 000) times the factor, rounded down to a hundred thousand (Query.budget); E01 and E03 of the heat map read no emission
rows and keep theirs. The factor is the inverse of the measured ratio where the municipal split takes more than 1,10 times the price
area's. Measured through HTTP on analysed tables (ANALYZE after the load, as the product's loader does), the demo's 18 roots, a year to
the frontier against the year before, the median of three runs in alternating order, twice (the same ratios to the second decimal), **after
B83's fix round** (the price-area path without the municipal joins, so that it costs what it cost before them; before the fix round the
ratios were 1.06, 1.11, 1.14 and 1.31, and the price area's seconds about 12 % higher):
| Query | LB-PA-125 | LB-MU-125 | Ratio | Factor | The budget |
|---|---|---|---|---|---|
overview.cards | 4.88 s | 5.42 s | 1.11 | 0.90 | 1 000 000 |
development.series G01 by month (and overview.months, which is the same file) | 2.57 s | 3.07 s | 1.20 | 0.83 | 1 600 000 |
consumption.weekday_hours G01 (not in §5's list: measured beside) | 1.05 s | 1.27 s | 1.21 | 0.82 | 1 600 000 |
report.footprint, blocks=emissions | 1.04 s | 1.50 s | 1.44 | 0.69 | 3 600 000 |
overview.mp_variance G01 (P1: after migration 0441; the demo's year in the database, best – worst of three, interleaved) | 2.07 – 3.07 s | 2.73 – 4.18 s | 1.31 – 1.36 | 0.75 | 1 500 000 |
Like B57's number for the cards, these are an extrapolation from the demo's 18 roots, to be measured at 50 and 80 roots (ADR-004,
item 4). The test of the times (test_a_year_of_every_root_under_both_splits_through_http_is_timed) guards against a several-fold
blow-up only (1.5 times and a second); the comparison is the one above.
P1v-04: the cards', the months' and the series' factors (0.90, 0.83, 0.83) were derived for the view's ratio and are not re-derived. Migration 0441 (P1) changed calc.emission_buckets, which all three read: its municipal branch now takes 1.31 – 1.36 times the price area's seconds on the demo's year (the ranking's row above), not the 1.20 the months' factor encodes. In seconds both branches are faster than before 0441 (the municipal branch faster than the old price area's), so the budgets admit nothing slower than before; the ratio they encode is not measured. Only the ranking's factor was re-derived (0.75). The read measured the municipal ranking at 85 roots' year at 1.0 – 1.2 times the price area's per row (not interleaved): a bound, not a ratio.
Names of master-data codes (B15b)
mp.master returns every code D1 shows with its Danish name, <code>_name_da, from one table in the database, ref.code
(list, code, name_da; the metering point type from ref.mp_type.name_da). A page has no table of names of its own.
| Column (code) | ref.code.list | Source of the names |
|---|---|---|
type | ref.mp_type | R1 §5.1 (the types of 0002) |
sub_type, physical_status, net_settlement_group, connection_type, disconnection_type | sub_type, physical_status, net_settlement_group, connection_type, disconnection_type | R1 §5.8; the values in the saved samples (getdetails.json: E22, 6, D02) are all named |
settlement_method | settlement_method | R1 §5.2 (D01, E01, E02) |
reading_occurrence | meter_reading_occurrence | R1 §5.3 (PT15M, PT1H, P1M, ANDET) |
unit | unit | R1 §5.7, which names a unit by its symbol (KWH kWh, KWT kW, MWH MWh, TNE tonne, …); migration 0181 fills the Danish name of the eight units that 0003 left empty |
product | product | R1 §5.8 (Item8716867000030 Aktiv energi, …) |
A code the table does not know, a code without a Danish name and a NULL code give a NULL name: **the page shows the code as it is,
never a guess**. services/api/tests/test_queries_b15b.py counts the codes of these lists that have no Danish name (none today:
every code of R1 §5 that D1 can show has one) and holds an unknown code to NULL. The grid_area stays a code: its table
(ref.grid_area) names the grid company, which no response carries (§7).
What may leave the database
The privacy fault found four times in the reviews of earlier epics was a value kept or returned because its field is allowed, without checking the value. So:
- The load of the catalogue refuses a SQL file that names
gsrn, the CVR numbers, the names and GLNs of supplier and grid operator, the location description, the DAR reference or the credential fingerprint; one that reads the schemaraw(the API's role cannot) or the viewcalc.v_emission_interval; one that reads an address column without testingprotected_name IS FALSEandprotected_address IS FALSE; one that reads an alias, a meter number or an address without declaring it underpersonal; and a column with nosource. - The address leaves only when the CURRENT version says that the name is known to be unprotected and the address is not
protected (N4), tested again in the query: a
protected_namethat is not known (NULL) withholds it, astruedoes, also when the database's own check oncore.mp_versionhas been taken away. An earlier version never shows an address, inmp.masteror anywhere else, whatever its own flags say: a person who gets protection hides the address they have, and an earlier version holds that same address (B15v-04).mp.mastersays that it is withheld inaddress_withheld. - Alias and meter number are the owner's own data on his own machine (§12.1, §10.4: "alias, address for the local user"):
the alias in
meta.context,mp.masterandmp.tree, the meter number inmp.masteronly. - The accounts and the company (B74).
meta.context'saccountsandcompanydimension carry a company's name (core.company.name, the owner's own label of a token, and for a private account the account's label, which is then the name), a company's id (the database's own key, the value of the dimension and off.company), an account's state and days left. Never an account's label as such, a fingerprint, a token file, a credential generation, an error code, a CVR number, or anything a row ofingest.token_noticeholds beyond that it exists for an account (itssentenceis the worker's log line and stays in the database and inmake status). The company's name is free text of the owner's and is returned to the local user, as the alias is. - No response holds a GSRN, a consumer name or contact data (not stored, §7), a quantity in a log (the runner logs request
ID, query, state, row count and time only, one line per named query on the server's stderr) or an upstream error text. The
request ID is the client's
X-Request-Idwhen it is a UUID, else one of the server's: no text of the client's choosing reaches the log.
The table below says, for every column of every response, where its value comes from and why it may leave. It is generated
from catalog.yaml.
meta.context (all)
The frontier, the metering points, the methods and GWP sets, the accounts' states. Reads: core.metering_point, core.mp_version. Personal columns: alias, address. At most 2000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
mp_id | int | core.metering_point.mp_id: the database's key, not an identifier of a meter or a person | |
type | text | core.metering_point.type_code (E17, E18, D06, ...) | |
alias | text | core.mp_version.alias of the current version: the name the owner gave the point, for the local user | |
address | text | core.mp_version street, number, floor, room, postcode, city of the current version, only when protected_name IS FALSE AND protected_address IS FALSE (N4) | |
parent_mp_id | int | core.metering_point.parent_mp_id |
meta.selection (all)
The number of E17 roots the selection holds. Reads: calc.select_roots(). Personal columns: none. At most 1 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
roots | int | root | calc.select_roots(sel, mp): the number of E17 roots the selection and the list of points select (every E17 root when neither is given); a count of the database's keys, no identifier of a point, a meter or a person |
overview.cards (X1)
The cards of the overview, with their strips. Reads: calc.consumption_buckets(), calc.consumption_matched(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 10 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
card | text | fixed by the query: E01, G01, G16, K01, K03, COVERAGE | |
unit | text | fixed by the query (kWh, g CO2e, g CO2e/kWh, share) | |
polarity | int | fixed by the query: consumption, emissions and intensity -1, coverage +1 (notation manual §3); cost -1 (K01, KNET: a lower net cost is better), the price (K03) and the energy sold (K02) 0 (phase-2.md §3.2) | |
ac | number | per row | ts.day_load (E01, E03, ENET, coverage) or calc.emission_buckets (G01, G16): the period's own figure; E03 is that of the selected roots' export children (calc.consumption_buckets with p_export), ENET is E01 - E03 where both are |
cp | number | per row | the same for the comparison period (docs/queries.md, 'The comparison'): py the previous year, days by month and day and the last day of February to the last day of February; pp and from:<date> an earlier period of the period's length, days by the position of the month and the day of the month (whole months) or by offset; each comparison day counted in one bucket, the last day of a shorter month taking the later days of a longer one |
cp_from | date | calc.comparison_buckets: the first comparison day this row holds (a card: the comparison period's) | |
cp_to | date | calc.comparison_buckets: the last comparison day this row holds, inclusive (a card: the comparison period's) | |
ac_matched | number | per row | calc.emission_buckets, its like-for-like part: the matched hour cells only (E01 on overview.cards: calc.consumption_matched, the same cells without a factor) |
cp_matched | number | per row | calc.emission_buckets, like-for-like (E01 on overview.cards: calc.consumption_matched) |
delta_cp | number | per row | ac - cp (E01, E03, ENET, coverage); ac_matched - cp_matched (G01, G16) |
delta_cp_pct | number | fraction | delta_cp / the comparison value, 9 decimals; NULL when the reference is not above zero |
delta_cp_total | number | per row | ac - cp: the total variance, all days of both ranges (the comparison period whole, docs/queries.md 'The comparison'; the previous year with a 29 February in it included). E01, E03, ENET and coverage: equal to delta_cp (ENET's is the difference of the two total variances, named total). G01 and G16: differs from the like-for-like delta_cp when a cell has no counterpart |
delta_cp_total_pct | number | fraction | delta_cp_total / cp, 9 decimals; NULL when cp is not above zero, and for coverage |
ac_solid_amount | number | per row | total minus provisional |
ac_provisional_amount | number | per row | E01: the estimated kWh (A03). G01: the emission of intervals whose reading is estimated or whose factor is not Final, counted once |
ac_missing_minutes | int | min | expected minutes of the series-days minus minutes with a quantity (ts.day_load) |
ac_incomplete_minutes | int | min | ts.day_load.minutes_incomplete (A05) |
ac_pending_factor_minutes | int | min | calc.emission_buckets: stored quantity, price area known, no factor yet |
cp_solid_amount | number | per row | as ac_solid_amount, comparison |
cp_provisional_amount | number | per row | as ac_provisional_amount, comparison |
cp_missing_minutes | int | min | as ac_missing_minutes, comparison |
cp_incomplete_minutes | int | min | as ac_incomplete_minutes, comparison |
cp_pending_factor_minutes | int | min | as ac_pending_factor_minutes, comparison |
provisional | bool | provisional amount x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2) | |
matched_hours | int | h | calc.emission_buckets, like-for-like (h); E01 on overview.cards: calc.consumption_matched (h) |
hours_in_period | int | h | calc.emission_buckets, like-for-like (H); E01 on overview.cards: calc.consumption_matched (H) |
excluded_readings | int | h | calc.emission_buckets, like-for-like; E01 on overview.cards: calc.consumption_matched |
excluded_factor | int | h | calc.emission_buckets, like-for-like; NULL for E01 (a consumption needs no factor) |
reason | text | the query: no_data, no_price_area, no_factor (the figure is unavailable); missing_readings, no_factor, no_data, no_counterpart (the variance is not applicable; no_counterpart also for consumption, when the row holds no comparison day) | |
pending_hours | int | h | calc.emission_buckets: hours with a quantity and no factor yet |
pending_kwh | number | kWh | calc.emission_buckets |
pending_share | number | fraction | pending_kwh / the period's consumption, 9 decimals |
ac_not_expected_minutes | int | min | calc.consumption_buckets (B15b): minutes of the bucket's days that no selected series is expected to hold (before its first readable day, after its expected end), never counted as missing; stored + missing + not expected = the minutes of the bucket's days of every selected series |
ac_not_yet_delivered_minutes | int | min | calc.consumption_buckets: the part of ac_not_expected_minutes that is days after a valid metering point's last stored day inside the daily run's window (not yet delivered) |
ac_outside_range_minutes | int | min | ac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03): the minutes before the first readable day or after the point's data ended, which the not-yet-delivered ones are not part of |
cp_not_expected_minutes | int | min | as ac_not_expected_minutes, comparison (before the first readable day) |
excluded_price | int | h | calc.cost_buckets, like-for-like: the hour cells left out because an interval of either side has no price (K01, K02, K03); NULL for KNET and for every figure that is not a cost, and without a comparison |
volume_effect | number | per row | calc.cost_buckets, K01 only: Σ over the matched hour cells of (q_AC - q_CP) x P_CP x 0.001, P the price of the hour (§3.2); NULL where no cell is matched |
price_effect | number | per row | calc.cost_buckets, K01 only: Σ over the matched hour cells of (c_AC - c_CP) - the volume effect (§3.2) |
unpriced_kwh | number | kWh | calc.cost_buckets: the energy of the period's intervals that have a price area and no price (KNET: of both series); coalesce 0 where there is energy; NULL for every figure that is not a cost |
unpriced_hours | int | h | calc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (as pending_hours counts, P1 §9.3: two points with the same unpriced hour are 2) |
unpriced_share | number | fraction | unpriced_kwh / the figure's energy (KNET: of both series), 9 decimals; NULL where there is no energy |
strip_months | json | the months of the period, YYYY-MM (every card, the coverage card included) | |
strip_delta_cp_pct | json | the variance of each month as a fraction: E01 from the day summaries, G01 and G16 like-for-like | |
delta_matched | number | per row | E01 only: ac_matched - cp_matched, the consumption of the matched hour cells (calc.consumption_matched); NULL for G01, G16 (whose delta_cp is already like-for-like) and coverage, and where nothing is matched |
delta_matched_pct | number | fraction | delta_matched / cp_matched, 9 decimals; NULL when cp_matched is not above zero |
matched_reason | text | the query, E01: no_data (no cell with a quantity in the period), no_counterpart (every such cell lacks one: 29 February, the DST hours), missing_readings; NULL when cells are matched, without a comparison, and for the other rows | |
strip_delta_cp | json | COVERAGE only (B15b): the variance of each month's coverage to the comparison as the difference of two shares (0.05 is 5 percentage points), like delta_cp of the COVERAGE row (calc.consumption_buckets by month); NULL elements where a month expects no minute | |
lowest_mp_id | int | COVERAGE only (B15b): core.metering_point.mp_id of the E17 root with the most missing expected minutes in the period (calc.consumption_buckets per point; the smaller key on a tie); NULL when no root misses a minute | |
lowest_mp_missing_minutes | int | min | COVERAGE only: expected minutes of that root minus minutes with a quantity |
lowest_mp_coverage | number | share | COVERAGE only: that root's own coverage of the period, 9 decimals |
expected_to | date | calc.series_expected (B15b): the latest end of the expected ranges of the selected series (docs/queries.md, 'Which intervals are expected'); the pages say 'data til og med' and how much is not yet delivered where the period reaches past it | |
local_kwh | number | kWh | G01 only, under a municipal method (municipality-method.md §5, B84): calc.emission_buckets' ac_local_kwh summed over the months, the energy that the municipality's own renewable production covered in the same hour (the exact sum of q x R x 0.01 over the intervals that have both inputs) |
local_share | number | fraction | G01 only, under a municipal method (B84): local_kwh over the consumption of the intervals with both inputs (ac_factor_kwh), 9 decimals |
overview.months (X1)
The measure of the chosen card by month. Reads: calc.consumption_buckets(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 400 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
bucket_from | date | calc.period_buckets: the first day of the month in the period | |
bucket_to | date | calc.period_buckets: the last day of the month in the period | |
unit | text | fixed by the query (kWh, g CO2e, g CO2e/kWh, share) | |
polarity | int | fixed by the query: consumption, emissions and intensity -1, coverage +1 (notation manual §3); cost -1 (K01, KNET: a lower net cost is better), the price (K03) and the energy sold (K02) 0 (phase-2.md §3.2) | |
ac | number | per row | ts.day_load (E01, E03, ENET, coverage) or calc.emission_buckets (G01, G16): the period's own figure; E03 is that of the selected roots' export children (calc.consumption_buckets with p_export), ENET is E01 - E03 where both are |
cp | number | per row | the same for the comparison period (docs/queries.md, 'The comparison'): py the previous year, days by month and day and the last day of February to the last day of February; pp and from:<date> an earlier period of the period's length, days by the position of the month and the day of the month (whole months) or by offset; each comparison day counted in one bucket, the last day of a shorter month taking the later days of a longer one |
cp_from | date | calc.comparison_buckets: the first comparison day this row holds (a card: the comparison period's) | |
cp_to | date | calc.comparison_buckets: the last comparison day this row holds, inclusive (a card: the comparison period's) | |
ac_matched | number | per row | calc.emission_buckets, its like-for-like part: the matched hour cells only (E01 on overview.cards: calc.consumption_matched, the same cells without a factor) |
cp_matched | number | per row | calc.emission_buckets, like-for-like (E01 on overview.cards: calc.consumption_matched) |
delta_cp | number | per row | ac - cp (E01, E03, ENET, coverage); ac_matched - cp_matched (G01, G16) |
delta_cp_pct | number | fraction | delta_cp / the comparison value, 9 decimals; NULL when the reference is not above zero |
delta_cp_total | number | per row | ac - cp: the total variance, all days of both ranges (the comparison period whole, docs/queries.md 'The comparison'; the previous year with a 29 February in it included). E01, E03, ENET and coverage: equal to delta_cp (ENET's is the difference of the two total variances, named total). G01 and G16: differs from the like-for-like delta_cp when a cell has no counterpart |
delta_cp_total_pct | number | fraction | delta_cp_total / cp, 9 decimals; NULL when cp is not above zero, and for coverage |
ac_solid_amount | number | per row | total minus provisional |
ac_provisional_amount | number | per row | E01: the estimated kWh (A03). G01: the emission of intervals whose reading is estimated or whose factor is not Final, counted once |
ac_missing_minutes | int | min | expected minutes of the series-days minus minutes with a quantity (ts.day_load) |
ac_incomplete_minutes | int | min | ts.day_load.minutes_incomplete (A05) |
ac_pending_factor_minutes | int | min | calc.emission_buckets: stored quantity, price area known, no factor yet |
cp_solid_amount | number | per row | as ac_solid_amount, comparison |
cp_provisional_amount | number | per row | as ac_provisional_amount, comparison |
cp_missing_minutes | int | min | as ac_missing_minutes, comparison |
cp_incomplete_minutes | int | min | as ac_incomplete_minutes, comparison |
cp_pending_factor_minutes | int | min | as ac_pending_factor_minutes, comparison |
provisional | bool | provisional amount x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2) | |
matched_hours | int | h | calc.emission_buckets, like-for-like (h); E01 on overview.cards: calc.consumption_matched (h) |
hours_in_period | int | h | calc.emission_buckets, like-for-like (H); E01 on overview.cards: calc.consumption_matched (H) |
excluded_readings | int | h | calc.emission_buckets, like-for-like; E01 on overview.cards: calc.consumption_matched |
excluded_factor | int | h | calc.emission_buckets, like-for-like; NULL for E01 (a consumption needs no factor) |
reason | text | the query: no_data, no_price_area, no_factor (the figure is unavailable); missing_readings, no_factor, no_data, no_counterpart (the variance is not applicable; no_counterpart also for consumption, when the row holds no comparison day) | |
pending_hours | int | h | calc.emission_buckets: hours with a quantity and no factor yet |
pending_kwh | number | kWh | calc.emission_buckets |
pending_share | number | fraction | pending_kwh / the period's consumption, 9 decimals |
ac_not_expected_minutes | int | min | calc.consumption_buckets (B15b): minutes of the bucket's days that no selected series is expected to hold (before its first readable day, after its expected end), never counted as missing; stored + missing + not expected = the minutes of the bucket's days of every selected series |
ac_not_yet_delivered_minutes | int | min | calc.consumption_buckets: the part of ac_not_expected_minutes that is days after a valid metering point's last stored day inside the daily run's window (not yet delivered) |
ac_outside_range_minutes | int | min | ac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03): the minutes before the first readable day or after the point's data ended, which the not-yet-delivered ones are not part of |
cp_not_expected_minutes | int | min | as ac_not_expected_minutes, comparison (before the first readable day) |
excluded_price | int | h | calc.cost_buckets, like-for-like: the hour cells left out because an interval of either side has no price (K01, K02, K03); NULL for KNET and for every figure that is not a cost, and without a comparison |
volume_effect | number | per row | calc.cost_buckets, K01 only: Σ over the matched hour cells of (q_AC - q_CP) x P_CP x 0.001, P the price of the hour (§3.2); NULL where no cell is matched |
price_effect | number | per row | calc.cost_buckets, K01 only: Σ over the matched hour cells of (c_AC - c_CP) - the volume effect (§3.2) |
unpriced_kwh | number | kWh | calc.cost_buckets: the energy of the period's intervals that have a price area and no price (KNET: of both series); coalesce 0 where there is energy; NULL for every figure that is not a cost |
unpriced_hours | int | h | calc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (as pending_hours counts, P1 §9.3: two points with the same unpriced hour are 2) |
unpriced_share | number | fraction | unpriced_kwh / the figure's energy (KNET: of both series), 9 decimals; NULL where there is no energy |
overview.mp_variance (X1)
The E17 roots ranked by the variance of the chosen card's measure to the comparison. Reads: calc.consumption_buckets(), calc.consumption_matched(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 500 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
rank | int | row_number over the absolute like-for-like variance (delta_matched), then the absolute total variance (delta_cp), largest first, NULLs last | |
mp_id | int | core.metering_point.mp_id of an E17 root | |
unit | text | fixed by the query: kWh (E01), g CO2e (G01), DKK (K01) | |
polarity | int | fixed by the query: -1 (lower is better for all three) | |
ac | number | per row | the root's figure in the period: E01 ts.day_load; G01 calc.emission_buckets (the intervals with a factor); K01 calc.cost_buckets (the intervals with a price) |
cp | number | per row | the same for the comparison period (docs/queries.md, 'The comparison') |
cp_from | date | calc.comparison_buckets: the first day of the comparison period; NULL with cmp=none | |
cp_to | date | calc.comparison_buckets: the last day of the comparison period, inclusive; NULL with cmp=none | |
delta_cp | number | per row | ac - cp, all days (the card's delta_cp_total for G01 and K01) |
delta_cp_pct | number | fraction | delta_cp / cp, 9 decimals; NULL when cp is not above zero |
ac_solid_amount | number | per row | ac minus its estimated part (E01 kWh, G01 the provisional CO2e, K01 the cost of estimated readings) |
ac_provisional_amount | number | per row | the estimated part of ac |
ac_missing_minutes | int | min | the root's consumption: expected minutes minus minutes with a quantity (every measure) |
ac_incomplete_minutes | int | min | ts.day_load.minutes_incomplete |
cp_solid_amount | number | per row | cp minus its estimated part |
cp_provisional_amount | number | per row | the estimated part of cp |
cp_missing_minutes | int | min | as ac_missing_minutes, comparison |
cp_incomplete_minutes | int | min | as ac_incomplete_minutes, comparison |
provisional | bool | more than 1 % of ac is provisional | |
ac_matched | number | per row | the root's figure in the matched hour cells of the period: E01 calc.consumption_matched (no factor needed); G01 calc.emission_buckets (a factor on both sides); K01 calc.cost_buckets (a price for every interval on both sides) |
cp_matched | number | per row | the corresponding cells of the comparison period |
matched_hours | int | h | the matched hour cells (h) of the measure's function |
hours_in_period | int | h | the hour cells with a quantity in the period (H) |
excluded_readings | int | h | the cells left out for missing or incomplete readings |
ac_not_expected_minutes | int | min | calc.consumption_buckets (B15b): minutes of the period not expected of the root's series |
ac_not_yet_delivered_minutes | int | min | calc.consumption_buckets: the not-yet-delivered part of ac_not_expected_minutes |
ac_outside_range_minutes | int | min | ac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03) |
cp_not_expected_minutes | int | min | as ac_not_expected_minutes, comparison |
delta_matched | number | per row | ac_matched - cp_matched: the like-for-like variance the ranking draws, names and ranks by (the card's like-for-like variance of the root) |
delta_matched_pct | number | fraction | delta_matched / cp_matched, 9 decimals; NULL when cp_matched is not above zero |
matched_reason | text | why no cell is matched: no_data, no_counterpart (29 February, the DST hours), missing_readings, and no_factor (G01) or no_price (K01); NULL when cells are matched and without a comparison | |
excluded_factor | int | h | G01: the cells left out for a missing factor on either side; NULL for E01 and K01 |
excluded_price | int | h | K01: the cells left out for a missing price on either side; NULL for E01 and G01 |
reason | text | G01 calc.emission_reason, K01 calc.cost_reason: why a root with consumption has no figure (no_price_area, no_factor, no_price; under a municipal method no_municipality, municipality_not_loaded, no_local_share); NULL for E01, where the root has a figure, and where it has no consumption |
overview.mp_positions (X1)
Where each E17 root of the selection lies, for the map. Reads: calc.select_roots(), calc.mp_positions(). Personal columns: none. At most 1000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
mp_id | int | core.metering_point.mp_id of an E17 root | |
precision | text | calc.mp_positions().precision_tag: exact (the owner's file or the demo's), postcode (the midpoint of its postcode), none | |
x | int | m | calc.mp_positions().x: EPSG:25832 easting in metres; NULL for none |
y | int | m | calc.mp_positions().y: EPSG:25832 northing in metres; NULL for none |
reason | text | calc.mp_positions().reason: protected, no_master_data, no_postcode; NULL when placed |
development.series (A1)
The chosen measure by month or day with the comparison and the variance. Reads: calc.consumption_buckets(), calc.emission_buckets(), calc.cost_buckets(). Personal columns: none. At most 800 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
bucket_from | date | calc.period_buckets: the first day of the day or month in the period | |
bucket_to | date | calc.period_buckets: the last day of the day or month in the period | |
unit | text | fixed by the query (kWh, g CO2e, g CO2e/kWh, share) | |
polarity | int | fixed by the query: consumption, emissions and intensity -1, coverage +1 (notation manual §3); cost -1 (K01, KNET: a lower net cost is better), the price (K03) and the energy sold (K02) 0 (phase-2.md §3.2) | |
ac | number | per row | ts.day_load (E01, E03, ENET, coverage) or calc.emission_buckets (G01, G16): the period's own figure; E03 is that of the selected roots' export children (calc.consumption_buckets with p_export), ENET is E01 - E03 where both are |
cp | number | per row | the same for the comparison period (docs/queries.md, 'The comparison'): py the previous year, days by month and day and the last day of February to the last day of February; pp and from:<date> an earlier period of the period's length, days by the position of the month and the day of the month (whole months) or by offset; each comparison day counted in one bucket, the last day of a shorter month taking the later days of a longer one |
cp_from | date | calc.comparison_buckets: the first comparison day this row holds (a card: the comparison period's) | |
cp_to | date | calc.comparison_buckets: the last comparison day this row holds, inclusive (a card: the comparison period's) | |
ac_matched | number | per row | calc.emission_buckets, its like-for-like part: the matched hour cells only (E01 on overview.cards: calc.consumption_matched, the same cells without a factor) |
cp_matched | number | per row | calc.emission_buckets, like-for-like (E01 on overview.cards: calc.consumption_matched) |
delta_cp | number | per row | ac - cp (E01, E03, ENET, coverage); ac_matched - cp_matched (G01, G16) |
delta_cp_pct | number | fraction | delta_cp / the comparison value, 9 decimals; NULL when the reference is not above zero |
delta_cp_total | number | per row | ac - cp: the total variance, all days of both ranges (the comparison period whole, docs/queries.md 'The comparison'; the previous year with a 29 February in it included). E01, E03, ENET and coverage: equal to delta_cp (ENET's is the difference of the two total variances, named total). G01 and G16: differs from the like-for-like delta_cp when a cell has no counterpart |
delta_cp_total_pct | number | fraction | delta_cp_total / cp, 9 decimals; NULL when cp is not above zero, and for coverage |
ac_solid_amount | number | per row | total minus provisional |
ac_provisional_amount | number | per row | E01: the estimated kWh (A03). G01: the emission of intervals whose reading is estimated or whose factor is not Final, counted once |
ac_missing_minutes | int | min | expected minutes of the series-days minus minutes with a quantity (ts.day_load) |
ac_incomplete_minutes | int | min | ts.day_load.minutes_incomplete (A05) |
ac_pending_factor_minutes | int | min | calc.emission_buckets: stored quantity, price area known, no factor yet |
cp_solid_amount | number | per row | as ac_solid_amount, comparison |
cp_provisional_amount | number | per row | as ac_provisional_amount, comparison |
cp_missing_minutes | int | min | as ac_missing_minutes, comparison |
cp_incomplete_minutes | int | min | as ac_incomplete_minutes, comparison |
cp_pending_factor_minutes | int | min | as ac_pending_factor_minutes, comparison |
provisional | bool | provisional amount x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2) | |
matched_hours | int | h | calc.emission_buckets, like-for-like (h); E01 on overview.cards: calc.consumption_matched (h) |
hours_in_period | int | h | calc.emission_buckets, like-for-like (H); E01 on overview.cards: calc.consumption_matched (H) |
excluded_readings | int | h | calc.emission_buckets, like-for-like; E01 on overview.cards: calc.consumption_matched |
excluded_factor | int | h | calc.emission_buckets, like-for-like; NULL for E01 (a consumption needs no factor) |
reason | text | the query: no_data, no_price_area, no_factor (the figure is unavailable); missing_readings, no_factor, no_data, no_counterpart (the variance is not applicable; no_counterpart also for consumption, when the row holds no comparison day) | |
pending_hours | int | h | calc.emission_buckets: hours with a quantity and no factor yet |
pending_kwh | number | kWh | calc.emission_buckets |
pending_share | number | fraction | pending_kwh / the period's consumption, 9 decimals |
ac_not_expected_minutes | int | min | calc.consumption_buckets (B15b): minutes of the bucket's days that no selected series is expected to hold (before its first readable day, after its expected end), never counted as missing; stored + missing + not expected = the minutes of the bucket's days of every selected series |
ac_not_yet_delivered_minutes | int | min | calc.consumption_buckets: the part of ac_not_expected_minutes that is days after a valid metering point's last stored day inside the daily run's window (not yet delivered) |
ac_outside_range_minutes | int | min | ac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL (B15bx-03): the minutes before the first readable day or after the point's data ended, which the not-yet-delivered ones are not part of |
cp_not_expected_minutes | int | min | as ac_not_expected_minutes, comparison (before the first readable day) |
excluded_price | int | h | calc.cost_buckets, like-for-like: the hour cells left out because an interval of either side has no price (K01, K02, K03); NULL for KNET and for every figure that is not a cost, and without a comparison |
volume_effect | number | per row | calc.cost_buckets, K01 only: Σ over the matched hour cells of (q_AC - q_CP) x P_CP x 0.001, P the price of the hour (§3.2); NULL where no cell is matched |
price_effect | number | per row | calc.cost_buckets, K01 only: Σ over the matched hour cells of (c_AC - c_CP) - the volume effect (§3.2) |
unpriced_kwh | number | kWh | calc.cost_buckets: the energy of the period's intervals that have a price area and no price (KNET: of both series); coalesce 0 where there is energy; NULL for every figure that is not a cost |
unpriced_hours | int | h | calc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (as pending_hours counts, P1 §9.3: two points with the same unpriced hour are 2) |
unpriced_share | number | fraction | unpriced_kwh / the figure's energy (KNET: of both series), 9 decimals; NULL where there is no energy |
energy.split (A1)
Bought, sold and net from the grid, in energy and in cost, with the comparison. Reads: calc.consumption_buckets(), calc.consumption_matched(), calc.cost_buckets(), core.metering_point, ref.mp_type. Personal columns: none. At most 3 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
figure | text | fixed by the query: bought, sold, net, in that order (net last) | |
kwh_polarity | int | fixed by the query: bought -1 (consumption, notation manual §3), sold 0, net 0 (as ENET) | |
dkk_polarity | int | fixed by the query: bought -1 (a lower cost is better), sold 0, net -1 (as KNET, §3.2's table) | |
cp_from | date | calc.consumption_buckets: the first day of the comparison period; NULL with cmp=none | |
cp_to | date | calc.consumption_buckets: the last day of the comparison period, inclusive; NULL with cmp=none | |
kwh_ac | number | kWh | bought: calc.consumption_buckets over the roots' day summaries (the E01 card's figure); sold: the same over the export children's series (E03's); net: bought - sold where both are; NULL where there is none (never zero) |
kwh_cp | number | kWh | the same for the comparison period (docs/queries.md, 'The comparison'); net: bought - sold where both are; NULL with cmp=none |
kwh_ac_matched | number | kWh | calc.consumption_matched, like-for-like: the energy of the matched hour cells of the period, the cells eligible by P1 §9.3 on their readings alone (the E01 card's own; sold: the export children's, p_export); NULL for net and where no cell is matched |
kwh_cp_matched | number | kWh | calc.consumption_matched, like-for-like: the same cells' energy in the comparison period; NULL for net |
kwh_delta_cp | number | kWh | kwh_ac_matched - kwh_cp_matched; NULL for net and where no cell is matched (i.r., with kwh_reason), never -100 % |
kwh_delta_cp_pct | number | fraction | kwh_delta_cp / kwh_cp_matched, 9 decimals; NULL when kwh_cp_matched is not above zero |
kwh_delta_cp_total | number | kWh | kwh_ac - kwh_cp: all days of both ranges. Net: the difference of the two total variances (bought's minus sold's), named total |
kwh_delta_cp_total_pct | number | fraction | kwh_delta_cp_total / kwh_cp, 9 decimals; NULL when kwh_cp is not above zero |
kwh_ac_provisional | number | kWh | calc.consumption_buckets: the estimated kWh (A03) of the period; net: bought's minus sold's |
kwh_provisional | bool | the provisional energy x 100 > the figure: more than 1 % of it is provisional (notation manual §9, rule 2); net: either part is | |
dkk_ac | number | DKK | calc.cost_buckets: K01 (bought) or K02 (sold), the cost of the intervals that have a price at the day-ahead price of the point's price area, in DKK; net: bought - sold where both are (KNET); NULL where there is none, never zero |
dkk_cp | number | DKK | the same for the comparison period; NULL with cmp=none |
dkk_ac_matched | number | DKK | calc.cost_buckets, like-for-like: the cost of the matched hour cells of the period (eligible and priced for every interval, on both sides); NULL for net |
dkk_cp_matched | number | DKK | calc.cost_buckets, like-for-like: the same cells in the comparison period; NULL for net |
dkk_delta_cp | number | DKK | dkk_ac_matched - dkk_cp_matched; NULL for net and where no cell is matched |
dkk_delta_cp_pct | number | fraction | dkk_delta_cp / dkk_cp_matched, 9 decimals; NULL when dkk_cp_matched is not above zero (manual §3) |
dkk_delta_cp_total | number | DKK | dkk_ac - dkk_cp: all days of both ranges. Net: the difference of the two total variances, named total |
dkk_delta_cp_total_pct | number | fraction | dkk_delta_cp_total / dkk_cp, 9 decimals; NULL when dkk_cp is not above zero |
dkk_ac_provisional | number | DKK | calc.cost_buckets: the cost of the intervals whose reading is estimated (A03); a price has no version; net: bought's minus sold's |
dkk_provisional | bool | more than 1 % of the cost, by absolute value, is provisional; net: either part is | |
kwh_matched_hours | int | h | calc.consumption_matched, like-for-like (h): the energy's matched cells (the E01 card's matched_hours; sold: the export children's); NULL for net and with cmp=none |
kwh_hours_in_period | int | h | calc.consumption_matched, like-for-like (H): the hour cells with a quantity in the period; NULL for net |
kwh_excluded_readings | int | h | calc.consumption_matched, like-for-like: left out for a missing or incomplete reading; NULL for net |
dkk_matched_hours | int | h | calc.cost_buckets, like-for-like (h): the cost's matched cells, those of the energy that also have a price for every interval on both sides; NULL for net and with cmp=none |
dkk_hours_in_period | int | h | calc.cost_buckets, like-for-like (H): the hour cells with a quantity in the period; NULL for net |
dkk_excluded_readings | int | h | calc.cost_buckets, like-for-like: left out for a missing or incomplete reading; NULL for net |
dkk_excluded_price | int | h | calc.cost_buckets, like-for-like: left out because an interval of either side has no price; NULL for net |
kwh_reason | text | the query, as the E01 card gives it: no_data (the figure is unavailable), missing_readings (the comparison has no figure), then the like-for-like variance's own reason (calc.consumption_matched: no_data, no_counterpart, missing_readings); net: no_data, no_counterpart, missing_readings | |
dkk_reason | text | calc.cost_reason (0257), the one rule of K01, K02 and KNET: no_data, no_price_area, no_price (the cost figure is unavailable), then for the comparison no_counterpart, missing_readings, no_price_area, no_price, then the like-for-like variance's own (calc.cost_buckets' reason); net: the same over both legs together, no reading on either first | |
ac_missing_minutes | int | min | calc.consumption_buckets: expected minutes of the series-days minus minutes with a quantity (the roots' series for bought, the export children's for sold, both added for net: NULL where neither expects any) |
ac_incomplete_minutes | int | min | calc.consumption_buckets: incomplete minutes (A05), as ac_missing_minutes |
ac_not_expected_minutes | int | min | calc.consumption_buckets: minutes that no series of the row is expected to hold, never counted as missing |
ac_not_yet_delivered_minutes | int | min | calc.consumption_buckets: the part of ac_not_expected_minutes that is days the API may still deliver |
ac_outside_range_minutes | int | min | ac_not_expected_minutes minus ac_not_yet_delivered_minutes, in SQL |
cp_missing_minutes | int | min | as ac_missing_minutes, comparison; NULL with cmp=none |
cp_incomplete_minutes | int | min | as ac_incomplete_minutes, comparison |
cp_not_expected_minutes | int | min | as ac_not_expected_minutes, comparison |
unpriced_kwh | number | kWh | calc.cost_buckets: the energy of the period's intervals that have a price area and no price; net: both series' added; coalesce 0 where there is energy, NULL where there is none |
unpriced_hours | int | h | calc.cost_buckets: the metering-point hours with an interval that has a quantity and a price area and no price (two points with the same unpriced hour are 2); net: both series' added |
unpriced_share | number | fraction | unpriced_kwh / the row's energy (net: of both series together), 9 decimals; NULL where there is no energy |
consumption.weekday_hours (A1)
The mean of each weekday and hour of the local day (the heatmap), with its margins and the comparison. Reads: calc.weekday_hour_cells(). Personal columns: none. At most 199 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
kind | text | fixed by the query: cell (a weekday and a clock hour), weekday (a margin: the 24 hours of a weekday), hour (a margin: a clock hour over the 7 weekdays) | |
weekday | int | day | the local day's ISO weekday (Europe/Copenhagen), Monday 1 to Sunday 7, of the start of the hour (calc.weekday_hour_cells, migrations 0188, 0240); NULL on an hour margin |
clock_hour | int | h | calc.hour_cell: the local clock hour 0-23 of the start of the hour; the repeated hour of the 25-hour day is clock hour 2 again, and the 23-hour day has none; NULL on a weekday margin |
kwh | number | kWh | B20's column, kept for its page until the page reads ac (B62): ac where the measure is in kWh (E01, E03), NULL for G01 (a column named kwh never holds g CO2e, B67f) |
roots | int | root | calc.weekday_hour_cells: the selected E17 roots that contributed an eligible hour |
roots_expected | int | root | calc.weekday_hour_cells: the selected E17 roots with any eligible hour in the period |
root_hours | int | h | calc.weekday_hour_cells: the eligible hours of the contributing roots, complete by the rule of phase-1.md §9.3 (60 minutes covered once, each with a quantity, none of quality A02 or A05; G01 also a factor for every interval; E03 every export child of the root that has a reading in the period) |
root_hours_expected | int | h | calc.weekday_hour_cells: roots_expected times the hours of that weekday and clock hour the period holds, from the local days (23, 24 or 25 hours): the repeated hour counts twice, the missing hour of the 23-hour day not at all |
min_root_hours | int | h | calc.weekday_hour_cells: the fewest eligible hours of a contributing root; 0 when none |
date_from | date | the period's first local day | |
date_to | date | the period's last local day: the end of an explicit range cut at the frontier (phase-1.md §2), so that no cell counts an hour after it | |
data_days | int | d | calc.weekday_hour_cells: the local days with at least one eligible hour of any root |
unit | text | fixed by the query from measure: kWh (E01, E03), g CO2e (G01) | |
polarity | int | fixed by the query from measure: -1 (E01, G01), 0 (E03, as B54's E03) | |
ac | number | per row | the measure of the hour (E01 ts.reading.quantity of the roots' own series; E03 that of their export children's series, summed per root; G01 the CO2e of calc.emission_intervals): per root the sum of its eligible hours' amount over their number, summed over the roots that have an eligible hour there, 6 decimals; the hour of a quarter-hourly series is the sum of its quarters; NULL when no root has one (never zero) |
cp | number | per row | calc.weekday_hour_cells: the same figure over the comparison period's own days (calc.comparison_period of the period as it ends at the frontier, docs/queries.md 'The comparison'), by the same rule; NULL with cmp=none, and where no root has an eligible hour there |
cp_roots | int | root | calc.weekday_hour_cells: the selected roots that contributed an eligible hour of the comparison; NULL with cmp=none |
cp_roots_expected | int | root | calc.weekday_hour_cells: the selected roots with any eligible hour in the comparison period; NULL with cmp=none |
cp_root_hours | int | h | calc.weekday_hour_cells: the comparison's eligible hours of its contributing roots; NULL with cmp=none |
cp_root_hours_expected | int | h | calc.weekday_hour_cells: cp_roots_expected times the hours of that weekday and clock hour the comparison's own days hold (its repeated hour twice, its missing hour not at all); NULL with cmp=none |
cp_min_root_hours | int | h | calc.weekday_hour_cells: the fewest eligible hours of a contributing root of the comparison; 0 when none; NULL with cmp=none |
cp_data_days | int | d | calc.weekday_hour_cells: the comparison's local days with an eligible hour of any root; NULL with cmp=none |
cp_from | date | calc.comparison_period: the comparison's first day, of the period as it ends at the frontier; NULL with cmp=none | |
cp_to | date | calc.comparison_period: the comparison's last day, inclusive; NULL with cmp=none | |
roots_matched | int | root | calc.weekday_hour_cells: the selected roots that have a mean of this cell or margin on both sides; NULL with cmp=none |
ac_matched | number | per row | calc.weekday_hour_cells: the sum of the period means of the roots_matched roots, 6 decimals; NULL when none |
cp_matched | number | per row | calc.weekday_hour_cells: the sum of the comparison means of the roots_matched roots, 6 decimals; NULL when none |
delta_cp | number | per row | ac_matched - cp_matched from the unrounded sums, 6 decimals: a difference of means per hour over the roots on both sides, never of matched cells and never a root's whole mean; NULL (i.r.) when roots_matched is 0 or there is no comparison |
delta_cp_pct | number | fraction | delta_cp / cp_matched from the unrounded sums, 9 decimals; NULL when cp_matched is not above zero |
mp.master (D1)
Current master data of one metering point and its versions. Reads: core.metering_point, core.mp_version, ref.code, ref.mp_type. Personal columns: alias, meter_number, address. At most 200 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
observed_from | instant | core.mp_version.observed_from | |
observed_to | instant | core.mp_version.observed_to; NULL for the current version | |
is_current | bool | observed_to IS NULL | |
type | text | core.metering_point.type_code | |
type_name_da | text | ref.mp_type.name_da (R1 §5.1): the Danish name of the type; NULL when the table does not know it | |
sub_type | text | core.mp_version.sub_type: a closed code list (R1 §5) | |
sub_type_name_da | text | ref.code (list sub_type, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
physical_status | text | core.mp_version.physical_status: a code | |
physical_status_name_da | text | ref.code (list physical_status, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
net_settlement_group | text | core.mp_version.net_settlement_group: a code | |
net_settlement_group_name_da | text | ref.code (list net_settlement_group, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
connection_type | text | core.mp_version.connection_type: a code | |
connection_type_name_da | text | ref.code (list connection_type, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
disconnection_type | text | core.mp_version.disconnection_type: a code | |
disconnection_type_name_da | text | ref.code (list disconnection_type, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
settlement_method | text | core.mp_version.settlement_method: a code | |
settlement_method_name_da | text | ref.code (list settlement_method, R1 §5.2): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
grid_area | text | core.mp_version.grid_area: the three-digit grid area code, a public code | |
supplier_start | date | core.mp_version.supplier_start: a date | |
consumer_start | date | core.mp_version.consumer_start: a date | |
capacity_kw | number | kW | core.mp_version.capacity_kw |
reading_occurrence | text | core.mp_version.reading_occurrence: PT15M, PT1H, P1M | |
reading_occurrence_name_da | text | ref.code (list meter_reading_occurrence, R1 §5.3): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
unit | text | core.mp_version.unit: the energy unit | |
unit_name_da | text | ref.code (list unit, R1 §5.7; migration 0181): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
product | text | core.mp_version.product: a code | |
product_name_da | text | ref.code (list product, R1 §5.8): the Danish name of the code; NULL when the code has none, is NULL or is not in the table, and then the page shows the code | |
tax_reduction | bool | core.mp_version.tax_reduction | |
alias | text | core.mp_version.alias: the name the owner gave the point, for the local user | |
meter_number | text | core.mp_version.meter_number: the device's number, kept on purpose (B07), for the local user on this query only | |
address | text | the postal address, on the CURRENT version only and only when it says protected_name IS FALSE AND protected_address IS FALSE (N4); NULL on every earlier version, whatever its own flags (B15v-04) | |
address_withheld | bool | true on every row without an address: an earlier version, or a current one that does not say protected_name IS FALSE AND protected_address IS FALSE |
mp.tree (D1)
The tree of the metering point's root with each child's role. Reads: core.metering_point, core.mp_version, ref.mp_type. Personal columns: alias. At most 500 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
mp_id | int | core.metering_point.mp_id | |
parent_mp_id | int | core.metering_point.parent_mp_id | |
is_root | bool | mp_id = root_mp_id | |
type | text | core.metering_point.type_code | |
type_name_da | text | ref.mp_type.name_da: the seeded type list | |
type_name_en | text | ref.mp_type.name_en: the seeded type list | |
role | int | ref.mp_type.role: 1 consumption, 2 production, 3 export, 4 import from grid, 5 tax basis, 6 surplus, 9 other | |
in_energy_totals | bool | ref.mp_type.in_energy_totals | |
chartable_as_load | bool | ref.mp_type.chartable_as_load: false for D15 and D04 (L1) | |
reading_occurrence | text | core.mp_version.reading_occurrence of the current version | |
alias | text | core.mp_version.alias of the current version: the owner's name for the point, for the local user | |
status | int | core.metering_point.status: 1 active, 2 no longer listed, 3 no current access, 4 invalid ID |
mp.series (D1)
One series of the tree by hour or quarter-hour with quality. Reads: calc.series_intervals(). Personal columns: none. At most 3000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
business_type | text | ts.series.business_type (A04 consumption, A01 production) | |
interval_start | instant | ts.reading.interval_start; for a gap the expected start | |
interval_end | instant | interval_start plus the row's resolution | |
local_date | date | the interval's local day (Europe/Copenhagen) | |
resolution | int | min | ts.reading.resolution; for a gap the grain or the resolution of the series' day (ts.day_load.resolution, else its nearest day's), whichever is longer |
kwh | number | kWh | ts.reading.quantity (the sum of the quarters of an hour); NULL for a gap or A02 |
quality | text | ts.reading.quality as A01-A05; NULL for a gap | |
stored | bool | false for an expected interval nothing is stored for | |
expected | bool | calc.series_expected (B15b): the interval lies inside its series' expected range (docs/queries.md); always true for a stored interval | |
not_expected_reason | text | calc.interval_expected: before_readable (before the first day the API can serve), not_yet_delivered (after a valid point's last stored day, inside the daily window), ended (after the day a point that is no longer valid ended); NULL when expected | |
expected_from | date | calc.series_expected: the first expected local day of the row's series | |
expected_to | date | calc.series_expected: the last expected local day of the row's series |
mp.emission_intervals (D1)
Per interval, how the emission was computed. Reads: calc.emission_series_intervals(). Personal columns: none. At most 3000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
business_type | text | ts.series.business_type | |
interval_start | instant | ts.reading.interval_start | |
interval_end | instant | interval_start plus the row's resolution | |
local_date | date | the interval's local day | |
resolution | int | min | ts.reading.resolution |
kwh | number | kWh | ts.reading.quantity |
quality | text | ts.reading.quality as A01-A05 | |
stored | bool | false for a gap | |
expected | bool | calc.series_expected (B15b): the interval lies inside its series' expected range (docs/queries.md); always true for a stored interval | |
not_expected_reason | text | calc.interval_expected: before_readable (before the first day the API can serve), not_yet_delivered (after a valid point's last stored day, inside the daily window), ended (after the day a point that is no longer valid ended); NULL when expected | |
expected_from | date | calc.series_expected: the first expected local day of the row's series | |
expected_to | date | calc.series_expected: the last expected local day of the row's series | |
price_area | text | core.mp_geo: the area valid on the interval's local day; NULL: none | |
pending | bool | no factor under the basis | |
factor_version | text | fx.factor_hour.version as Initial, Preliminary or Final; NULL when pending | |
factor_retrieved_at | instant | fx.factor_hour.retrieved_at | |
factor_generated | bool | the factor row is generated (the frozen extract), never Energinet's | |
factor_co2e_g_per_kwh | number | g CO2e/kWh | fx.factor_hour co2_g + ch4_mg x GWP_CH4 x 0.001 + n2o_mg x GWP_N2O x 0.001 |
co2_g | number | g | calc.v_emission_interval: kwh x factor |
ch4_mg | number | mg | calc.v_emission_interval |
n2o_mg | number | mg | calc.v_emission_interval |
biogenic_co2_g | number | g | calc.v_emission_interval: memo, outside the scopes |
co2e_g | number | g CO2e | calc.v_emission_interval: Scope 2 excluding losses |
transmission_co2_g | number | g | calc.v_emission_interval: amount x (t_factor - 1) |
transmission_ch4_mg | number | mg | calc.v_emission_interval |
transmission_n2o_mg | number | mg | calc.v_emission_interval |
transmission_biogenic_co2_g | number | g | calc.v_emission_interval |
transmission_co2e_g | number | g CO2e | calc.v_emission_interval |
distribution_co2_g | number | g | calc.v_emission_interval: amount x (d_factor - 1), additive |
distribution_ch4_mg | number | mg | calc.v_emission_interval |
distribution_n2o_mg | number | mg | calc.v_emission_interval |
distribution_biogenic_co2_g | number | g | calc.v_emission_interval |
distribution_co2e_g | number | g CO2e | calc.v_emission_interval |
re_share_pct | number | % | fx.re_coverage_hour (public data) through calc.v_emission_interval: the municipal share of the interval's hour as delivered, 0 to 100; municipal methods only (municipality-method.md §5, B84) |
local_kwh | number | kWh | calc.v_emission_interval: q x R x 0.01, the part the municipality's own renewable production covered; municipal methods only |
grid_kwh | number | kWh | calc.v_emission_interval: q - local_kwh, the part that has the transmission grid's factor; municipal methods only |
pending_reason | text | calc.v_emission_interval: why the interval has no figure under a municipal method: no_price_area, no_municipality, municipality_not_loaded, no_local_share or no_factor |
mp.cost_intervals (D1)
Per interval of one point, the price used and what it cost. Reads: calc.cost_intervals(), calc.cost_point_status(). Personal columns: none. At most 3000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
business_type | text | ts.series.business_type (A04 consumption, A01 production) | |
interval_start | instant | ts.reading.interval_start; for a gap the expected start | |
interval_end | instant | interval_start plus the row's resolution | |
local_date | date | the interval's local day (Europe/Copenhagen) | |
resolution | int | min | ts.reading.resolution; for a gap the grain or the resolution of the series' day, whichever is longer (as mp.series) |
kwh | number | kWh | ts.reading.quantity (the sum of the quarters of an hour); NULL for a gap or A02 |
quality | text | ts.reading.quality as A01-A05; NULL for a gap | |
stored | bool | false for an expected interval nothing is stored for (mangler) | |
expected | bool | calc.series_expected (B15b): the interval lies inside its series' expected range; always true for a stored interval | |
not_expected_reason | text | calc.interval_expected: before_readable, not_yet_delivered, ended; NULL when expected | |
expected_from | date | calc.series_expected: the first expected local day of the row's series | |
expected_to | date | calc.series_expected: the last expected local day of the row's series | |
price_area | text | core.mp_geo: the price area valid on the interval's local day (calc.price_areas); NULL: none | |
dkk_per_mwh | number | DKK/MWh | calc.cost_intervals (calc.interval_prices): the day-ahead price of the row's interval in DKK per MWh as delivered. At the hour's grain the hour's own price P: its row before the seam, the mean of its four quarters from it, none with fewer; as stored, the interval's own. Negative prices are kept. NULL: no price (afventer pris), a gap's slot without a price row, or no price area |
price_resolution | int | min | calc.cost_intervals: the resolution of the price rows used: 60 (the hour's row) or 15 (a quarter's own, or the quarters an hourly interval takes the mean of); NULL without a price |
price_rows | int | row | calc.cost_intervals: 1, or 4 for the mean of the four quarters of an hourly interval from the seam; NULL without a price |
price_generated | bool | calc.cost_intervals: a price row used is generated (the frozen extract), never Energinet's; NULL without a price | |
price_pending | bool | the query: the interval is stored, has a quantity and a price area, and no price: 'afventer pris' (a gap is 'mangler'; an interval without a price area has a NULL price_area and is neither) | |
cost_dkk | number | DKK | calc.cost_intervals: the SUM of the costs (kWh x DKK per MWh x 0.001) of the row's intervals that have a price and a quantity, each at its own price: an hour of four quarters can cost other than kWh x P; may be negative; NULL for a gap and where none has |
unpriced_kwh | number | kWh | calc.cost_intervals: the energy of the row's intervals with a price area and no price |
mp.changes (D1)
Changed readings and withdrawn days in a window. Reads: ts.reading_change, ts.series, ts.day_load. Personal columns: none. At most 1000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
kind | text | change (ts.reading_change) or withdrawn_day (ts.day_load) | |
changed_at | instant | ts.reading_change.changed_at, or ts.day_load.withdrawn_at | |
business_type | text | ts.series.business_type | |
interval_start | instant | ts.reading_change.interval_start; NULL for a withdrawn day | |
local_date | date | the interval's or the day's local date | |
old_present | bool | ts.reading_change.old_present | |
old_resolution | int | min | ts.reading_change.old_resolution |
old_kwh | number | kWh | ts.reading_change.old_quantity |
old_quality | text | ts.reading_change.old_quality as A01-A05 | |
new_present | bool | ts.reading_change.new_present | |
new_resolution | int | min | ts.reading_change.new_resolution |
new_kwh | number | kWh | ts.reading_change.new_quantity |
new_quality | text | ts.reading_change.new_quality as A01-A05 |
mp.ingestion (D1)
What the ingestion knows about one metering point. Reads: core.metering_point, ingest.mp_state, ts.day_load, ts.series, ingest.chunk. Personal columns: none. At most 2000 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
part | text | fixed by the query: readable_from, awaiting_first_data, latest_day, current_access, daily, chunks_by_state, open_window, unconfirmed_day, observed_absent | |
date_from | date | ingest.mp_state.readable_from; ts.day_load.local_date; ingest.chunk.date_from | |
date_to | date | ingest.chunk.date_to (half-open) | |
label | text | the name of an ingest.chunk.state | |
count | int | ingest.mp_state.daily_failures; the chunks of a state; ingest.chunk.attempts | |
code | int | a documented DataHub error code: ingest.mp_state.last_daily_code, ingest.chunk.last_error_code | |
reason | text | fixed by the query: verification_failed or not_delivered (§4.3) | |
at | instant | ingest.mp_state.last_daily_ok_at; ingest.chunk.next_try_at; ts.day_load.absent_since | |
flag | bool | awaiting first data (§6.3); current_access |
mix.structure (A4)
The sources of the consumption for a period, by group or by connected area. Reads: calc.mix_buckets(), ref.mix_group, ref.code. Personal columns: none. At most 60 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
part | text | calc.mix_buckets: the group code of ref.mix_group (by=source) or the connected area's code (by=origin: the code as delivered, never its name) | |
name | text | ref.mix_group.name_da (by=source) or ref.code, list connected_area (by=origin); NULL for a connected area the table does not know | |
known | bool | calc.mix_buckets: ref.mix_group / ref.code knows the part (a group always; an area not in ref.code is reported by make status) | |
ac_kwh | number | kWh | calc.mix_buckets: the part's energy over the hours whose mix is complete under the basis (§3.3 steps 2 and 6; the groups of an hour sum to its consumption exactly); NULL never zero where no hour is in the figures |
ac_share | number | fraction | calc.mix_buckets: ac_kwh / the consumption of the hours in the figures, 9 decimals |
cp_kwh | number | kWh | calc.mix_buckets: the same over the comparison period's hours in the figures; NULL with cmp=none |
cp_share | number | fraction | calc.mix_buckets: the comparison's share of its own consumption of the hours in the figures; NULL with cmp=none |
ac_matched_share | number | fraction | calc.mix_buckets, like-for-like: the share over the matched hour cells of the period (the same cells on both sides) |
cp_matched_share | number | fraction | calc.mix_buckets, like-for-like: the share over the same cells of the comparison period |
delta_cp_pp | number | pp | the query: (ac_matched_share - cp_matched_share) x 100, exact, of the two matched shares the function returns; NULL where no cell is matched or the group has no share on either side |
cp_from | date | calc.mix_buckets: the first comparison day this row holds (the comparison period's) | |
cp_to | date | calc.mix_buckets: the last comparison day, inclusive | |
matched_hours | int | h | calc.mix_buckets, like-for-like (h), in metering-point hours |
hours_in_period | int | h | calc.mix_buckets, like-for-like (H) |
excluded_readings | int | h | calc.mix_buckets, like-for-like |
excluded_mix | int | h | calc.mix_buckets, like-for-like: the cells whose hour has no complete mix under the basis on either side |
reason | text | calc.mix_buckets: why the variance is not applicable (no_data, missing_readings, no_mix, no_counterpart); NULL when cells are matched and without a comparison | |
basis_kwh | number | kWh | calc.mix_buckets: the period's consumption, every hour (E01, as on the cards) |
basis_mix_kwh | number | kWh | calc.mix_buckets: the consumption of the hours in the figures (the denominator of E11a and E11b); NULL when no hour is |
basis_mix_hours | int | h | calc.mix_buckets: the metering-point hours in the figures |
basis_e07_kwh | number | kWh | calc.mix_buckets: E07, the renewable energy in the grid's mix (§3.3 step 4: Σ group energy x renewable_share) |
basis_e11a | number | fraction | calc.mix_buckets: E11a = E07 / the consumption of the complete hours, 9 decimals; NULL, never zero, with no complete hour |
basis_e11b | number | fraction | calc.mix_buckets: E11b = (E07 + nuclear) / the same, 9 decimals |
basis_cp_e11a | number | fraction | calc.mix_buckets: E11a of the comparison period; NULL with cmp=none |
basis_cp_e11b | number | fraction | calc.mix_buckets: E11b of the comparison period; NULL with cmp=none |
basis_cp_e11a_matched | number | fraction | calc.mix_buckets, like-for-like (cmp_e11a): E11a of the comparison over the matched cells; NULL with cmp=none or where none is matched (M1f) |
basis_ac_e11a_matched | number | fraction | calc.mix_buckets, like-for-like (e11a over the matched cells): E11a of the period over the matched cells; NULL with cmp=none or where none is matched (M1f2) |
basis_delta_e11a_pp | number | pp | the query: (E11a - the comparison's E11a) x 100 over the matched hour cells, exact |
basis_delta_e11b_pp | number | pp | the query: the same for E11b |
basis_pending_kwh | number | kWh | calc.mix_buckets: the consumption of the hours with a price area that are outside the figures under the basis (no complete mix, or not Final under basis=final) |
basis_pending_hours | int | h | calc.mix_buckets: those hours in metering-point hours: two roots with the same pending hour are 2 |
basis_pending_share | number | fraction | the query: basis_pending_kwh / basis_kwh, 9 decimals; NULL where there is no consumption |
basis_provisional_share | number | fraction | calc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals, the share of the period's consumption in the figures (the columns' base, not all the consumption) whose mix is not Final; 0 under basis=final; NULL with no complete hour (M4f) |
basis_cp_provisional_share | number | fraction | calc.mix_buckets: (cp_preliminary_kwh + cp_initial_kwh) / cp_mix_kwh, 9 decimals, from the comparison's own status energies; 0 under basis=final; NULL with cmp=none or no complete hour of the comparison (M4f) |
mix.series (A4)
E11a and E11b by day or month with the energy of each group, the comparison and the variance. Reads: calc.mix_buckets(). Personal columns: none. At most 800 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
bucket_from | date | calc.mix_buckets: the first day of the day or month in the period | |
bucket_to | date | calc.mix_buckets: the last day of the day or month in the period | |
ac_kwh | number | kWh | calc.mix_buckets: the bucket's consumption, every hour |
ac_mix_kwh | number | kWh | calc.mix_buckets: the consumption of the bucket's hours in the figures under the basis |
ac_e11a | number | fraction | calc.mix_buckets: E11a of the bucket, 9 decimals; NULL, never zero, with no complete hour |
ac_e11b | number | fraction | calc.mix_buckets: E11b of the bucket, 9 decimals |
ac_pending_kwh | number | kWh | calc.mix_buckets: the bucket's consumption with a price area that is outside the figures under the basis |
ac_pending_hours | int | h | calc.mix_buckets: those hours, in metering-point hours |
ac_provisional_share | number | fraction | calc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals, the share of the bucket's consumption in the figures whose mix is not Final; 0 under basis=final (only Final hours are in the figures); NULL with no complete hour (M1) |
cp_provisional_share | number | fraction | calc.mix_buckets: (cp_preliminary_kwh + cp_initial_kwh) / cp_mix_kwh, 9 decimals, from the comparison's own status energies; 0 under basis=final; NULL with cmp=none or no complete hour of the comparison (M1f) |
groups | json | calc.mix_buckets by source: [{group, kwh, share, cp_kwh_matched, cp_share_matched, cp_kwh_all, cp_share_all}] for the nine groups in the order of ref.mix_group.sort: part_ac_kwh, part_ac_share, part_cmp_kwh, part_cmp_share, part_cp_kwh, part_cp_share (M1f: the comparison the form draws is on the comparable hours, the matched cells, as the variance; its level over all its own hours in the figures is cp_*_all and drawn nowhere in the form); kwh and share NULL, never zero, where the bucket has no hour in the figures, the comparison's where those hours have none, and all four with cmp=none; the nine shares of each side sum to 1 within the rounding of each (9 decimals, half away from zero) | |
cp_kwh | number | kWh | calc.mix_buckets: the comparison's consumption for the bucket's comparison days; NULL with cmp=none |
cp_mix_kwh | number | kWh | calc.mix_buckets: the comparison's consumption of the hours in the figures |
cp_e11a | number | fraction | calc.mix_buckets: E11a of the comparison days of the bucket |
cp_e11b | number | fraction | calc.mix_buckets: E11b of the comparison days of the bucket |
cp_from | date | calc.mix_buckets: the first comparison day this row holds | |
cp_to | date | calc.mix_buckets: the last comparison day this row holds, inclusive | |
ac_e11a_matched | number | fraction | calc.mix_buckets, like-for-like: E11a over the matched hour cells of the bucket |
cp_e11a_matched | number | fraction | calc.mix_buckets, like-for-like: E11a over the same cells of the comparison |
cp_kwh_matched | number | kWh | calc.mix_buckets, like-for-like (cmp_kwh): the comparison's consumption over the matched cells; NULL where none is matched (M1f) |
ac_e11b_matched | number | fraction | calc.mix_buckets, like-for-like: E11b over the matched cells |
cp_e11b_matched | number | fraction | calc.mix_buckets, like-for-like: E11b over the same cells of the comparison |
delta_e11a_pp | number | pp | the query: (ac_e11a_matched - cp_e11a_matched) x 100, exact; NULL where no cell is matched |
delta_e11b_pp | number | pp | the query: (ac_e11b_matched - cp_e11b_matched) x 100, exact |
matched_hours | int | h | calc.mix_buckets, like-for-like (h), in metering-point hours |
hours_in_period | int | h | calc.mix_buckets, like-for-like (H) |
excluded_readings | int | h | calc.mix_buckets, like-for-like |
excluded_mix | int | h | calc.mix_buckets, like-for-like |
reason | text | the query: no_data (nothing stored), no_price_area (every hour lacks one), no_mix (consumption and no hour in the figures) make the figures NULL; missing_readings, no_mix, no_counterpart say why a variance is not applicable |
mix.profile (A4)
The sources by the 24 clock hours of the day, with the comparison and the variance. Reads: calc.mix_buckets(). Personal columns: none. At most 24 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
clock_hour | int | calc.mix_buckets by the grain hour (M4): the class's local clock hour 0 to 23, always 24 rows in that order | |
hour_count | int | h | calc.mix_buckets (clock_hour_count): the local hours of the period's days in the class; the 25-hour day's 02 counts two (02A, 02B), the 23-hour day's none |
hour_repeated | int | calc.mix_buckets (clock_hour_repeated): the days of the period on which the class occurs twice (02A and 02B of the 25-hour day) | |
hour_absent | int | calc.mix_buckets (clock_hour_absent): the days of the period on which the class does not occur (02 of the 23-hour day) | |
ac_kwh | number | kWh | calc.mix_buckets: the class's consumption, every hour |
ac_mix_kwh | number | kWh | calc.mix_buckets: the consumption of the class's hours in the figures under the basis |
ac_kwh_per_hour | number | kWh | the query: ac_kwh / hour_count, rounded once to 9 decimals half away from zero; NULL with no hour in the class |
ac_mix_kwh_per_hour | number | kWh | the query: ac_mix_kwh / hour_count, 9 decimals, half away from zero; NULL with no complete hour |
ac_e11a | number | fraction | calc.mix_buckets: E11a of the class, 9 decimals; NULL, never zero, with no complete hour |
ac_e11b | number | fraction | calc.mix_buckets: E11b of the class, 9 decimals |
ac_pending_kwh | number | kWh | calc.mix_buckets: the class's consumption with a price area that is outside the figures under the basis |
ac_pending_hours | int | h | calc.mix_buckets: those hours, in metering-point hours |
ac_provisional_share | number | fraction | calc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals, the share of the class's consumption in the figures whose mix is not Final; 0 under basis=final (only Final hours are in the figures); NULL with no complete hour (M1) |
cp_provisional_share | number | fraction | calc.mix_buckets: (cp_preliminary_kwh + cp_initial_kwh) / cp_mix_kwh, 9 decimals, from the comparison's own status energies; 0 under basis=final; NULL with cmp=none or no complete hour of the comparison (M1f) |
groups | json | calc.mix_buckets by source: [{group, kwh, share, kwh_per_hour, cp_kwh_matched, cp_share_matched, cp_kwh_all, cp_share_all}] for the nine groups in the order of ref.mix_group.sort: part_ac_kwh, part_ac_share, part_ac_kwh / hour_count (9 decimals, half away from zero: the band of the day profile in kWh pr. time), part_cmp_kwh, part_cmp_share, part_cp_kwh, part_cp_share (M1f: the comparison the form draws is on the comparable hours, the matched cells, as the variance; its level over all its own hours in the figures is cp_*_all and drawn nowhere in the form); kwh and share NULL, never zero, where the bucket has no hour in the figures, the comparison's where those hours have none, and all four with cmp=none; the nine shares of each side sum to 1 within the rounding of each (9 decimals, half away from zero) | |
cp_kwh | number | kWh | calc.mix_buckets: the comparison's consumption for the class's comparison days; NULL with cmp=none |
cp_mix_kwh | number | kWh | calc.mix_buckets: the comparison's consumption of the hours in the figures |
cp_e11a | number | fraction | calc.mix_buckets: E11a of the comparison days of the class |
cp_e11b | number | fraction | calc.mix_buckets: E11b of the comparison days of the class |
cp_from | date | calc.mix_buckets: the first comparison day this row holds | |
cp_to | date | calc.mix_buckets: the last comparison day this row holds, inclusive | |
ac_e11a_matched | number | fraction | calc.mix_buckets, like-for-like: E11a over the matched hour cells of the class |
cp_e11a_matched | number | fraction | calc.mix_buckets, like-for-like: E11a over the same cells of the comparison |
cp_kwh_matched | number | kWh | calc.mix_buckets, like-for-like (cmp_kwh): the comparison's consumption over the matched cells; NULL where none is matched (M1f) |
ac_e11b_matched | number | fraction | calc.mix_buckets, like-for-like: E11b over the matched cells |
cp_e11b_matched | number | fraction | calc.mix_buckets, like-for-like: E11b over the same cells of the comparison |
delta_e11a_pp | number | pp | the query: (ac_e11a_matched - cp_e11a_matched) x 100, exact; NULL where no cell is matched |
delta_e11b_pp | number | pp | the query: (ac_e11b_matched - cp_e11b_matched) x 100, exact |
matched_hours | int | h | calc.mix_buckets, like-for-like (h), in metering-point hours |
hours_in_period | int | h | calc.mix_buckets, like-for-like (H) |
excluded_readings | int | h | calc.mix_buckets, like-for-like |
excluded_mix | int | h | calc.mix_buckets, like-for-like |
reason | text | the query: no_hour (the class has no hour in the period: 02 of a period of the 23-hour day alone), no_data (nothing stored), no_price_area (every hour lacks one), no_mix (consumption and no hour in the figures) make the figures NULL; missing_readings, no_mix, no_counterpart say why a variance is not applicable |
mix.hours (A4)
The sources of every hour of a window of at most 31 days. Reads: calc.mix_buckets(), ref.mix_group, ref.code. Personal columns: none. At most 745 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
hour_utc | instant | calc.mix_buckets by the grain utc_hour (M5a, hour_utc): the UTC instant the hour starts | |
local_date | date | calc.mix_buckets by the grain utc_hour (bucket_key): the hour's local day, Europe/Copenhagen | |
clock_hour | int | calc.mix_buckets by the grain utc_hour (clock_hour): the hour's local clock hour 0 to 23 | |
occurrence | int | calc.mix_buckets by the grain utc_hour (hour_occurrence): 2 for the second 02:00 of the 25-hour day (02B), 1 otherwise | |
ac_kwh | number | kWh | calc.mix_buckets: the hour's consumption, every metering point of the selection |
ac_mix_kwh | number | kWh | calc.mix_buckets: the consumption of the hour in the figures under the basis (a price area and a complete mix, Final under basis=final) |
ac_e11a | number | fraction | calc.mix_buckets: E11a of the hour, 9 decimals; NULL, never zero, with no consumption in the figures |
ac_e11b | number | fraction | calc.mix_buckets: E11b of the hour, 9 decimals |
ac_pending_kwh | number | kWh | calc.mix_buckets: the hour's consumption with a price area that is outside the figures under the basis (its mix pending, or not Final under basis=final) |
ac_no_price_area_kwh | number | kWh | calc.mix_buckets: the hour's consumption of points without a price area on its day |
ac_provisional_share | number | fraction | calc.mix_buckets: (ac_preliminary_kwh + ac_initial_kwh) / ac_mix_kwh, 9 decimals; 0 under basis=final; NULL with no consumption in the figures |
parts | json | calc.mix_buckets by the grain utc_hour: [{part, name, known, kwh, share}] in part_sort: by=source the nine groups of ref.mix_group (name ref.mix_group.name_da), by=origin every connected area with energy in the window, the largest of the window first (name ref.code's, NULL for an area the table does not know, which keeps its code); kwh and share (part_ac_kwh, part_ac_share) NULL, never zero, where the hour has no consumption in the figures, 0 for a part without energy in an hour that has some; the energies sum to ac_mix_kwh exactly, the shares to 1 within the rounding of each (9 decimals, half away from zero) | |
reason | text | the query: no_data (nothing stored in the hour), no_price_area (every kWh of the hour lacks a price area), no_mix (consumption and nothing in the figures: the mix pending, or not Final under basis=final); NULL when the hour has figures |
report.footprint (validation)
The blocks of Eloverblik's climate report for a period and a method. Reads: calc.footprint(), calc.mix_buckets(). Personal columns: none. At most 60 rows.
| Column | Type | Unit | Source: where the value comes from, and why it may leave |
|---|---|---|---|
block | text | fixed by the query: consumption, emissions, distribution_loss, transmission_loss, biogenic, co2_intensity, ch4_intensity, n2o_intensity (the blocks of L2 that phase 1 computes), then under a municipal method local_energy (B84: the exact sum of the municipal part, kWh; the method's ninth block, with blocks=emissions only until B88), then renewable_share_ex_nuclear, renewable_share_with_nuclear, source:<group_code> (the nine groups) and origin:<connected_area> (B59: calc.mix_buckets) | |
unit | text | fixed by the query: the report's unit of the block (kWh, kg CO2e, kg CO2, g/kWh, mg/kWh; fraction for a renewable share; kWh for a source and an origin) | |
value | number | per row | calc.footprint: a total as its exact sum in g x 0.001 (kg) or in kWh, never rounded; an intensity as amount / per_kwh rounded to 9 decimals; a renewable share E11a or E11b (calc.mix_buckets, 9 decimals), the energy of a source or an origin in kWh |
amount | number | calc.footprint: the exact sum behind the figure, in amount_unit (Σ over the intervals that have a factor, consumption over every stored quantity; a renewable share: E07, or E07 + nuclear, in kWh) | |
amount_unit | text | fixed by the query: kWh, g CO2e, g CO2, g, mg | |
per_kwh | number | kWh | calc.footprint: the quantity of the intervals that have a factor under the basis (intensity rows); calc.mix_buckets: the consumption of the hours whose mix is complete under the basis (the two shares); no other row |
complete | bool | the query: every MP-hour of the period has its readings (covered_hours = expected_hours); an emission block also a factor for every hour with a quantity (no pending hour, no hour without a price area, under a municipal method none without a municipality or a share); a row of the sources also some hour in the figures, none pending, none without a price area (B59) | |
reason | text | the query: no_data, no_factor, no_price_area, missing_readings, pending_factor, zero_consumption; under a municipal method also no_municipality, municipality_not_loaded and pending_share (hours with a wanted municipality and no share, before pending_factor), and with no hour in the figures the cause that holds the largest share of the consumption (calc.emission_reason); for a row of the sources also no_mix and pending_mix (B59) | |
roots | int | calc.footprint: the E17 roots selected | |
expected_hours | int | h | calc.footprint: roots x the hours of the period's local days (23, 24 or 25 a day) |
covered_hours | int | h | calc.footprint: MP-hours whose stored intervals cover exactly the hour, whatever their quality |
factor_hours | int | h | calc.footprint: MP-hours with a quantity whose intervals all have a factor under the basis; emission rows only |
pending_hours | int | h | calc.footprint: MP-hours with a quantity, a price area and no factor yet (emission rows); calc.mix_buckets: MP-hours with a price area and no complete mix under the basis (rows of the sources) |
no_price_area_hours | int | h | calc.footprint: MP-hours with a quantity and no price area on their local day; every row but consumption carries it (a row of the sources too, B59f) |
The building blocks (migrations 0120, 0140)
calc.period_buckets (day, month or period buckets), calc.previous_year_last (the rule of "The previous year": the last
previous-year day of a day), calc.comparison_period and calc.comparison_buckets (0225, B55: a comparison's days and shift,
and the comparison days of each bucket, "The comparison"; calc.previous_year_buckets before), calc.emission_intervals (the emission view of one method, GWP set and
basis: the queries never read calc.v_emission_interval, which has one row per interval × method × GWP set × basis and
would count every interval eight times; a call without the three, or with an unknown one, gives no row),
calc.consumption_buckets (consumption from the day summaries, with the comparison, per bucket), calc.emission_buckets
(from ONE read of the emission rows of the period and its comparison: the totals, quality contributions and the comparison
per bucket, B12a's comparison per bucket, and the period's basis block); each takes the comparison (p_cmp, p_cmp_date), calc.series_intervals and
calc.emission_series_intervals (one row per expected interval); calc.footprint (0140, B12b: the report's totals and
what they rest on). Executable by elo_api only. elo_api reads, and owns
nothing.
The readings are found by the selection's series (0212, B77, ADR-004 §5). Each function that reads readings first
computes v_series := calc.selection_series(mp_ids), the array of the selected E17 roots' own series (NULL for every
root), and its scan of ts.reading has series_id = ANY (v_series) as a condition of its own: in the plan of the call
(plan_cache_mode = force_custom_plan) the array is a constant, an index condition of every monthly partition on its
key (series_id, interval_start) with that array's estimate, which a join to the series is not while the functions plan
without nested loops (B15f). For every root the condition is left out, and every partition is read whole, sequentially
and in parallel, as before. One place each reads the readings: calc.selection_readings(series, from, to) for the
consumption functions (calc.consumption_matched, its period and its comparison; calc.weekday_hour_cells), and
calc.emission_intervals(…, series) (a seventh argument, NULL by default) for the emission functions
(calc.emission_buckets, calc.footprint, calc.emission_series_intervals, calc.emission_matched).
calc.series_intervals (one point, all its series) is as it was: it plans with nested loops allowed and already reads
each partition by its key. A small selection's cost is therefore its own rows, not the database's in the period; a
selection of every root reads every partition as before.
An aggregate emission query (overview.cards, overview.months and development.series with G01) returns the period's
factor status and matched hours in its own rows, in the columns basis_* after the catalogue's columns; the runner builds
basis.factorStatus, basis.factorSource and basis.matched from the first row and never sends these columns. So a
response reads the emission rows once (it read them four times, B15v-02). mp.emission_intervals reads its factor status from
the provider providers/factor_status.sql. Without a comparison (cmp=none) the comparison period is not read at all, as the
row budget does not count it (B15v-06).
Cost
Measured on the demo organisation of B12a's test (18 E17 roots, 14 with data, 444 812 readings 2024-01-01 to 2026-11-13,
the frozen factor extract) in the PostgreSQL 18 of the Colima VM (4 vCPUs), autovacuum off, through HTTP, warm; seconds per
request, B15f's figures (docs/build/B15-report.md has the table before and after):
| Request | Analysed | Never analysed |
|---|---|---|
overview.cards, 2025 with 2024, all roots | 2.3–2.4 | 2.3 |
overview.months G01, the same | 2.4 | 2.2 |
development.series G01 by day, the same | 2.3–2.4 | 2.3 |
overview.cards, one month / one root for a year | 0.3 / 0.3 | 0.3 / 0.3 |
mp.emission_intervals, a week / a month of one root | 0.15 / 0.18 | 0.1 / 0.13 |
meta.context, E01 queries, overview.mp_variance, mp.series | ≤ 0.03 | ≤ 0.09 |
The functions that read emission rows over a range plan their statement with nested loops disabled, and every function that
reads readings plans without JIT, so that the plan does not depend on statistics: right after a load, before the tables are
analysed, the planner expected one row of everything and joined the readings to the factors by a nested loop (every emission
query answered 503 after the 30 s timeout). The jobs that load (B08b, B11) should still run ANALYZE on ts.reading,
ts.day_load, fx.factor_hour and core.mp_geo after a load.
Cost after B15b
Measured the same way (warm, through HTTP, the Colima VM, a demo organisation of 12 roots with data, 2024-01-01 to 2026-11-13, the
frozen factor extract), seconds per request, the fastest of three after a first; "before" is the table above (B15f, 18 roots; a
same-day calibration is the untouched development.series G01 by day, 1.95 s here against 2.3–2.4 there):
| Request | Before | After |
|---|---|---|
overview.cards, 2025 with 2024, all roots | 2.3–2.4 | 3.0 |
overview.cards, the default page's ytd | (as a year) | 3.0 |
overview.cards, the widest period, 2024-01-01 to 2026-11-13 | – | 7.4 |
overview.cards, one month / one root for a year | 0.3 / 0.3 | 0.28 / 0.39 |
overview.mp_variance, 2025 / ytd / the widest | ≤ 0.03 | 1.2 / 1.2 / 3.2 |
overview.months E01, overview.months G01, development.series G01 by day | ≤ 0.03 / 2.4 / 2.4 | 0.02 / 1.9 / 1.95 |
mp.emission_intervals, a week / a month of one root | 0.15 / 0.18 | 0.06 / 0.13 |
mp.series a month, mp.master, meta.context | ≤ 0.03 | 0.03, 0.00, 0.01 |
What got dearer is what the like-for-like consumption variance reads: the readings of both years (calc.consumption_matched), about
0.6 s of the cards' year and 1.2 s of the ranking's, which read the day summaries only before. The two requests of X1's default
page run in parallel, so the page waits for the cards (3.0 s). The ranking now counts its reading rows against the row budget
(readings: always: above its row budget, 2 000 000 or ELO_ROW_BUDGET when set, it answers too_large_for_grain, as the cards do at their own, B77). The expected range
(calc.series_expected, one read of ts.day_load per series) costs nothing that shows.
Of the 2.3 s of a year of 18 roots, reading the 248 000 emission rows of both years through calc.v_emission_interval is
about 1.3 s (half of it the view's price-area lookup per reading), grouping them by hour 0.3–0.4 s and the like-for-like
comparison 0.5–0.6 s.
Cost after B57
Measured the same way (warm, through HTTP, the Colima VM, the demo organisation of 18 roots loaded from 2024-10-01 to 2026-11-13, analysed as the owner's stack is: the loader analyses what it loads), seconds per request, the median of five after a first; "before" is the code before B57 (B56's functions, no cost in the queries):
| Request | Before B57 | After |
|---|---|---|
overview.cards, 1 November 2025 to 31 October 2026 with the previous year, all roots | 4.07 | 5.06 |
overview.cards, ytd | 3.44 | 4.51 |
overview.months G01 / development.series G01 by day, the same year | 2.75 / 2.73 | 2.70 / 2.72 |
overview.months K01 / development.series K01 by day | – | 1.21 / 1.19 |
overview.months KNET (two calls of calc.cost_buckets) | – | 1.57 |
consumption.weekday_hours K01 / G01 / E01, the year, no comparison | – / – / – | 0.85 / 1.02 / 0.36 |
The cards pay one call of calc.cost_buckets by month (1.2 s), as B56 measured it. **That is so only since migration 0256 and the
runner's SET LOCAL jit = off**: B56 measured calc.cost_buckets on tables that were never analysed (1.1 s); once ANALYZE had run
the same call took 3.03 s (the cards 7.06 s, K01 by month 3.13 s), and KNET's statement spent 2.4 s of its 4.1 s compiling. The first
was an estimate: calc.window_hours made the hours of a day with a series whose bounds come from the calendar row, which the
planner takes for 1 000 rows each, so that analysed (it then knew the 365 days of a year) it estimated the two windows' hours at
2 110 000 (never analysed 2 294 000) against 17 520, and the join of the readings' hours to them at 313 million rows analysed, which it hashed
to disk in 4 096 batches (never analysed a hash of 64 batches: the same error, small in the one state). The series has constant bounds now (0 to 24, cut
by the day's length): same rows, an estimate of 3 042 hours a year analysed and 433 never analysed against 8 760, and the
largest hash of the call in 256 batches (0.05 s) in place of 4 096 (2.5 s) in either state (1.05–1.12 s analysed, 1.27–1.29 s never analysed, where the old text took 3.05 s and
1.21–1.24 s). The second: a statement of several CTEs over functions whose rows are guessed at 1 000 each is estimated above
jit_above_cost, and PostgreSQL compiled it; the runner now sets jit = off for the request's transaction, as B77's functions do for
their own statements. test_queries_b57.py holds both: the plan of the call in both states (batches, estimate, time) and a request
that would be compiled if the runner did not say no.
Cost after B68
Measured the same way as "Cost after B57" (warm, through HTTP, the Colima VM, the demo organisation of 18 roots loaded from 2024-10-01 to 2026-11-13, analysed: 183 of 183 tables), the median of five after a first, the year 1 November 2025 to 31 October 2026 with the previous year:
| Request | Seconds |
|---|---|
energy.split, all roots, cmp=py / cmp=none | 3.13 / 0.72 (B68: 1.72 / 0.81, before the second scan) |
energy.split, ytd, all roots, cmp=py | 2.78 (B68: 1.54) |
energy.split, root 1 (with an export child), the year / October 2026, cmp=py | 0.74 / 0.10 (B68: 0.47 / 0.08) |
overview.months KNET / K01 (beside), the same year | 1.52 / 1.16 |
mp.cost_intervals, 745 hours of October 2026, a root / an export child (read in quarters) | 0.08 / 0.09 |
mp.cost_intervals, 676 quarters of the week of 25 October, the export child | 0.05 |
mp.series / mp.emission_intervals, 745 hours of one root (beside) | 0.04 / 0.12 |
energy.split is two calls of calc.cost_buckets, two of calc.consumption_buckets (the day summaries, a few milliseconds) and, since
B68f, two of calc.consumption_matched in one statement. With a comparison each reading row is read twice, so it takes about twice
what KNET takes (3.1 s against 1.5 s for the year of the demo) and has half KNET's budget; B68 before the second scan measured 1.7 s.
Without a comparison the second year is not read and calc.consumption_matched returns at once (0.7 s). Median of five after a first,
the demo database analysed (183 of 183 tables).
Tests
services/api/tests/test_queries*.py: the catalogue and its refusals (no database), the acceptance criteria of B15's row,
the queries of D1, the privacy rules, and the building blocks against the Python reference of B12a to the last decimal
(test_queries_buckets.py). B84: test_queries_b84.py (every query that takes m under LB-MU-125, the reasons and their order, the
cards' local_kwh and local_share, D1's columns, the footprint's ninth block and its 422, calc.emission_reason, calc.share_source's
factorSource, the budgets and the times under both splits); test_queries_b66.py holds every price-area answer to the frozen fixture
but for B84's members (_b84_part).
Kilde: docs/queries.md i løsningens
repository.