@uk-energy/dno
v0.1.0
Published
Typed client for the GB DNO open-data portals (UKPN, NPG, ENWL, SPEN on Opendatasoft; NGED, SSEN on CKAN): one registry, two adapters, and the Embedded Capacity Register normalised across all six. Part of uk-energy-sdk.
Maintainers
Readme
@uk-energy/dno
One client for the open-data portals of the six GB distribution network operators: the Embedded Capacity Register (every generator and storage site ≥ 50 kW connected or queued on each network) normalised to one shape, the network capacity / headroom publications, and raw access to everything else each portal holds. Four portals run on Opendatasoft, two on CKAN; the client hides which is which.
| DNO | Licence areas | Portal | API key | Licence |
| --- | --- | --- | --- | --- |
| ukpn UK Power Networks | Eastern, London, South Eastern | Opendatasoft | required for records (sign up) | CC BY 4.0 |
| npg Northern Powergrid | Northeast, Yorkshire | Opendatasoft | no (5,000 req/day anonymous) | NPg Open Data Licence v1.0 |
| enwl Electricity North West | North West | Opendatasoft | required for records (sign up) | CC BY 4.0 |
| spen SP Energy Networks | SP Distribution, SP Manweb | Opendatasoft | required for records (sign up) | CC BY 4.0 |
| nged National Grid Electricity Distribution | East & West Midlands, South Wales, South West | CKAN | no | NGED Open Data Licence |
| ssen Scottish and Southern Electricity Networks | SHEPD, SEPD | CKAN | no | CC BY 4.0 |
Verified 22 Oct 2026. UKPN, ENWL and SPEN publish their datasets with Opendatasoft "domain"
visibility: metadata and field lists are public, but records come back 403 ForbiddenAccess
(and exports empty) without a key. Registration is free and immediate. DNOS[id] carries each
portal's base URL, sign-up page, licence and the attribution line to keep wherever you show the
data.
Python mirror: uk_energy.dno in the uk-energy distribution.
pnpm add @uk-energy/dnoUsage
import { DnoClient, DNOS } from "@uk-energy/dno";
const dno = new DnoClient({ apiKeys: { ukpn: process.env.UKPN_KEY } });
// Embedded Capacity Register, one shape across all six DNOs
const npg = await dno.ecr.list("npg");
npg[0].maxExportMw; // 380 (Lynemouth) — numbers, dates ("2002-10-01") and yes/no flags parsed; raw row in .raw
const npgWind = await dno.ecr.list("npg", { where: 'energy_source_1="Wind"' }); // ODSQL, Opendatasoft portals only
// Every DNO at once; portals you have no key for are reported, not thrown
const { rows, errors } = await dno.ecr.all();
errors.map((e) => `${e.dno}: ${e.error.message}`); // e.g. "enwl: Electricity North West needs an API key …"
// Headroom / capacity publications (schemas differ per DNO; rows are the portal's own)
dno.headroom.datasets("ukpn"); // [{ id: "ukpn-capacity-heatmap", note: "LTDS capacity heatmap per primary" }, …]
const heatmap = await dno.headroom.rows("ukpn", 0, { where: 'voltage_level="33kV"' });
// Raw portal access for anything else
const ods = dno.ods("npg"); // Opendatasoft Explore v2.1
const page = await ods.records("embedded-capacity-register", { limit: 100, offset: 0, orderBy: "ecrid" });
const all = await ods.all("heatmapdatatable", { select: ["primary", "headroom_mw"] }); // exports/json, no row ceiling
const ckan = dno.ckan("nged"); // CKAN (same client as @uk-energy/neso)
const res = await ckan.resourceByName("embedded-capacity-register", /^ECR/);
const everything = await ckan.datastoreAll(res.id);
DNOS.npg.licence.attribution; // "Contains Northern Powergrid open data, used under the Northern Powergrid Open Data Licence v1.0"The Embedded Capacity Register
Every DNO publishes Ofgem's ECR template in two parts — sites of 1 MW and above ("1mw") and
50 kW to 1 MW ("under1mw"); the portals number the parts differently — with the same ~45
columns under different header spellings (export_mpan_msid,
export_mpan/msid, export_mpan___msid), numbers as text and "data not available" for blanks.
ecr.list() returns EcrRows: id, exportMpan, customerName, customerSite, postcode,
latitude/longitude (from the portal's geopoint where there is one), gridSupplyPoint,
pocVoltageKv, energySource1..3, technology1..3, registeredCapacity1..3Mw,
storageCapacity1Mwh, maxExportMw, maxImportMw, connectionStatus, dateConnected,
acceptedToConnectMw, targetEnergisationDate, inConnectionQueue, lastUpdated and the
rest, all null when the DNO published nothing. NGED publishes one CSV for both parts; rows are
labelled by the largest of their connected, accepted, registered, export and import capacity.
ecr.list(dno, { part, where, limit, orderBy }): part is "1mw", "under1mw" or both;
where and orderBy are ODSQL and only the Opendatasoft portals take them — on NGED or SSEN
they throw UkEnergyError rather than silently returning the whole register (in ecr.all()
that lands in errors); limit is a preview, one request per part (on NGED the split happens
after the fetch, so a one-part preview can hold fewer rows). SPEN publishes the ≥ 1 MW part only;
ENWL also has a DSR register (DNOS.enwl.datasets.ecrDsr). ecr.all() keeps every part that
succeeded and reports each failing part with its DNO and the reason.
Surface
| Namespace | Methods |
| --- | --- |
| ecr | list(dno, { part, where, limit, orderBy }), all({ dnos, part, where, limit, orderBy }) |
| headroom | datasets(dno), rows(dno, index, odsQuery) — on a CKAN DNO only limit applies (one page) |
| ods(dno) | catalog({ search, where, limit, offset }), dataset(id), records(id, { where, select, orderBy, limit ≤ 100, offset }), all(id, { where, select, orderBy, limit }) |
| ckan(dno) | @uk-energy/core's CkanClient: packageShow, packageSearch, resourceByName, datastoreSearch, datastoreAll, sql |
| | info(dno), hasApiKey(dno), rows(dno, ref, odsQuery); DNOS, DNO_IDS, normaliseEcr, ecrPartOf |
Opendatasoft limits: records pages ≤ 100 rows and refuses offset + limit > 10,000, so
all() uses exports/json instead. Anonymous quota is 5,000 requests/day (UKPN 10,000), reported
in x-ratelimit-* headers; a key raises it. Default client rate limit is 5 rps, burst 10, per
portal.
Licences
| DNO | Terms | Attribution (DNOS[id].licence.attribution) |
| --- | --- | --- |
| UKPN, ENWL, SPEN, SSEN | CC BY 4.0 | "Contains <DNO> open data, licensed under CC BY 4.0" |
| NPG | Northern Powergrid Open Data Licence v1.0 (OGL-style) | "Contains Northern Powergrid open data, used under the Northern Powergrid Open Data Licence v1.0" |
| NGED | NGED Open Data Licence (formerly WPD; OGL-style) | "Contains National Grid Electricity Distribution open data, used under the NGED Open Data Licence" |
Dataset ids drift when a DNO reorganises its portal; src/registry.ts is the one place they
live. Please open an issue (or PR) when one moves.
