In this section
- Substation Intelligence V9 63 geodesy · gridatlas / atlas/cartridges/202611180026-substation-intelligence-v9-63.js lines 8275–8609
- Substation Lookup electrical · gridatlas / atlas/modules/202609011950-substation-lookup.js lines 1–82
- Map Click Network render · gridatlas / atlas/modules/202609012230-map-click-network.js lines 1–57
Substation Intelligence V9 63
A JavaScript file in the cartridges folder of GridAtlas that maps elizabeth line, using haversine and SHA-256 and uses data from the Ventus Grid Engine, data-federation-map-for-GlobalGrid2050-all-repos and spiders repositories.
Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.
Evidence
- line 4 comment: * ASSEMBLED by tools/build-cartridge.mjs from the parts below. Do not edit
geodesygridatlas / atlas/cartridges/202611180026-substation-intelligence-v9-63.js · lines 8275–8609 of 8609 · version 2026-11-18 00:26 (continued from section 383) · pattern switchOn (shared by 4 files)
- What it does
- It maps elizabeth line, london underground, UK metros trams and hs2. Defines 238 functions or classes, including deepFreeze, escapeHTML, normalizeStatus, fmt, haversine. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV.
- Inputs & outputs
- In: data source: ventus-grid-engine data; data source: data-federation-map-for-globalgrid2050-all-repos data; data source: spiders data; data source: npm data; GeoJSON file elizabeth_line.geojson; GeoJSON file london_underground.geojson; GeoJSON file uk_metros_trams.geojson; GeoJSON file hs2.geojson. Out: downloaded file gridatlas-; downloaded file globalgrid2050-grid-atlas-; interactive map; canvas drawing; SVG drawing. Voltage levels named: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV, 11kV.
- Downstream impact
- Used directly by 4 files: Code Generator — Substation Finder Page (code-generator, https://ventusltd.github.io/code-generator/apps/substation-finder/); Map Removal Test (gridatlas); Build Graph (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/genome/); Ventus Grid Engine — Genome Page (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/genome/). Reached from 2 other entry points, including GridAtlas PR File Size Guard Workflow (gridatlas); Genome Workflow (ventus-grid-engine).
- What it achieves
- It normalizes status (`normalizeStatus`), toggles zone draw mode (`toggleZoneDrawMode`) and opens popup (`openPopup`). ASSEMBLED by `tools/build-cartridge.mjs` from the parts below. Its code works with 400 kV, 100 MVA and 132 kV. It responds to fullscreenchange, webkitfullscreenchange and click events.
- Why it matters
- Loaded by the Substation Finder page in Code Generator at https://ventusltd.github.io/code-generator/apps/substation-finder/ and 1 other page. Also imported by Build Graph, from Ventus Grid Engine. Checked by Map Removal Test.
- Application
- gridatlas · atlas/cartridges · script
- VEDIC
- SNAP LINE ENDS TO SUBSTATIONS (GG2050-VEDIC-000106): GridAtlas / Substations · Geospatial data processing. line_features, substation_point_features → Line features whose first and last vertices are moved onto the nearest substation point within tolerance; other geometry unchanged.
- VEDIC
- MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
- VEDIC
- REPRESENT (GG2050-VEDIC-000002): GridAtlas / Geodesy · Computer science / Geometry processing. geojson_geometry → coordinate_pair_or_null
- Uses
- Spider Full Po Test (estate URL), Data — Grid Studies Public Page (estate URL)
- Used by
- linked from Code Generator — Substation Finder Page (link), referenced by Map Removal Test (new URL import.meta.url), named by URL in Build Graph (estate URL), named by URL in Ventus Grid Engine — Genome Page (estate URL), mentioned in Standalone (comment link)
- Produces
- deepFreeze, escapeHTML, normalizeStatus, fmt, haversine, _zoneDrawGetRadius, _zoneDrawCirclePoints, _zoneDrawCalcArea, _zoneDrawUpdateLayers, _zoneDrawShowPopup, _zoneDrawShowPopupDebounced, _zoneDrawClear
- Defines here
- normalise, ready, eligible, unitCount
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/cartridges/202611180026-substation-intelligence-v9-63.js:8275-8609 · blob c6f9632fdb6e803baae03a54a542fe508431d153 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
document.addEventListener('click', function (event) {
var title = event.target && event.target.closest
? event.target.closest('.gm-title') : null;
if (title && /file/i.test(title.textContent || '')) beginPreparing();
}, true);
return true;
}
/* The export group is built by the menu bar, which itself installs only once
63 layer controls exist. Polling rather than assuming: a fixed delay is a
guess that is wrong on a slow phone and wasteful on a fast desktop. */
if (!install()) {
var tries = 0;
var timer = setInterval(function () {
tries += 1;
if (install() || tries >= MAX_TRIES) clearInterval(timer);
}, 250);
}
}());
/* ══════════════════════════════════════════════════════════════════════
PART 2 - the network, as its operator publishes it
══════════════════════════════════════════════════════════════════════ */
(() => {
'use strict';
const GENERATION = '202609012045';
/* Pinned to a commit and hashed. The reasoning, the table and the
digest arithmetic are in the pinned-products module beside this file;
what matters here is that `main` was the ref and the schema string was
the whole defence, and a schema string is blind to values. */
const PINS = (window.__GRIDATLAS_MODULES__ || {}).pinnedProducts || null;
const PRODUCT_ID = 'connection-points.v3';
const PRODUCT = PINS ? PINS.url(PRODUCT_ID) : null;
const REQUIRED_SCHEMA = 'data-grid-gb.connection-points.v3';
/* Appendix D publishes eight current metrics and they are NOT
interchangeable, so one is quoted and named rather than any of them
being called "the fault level".
Codex, 202609011852: an earlier version of this comment and of the
card said the RMS break current is "the one switchgear is rated
against". That overclaims. Switchgear carries several relevant
ratings - making capacity, short-time withstand, peak withstand -
and this is ONE published breaker-duty metric among the eight. */
const QUOTED_METRIC = 'three_phase_rms_break_current_ka';
const QUOTED_METRIC_LABEL = 'three-phase RMS break current';
const DEG = Math.PI / 180;
const state = {
schema: 'gridatlas.substation-intelligence.v2',
generation: GENERATION,
product: PRODUCT,
loaded: false,
points: 0,
located: 0,
product_schema: null,
quoted_metric: QUOTED_METRIC,
failures: []
};
window.__GRIDATLAS_NETWORK__ = state;
/* ONE geodesy, and it is the module's.
--------------------------------------------------------------
This carried its own haversine using 2*R*asin(sqrt(a)) while the
estate canonical form is R*2*atan2(sqrt(a), sqrt(1-a)). They
agree algebraically and differ in the last place, and the
difference was invisible for as long as this half of the
cartridge was a monolith the all-versions scan could not read.
202609012350 extracted it, the scan found it immediately, and
the answer is not to retype the right form here but to stop
having a second implementation at all. */
const GEODESY = (window.__GRIDATLAS_MODULES__ || {}).geodesy;
if (!GEODESY) throw new Error("substation-intelligence requires the geodesy module");
const distanceKm = GEODESY.distanceKm;
const NOISE = /\b(SUBSTATION|SUB STATION|SUBSTN|GRID|SUPPLY|POINT|GSP|NATIONAL|POWER|STATION|WIND|FARM|WINDFARM|OFFSHORE|ONSHORE|EXTENSION|400KV|275KV|132KV|66KV|33KV|11KV|NGET|SSE|SP|SHE)\b/g;
function normalise(name) {
return String(name || '').toUpperCase()
.replace(/[^A-Z0-9 ]/g, ' ').replace(NOISE, ' ')
.split(/\s+/).filter(Boolean).join(' ');
}
const byName = new Map();
const located = [];
/* Every point, not only the ones that survived the name join. `byName`
keeps the first of a colliding key, so counting from it would report a
smaller network than the operator publishes. */
const published = [];
const ready = (async () => {
try {
if (!PRODUCT) throw new Error('the pinned-products module is not composed, '
+ 'so this cartridge has no pinned ref to read and will not guess one');
const response = await fetch(PRODUCT, { cache: 'no-cache' });
if (!response.ok) throw new Error('HTTP ' + response.status);
const text = await response.text();
const seal = await PINS.verify(PRODUCT_ID, text);
state.product_pin = seal;
if (seal.state === 'MISMATCH') {
state.failures.push(seal.detail
+ '; refusing to answer from bytes this composition has not seen');
return false;
}
const product = JSON.parse(text);
state.product_schema = product?.schema || null;
if (product?.schema !== REQUIRED_SCHEMA) {
state.failures.push('schema is ' + String(product?.schema)
+ ', this cartridge answers only ' + REQUIRED_SCHEMA);
return false;
}
for (const point of product.connection_points || []) {
const key = normalise(point.name);
if (key && !byName.has(key)) byName.set(key, point);
published.push(point);
if (point.location) located.push(point);
}
state.points = (product.connection_points || []).length;
state.located = located.length;
state.counts = product.counts || null;
state.join = product.join || null;
state.source = product.source || null;
state.loaded = true;
return true;
} catch (error) {
state.failures.push('network product: ' + String(error?.message || error));
return false;
}
})();
state.ready = ready;
state.byName = (name) => state.loaded
? (byName.get(normalise(name)) || null) : null;
/* The owner product's coordinates are NOT used for anything a reader
sees. Codex, 202609011852: WBUR's exact-name join binds a different
West Burton 96.42 km from the project, and exact text equality is not
exact identity. The Atlas measures on its own substation payload and
always has; this stays available for callers that want it, marked,
and the card is proven never to print a distance from here. */
state.location_join_is_unverified = true;
state.nearest = (lon, lat, options) => {
if (!state.loaded) return null;
const minimumKv = options?.minimumKv ?? 0;
const limit = options?.limit ?? 1;
const found = [];
for (const point of located) {
if (Math.max(...point.voltages_kv) < minimumKv) continue;
found.push({ point, km: distanceKm(lon, lat, point.location.lon, point.location.lat) });
}
found.sort((a, b) => a.km - b.km);
return limit === 1 ? (found[0] || null) : found.slice(0, limit);
};
/* One line a card can print, built only from what is published, or null
when nothing is. An empty sentence about a substation is worse than
silence. */
/* connectionKv is the voltage the connection is actually made at: the
declared point of connection's class, or the class of the substation
being measured to. Given one, the fault current is quoted at THAT
busbar group rather than across the site.
An outside review put the reason plainly: fault duty at a 400 kV
busbar and at a 132 kV busbar are different physical quantities
governing different switchgear, so a range spanning both is
meaningless to the engineer reading it - and the more correctly the
metric is named, the more readily the eye trusts it. */
/* WHAT A DISTANCE SEARCH COULD SEE, at the voltage it was asked for.
------------------------------------------------------------------
ETYS names substations and does not locate them; the only geometry
this estate holds comes from OpenStreetMap through a GridAtlas
release. So a proportion of what the operator publishes is invisible
to any search by distance, and a card that says "nearest" without
saying that is asserting something it cannot know.
COMPUTED, never written down. The numbers move when the product moves
- Codex's join correction takes located from 502 to 489 - and a
sentence with a literal in it would go quietly false the day the pin
is bumped. This counts the payload that was actually fetched, using
exactly the predicate state.nearest uses to decide what is eligible,
so the denominator on the card is the denominator of the search. */
state.coverage = (minimumKv) => {
if (!state.loaded) return null;
const floor = Number(minimumKv) || 0;
const eligible = (point) => Array.isArray(point.voltages_kv)
&& point.voltages_kv.length
&& Math.max(...point.voltages_kv) >= floor;
const inBand = published.filter(eligible);
const seen = located.filter(eligible);
return {
minimum_kv: floor,
published: inBand.length,
located: seen.length,
unlocated: inBand.length - seen.length,
/* Named rather than computed by the reader, and never graded. */
basis: 'counted from the connection-points payload this session fetched'
};
};
state.summarise = (name, options) => {
const point = state.byName(name);
if (!point) return null;
const connectionKv = options && Number(options.connectionKv);
/* connection-points.v3 publishes `circuits` and `transformers` as
LANDINGS - one per node-end at the site - not as machines. A
transformer's two windings are both at the site by construction, so
almost every transformer is counted twice: Cowley publishes 10 for
its five machines, and 484 of the 525 sites that hold a transformer
are overstated, 2,944 landings against 1,550 units (1.90x).
This cartridge holds no node pairs, so it cannot deduplicate on its
own; the caller may pass `units` derived from the node/branch model
by the network-topology module, which does hold them. Where it does,
the machine count is stated. Where it does not, the published figure
is still shown but is named for what it is, because a landing tally
presented as a machine count is the defect, not the tally. */
/* Number(null) is 0, not NaN, so `Number(units && units.x)` reports a
finite ZERO the moment no units are passed - which is every call
that does not supply them. The proof caught it saying "0 circuits"
for a site publishing eight. Read the field only when there is one. */
const units = (options && options.units) || null;
const unitCount = (field) => {
if (!units) return null;
const value = Number(units[field]);
return Number.isFinite(value) ? value : null;
};
const transformerUnits = unitCount('transformers');
const circuitUnits = unitCount('circuits');
const parts = [];
if (circuitUnits !== null) {
parts.push(circuitUnits + (circuitUnits === 1 ? ' circuit' : ' circuits'));
} else if (point.circuits) {
parts.push(point.circuits + (point.circuits === 1 ? ' circuit' : ' circuits'));
}
if (transformerUnits !== null) {
parts.push(transformerUnits
+ (transformerUnits === 1 ? ' transformer' : ' transformers'));
} else if (point.transformers) {
parts.push(point.transformers + ' transformer winding connections at the site '
+ '(a transformer whose windings are both here is published at each of them, '
+ 'so this is not a count of machines)');
}
const rating = point.circuit_winter_rating_mva;
if (rating) {
/* The product does not split ratings by voltage, and a site with
several voltages will show a range no single circuit could span -
Blackhillock publishes 23 to 1,995 MVA. So it is marked site-wide
wherever it appears, rather than sitting beside a bus-specific
fault figure as though it shared its scope. */
parts.push('circuit winter ratings across the site '
+ rating.min.toLocaleString('en-GB')
+ '\u2013' + rating.max.toLocaleString('en-GB') + ' MVA');
}
/* Prefer the busbar group the connection is made at. Fall back to the
site-wide envelope only when the voltage is unknown or the product
does not publish that group, and say which was used either way. */
const byVoltage = point.fault_current_by_voltage || null;
let peak = point.fault_current?.peak || null;
let faultScope = 'site';
let faultKv = null;
if (Number.isFinite(connectionKv) && byVoltage) {
const key = Object.keys(byVoltage)
.find(k => Math.abs(Number(k) - connectionKv) < 0.5);
if (key && byVoltage[key]?.peak) {
peak = byVoltage[key].peak;
faultScope = 'bus';
faultKv = Number(key);
}
}
const metric = peak?.metrics?.[QUOTED_METRIC];
if (metric) {
parts.push(QUOTED_METRIC_LABEL + ' ' + metric.min.toFixed(1) + '\u2013'
+ metric.max.toFixed(1) + ' ' + metric.unit
+ (faultScope === 'bus'
? ' at the ' + faultKv + ' kV busbars'
: ' across every busbar at this site')
+ ' over ' + peak.scenarios + ' peak-demand rows'
+ (peak.locations?.length ? ' at ' + peak.locations.length
+ (peak.locations.length === 1 ? ' bus' : ' buses') : '')
+ (peak.winters?.length
? ' (' + peak.winters[0] + ' to ' + peak.winters[peak.winters.length - 1] + ')'
: ''));
}
if (point.reactive_compensation?.units) {
parts.push(point.reactive_compensation.units + ' reactive compensation units');
}
if (point.planned_changes) {
const years = point.planned_change_years || [];
parts.push(point.planned_changes + ' changes published for '
+ (years.length ? years[0] + '\u2013' + years[years.length - 1] : 'later years'));
}
if (!parts.length) return null;
/* Everything above is aggregated at SITE CODE, not selected for a
bus. Where a site carries more than one voltage the numbers span
them, so the reader is told that before reading any of them -
otherwise a sentence under a 400 kV point of connection reads as a
400 kV result. West Burton is exactly this case: WBUR1 is 132 kV
and WBUR4 is 400 kV, and its published fault range spans both. */
const voltages = point.voltages_kv || [];
/* Site-wide is now about what remains site-wide. Once the fault
current is quoted at a busbar group, the label must not claim the
whole sentence is site-wide - only the parts that still are. */
const siteWide = voltages.length > 1;
const busLocations = point.fault_current?.peak?.locations || [];
return {
site_code: point.site_code,
transmission_owner: point.transmission_owner,
voltages_kv: voltages,
site_wide: siteWide,
bus_locations: busLocations,
fault_scope: faultScope,
fault_kv: faultKv,
scope_label: faultScope === 'bus'
? ('Fault current is quoted at the ' + faultKv + ' kV busbars, the '
+ 'voltage this connection is made at. Circuit counts, ratings, '
+ 'transformers and planned changes remain site-wide across the '
+ voltages.slice().sort((a, b) => b - a).join('/') + ' kV buses here')
: (siteWide
? ('Site-wide published envelope across the '
+ voltages.slice().sort((a, b) => b - a).join('/') + ' kV buses at this site, '
+ 'not a value for any one bus')
: ('Published for this site, which carries one voltage: '
+ (voltages[0] || '?') + ' kV')),
sentence: parts.join(' \u00b7 '),
metric_named: QUOTED_METRIC_LABEL,
metrics_not_interchangeable: 'Appendix D publishes eight current '
+ 'metrics and they are not interchangeable; this is one published '
+ 'breaker-duty metric, and switchgear carries several relevant '
+ 'ratings besides it.',
attribution: 'NESO Electricity Ten Year Statement 2025, appendices B and D, '
+ 'via Ventusltd/data-grid-gb',
not_an_assessment: 'Published parameters. Not a statement about whether '
+ 'any project can connect here.'
};
};
})();Substation Lookup
A JavaScript file in the atlas folder of GridAtlas covering substations. It is built from the normalise step (`normalise`) and the index step (`index`).
electricalgridatlas / atlas/modules/202609011950-substation-lookup.js · lines 1–82 of 82 · version 2026-09-01 19:50
- What it does
- It lists and searches substations. Defines normalise, index. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: substations, 400kV, 275kV, 132kV, 66kV, 33kV.
- Inputs & outputs
- Voltage levels named: 400kV, 275kV, 132kV, 66kV, 33kV, 11kV.
- Downstream impact
- Used directly by 2 files: Build Graph (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/genome/); Ventus Grid Engine — Genome Page (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/genome/). Reached from 1 other entry point, including Genome Workflow (ventus-grid-engine).
- What it achieves
- Finding a substation by the name someone wrote, and by position.
- Why it matters
- Loaded by the Genome page in Ventus Grid Engine at https://ventusltd.github.io/ventus-grid-engine/genome/. Also imported by Build Graph, from Ventus Grid Engine.
- Application
- gridatlas · atlas/modules · script
- Uses
- none found
- Used by
- named by URL in Build Graph (estate URL), named by URL in Ventus Grid Engine — Genome Page (estate URL)
- Produces
- normalise, index
- Defines here
- normalise, index
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/modules/202609011950-substation-lookup.js:1-82 · blob d157ee0bed9218cacf9ba59f08862f4868c0b02c · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/**
* Module: substation-lookup
*
* Finding a substation by the name someone wrote, and by position. Two
* jobs, one boundary:
*
* normalise(name) the lookup key, matching the one data-grid-gb's own
* join uses, so a name that matched there matches here
* index(points) a name map and a located list, built once
* nearest(...) the closest located sites, measured on the estate's
* single radius via the geodesy module
*
* It does NOT fetch, render, summarise or decide. The cartridge fetches;
* the summary module writes sentences; this only finds.
*
* Depends on: geodesy.
*/
(() => {
'use strict';
const NS = (window.__GRIDATLAS_MODULES__ = window.__GRIDATLAS_MODULES__ || {});
if (NS.substationLookup) return;
const geodesy = NS.geodesy;
if (!geodesy) {
// Fail loudly at load rather than quietly at first use: a module whose
// dependency is missing has nothing useful to do.
throw new Error('substation-lookup requires the geodesy module');
}
/* Deliberately dull. This is a lookup key, not a search engine, and it
must stay byte-compatible with the normalisation the owner product's
join uses - if the two drift, a name that joined upstream stops
resolving downstream and nobody sees it happen. */
const NOISE = /\b(SUBSTATION|SUB STATION|SUBSTN|GRID|SUPPLY|POINT|GSP|NATIONAL|POWER|STATION|WIND|FARM|WINDFARM|OFFSHORE|ONSHORE|EXTENSION|400KV|275KV|132KV|66KV|33KV|11KV|NGET|SSE|SP|SHE)\b/g;
function normalise(name) {
return String(name || '').toUpperCase()
.replace(/[^A-Z0-9 ]/g, ' ')
.replace(NOISE, ' ')
.split(/\s+/).filter(Boolean).join(' ');
}
function index(points) {
const byName = new Map();
const located = [];
for (const point of points || []) {
const key = normalise(point && point.name);
if (key && !byName.has(key)) byName.set(key, point);
if (point && point.location) located.push(point);
}
return {
size: byName.size,
located: located.length,
byName: (name) => byName.get(normalise(name)) || null,
/* Nearest by measurement, not by guess. minimumKv filters on the
highest voltage the site declares; limit 1 returns one match or
null, anything else returns a sorted list. */
nearest: (lon, lat, options) => {
const minimumKv = (options && options.minimumKv) || 0;
const limit = (options && options.limit) || 1;
const found = [];
for (const point of located) {
const voltages = point.voltages_kv || [];
if (!voltages.length || Math.max(...voltages) < minimumKv) continue;
found.push({
point,
km: geodesy.distanceKm(lon, lat, point.location.lon, point.location.lat)
});
}
found.sort((a, b) => a.km - b.km);
return limit === 1 ? (found[0] || null) : found.slice(0, limit);
}
};
}
NS.substationLookup = Object.freeze({
schema: 'gridatlas.module.substation-lookup.v1',
normalise,
index
});
})();Map Click Network
A JavaScript file in the atlas folder of GridAtlas covering transformers and interconnectors. It is built from the index step (`index`) and the select step (`select`).
rendergridatlas / atlas/modules/202609012230-map-click-network.js · lines 1–57 of 57 · version 2026-09-01 22:30 · Not reached from any entry point (candidate for review)
- What it does
- It lists and searches transformers and interconnectors. Defines index, at, select. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: transformers, interconnectors.
- What it achieves
- Reads data-grid-GB's precomputed, provenance-bound one-hop projection.
- Why it matters
- No other file in the estate was found to import it.
- Application
- gridatlas · atlas/modules · script
- Uses
- none found
- Used by
- none found
- Produces
- index, at, select
- Defines here
- index, at, select
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/modules/202609012230-map-click-network.js:1-57 · blob 59e8b97dc961e4c9875ef490cd391642a29a8e5f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/**
* Module: map-click-network
*
* Reads data-grid-gb's precomputed, provenance-bound one-hop projection. It
* selects only appearances whose explicit validated local voltage equals the
* declared connection voltage. It never decodes node names, solves a load
* flow, estimates headroom or decides whether a project can connect.
*/
(() => {
'use strict';
const NS = (window.__GRIDATLAS_MODULES__ = window.__GRIDATLAS_MODULES__ || {});
if (NS.mapClickNetwork) return;
const ACCEPTS = 'data-grid-gb.map-click-network.v1';
const REFUSAL = 'Published topology and parameters are not solved power flow, available headroom, queue position, a connection offer or a connection assessment.';
function index(product) {
if (!product || product.schema !== ACCEPTS || !Array.isArray(product.connection_points)) return null;
const points = new Map();
for (const point of product.connection_points) {
if (point?.site_code && !points.has(point.site_code)) points.set(point.site_code, point);
}
function at(siteCode, { connectionKv } = {}) {
const point = points.get(String(siteCode || '').toUpperCase());
if (!point) return null;
const wanted = Number.isFinite(connectionKv) ? connectionKv : null;
const select = rows => wanted == null ? []
: (rows || []).filter(row => row.local_voltage_kv === wanted);
return {
schema: 'gridatlas.module.map-click-network.v1',
source_schema: ACCEPTS,
site: {
site_code: point.site_code, name: point.name,
transmission_owner: point.transmission_owner,
voltages_kv: point.voltages_kv, location: point.location
},
connection_voltage_kv: wanted,
fault_current: wanted == null ? null
: point.fault_current_by_voltage?.[String(wanted)] || null,
existing_circuits: select(point.existing_circuits),
planned_changes: select(point.planned_changes),
transformers: wanted == null ? [] : (point.transformers || []).filter(row =>
row.voltage_1_kv === wanted || row.voltage_2_kv === wanted),
reactive_compensation: wanted == null ? [] : (point.reactive_compensation || [])
.filter(row => row.connection_kv === wanted),
interconnectors: point.interconnectors || [],
reconciliation: point.projection_reconciliation || null,
not_an_assessment: REFUSAL
};
}
return { schema: 'gridatlas.module.map-click-network.v1', source_schema: ACCEPTS,
points: points.size, at };
}
NS.mapClickNetwork = Object.freeze({
schema: 'gridatlas.module.map-click-network.v1', accepts: ACCEPTS,
not_an_assessment: REFUSAL, index
});
})();