GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / gridatlas / atlas/modules

Regional Native (part 12)

A JavaScript file in the atlas folder of GridAtlas that maps elizabeth line and london underground, using haversine and SHA-256, and uses data from the ventus-grid-engine, data-federation-map-for-GlobalGrid2050-all-repos and spiders repositories.

509 lines of JavaScript from gridatlas, in 1 file. Topic: Maps, GIS and field navigation. Section 553 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Regional Native geodesy · gridatlas / atlas/modules/202612012117-regional-native.js lines 8099–8607

Regional Native

A JavaScript file in the atlas folder of GridAtlas that maps elizabeth line and london underground, 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: 99% of its lines are the same as atlas/cartridges/202611180026-substation-intelligence-v9-63.js (gridatlas), which stays. (near-copy-of, proposed by families.py). 99% of lines shared with Substation Intelligence V9 63; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.994 to gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atlas/cartridges/202611180026-substation-intelligence-v9-63.js:1-8609 c6f9632fdb6e803baae03a54a542fe508431d153
  • sha256 6350426294d6ee73ee6b6475003b30b79be79ae5a1e4a5a15de1a780fe517ce0
  • target sha256 88c538b97bf426776cda436151741f17500a2136867d28362407550d72f9038f
  • group of 4 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

geodesygridatlas / atlas/modules/202612012117-regional-native.js · lines 8099–8607 of 8607 · version 2026-12-01 21:17 (continued from section 541) · Not reached from any entry point (candidate for review) · pattern regionalEligible (shared by 3 files)

What it does
It maps elizabeth line, london underground, UK metros trams and hs2. Defines 239 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.
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
No other file in the estate was found to import it.
Application
gridatlas · atlas/modules · 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
none found
Produces
deepFreeze, escapeHTML, normalizeStatus, fmt, haversine, _zoneDrawGetRadius, _zoneDrawCirclePoints, _zoneDrawCalcArea, _zoneDrawUpdateLayers, _zoneDrawShowPopup, _zoneDrawShowPopupDebounced, _zoneDrawClear
Defines here
printSourceCode, statusLine, say, beginPreparing, button, install, 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/modules/202612012117-regional-native.js:8099-8607 · blob e01079f148704c08dfda3ccf7ae8239e3d77a00a · 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: unreached_review
          ? 'share: the reader cancelled'
          : 'share: ' + String((error && error.message) || error));
      }
    }

    return record;
  }

  /** Collect and deliver in one call, for callers outside a gesture. */
  async function printSourceCode(options = {}) {
    const collected = await collectSourceCode(options);
    return deliverSourceCode(collected, options);
  }


  /* WIRING: put the two functions in the File menu, and nowhere else.
     --------------------------------------------------------------------------
     The reader already knows where printing lives -- they found it once and
     printed a sheet from it. A floating button somewhere else would be a second
     place to learn, so both controls go into the same EXPORT THIS VIEW group,
     next to the print command that is already there.

     The two are SEPARATE COMMANDS and are never merged into one "export":
       Print PDF          a picture of the screen, for a person to look at
       Print source code  the whole source and its dependencies, for a machine
                          to read

     NOTHING EXISTING IS REPLACED. The older map-only PDF control stays exactly
     as it is. Two implementations of the same idea sitting side by side is the
     point -- where they disagree, the disagreement is the finding. */

  var PANEL_ANCHOR = '#gridatlas-export-print';
  var STATUS_ID = 'gridatlas-teleprint-status';
  var MAX_TRIES = 80;

  function statusLine(anchor) {
    var node = document.getElementById(STATUS_ID);
    if (node) return node;
    node = document.createElement('div');
    node.id = STATUS_ID;
    node.setAttribute('role', 'status');
    node.setAttribute('aria-live', 'polite');
    node.style.cssText = 'padding:6px 11px;font:10px/1.4 ui-monospace,'
      + 'SFMono-Regular,Menlo,monospace;color:#9fd6e4;opacity:.9;'
      + 'white-space:normal;max-width:34ch';
    if (anchor && anchor.parentNode) anchor.parentNode.appendChild(node);
    return node;
  }

  function say(text) {
    var node = document.getElementById(STATUS_ID);
    if (node) node.textContent = text;
  }

  /* The teleprint of the source is prepared when the FILE MENU OPENS, not when
     the button is pressed.

     Collecting it means reading every resource the browser loaded, which takes
     seconds and ends the user gesture. A share sheet or a clipboard write
     requested after that gesture has ended is refused, and the reader is told
     nothing happened for no reason they can see. Preparing early costs one
     speculative pass and makes the press instant. */
  var prepared = null;
  var preparing = null;

  function beginPreparing() {
    if (prepared || preparing) return preparing;
    preparing = collectSourceCode({ appName: 'GridAtlas' })
      .then(function (result) {
        prepared = result;
        preparing = null;
        say('Source ready · ' + result.included + ' files'
          + (result.missing.length ? ' · ' + result.missing.length + ' not readable' : ''));
        return result;
      })
      .catch(function (error) {
        preparing = null;
        say('Source could not be prepared: ' + (error && error.message));
        throw error;
      });
    return preparing;
  }

  function button(label, id, onClick) {
    var node = document.createElement('button');
    node.id = id;
    node.setAttribute('type', 'button');
    node.setAttribute('data-gm-export', id.replace('gridatlas-', ''));
    node.setAttribute('data-teleprint', '1');
    node.textContent = label;
    node.addEventListener('click', function () { onClick(node); });
    return node;
  }

  function install() {
    var anchor = document.querySelector(PANEL_ANCHOR);
    if (!anchor || !anchor.parentNode) return false;
    if (document.getElementById('gridatlas-teleprint-source')) return true;

    var pdf = button('⎙ Print PDF · exactly this screen',
      'gridatlas-teleprint-pdf', function (node) {
        var was = node.textContent;
        say('Capturing the screen…');
        printPdf({
          note: {
            brand: 'VENTUS · GLOBALGRID2050 · GRID ATLAS',
            title: document.title,
            url: location.href,
            stamp: new Date().toISOString().replace('T', ' ').slice(0, 16) + ' UTC',
            credit: Array.prototype.map.call(
              document.querySelectorAll('.maplibregl-ctrl-attrib-inner'),
              function (n) { return n.textContent.trim(); }
            ).filter(Boolean).join(' | ')
          }
        }).then(function (receipt) {
          /* REPORT THE MEASUREMENT, DO NOT GRADE IT.
             ------------------------------------------------------------------
             This read `scale >= 0.999 ? 'every screen pixel'`. An ultrawide
             capture measured 2326 of 2327 columns -- 0.99957 -- so the sheet
             announced "every screen pixel" for a record that was one pixel
             column short. A threshold dressed as a fact is exactly the habit
             this estate has a rule against, and I wrote the rule.

             It also read width only, so a frame that was full width and short in
             height reported as complete. The claim is now an integer equality on
             BOTH axes, decided in screen-frame.js where the numbers are, and
             anything less prints the pixel counts rather than a verdict. */
          var fidelity = '';
          if (receipt.everyScreenPixel) {
            fidelity = ' · every screen pixel';
          } else if (receipt.screenWidth) {
            fidelity = ' · ' + receipt.width + '×' + receipt.height + ' of '
              + receipt.screenWidth + '×' + receipt.screenHeight + ' screen pixels';
          }
          say('PDF · ' + receipt.width + '×' + receipt.height + ' px, page '
            + receipt.pageWidth + '×' + receipt.pageHeight + fidelity
            + ' · via ' + receipt.method);
          node.textContent = was;
        }, function (error) {
          /* The reader cancelling the screen-share chooser is a decision, not a
             fault, and must not be reported as one. */
          say(error && /denied|Permission|abort/i.test(String(error.message || error))
            ? 'Screen capture was not allowed, so nothing was printed.'
            : 'Could not print: ' + (error && error.message));
          node.textContent = was;
        });
      });

    var source = button('⎙ Print source code · for AI review',
      'gridatlas-teleprint-source', function () {
        say('Preparing the source…');
        Promise.resolve(prepared || beginPreparing()).then(function (collected) {
          return deliverSourceCode(collected, { panel: true });
        }).then(function (receipt) {
          say('Source code · ' + receipt.included + ' files, '
            + receipt.bytes + ' bytes'
            + (receipt.volumesAvailable > 1
              ? ' · whole file; ' + receipt.volumesAvailable
                + ' volumes available if your chat refuses it'
              : '')
            + ' · ' + receipt.via.join(' + ')
            + (receipt.missing ? ' · ' + receipt.missing + ' not readable' : ''));
        }, function (error) {
          say('Could not print the source: ' + (error && error.message));
        });
      });

    anchor.parentNode.insertBefore(pdf, anchor.nextSibling);
    pdf.parentNode.insertBefore(source, pdf.nextSibling);
    statusLine(source);
    say('Print PDF saves this screen. Print source code saves the code behind it.');

    /* Opening File is the signal to start work. Delegated from the document so
       it survives the menu being rebuilt. */
    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.'
    };
  };
})();