GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / globalgrid2050 / uk_renewables_pipeline/v8/styles

Canonical Project Table and 3 more files (part 2)

A JavaScript module in the plugins folder of GlobalGrid2050 that works with the Renewable Energy Planning Database (REPD) register.

600 lines of JavaScript and HTML and CSS from globalgrid2050, in 4 files. Topic: Electricity markets and data pipelines. Section 964 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. V8 render · globalgrid2050 / uk_renewables_pipeline/v8/styles/v8.css lines 1–24
  2. Check V8 1 Mvp test · globalgrid2050 / uk_renewables_pipeline/v8/tests/check_v8_1_mvp.mjs lines 1–108
  3. UK Renewables Pipeline — V9 4 Page render · globalgrid2050 / uk_renewables_pipeline/v9.4/index.html lines 1–153
  4. Canonical Project Table transform · globalgrid2050 / uk_renewables_pipeline/v9.4/scripts/plugins/canonical-project-table.js lines 1–315

V8

A style sheet in the styles folder of GlobalGrid2050.

renderglobalgrid2050 / uk_renewables_pipeline/v8/styles/v8.css · lines 1–24 of 24 · Entry point

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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.
Downstream impact
Used directly by 1 file: UK Renewables Pipeline — V8 Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/v8/). Reached from 185 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
Loaded by the page of the same name at https://globalgrid2050.com/uk_renewables_pipeline/v8/.
Application
globalgrid2050 · uk_renewables_pipeline/v8/styles · style sheet
Uses
none found
Used by
loaded by UK Renewables Pipeline — V8 Page (stylesheet)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/v8/styles/v8.css:1-24 · blob 302b99bfa5fab35d528a9c43e3c8678e6aa9aece · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
.gauges {
  grid-template-columns: repeat(4, 1fr);
}

table {
  min-width: 1500px;
}

.identity {
  color: #66ccff;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  .gauges {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .gauges {
    grid-template-columns: 1fr;
  }
}

Check V8 1 Mvp

A JavaScript module in the tests folder of GlobalGrid2050 that tests plugin, major project news and solar, using SHA-256. It reads text (`readText`) and reads JSON (`readJson`).

Set aside from the main view: 94% of its lines are the same as uk_renewables_pipeline/202609051156/tests/check_v8_1_mvp.mjs (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 93% of lines shared with Check V8 1 Mvp; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.9381 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202609051156/tests/check_v8_1_mvp.mjs:1-104 a618d59d59334cf328b6de689ede73e51faa8475
  • sha256 e032a7e21439f650b9375ab0d4968c65415fab08a6db93714fdd5de7c3990556
  • target sha256 bb9de4d47610ded4aa8e05072ab1ff3a31cde0be98b98314becaa8a1f9f1ef8c
  • group of 2 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

testglobalgrid2050 / uk_renewables_pipeline/v8/tests/check_v8_1_mvp.mjs · lines 1–108 of 108 · Not reached from any entry point (candidate for review) · pattern readText (shared by 28 files)

What it does
It tests plugin, major project news and solar. Defines readText, readJson, sha256, refs. Uses libraries node:assert/strict, node:crypto, node:fs/promises. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: solar.
Inputs & outputs
In: JSON file mvp.v8.1.json; CSV file globalgrid2050_uk_renewables_pipeline_v7_2_2026-08-23.csv; JSON file plugin_manifest.json; JSON file major_project_news_v5.json.
What it achieves
Its name says it checks mvp. Defines `readText`, `readJson`, `sha256` and 1 more. It reads `contracts/mvp.v8.1.json`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · uk_renewables_pipeline/v8/tests · JavaScript module
Uses
Canonical Projects (import), Project State (import), Canonical Project Export (import), Canonical Project Table (import), UK Renewables Pipeline — V8 Page (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises
Used by
none found
Produces
readText, readJson, sha256, refs
Defines here
readText, readJson, sha256, refs
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/v8/tests/check_v8_1_mvp.mjs:1-108 · blob 4d05c11fd786ed14b01d4349b443aadba6247776 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: duplicate_candidate
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";

import {
  buildCanonicalProjectModel,
  searchCanonicalProjects,
} from "../scripts/data/canonical-projects.js";
import {
  commitCanonicalProjectModel,
  createCanonicalProjectState,
  resetCanonicalProjectFilters,
  setCanonicalProjectFilter,
} from "../scripts/core/project-state.js";
import { buildCanonicalProjectCsv } from "../scripts/plugins/canonical-project-export.js";
import { buildCanonicalProjectTableView } from "../scripts/plugins/canonical-project-table.js";

const v8Url = new URL("../", import.meta.url);
const repoUrl = new URL("../../../", import.meta.url);
const readText = (path) => readFile(new URL(path, v8Url), "utf8");
const readJson = async (path) => JSON.parse(await readText(path));
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");

const mvp = await readJson("contracts/mvp.v8.1.json");
const projectContract = await readJson(mvp.projects.contract);
const projectPayloadBytes = await readFile(new URL(mvp.projects.source, v8Url));
const projectPayload = JSON.parse(projectPayloadBytes.toString("utf8"));
const model = buildCanonicalProjectModel(projectPayload, projectContract);

assert.equal(mvp.schema, "globalgrid2050.v8.mvp-contract.v1");
assert.equal(mvp.release, "8.1");
assert.equal(mvp.status, "LIVE_VALIDATED");
assert.equal(sha256(projectPayloadBytes), mvp.projects.source_sha256);
assert.equal(model.projects.length, mvp.projects.expected.project_count);
assert.equal(new Set(model.projects.map((project) => project.gg_development_id)).size, 718);
assert.equal(model.projects.filter((project) => project.technology === "solar").length, 384);
assert.equal(model.projects.filter((project) => project.technology === "bess").length, 382);
assert.equal(model.projects.filter((project) => !["solar", "bess"].includes(project.technology)).length, 0);
assert.equal(model.metrics.solar_mwp, 34073.49);
assert.equal(model.metrics.bess_mw, 106338.18);
assert.equal(model.metrics.largest_project.capacity_mw, 1450);

const fields = projectContract.interface.search_fields;
const refs = (query) => searchCanonicalProjects(model.projects, query, fields)
  .map((project) => project.repd_ref)
  .sort();
assert.deepEqual(refs("13599"), ["13599"]);
assert.deepEqual(refs("GG2050-REPD-13599"), ["13599"]);
assert.deepEqual(refs("GG2050-DEV-E13842D4D80DEC"), ["13599", "13600"]);
assert.deepEqual(refs("EN010151"), ["13599", "13600"]);
assert.deepEqual(refs("Beacon Fen"), ["13599", "13600"]);

const state = createCanonicalProjectState();
commitCanonicalProjectModel(state, model);
const table = buildCanonicalProjectTableView(state);
assert.equal(table.rowCount, 766);
assert.equal(table.columns.length, 11);
assert.equal(table.rows.every((row) => row.primary.repdRef && row.primary.ggProjectId), true);
assert.equal(table.rows.every((row) => row.primary.legacyNews.verified === false), true);

setCanonicalProjectFilter(state, "technology", "solar");
assert.equal(state.filtered.length, 384);
assert.equal(state.metrics.solar_mwp, 34073.49);
assert.equal(state.metrics.bess_mw, 0);
setCanonicalProjectFilter(state, "technology", "bess");
assert.equal(state.filtered.length, 382);
assert.equal(state.metrics.solar_mwp, 0);
assert.equal(state.metrics.bess_mw, 106338.18);
resetCanonicalProjectFilters(state);
setCanonicalProjectFilter(state, "query", "no-project-can-match-this-v8-1-gate");
const emptyCsv = buildCanonicalProjectCsv(state, { date: "2026-08-23" });
assert.equal(emptyCsv.rowCount, 0);
assert.equal(emptyCsv.content.split("\r\n").length, 1);
assert.equal(emptyCsv.filename, "globalgrid2050_uk_renewables_pipeline_v7_2_2026-08-23.csv");

const newsBytes = await readFile(new URL(mvp.newspaper.fixture, v8Url));
const news = JSON.parse(newsBytes.toString("utf8"));
assert.equal(sha256(newsBytes), mvp.newspaper.fixture_sha256);
assert.equal(news.headline_count, 125);
assert.equal(news.items.length, 125);

const html = await readText("index.html");
const projectsSource = await readText("scripts/plugins/projects.js");
const stateSource = await readText("scripts/core/state.js");
const newspaperSource = await readText("scripts/plugins/newspaper.js");
const pluginManifest = await readJson("data/plugin_manifest.json");
const rootIndex = await readFile(new URL("index.html", repoUrl), "utf8");

assert.match(html, /V8\.1 MVP/);
assert.match(html, /legacy V5 newspaper · project bindings unverified/i);
assert.equal((html.match(/<canvas id="g[1-4]"/g) || []).length, 4);
assert.equal((html.match(/<th(?:\s[^>]*)?>/g) || []).length, 11);
assert.equal(/data-technology="[^"]*wind/i.test(html), false);
assert.match(html, /data-technology="solar"/);
assert.match(html, /data-technology="bess"/);
assert.match(projectsSource, /loadCanonicalProjectModel/);
assert.match(projectsSource, /buildCanonicalProjectCsv/);
assert.equal(stateSource.includes("assets.publishing.service.gov.uk"), false);
assert.equal(newspaperSource.includes("major_project_news_v5.json"), false);
assert.equal(pluginManifest.version, "8.1");
assert.equal(pluginManifest.plugins.find((plugin) => plugin.id === "gauges").owns.includes("g4"), true);
/* Was: assert.match(rootIndex, /V8.1 MVP · canonical 766-project utility
   pipeline/). That is homepage copy, deleted when the front page was rebuilt to
   timestamp-and-title, and asserting it made this version's gate depend on
   editorial wording it does not own. The durable fact is reachability. */
assert.match(rootIndex, /uk_renewables_pipeline\/v8\//);

console.log("V8.1 MVP contract: PASS (766 canonical projects, 125 legacy headlines)");

UK Renewables Pipeline — V9 4 Page

A web page in GlobalGrid2050 that reads inputs for news, county and sort projects, covering the Renewable Energy Planning Database (REPD) register, solar and battery storage (BESS). Published at https://globalgrid2050.com/uk_renewables_pipeline/v9.4/.

renderglobalgrid2050 / uk_renewables_pipeline/v9.4/index.html · lines 1–153 of 153 · Entry point

What it does
It draws the REPD register, solar and battery storage (BESS). Uses libraries styles/v7.css?v=9.4. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: the REPD register, solar, battery storage (BESS).
Inputs & outputs
In: form fields (user input). Out: web page.
Downstream impact
Used directly by 73 files: GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/); Testcode — Pipeline Page (globalgrid2050, https://globalgrid2050.com/testcode/202609060345/pipeline/); Check V9 0 (globalgrid2050); Check V9 4 (globalgrid2050); and 69 more. Reached from 114 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Grid Engine — Compute Against Charging Page (globalgrid2050, https://globalgrid2050.com/grid_engine/202609060324-compute-against-charging/). It is itself an entry point, published at https://globalgrid2050.com/uk_renewables_pipeline/v9.4/.
What it achieves
Its code works with 1 MW.
Why it matters
Loaded by the PipelineNews Intelligence page at https://globalgrid2050.com/pipelinenews_intelligence/202609050309/ and 67 other pages. Also imported by Compile V8 Fast, Compile Index and Estate Menu, from PipelineNews and Spiders. Checked by 2 tests, including Check V9 0.
Application
globalgrid2050 · uk_renewables_pipeline/v9.4 · page
Uses
Mobile (stylesheet), V9 3 (stylesheet), V9 4 (stylesheet), UK Renewables Pipeline — V9 Page (link), UK Renewables Pipeline — V8 Page (link), UK Renewables Pipeline — V7 Page (link), Dashboard V6 Live (link), Dashboard V5 Live (link), and 6 more, styles/v7.css?v=9.4, https://cdn.jsdelivr.net/npm/chart.js
Used by
linked from GlobalGrid2050 — PipelineNews Intelligence Page (link), linked from Testcode — Pipeline Page (link), referenced by Check V9 0 (new URL import.meta.url), referenced by Check V9 4 (new URL import.meta.url), linked from UK Renewables Pipeline — V9 5 1 Page (link), linked from UK Renewables Pipeline — V9 5 Page (link), linked from UK Renewables Pipeline — V9 6 1 Page (link), linked from UK Renewables Pipeline — V9 6 2 Page (link), and 65 more
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/v9.4/index.html:1-153 · blob 504e2bc8651f8e8161d70c52fcf9f275ec049240 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title>GlobalGrid2050 | UK Renewables Pipeline V9.4</title>
  <link rel="stylesheet" href="styles/v7.css?v=9.4">
  <link rel="stylesheet" href="styles/mobile.css?v=9.4">
  <link rel="stylesheet" href="styles/v9-3.css?v=9.4">
  <link rel="stylesheet" href="styles/v9-4.css?v=9.4">
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
  <aside class="sidebar">
    <div class="brand">
      <b>GLOBALGRID2050</b>
      <small>UK RENEWABLES PIPELINE · V9.4</small>
    </div>
    <nav class="nav">
      <a class="active" href="#">V9.4 LIVE</a>
      <a href="../v9/">V9.3.1 FROZEN APP</a>
      <a href="https://github.com/Ventusltd/globalgrid2050/tree/eee4cf7d854bf44235c249d337c2aad3916bcdc0/uk_renewables_pipeline/v9" target="_blank" rel="noopener">V9.3 CHECKPOINT</a>
      <a href="https://github.com/Ventusltd/globalgrid2050/tree/77085a5dc8a8ce42cd4de7dad927eaf9aaf785ee/uk_renewables_pipeline/v9" target="_blank" rel="noopener">V9.2 CHECKPOINT</a>
      <a href="https://github.com/Ventusltd/globalgrid2050/tree/59f74e319fbaad62abdb995107dba5759d7f3ca2/uk_renewables_pipeline/v9" target="_blank" rel="noopener">V9.1 CHECKPOINT</a>
      <a href="../v8/">V8.1 FALLBACK</a>
      <a href="../v7/">V7 FALLBACK</a>
      <a href="../dashboard_v6_live.html">V6</a>
      <a href="../dashboard_v5_live.html">V5</a>
      <a href="../dashboard_v4_live.html">V4</a>
      <a href="../dashboard_v3_live_2026-08-22.html">V3</a>
      <a href="../dashboard_v2_2026-08-22.html">V2</a>
      <a href="../dashboard.html">V1 LEGACY</a>
      <a href="../../index.html">DIRECTORY</a>
      <a href="../../repd_grid_atlasv8/">MAP ATLAS</a>
      <a href="#" id="export">EXPORT CSV</a>
    </nav>
  </aside>
  <main class="main">
    <div class="header">
      <h1>UK RENEWABLES PIPELINE V9.4</h1>
      <div class="status">● CLICK REPD UPDATED TO SORT · FULL ≥1 MW PIPELINE</div>
    </div>
    <div class="meta">
      <strong>V9.4 · 23 August 2026</strong>
      <span>Canonical DESNZ REPD Q2 2026: 7,680 solar, BESS and wind records at ≥1 MW.</span>
      <span id="releaseMeta" class="release-meta">Loading canonical release contract…</span>
      <a href="https://www.gov.uk/government/publications/renewable-energy-planning-database-quarterly-extract" target="_blank" rel="noopener">Official REPD source</a>
    </div>

    <section class="newspaper">
      <div class="masthead">
        <h2>GLOBALGRID2050 <span>ENERGY DAILY</span></h2>
        <div class="strap">
          <span>Legacy V5 feed · V9.2 relevance screen retained · all project bindings remain unverified</span>
          <span id="newsMeta">loading daily edition…</span>
        </div>
      </div>
      <div class="news-tools" id="newsTools">
        <button class="active" data-news="ALL">ALL</button>
        <button data-news="RELEVANT">RELEVANT</button>
        <button data-news="SOLAR">SOLAR</button>
        <button data-news="BESS">BESS</button>
        <button data-news="CONSENT">CONSENT</button>
        <button data-news="CONSTRUCTION">CONSTRUCTION</button>
        <button data-news="OPERATIONAL">OPERATIONAL</button>
        <button data-news="FINANCE">FINANCE / M&amp;A</button>
        <input id="newsSearch" placeholder="SEARCH HEADLINES / PROJECT / OPERATOR">
      </div>
      <div class="paper">
        <div class="stories" id="stories">
          <div class="news-empty">Loading today’s major-project newspaper…</div>
        </div>
      </div>
    </section>

    <h2 class="section-title">REPD PIPELINE ANALYTICS</h2>
    <div class="gauges">
      <div class="card">
        <h3>FILTERED CAPACITY (MW)</h3>
        <div class="chart"><canvas id="g1"></canvas><div class="value" id="v1">0</div></div>
      </div>
      <div class="card">
        <h3>FILTERED PROJECTS (≥1MW)</h3>
        <div class="chart"><canvas id="g2"></canvas><div class="value" id="v2">0</div></div>
      </div>
      <div class="card">
        <h3>LARGEST SINGLE SITE (MW)</h3>
        <div class="chart"><canvas id="g3"></canvas><div class="value" id="v3">0</div></div>
      </div>
    </div>

    <div class="filters" id="tech">
      <button class="btn active" data-technology="all" aria-pressed="true">ALL TECH</button>
      <button class="btn" data-technology="solar" aria-pressed="false">SOLAR</button>
      <button class="btn" data-technology="bess" aria-pressed="false">BATTERY</button>
      <button class="btn" data-technology="wind_onshore" aria-pressed="false">ONSHORE</button>
      <button class="btn" data-technology="wind_offshore" aria-pressed="false">OFFSHORE</button>
    </div>
    <div class="filters" id="status">
      <button class="btn active" data-official-status="All" aria-pressed="true">ALL STATUS</button>
      <button class="btn" data-official-status="Operational" aria-pressed="false">OPERATIONAL</button>
      <button class="btn" data-official-status="Under Construction" aria-pressed="false">CONSTRUCTING</button>
      <button class="btn" data-official-status="Awaiting Construction" aria-pressed="false">AWAITING</button>
      <button class="btn" data-official-status="Application Submitted" aria-pressed="false">SUBMITTED</button>
    </div>
    <div class="filters">
      <select id="county"><option value="All">🌍 ALL COUNTIES</option></select>
      <select id="sortProjects" aria-label="Sort projects">
        <option value="capacity_desc">SORT: CAPACITY (DEFAULT)</option>
        <option value="updated_desc">SORT: REPD UPDATED — NEWEST</option>
        <option value="updated_asc">SORT: REPD UPDATED — OLDEST</option>
      </select>
      <input id="search" class="asset-search" placeholder="🔍 SEARCH PROJECT / REPD / GLOBALGRID / PLANNING..." autocomplete="off">
      <button class="btn clear-filters" id="clearFilters">CLEAR FILTERS</button>
      <button class="btn export-inline" id="exportInline">EXPORT FILTERED CSV</button>
      <span id="resultsMeta" class="results-meta">Loading all qualifying records…</span>
      <span id="exportMeta" class="export-meta">CSV contains the current filtered rows only</span>
    </div>
    <div class="meta">
      <strong>STATUS DISCIPLINE</strong>
      <span><b>DEFAULT:</b> every qualifying ≥1 MW record is loaded. Filters are user controls; they never redefine or truncate the pipeline.</span>
      <span><b>NEWS:</b> relevance scores are algorithmic screening only and never change an official REPD fact.</span>
      <span><b>ATLAS:</b> valid geometry resolves the exact REPD Ref. Missing geometry remains in search and CSV and is labelled NO MAP.</span>
    </div>
    <div class="tablewrap">
      <table>
        <thead>
          <tr>
            <th>SITE NAME</th>
            <th class="hide-mobile">COUNTY</th>
            <th class="hide-mobile">OPERATOR</th>
            <th>TECHNOLOGY</th>
            <th>OFFICIAL REPD STATUS</th>
            <th>OFFICIAL CAPACITY</th>
            <th class="hide-mobile">REPD REF</th>
            <th class="hide-mobile">GLOBALGRID REF</th>
            <th class="hide-mobile repd-updated-heading" id="repdUpdatedHeader" aria-sort="none">
              <button id="sortUpdated" type="button" aria-label="Sort by REPD updated date, newest first">
                REPD UPDATED <span id="updatedSortIndicator" aria-hidden="true">↕</span>
              </button>
            </th>
            <th>NEWS SIGNAL</th>
            <th>ACTIONS</th>
          </tr>
        </thead>
        <tbody id="tbody"></tbody>
      </table>
    </div>
  </main>
  <script type="module" src="scripts/app-v9-4.js?v=9.4"></script>
  <script type="module" src="scripts/plugins/capacity-presentation-v9-3.js?v=9.4"></script>
</body>
</html>

Canonical Project Table

A JavaScript module in the plugins folder of GlobalGrid2050 that works with the Renewable Energy Planning Database (REPD) register.

Set aside from the main view: 90% of its lines are the same as uk_renewables_pipeline/v7/scripts/plugins/canonical-project-table.js (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 90% of lines shared with Canonical Project Table; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.9009 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/v7/scripts/plugins/canonical-project-table.js:1-283 a581ade3fd318c51cbaeeb03c6c82efa400b5b4e
  • sha256 86cc497f93d28ac4712b04d4e66add36fe61f715c632e7f12162696f151044a5
  • target sha256 c5125a3701ab289d915e08aa631596fd5664cf23c6025dca1fb18a0b3717b94f
  • group of 3 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

transformglobalgrid2050 / uk_renewables_pipeline/v9.4/scripts/plugins/canonical-project-table.js · lines 1–315 of 315 · Not reached from any entry point (candidate for review) · pattern displayOfficialDate (shared by 2 files)

What it does
It calculates the REPD register. Defines 15 functions or classes, including invariant, deepFreeze, hasValidatedModel, isCanonicalOrder, displayOfficial.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: the REPD register.
Inputs & outputs
Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid).
Downstream impact
Used directly by 1 file: Check V9 0 (globalgrid2050).
What it achieves
It builds atlas v8 URL (`buildAtlasV8Url`), builds canonical news search URL (`buildCanonicalNewsSearchUrl`) and validates published metadata (`validatePublishedMetadata`). Defines `invariant`, `deepFreeze`, `hasValidatedModel` and 12 more.
Why it matters
Checked by Check V9 0.
Application
globalgrid2050 · uk_renewables_pipeline/v9.4/scripts/plugins · JavaScript module
Uses
GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL)
Used by
imported by Check V9 0 (import)
Produces
buildAtlasV8Url, buildCanonicalNewsSearchUrl, buildCanonicalProjectTableView
Defines here
invariant, deepFreeze, hasValidatedModel, isCanonicalOrder, displayOfficial, displayCapacity, displayOfficialDate, buildAtlasV8Url, sameFlatRecord, buildCanonicalNewsSearchUrl, legacyNewsFor, validatePublishedMetadata, evidenceFor, rowFor, buildCanonicalProjectTableView
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/v9.4/scripts/plugins/canonical-project-table.js:1-315 · blob be1098e923cbcf37a05cd5150d1350303af315d8 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: duplicate_candidate
const CAPACITY_BASIS = "official_repd_record_capacity_not_development_deduplicated";
const NO_RELATIONSHIPS = "none recorded";
const LEGACY_NEWS_AUTHORITY = "external legacy intelligence — unverified";
const ATLAS_V8_URL = "https://globalgrid2050.com/repd_grid_atlasv8/";

function invariant(condition, message) {
  if (!condition) throw new Error(`V7.2 canonical table: ${message}`);
}

function deepFreeze(value) {
  if (!value || typeof value !== "object" || Object.isFrozen(value)) return value;
  Object.values(value).forEach(deepFreeze);
  return Object.freeze(value);
}

function hasValidatedModel(state) {
  return Boolean(
    state?.contract
    && state?.metadata
    && Array.isArray(state.all)
    && state.all.length > 0
    && Array.isArray(state.filtered),
  );
}

function isCanonicalOrder(projects) {
  return projects.every((project, index) => {
    if (index === 0) return true;
    const previous = projects[index - 1];
    return previous.capacity_mw > project.capacity_mw
      || (
        previous.capacity_mw === project.capacity_mw
        && previous.gg_project_id.localeCompare(project.gg_project_id) <= 0
      );
  });
}

function displayOfficial(value, missingValueLabel) {
  return value === null || value === undefined || value === "" ? missingValueLabel : String(value);
}

function displayCapacity(project) {
  return `${new Intl.NumberFormat("en-GB", { maximumFractionDigits: 2 }).format(project.capacity_mw)} ${project.capacity_unit}`;
}

function displayOfficialDate(value, missingValueLabel) {
  if (!value) return missingValueLabel;
  const [year, month, day] = value.split("-");
  return `${day}/${month}/${year}`;
}

export function buildAtlasV8Url(project) {
  const url = new URL(ATLAS_V8_URL);
  url.searchParams.set("repd_ref", project.repd_ref);
  url.searchParams.set("project", project.name);
  url.searchParams.set("technology", project.technology);
  url.searchParams.set("capacity_mw", String(project.capacity_mw));
  if (project.geometry_status === "valid") {
    url.searchParams.set("latitude", String(project.latitude));
    url.searchParams.set("longitude", String(project.longitude));
    url.searchParams.set("zoom", "12");
  }
  return url.href;
}

function sameFlatRecord(left, right) {
  if (!left || !right || typeof left !== "object" || typeof right !== "object") return false;
  const keys = Object.keys(left).sort();
  return keys.join("\n") === Object.keys(right).sort().join("\n")
    && keys.every((key) => left[key] === right[key]);
}

export function buildCanonicalNewsSearchUrl(project) {
  const url = new URL("https://www.google.com/search");
  url.searchParams.set("q", `${project.name} ${project.technology_label} UK`);
  url.searchParams.set("tbm", "nws");
  return url.href;
}

function legacyNewsFor(project, resolver) {
  if (typeof resolver !== "function") {
    return {
      authority: LEGACY_NEWS_AUTHORITY,
      verified: false,
      status: "not_evaluated_in_isolated_v7_2",
      label: "not evaluated",
      note: "Trusted project-event binding is V7.3 scope",
    };
  }
  try {
    const result = resolver(project);
    const label = typeof result?.label === "string" && result.label.trim()
      ? result.label.trim()
      : "no matched legacy headline";
    const note = typeof result?.note === "string" && result.note.trim()
      ? result.note.trim()
      : "No legacy-news note supplied";
    return {
      authority: LEGACY_NEWS_AUTHORITY,
      verified: false,
      status: label === "no matched legacy headline" ? "no_match" : "legacy_match_unverified",
      label,
      note,
    };
  } catch {
    return {
      authority: LEGACY_NEWS_AUTHORITY,
      verified: false,
      status: "legacy_news_unavailable",
      label: "legacy news unavailable",
      note: "Legacy news resolver failed",
    };
  }
}

function validatePublishedMetadata(state) {
  const expected = state.contract.canonical_universe.published_snapshot;
  const actual = state.metadata;
  invariant(expected && typeof expected === "object", "published snapshot contract is absent");
  for (const field of [
    "projects_sha256",
    "source_identity_sha256",
    "source_coordinate_fixture_sha256",
    "source_workbook_sha256",
  ]) {
    invariant(actual[field] === expected[field], `${field} is not the contracted published value`);
  }
  invariant(sameFlatRecord(actual.source_provenance, expected.source_provenance), "source provenance is not the contracted published value");
  invariant(sameFlatRecord(actual.geometry_policy, expected.geometry_policy), "geometry policy is not the contracted published value");
}

function evidenceFor(project, state, inScopeRefs, missingValueLabel) {
  const milestoneFields = state.contract.interface.official_milestone_fields;
  const milestones = Object.fromEntries(milestoneFields.map((field) => [
    field,
    {
      value: project[field],
      display: displayOfficial(project[field], missingValueLabel),
      authority: "official REPD field",
    },
  ]));
  const relationships = project.relationships.map((relationship) => ({
    repdRef: relationship.repd_ref,
    type: relationship.type,
    sourceField: relationship.source_field,
    targetInCurrentUniverse: inScopeRefs.has(relationship.repd_ref),
  }));
  const metadata = state.metadata;
  return {
    identity: {
      ggDevelopmentId: project.gg_development_id,
      status: project.identity_status,
      confidence: project.identity_confidence,
    },
    officialPlanning: {
      authority: project.planning_authority,
      repdRecordUpdated: {
        value: project.repd_record_updated,
        display: displayOfficial(project.repd_record_updated, missingValueLabel),
      },
      milestones,
    },
    lifecycle: {
      value: project.lifecycle,
      view: project.lifecycle_view,
      derived: true,
      note: "Derived lifecycle; does not replace the official REPD status",
    },
    relationships: {
      items: relationships,
      display: relationships.length ? null : NO_RELATIONSHIPS,
      directRelatedRepdRefs: [...project.direct_related_repd_refs],
      planningSiblingRepdRefs: [...project.planning_sibling_repd_refs],
      developmentRepdRefs: [...project.development_repd_refs],
      outOfScopeTargetsRemainContextOnly: true,
    },
    geometry: {
      status: project.geometry_status,
      easting: project.easting,
      northing: project.northing,
      longitude: project.longitude,
      latitude: project.latitude,
      coordinateSource: project.coordinate_source,
      policy: { ...metadata.geometry_policy },
      contextOnly: true,
    },
    provenance: {
      kind: "published snapshot metadata",
      dataset: metadata.source_provenance.dataset,
      sourcePath: state.source,
      sourceRow: project.source_row,
      projectsSha256: metadata.projects_sha256,
      sourceIdentitySha256: metadata.source_identity_sha256,
      sourceCoordinateFixtureSha256: metadata.source_coordinate_fixture_sha256,
      sourceWorkbookSha256: metadata.source_workbook_sha256,
      canonicalIdentitySourceXlsxSha256: metadata.source_provenance.canonical_identity_source_xlsx_sha256,
      coordinateWorkbookCopySha256: metadata.source_provenance.coordinate_workbook_copy_sha256,
      reconciliation: metadata.source_provenance.reconciliation,
      note: "Published snapshot metadata; not recomputed by the browser",
    },
  };
}

function rowFor(project, state, inScopeRefs, resolver, missingValueLabel) {
  const legacyNews = legacyNewsFor(project, resolver);
  return {
    key: project.gg_project_id,
    primary: {
      project: project.name,
      location: [project.county, project.region, project.country].filter(Boolean).join(", "),
      operator: project.operator,
      technology: project.technology_label,
      officialStatus: project.status,
      capacity: {
        value: project.capacity_mw,
        unit: project.capacity_unit,
        display: displayCapacity(project),
        authority: "official REPD record",
      },
      repdRef: project.repd_ref,
      ggProjectId: project.gg_project_id,
      planningReference: displayOfficial(project.planning_application_reference, missingValueLabel),
      repdRecordUpdated: {
        value: project.repd_record_updated,
        display: displayOfficialDate(project.repd_record_updated, missingValueLabel),
        authority: "official REPD field",
      },
      atlas: {
        label: "Open Atlas V8",
        url: buildAtlasV8Url(project),
        exactFocusSupported: project.geometry_status === "valid",
        note: "Atlas V8 opens with canonical coordinates supplied, but does not yet consume the deep-link parameters",
      },
      legacyNews,
      news: {
        label: "Search news",
        url: buildCanonicalNewsSearchUrl(project),
        role: "external search context; not canonical evidence",
      },
    },
    evidence: evidenceFor(project, state, inScopeRefs, missingValueLabel),
  };
}

export function buildCanonicalProjectTableView(state, { legacySignalResolver } = {}) {
  if (!hasValidatedModel(state)) {
    return deepFreeze({
      available: false,
      status: state?.status || "idle",
      error: state?.error || null,
      columns: [],
      evidenceFields: [],
      rows: null,
      rowCount: null,
      missingValueLabel: null,
      capacityBasis: CAPACITY_BASIS,
    });
  }

  const snapshot = Object.freeze({
    all: state.all,
    filtered: state.filtered,
    contract: state.contract,
    metadata: state.metadata,
    source: state.source,
    status: state.status,
    error: state.error,
  });
  validatePublishedMetadata(snapshot);
  const primaryFields = snapshot.contract.interface.primary_table_fields;
  invariant(Array.isArray(primaryFields) && primaryFields.length === 13, "13-column table contract is absent");
  invariant(
    primaryFields.map((field) => field.label).join("\n")
      === snapshot.contract.interface.primary_table_columns.join("\n"),
    "table field labels do not match the frozen column order",
  );
  const canonicalById = new Map(snapshot.all.map((project) => [project.gg_project_id, project]));
  const inScopeRefs = new Set(snapshot.all.map((project) => project.repd_ref));
  invariant(
    snapshot.filtered.every((project) => canonicalById.get(project.gg_project_id) === project),
    "filtered rows are not exact canonical project objects",
  );
  invariant(
    new Set(snapshot.filtered.map((project) => project.gg_project_id)).size === snapshot.filtered.length,
    "filtered rows contain a duplicate canonical project",
  );
  invariant(isCanonicalOrder(snapshot.filtered), "filtered rows are not in canonical capacity/project-ID order");
  const missingValueLabel = snapshot.contract.interface.missing_value_label;
  const rows = snapshot.filtered.map((project) => rowFor(
    project,
    snapshot,
    inScopeRefs,
    legacySignalResolver,
    missingValueLabel,
  ));
  invariant(
    state.all === snapshot.all
      && state.filtered === snapshot.filtered
      && state.contract === snapshot.contract
      && state.metadata === snapshot.metadata
      && state.source === snapshot.source,
    "canonical state changed while the table view was being built",
  );
  return deepFreeze({
    available: true,
    status: snapshot.status,
    error: snapshot.error,
    columns: primaryFields.map((field) => ({ ...field })),
    evidenceFields: [...snapshot.contract.interface.evidence_fields],
    rows,
    rowCount: rows.length,
    missingValueLabel,
    capacityBasis: CAPACITY_BASIS,
  });
}