Eloverblik

Dokumentation · Data og kilder

Master data (phase-1.md §7, §3.3; B07)

The worker turns the Customer API's list (meteringpoints) and getdetails into the metering point tree, versioned master data and the price area. Code: elo_worker.ingest.masterdata (the appliers), elo_worker.eloverblik (the PostgreSQL pace store, the account, the observer, the runtime), elo_worker.jobs.eloverblik_weekly.

What is stored, and what is not

A field is stored only if it is on the allowlist (B04a's models) and its value is valid for the field. Before anything is versioned or stored, every kept key of a record is checked, and a key whose value fails is removed; the same cleaned record becomes the version and the body in raw.payload, for accepted and refused items alike.

FieldValid when
typeOfMPa type of ref.mp_type
subTypeOfMP, physicalStatusOfMP, netSettlementGroup, mpConnectionType, disconnectionType, settlementMethod, assetType, meterReadingOccurrence, energyTimeSeriesMeasureUnit, producta code of its list in ref.code
meteringPointId, parentMeteringPointId18 digits (and, in a getdetails body, a metering point the list registered)
meteringGridAreaIdentification, municipalityCode3 digits
gridOperatorID, balanceSupplierId13 digits (GLN)
consumerCVR, dataAccessCVR8 digits
postcode4 digits
darReferencea UUID in the canonical form DAR writes: lower case, hyphenated (not braces, urn:uuid: or 32 bare digits, which uuid.UUID also accepts)
the two start dates; occurrencea date; an instant ending in Z
mpCapacitya plain decimal, not negative, at most three decimals
hasRelation, isMovedOut, taxReduction, protectedNamea flag
gridOperatorName, balanceSupplierName, cityName, streetName, meteringPointAliasfree text: letters, digits, spaces and .,-/&'()+:#, at most 100 characters (60 for city and street); no eyJ, no :// or www., no c/o; and no run of eight or more digits once everything that is not a letter or a digit is removed
buildingNumbera house number of DAR: 1 to 3 digits and an optional letter (5, 12B)
floorIda floor of DAR: st, kl, k2…k9 or 1 to 2 digits
roomIda door of DAR: tv, th, mf, 1 to 4 digits, or a letter and up to 3 digits
meterNumberup to 30 letters, digits or -, no eyJ, no run of 18 or more digits once the hyphens are removed

The three DAR forms are case-insensitive. They are the review's (B07v-01), written from memory of DAR: no published rule is in docs/sources/, and they are to be checked against the owner's capture; a value outside them is dropped and counted (below), so the capture shows it.

What the checks cannot tell. The free-text bounds refuse a CPR, CVR or phone number however it is written (a hyphen, spaces, +45), a URL and a c/o line, but no pattern tells a person's name from a company's ("Karen Testesen" from "Fjordstrøm Energi"). The lead's rulings (§7 of v1.5): gridOperatorName and balanceSupplierName are stored, as company names from DataHub's register; meteringPointAlias is stored, the organisation's own label for its meter, and may hold a name the organisation chose to put there. **meterNumber is an identifier of a device, kept on purpose** to match the organisation's own meter lists; its shape cannot be told from another number of the same length (a CVR or phone number of eight digits passes, as a meter number of eight digits must). A DAR reference in the canonical form cannot be told from another UUID either.

locationDescription is not stored at all (the lead's ruling 1): it is text typed by people about access to a meter and has no use in the product. The allowlist discards it (it is not counted as unknown), and core.mp_version has no column for it (migration 0020 drops it).

The envelope of a getdetails item is checked too (success a flag, errorCode a number of at most five digits, id an ID); errorText and stackTrace never reach the worker. An error code of more than five digits is stored as none in raw.fetch_item.error_code and raw.fetch.error_code (a documented code has five).

Dropped values are counted, by name. Every kept value a check drops is counted in ingest.unknown_field as <path>.<key>=<invalid> (for example result[].result.floorId=<invalid>), and a list entry that cannot be registered (a child of a type ref.mp_type does not hold, a child that is its own root) as result[].childMeteringPoints[]=<not registered>; a getdetails record whose own ID is not the item's is dropped as result[].result.meteringPointId=<not the item's> and the item is a parse error. The value is never counted or stored.

The address (streetName, buildingNumber, floorId, roomId, darReference) is stored only when protectedName is false and no contact address says protected (N4). A protectedName that is absent, empty or unreadable is unknown: protected_name is NULL, never false, and the address is withheld. A protectedAddress that cannot be read counts as protected. The list carries no protection flag, so an address never comes from the list.

The tree, versions, price area

The worker's runtime

When ELOVERBLIK_REFRESH_TOKEN is set, the worker builds the runtime at start: it records the account with the fingerprint and generation of the configured token (step 0, the worker's side: a different token raises credential_generation and makes the account active again), then tries to acquire the egress at most once a minute from its main loop, never blocking, and starts the client once it owns it. Eloverblik jobs are refused (and retried by the queue) while the egress is the capture tool's, the account is invalid, or the API's pause (cooldown_until) ends more than a poll from now, so that no job waits for it inside the queue's claim. An ELO_ACCOUNT_PARTY_KIND other than 0, 1 or 2 ends the worker at its start. A refused refresh token marks the account invalid. On a graceful stop the worker releases the egress and writes the handoff record. Every raw.fetch row the worker writes carries the account and the credential generation.

eloverblik-weekly asks getdetails for every metering point with status 1 or 3, children included, ten to a request. A run in which every request failed (not a 200, or every item 20011) fails, and the queue retries it by its ordinary rule; a run in which some failed is done and says how many (failed_requests), with the items counted by outcome.

The pacer's row is moved by the database's functions only. The worker role may update the three persisted waits of ingest.pacer itself; every deadline and counter moves through ingest.reserve_start, ingest.finish_call and ingest.absorb (the handoff), which run with the owner's rights and never move one earlier (P7, B07v-09). When transaction B fails, the completion is recorded alone before the error propagates, and a reservation that finds a call still in flight finishes it first (B07v-04). The scheduler that queues it on Sundays at 02:00 is B09's (elo_worker.schedule).

Kilde: docs/master-data.md i løsningens repository.