GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / worlds- / src

Atlas Lattice and 3 more files

A Python command-line tool in Worlds that builds axes (`build_axes`) (units: kV, kVA).

608 lines of Python and JavaScript and CSS from worlds-, youengineer-code-review, in 4 files. Topic: Maps, GIS and field navigation. Section 726 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. Atlas Lattice other · worlds- / src/atlas_lattice.py lines 1–237
  2. Atlas V8 Fixes render · youengineer-code-review / civilisation-atlas-v8/atlas-v8-fixes.css lines 1–138
  3. Atlas V8 Polish render · youengineer-code-review / civilisation-atlas-v8/atlas-v8-polish.js lines 1–186
  4. Youengineer Code Review — Civilisation Atlas V8 Page render · youengineer-code-review / civilisation-atlas-v8/index.html lines 1–47

Atlas Lattice

A Python command-line tool in Worlds that builds axes (`build_axes`) (units: kV, kVA).

otherworlds- / src/atlas_lattice.py · lines 1–237 of 237 · Entry point · pattern reference (shared by 15 files)

What it does
It lists and searches its content. Defines stations, build_axes, kernel_src, reference, main. Uses libraries argparse, io, json, os, re. Side effects: starts processes.
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.
Inputs & outputs
In: JSON file atlas-lattice.json; command-line arguments.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
It is built from the stations step (`stations`), the kernel src helper (`kernel_src`) and the reference step (`reference`). The lattice over the atlas that is already there. It accepts `--run` and `--cap`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
worlds- · src · Python CLI
Uses
Paths (import), argparse, io, json, os, re, sys, time, numpy
Used by
none found
Produces
stations, build_axes, kernel_src, reference, main
Defines here
stations, build_axes, kernel_src, reference, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
worlds-@83817c34790800d4af5057629121d83d0d67a332 src/atlas_lattice.py:1-237 · blob e3b9ffa4ee3b52fe1f24ced4bb86b30229541ed7 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
"""The lattice over the atlas that is already there.

Not a new dataset. The 5,800 stations the Kuiper already draws, crossed with
the design axes we already prove, evaluated on the card.

The point of a lattice rather than a list: a station is not one question, it is
a product of questions. Which voltage class, which conductor, which site
minimum temperature, how many modules in series, how many strings, which
routing. Every one of those is currently CHOSEN by a person and then never
revisited, which means the alternatives are invisible - not rejected, invisible.

    python atlas_lattice.py                 the space, and what it costs
    python atlas_lattice.py --run           evaluate it on the card
    python atlas_lattice.py --run --cap 2e9 evaluate a bounded slice

Every verdict carries its denominator. Both readings of the disputed clause
are computed and neither is collapsed.
"""
import argparse
import io
import json
import os
import re
import sys
import time

import numpy as np

import paths

# Not written down here: this repository is public and an absolute path
# names a drive, a machine and an account. The root comes from GRID_DATA
# in the environment; see src/paths.py for the whole argument.
TUBE = paths.TUBE

# ---- the design axes, all from work already proven on this machine
CLASSES = [(45.90, -0.25, 660.0), (50.59, -0.22, 760.0), (53.27, -0.25, 650.0)]
KV = [400, 275, 220, 132, 66]                     # kvOrder, from TUBE-DATA
CSA = [50, 70, 95, 120, 150, 185, 240, 300, 400, 500, 630]   # the R20 table
TMIN = [-14.0, -12.0, -11.0, -10.0, -8.0, -6.0]
SERIES = list(range(20, 35))
STRINGS = list(range(16, 33))
ROUTING = [0, 1]                                  # sequential, leapfrog
VOC_TOL = 101                                     # Voc +/- 1%

MAX_V, INVERTER_KVA = 1500.0, 352.0
DCAC_LO, DCAC_HI = 1.15, 1.40
OK, DISPUTED, FAIL_COLD, OUT_OF_BAND = 0, 1, 2, 3
LABEL = ["buildable, both readings", "disputed: the clause decides it",
         "fails cold voltage", "DC:AC outside the band"]


def stations():
    """How many stations the atlas actually holds. Read, not assumed."""
    paths.require(TUBE, "the tube-map data (TUBE-DATA.js)")
    s = io.open(TUBE, encoding="utf-8", errors="replace").read()
    m = re.search(r'"stations"\s*:\s*\[', s)
    if not m:
        raise SystemExit("FAIL: no stations array in TUBE-DATA.js")
    i, depth, n = m.end(), 1, 1
    while i < len(s) and depth:
        c = s[i]
        if c in "[{":
            depth += 1
        elif c in "]}":
            depth -= 1
        elif c == "," and depth == 1:
            n += 1
        i += 1
    return n, len(s)


AXES = None


def build_axes(n_stations):
    return [("station", n_stations), ("module class", len(CLASSES)),
            ("voltage class", len(KV)), ("conductor mm2", len(CSA)),
            ("site min temp", len(TMIN)), ("modules in series", len(SERIES)),
            ("strings", len(STRINGS)), ("routing", len(ROUTING)),
            ("Voc tolerance", VOC_TOL)]


def kernel_src(rad):
    """One fused pass: decode, evaluate, emit a verdict. No temporaries."""
    return """
long long r = idx;
int st = (int)(r %% %(A0)d); r /= %(A0)d;
int ci = (int)(r %% %(A1)d); r /= %(A1)d;
int kv = (int)(r %% %(A2)d); r /= %(A2)d;
int cs = (int)(r %% %(A3)d); r /= %(A3)d;
int ti = (int)(r %% %(A4)d); r /= %(A4)d;
int si = (int)(r %% %(A5)d); r /= %(A5)d;
int ni = (int)(r %% %(A6)d); r /= %(A6)d;
int ro = (int)(r %% %(A7)d); r /= %(A7)d;
int vt = (int)(r %% %(A8)d);

double v = voc[ci] * (1.0 + ((double)vt - %(VMID)d.0) / %(VMID)d.0 * 0.01);
double b = beta[ci], w = wp[ci];
double tm = tmin[ti], se = ser[si], sn = strs[ni];

double nb = floor(%(MAXV).17g / (v * (1.0 + b / 100.0 * (tm - 25.0))));
double na = floor(%(MAXV).17g / (v * (1.0 + b / 100.0 * (tm - 15.0))));
double dcac = (se * w / 1000.0) * sn / %(KVA).17g;
bool band = (dcac >= %(LO).17g) && (dcac <= %(HI).17g);
code = (se > na) ? %(FC)d : ((se > nb) ? %(DI)d : (band ? %(OK)d : %(OB)d));
""" % {"A0": rad[0], "A1": rad[1], "A2": rad[2], "A3": rad[3], "A4": rad[4],
       "A5": rad[5], "A6": rad[6], "A7": rad[7], "A8": rad[8],
       "VMID": VOC_TOL // 2, "MAXV": MAX_V, "KVA": INVERTER_KVA,
       "LO": DCAC_LO, "HI": DCAC_HI, "FC": FAIL_COLD, "DI": DISPUTED,
       "OK": OK, "OB": OUT_OF_BAND}


def reference(idx, rad):
    """The processor's answer for the same indices. Nothing is quoted until
    this agrees."""
    out = np.zeros(len(idx), np.int64)
    for j, i in enumerate(idx):
        r = int(i)
        vals = []
        for q in rad:
            vals.append(r % q)
            r //= q
        _st, ci, _kv, _cs, ti, si, ni, _ro, vt = vals
        v0, b, w = CLASSES[ci]
        v = v0 * (1 + (vt - VOC_TOL // 2) / (VOC_TOL // 2) * 0.01)
        tm, se, sn = TMIN[ti], float(SERIES[si]), float(STRINGS[ni])
        nb = np.floor(MAX_V / (v * (1 + b / 100 * (tm - 25))))
        na = np.floor(MAX_V / (v * (1 + b / 100 * (tm - 15))))
        dcac = (se * w / 1000.0) * sn / INVERTER_KVA
        band = DCAC_LO <= dcac <= DCAC_HI
        out[j] = (FAIL_COLD if se > na else
                  (DISPUTED if se > nb else (OK if band else OUT_OF_BAND)))
    return out


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--run", action="store_true")
    ap.add_argument("--cap", type=float, default=None,
                    help="evaluate at most this many cases")
    a = ap.parse_args()

    n_st, nbytes = stations()
    axes = build_axes(n_st)
    rad = [n for _n, n in axes]
    size = 1
    for n in rad:
        size *= n

    print("THE ATLAS THAT IS ALREADY THERE")
    print("  TUBE-DATA.js .......... %s bytes, %s stations (read, not assumed)"
          % ("{:,}".format(nbytes), "{:,}".format(n_st)))
    print("\nTHE LATTICE OVER IT")
    for name, n in axes:
        print("  %-22s %6s" % (name, "{:,}".format(n)))
    print("  %-22s %6s" % ("", "-" * 6))
    print("  cases                  %s" % "{:,}".format(size))
    print("\n  at 3,544,292,885 cases/s that is %.1f s (%.2f minutes)"
          % (size / 3544292885.0, size / 3544292885.0 / 60.0))
    print("  every one of the %s stations gets %s design variants, none of"
          % ("{:,}".format(n_st), "{:,}".format(size // n_st)))
    print("  which is currently visible because each was chosen once.")

    if not a.run:
        print("\n  --run to evaluate. --cap to bound it.")
        return 0

    try:
        import cupy as cp
    except Exception as exc:
        print("\nFAIL: cupy unavailable (%r). Not evaluated." % (exc,))
        return 1

    total = int(min(size, a.cap)) if a.cap else size
    src = kernel_src(rad)
    K = cp.ElementwiseKernel(
        "int64 idx, raw float64 voc, raw float64 beta, raw float64 wp, "
        "raw float64 tmin, raw float64 ser, raw float64 strs",
        "int64 code", src, "ventus_atlas")
    T = (cp.asarray([c[0] for c in CLASSES]), cp.asarray([c[1] for c in CLASSES]),
         cp.asarray([c[2] for c in CLASSES]), cp.asarray(TMIN),
         cp.asarray([float(s) for s in SERIES]),
         cp.asarray([float(s) for s in STRINGS]))

    # verify BEFORE timing, on a coprime stride through the whole space
    stride = 1000003
    while np.gcd(stride, size) != 1:
        stride += 2
    probe = (np.arange(200000, dtype=np.int64) * stride) % size
    gpu = cp.asnumpy(K(cp.asarray(probe), *T))
    cpu = reference(probe, rad)
    differ = int((gpu != cpu).sum())
    print("\n  verified: processor vs card on 200,000 cases along stride "
          "%s: %d differ" % ("{:,}".format(stride), differ))
    if differ:
        print("  FAIL: refusing to report a rate for arithmetic that differs.")
        return 1

    free, _tot = cp.cuda.Device(0).mem_info
    batch = max(1 << 16, min(1 << 23, int(free * 0.25 / 24)))
    totals = cp.zeros(4, dtype=cp.int64)
    done, t0 = 0, time.perf_counter()
    while done < total:
        n = min(batch, total - done)
        totals += cp.bincount(K(cp.arange(done, done + n, dtype=cp.int64), *T),
                              minlength=4)[:4]
        done += n
    cp.cuda.Stream.null.synchronize()
    sec = time.perf_counter() - t0
    got = [int(x) for x in cp.asnumpy(totals)]
    if sum(got) != total:
        print("  FAIL: the reduction lost cases: %d of %d" % (sum(got), total))
        return 1

    print("\n  EVALUATED %s of %s cases in %.2f s  (%s cases/s)"
          % ("{:,}".format(total), "{:,}".format(size), sec,
             "{:,.0f}".format(total / sec)))
    for k in range(4):
        print("    %-32s %16s  %6.3f%%"
              % (LABEL[k], "{:,}".format(got[k]), 100.0 * got[k] / total))
    out = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                       "..", "atlas-lattice.json")
    io.open(out, "w", encoding="utf-8", newline="\n").write(json.dumps({
        "stations": n_st, "axes": [{"name": n, "steps": s} for n, s in axes],
        "cases": total,   # the key its four siblings write; without it
               # this run was counted as zero for a whole night
               "space": size, "evaluated": total, "seconds": round(sec, 3),
        "verified_differ": differ, "verdicts": dict(zip(LABEL, got)),
    }, indent=1) + "\n")
    print("\n  wrote atlas-lattice.json")
    print("  Not computed: load flow, fault level, yield, cost. None stated.")
    return 0


if __name__ == "__main__":
    sys.exit(main())

Atlas V8 Fixes

A style sheet in Youengineer Code Review. Served with the page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.

renderyouengineer-code-review / civilisation-atlas-v8/atlas-v8-fixes.css · lines 1–138 of 138 · 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 '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.
Downstream impact
Used directly by 1 file: Youengineer Code Review — Civilisation Atlas V8 Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/). Reached from 2 other entry points, including Civilisation Map (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-map.html); Youengineer Code Review — Index Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/). It is itself an entry point, published at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Loaded by the Civilisation Atlas V8 page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
Application
youengineer-code-review · civilisation-atlas-v8 · style sheet
Uses
none found
Used by
loaded by Youengineer Code Review — Civilisation Atlas 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
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas-v8/atlas-v8-fixes.css:1-138 · blob 087b365d8363180b75db3bf6fb921d855ce7d07d · 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: unknown
.key-dot {
    width: 10px;
    height: 10px;
}

.key-item {
    min-height: 30px;
    font-size: 13px;
    gap: 8px;
}

.key-status {
    font-size: 9px;
}

.scada-keys input[type="checkbox"],
.scada-keys input[type="radio"],
#fs-curtain input[type="checkbox"],
#fs-curtain input[type="radio"] {
    transform: scale(1.25);
    margin-right: 4px;
}

.map-toggle-btn,
.map-ctrl-btn,
.search-btn {
    min-height: 34px;
}

body.fs-active .map-mode-controls {
    top: auto;
    bottom: 74px;
    right: 12px;
}

body.fs-active .custom-map-attrib {
    right: 12px;
    max-width: calc(100% - 24px);
}

.popup-search-btns {
    display: flex;
    gap: 7px;
    margin-top: 10px;
}

.popup-btn {
    flex: 1;
    display: block;
    min-height: 34px;
    padding: 7px 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #0a0a0a;
    color: #999;
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.popup-btn-news {
    color: #ffae00;
    border-color: #ffae00;
}

.popup-btn-wiki {
    color: #ffffff;
    border-color: #888888;
}

.popup-btn-images {
    color: #00ffff;
    border-color: #00ffff;
}

.popup-btn:hover,
.popup-btn:focus-visible {
    background: #111;
    color: #000;
    outline: none;
}

.popup-btn-news:hover,
.popup-btn-news:focus-visible {
    background: #ffae00;
}

.popup-btn-wiki:hover,
.popup-btn-wiki:focus-visible {
    background: #ffffff;
}

.popup-btn-images:hover,
.popup-btn-images:focus-visible {
    background: #00ffff;
}

@media (max-width: 720px) {
    .search-bar-wrapper {
        top: 86px;
        right: 8px;
    }

    .custom-map-attrib {
        max-width: calc(100% - 92px);
    }

    .hud-val {
        font-size: 14px;
    }

    .key-dot {
        width: 11px;
        height: 11px;
    }

    .key-item {
        min-height: 34px;
        font-size: 14px;
    }

    .scada-keys input[type="checkbox"],
    .scada-keys input[type="radio"],
    #fs-curtain input[type="checkbox"],
    #fs-curtain input[type="radio"] {
        transform: scale(1.35);
    }

    .popup-btn {
        min-height: 40px;
        font-size: 12px;
        line-height: 22px;
    }
}

Atlas V8 Polish

A JavaScript file in Youengineer Code Review that sets changed (`setTextIfChanged`), gets popup field (`getPopupField`) and builds knowledge query (`buildKnowledgeQuery`). Served with the page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.

renderyouengineer-code-review / civilisation-atlas-v8/atlas-v8-polish.js · lines 1–186 of 186 · Entry point

What it does
It draws its content. Defines 12 functions or classes, including setTextIfChanged, polishViewLabel, isSatelliteActive, polishSatelliteButton, polishLayerStatuses. 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.
Downstream impact
Used directly by 1 file: Youengineer Code Review — Civilisation Atlas V8 Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/). Reached from 2 other entry points, including Civilisation Map (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-map.html); Youengineer Code Review — Index Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/). It is itself an entry point, published at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
What it achieves
It sets text if changed (`setTextIfChanged`), gets popup field (`getPopupField`) and builds knowledge query (`buildKnowledgeQuery`). Defines `setTextIfChanged`, `polishViewLabel`, `isSatelliteActive` and 9 more. It responds to change, click and DOMContentLoaded events.
Why it matters
Loaded by the Civilisation Atlas V8 page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
Application
youengineer-code-review · civilisation-atlas-v8 · script
Uses
none found
Used by
loaded by Youengineer Code Review — Civilisation Atlas V8 Page (script src)
Produces
setTextIfChanged, polishViewLabel, isSatelliteActive, polishSatelliteButton, polishLayerStatuses, getPopupField, buildKnowledgeQuery, addKnowledgeButtonsToPopup, polishPopups, addBasemapControls, syncBasemapRadios, startAtlasPolish
Defines here
setTextIfChanged, polishViewLabel, isSatelliteActive, polishSatelliteButton, polishLayerStatuses, getPopupField, buildKnowledgeQuery, addKnowledgeButtonsToPopup, polishPopups, addBasemapControls, syncBasemapRadios, startAtlasPolish
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas-v8/atlas-v8-polish.js:1-186 · blob 9c2722cdda60d919813227b629c3facdf55fbce5 · 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: unknown
"use strict";

function setTextIfChanged(element, value) {
    if (element && element.textContent !== value) {
        element.textContent = value;
    }
}

function polishViewLabel() {
    const label = document.getElementById("days");
    if (!label) return;
    setTextIfChanged(label, label.textContent.replace("ZERO LAYERS", "0 LAYERS"));
}

function isSatelliteActive() {
    const button = document.getElementById("btn-satellite");
    return Boolean(button && button.classList.contains("active"));
}

function polishSatelliteButton() {
    const button = document.getElementById("btn-satellite");
    if (!button) return;
    const target = isSatelliteActive() ? "DARK MAP VIEW" : "SATELLITE VIEW";
    setTextIfChanged(button, target);
    syncBasemapRadios();
}

function polishLayerStatuses() {
    document.querySelectorAll("input[data-layer-toggle]").forEach((input) => {
        if (!input.checked) {
            document.querySelectorAll(`[data-status="${input.dataset.layerToggle}"]`).forEach((status) => {
                status.textContent = "OFF";
            });
        }
    });
}

function getPopupField(content, fieldName) {
    const wanted = fieldName.toLowerCase();
    for (const row of content.querySelectorAll(".popup-row")) {
        const key = row.querySelector("span:first-child")?.textContent?.replace(":", "").trim().toLowerCase();
        const value = row.querySelector(".popup-val")?.textContent?.trim();
        if (key === wanted && value) return value;
    }
    return "";
}

function buildKnowledgeQuery(content) {
    const name = getPopupField(content, "Name");
    const civilisation = getPopupField(content, "Civilisation");
    const region = getPopupField(content, "Region");
    return [name, civilisation, region, "history archaeology"]
        .filter(Boolean)
        .join(" ")
        .replace(/\s+/g, " ")
        .trim();
}

function addKnowledgeButtonsToPopup(content) {
    if (!content || content.querySelector(".popup-search-btns")) return;

    const query = buildKnowledgeQuery(content);
    if (!query) return;

    const encoded = encodeURIComponent(query);
    const wikiQuery = encodeURIComponent(getPopupField(content, "Name") || query);

    const row = document.createElement("div");
    row.className = "popup-search-btns";

    const links = [
        { label: "News", className: "popup-btn-news", href: `https://news.google.com/search?q=${encoded}` },
        { label: "Wiki", className: "popup-btn-wiki", href: `https://en.wikipedia.org/w/index.php?search=${wikiQuery}` },
        { label: "Images", className: "popup-btn-images", href: `https://www.google.com/search?tbm=isch&q=${encoded}` }
    ];

    links.forEach((link) => {
        const anchor = document.createElement("a");
        anchor.className = `popup-btn ${link.className}`;
        anchor.href = link.href;
        anchor.target = "_blank";
        anchor.rel = "noopener noreferrer";
        anchor.textContent = link.label;
        row.appendChild(anchor);
    });

    content.appendChild(row);
}

function polishPopups() {
    document.querySelectorAll(".maplibregl-popup-content").forEach(addKnowledgeButtonsToPopup);
}

function addBasemapControls(containerId) {
    const container = document.getElementById(containerId);
    if (!container || container.querySelector(".basemap-group")) return;

    const group = document.createElement("div");
    group.className = "key-group basemap-group";

    const title = document.createElement("div");
    title.className = "key-title";
    title.textContent = "Basemap";
    group.appendChild(title);

    const options = [
        { value: "dark", label: "Dark" },
        { value: "satellite", label: "Satellite" }
    ];

    options.forEach((option) => {
        const row = document.createElement("label");
        row.className = "key-item";

        const input = document.createElement("input");
        input.type = "radio";
        input.name = `${containerId}-basemap`;
        input.value = option.value;
        input.checked = option.value === "dark";
        input.addEventListener("change", () => {
            const button = document.getElementById("btn-satellite");
            if (!button) return;
            const wantsSatellite = option.value === "satellite";
            if (isSatelliteActive() !== wantsSatellite) button.click();
        });

        const text = document.createElement("span");
        text.textContent = option.label;

        row.appendChild(input);
        row.appendChild(text);
        group.appendChild(row);
    });

    container.appendChild(group);
}

function syncBasemapRadios() {
    const active = isSatelliteActive();
    document.querySelectorAll(".basemap-group input[type='radio']").forEach((input) => {
        input.checked = active ? input.value === "satellite" : input.value === "dark";
    });
}

function startAtlasPolish() {
    polishViewLabel();
    polishSatelliteButton();
    polishLayerStatuses();
    addBasemapControls("scada-ui-container");
    addBasemapControls("fs-curtain-keys");
    syncBasemapRadios();
    polishPopups();

    const label = document.getElementById("days");
    if (label) {
        new MutationObserver(polishViewLabel).observe(label, { childList: true, characterData: true, subtree: true });
    }

    const button = document.getElementById("btn-satellite");
    if (button) {
        new MutationObserver(polishSatelliteButton).observe(button, {
            attributes: true,
            attributeFilter: ["class"]
        });
        button.addEventListener("click", () => setTimeout(polishSatelliteButton, 0));
    }

    new MutationObserver(polishPopups).observe(document.body, { childList: true, subtree: true });

    document.addEventListener("change", (event) => {
        if (event.target && event.target.matches("input[data-layer-toggle]")) {
            setTimeout(polishLayerStatuses, 0);
        }
    });

    const clearButton = document.getElementById("btn-clear");
    if (clearButton) {
        clearButton.addEventListener("click", () => setTimeout(polishLayerStatuses, 0));
    }
}

if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", startAtlasPolish);
} else {
    startAtlasPolish();
}

Youengineer Code Review — Civilisation Atlas V8 Page

A web page that draws ancient greek sites, roman world, ancient egypt and mesopotamia persia. Published at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.

renderyouengineer-code-review / civilisation-atlas-v8/index.html · lines 1–47 of 47 · Entry point

What it does
It draws ancient greek sites, roman world, ancient egypt and mesopotamia persia. 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. README: "Download or clone the repo, then open `index.html` or `civilisation-atlas-v8/index.html` in a browser."
Inputs & outputs
In: form fields (user input). Out: web page.
Downstream impact
Used directly by 1 file: Youengineer Code Review — Index Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/). Reached from 1 other entry point, including Civilisation Map (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-map.html). It is itself an entry point, published at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
What it achieves
The README says: Download or clone the repo, then open `index.html` or `civilisation-atlas-v8/index.html` in a browser.
Why it matters
Loaded by the Youengineer Code Review page at https://ventusltd.github.io/youengineer-code-review/.
Application
youengineer-code-review · civilisation-atlas-v8 · page
Uses
Ventus v8 (stylesheet), Atlas V8 Fixes (stylesheet), Ventus Corev8engine (script src), Atlas V8 Polish (script src), https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js
Used by
linked from Youengineer Code Review — Index Page (link)
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
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas-v8/index.html:1-47 · blob bf0b3c7bde1576eae1dcac40e0ebbd4336e508ff · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>YouEngineer | Civilisation Atlas V8</title>
    <link href="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css" rel="stylesheet" />
    <link href="ventusv8.css" rel="stylesheet" />
    <link href="atlas-v8-fixes.css" rel="stylesheet" />
</head>
<body>
<div id="fatal-banner">CRITICAL ERROR: SYSTEM DEPENDENCIES FAILED TO LOAD</div>
<button id="btn-fullscreen-exit" onclick="exitFullscreen()">✕ Exit</button>
<div id="fs-curtain-tab">⬇ Layers</div>
<div id="fs-curtain"><div id="fs-curtain-keys"></div></div>
<div id="fs-letterhead"><div class="ventus-main">Classic Civilisations</div><div class="ventus-sub">Coding for All</div></div>
<div class="dashboard">
    <div class="hud-header">
        <div><small style="color:#888">SYSTEM TIME</small><br><span class="hud-val" id="clock">--:--:--</span><br><span id="date" style="font-size:11px;color:#888;">--/--/----</span></div>
        <div class="ventus-brand"><div class="ventus-main">Classic Civilisations</div><div class="ventus-sub">Coding for All</div></div>
        <div style="text-align:right"><small style="color:#888">VIEW</small><br><span class="hud-val" id="days" style="color:#ff9d00">MAP · 0 LAYERS</span></div>
    </div>
    <div class="map-container" id="map-container">
        <div id="map"></div>
        <div class="custom-map-attrib">Base map © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap contributors</a> | © CARTO | Satellite © Esri | Local civilisation GeoJSON only</div>
        <div class="map-mode-controls"><button id="btn-satellite" class="map-toggle-btn">SATELLITE VIEW</button></div>
        <button id="btn-fullscreen" onclick="enterFullscreen()" title="Fullscreen">⛶</button>
        <div class="search-bar-wrapper"><div style="position:relative"><input class="search-input" id="search-input" type="text" placeholder="Search site name..." autocomplete="off" /><div class="search-results" id="search-results"></div></div><button class="search-btn" id="search-btn">GO</button></div>
        <div class="map-controls"><button class="map-ctrl-btn" id="btn-export">⬇ Export CSV</button><button class="map-ctrl-btn" id="btn-clear">✕ Clear Layers</button><button class="map-ctrl-btn" id="btn-reset">◎ Reset View</button></div>
        <div class="podcast-shoutout">Civilisation Atlas V8<br>Static GeoJSON learning layers</div>
    </div>
    <div class="scada-wrapper">
        <div class="scada-brand"><div><div class="scada-brand-main">Classic Civilisations</div><div class="scada-brand-sub">Coding for All</div></div><div class="scada-brand-tag">youengineer-code-review | classics map shell</div></div>
        <div class="status-legend"><div class="status-dot"><span style="background:#ffae00"></span>Classical civilisation</div><div class="status-dot"><span style="background:#00ffff"></span>UNESCO starter</div><div class="status-dot"><span style="background:#ff00ff"></span>Mythic geography</div><div class="status-dot"><span style="background:#66ff66"></span>Ancient routes</div></div>
        <div class="scada-keys" id="scada-ui-container"></div>
        <div class="disclaimer-box">Site points and summaries are a manually curated educational starter dataset stored as local GeoJSON in this repo. It is not an official UNESCO, Wikidata or national heritage register. Verify important facts against official heritage bodies or primary references before formal use. Basemap © OpenStreetMap contributors and CARTO. Satellite imagery © Esri.</div>
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js"></script>
<script src="ventus-corev8engine.js"></script>
<script src="atlas-v8-polish.js"></script>
<script>
const classicsConfig=[{group:"Classical Civilisations (GeoJSON)",layers:[{id:"greek",label:"Ancient Greek Sites",color:"#ffae00",type:"point",radius:10,url:"data/ancient_greek_sites.geojson",preload:false},{id:"roman",label:"Roman World",color:"#ff4444",type:"point",radius:10,url:"data/roman_world.geojson",preload:false},{id:"egypt",label:"Ancient Egypt",color:"#ffff00",type:"point",radius:10,url:  … [line shortened here: 1,660 characters; full line on GitHub]
window.initVentusMap({config:classicsConfig,center:[15,25],zoom:1.55});
</script>
</body>
</html>