ALL PEOPLE GROUPS. The Driver: "not even loading, takes a very long
time", and its DOXA pins were dark on a dark map.
- It downloaded the 7.5 MB people-groups-slim.json (22 columns) to draw
ten fields. It now fetches people-groups-points.json: the same rows in
column order, repeated strings in dictionaries, coordinates at 3
decimals. 0.74 MB, generated deterministically by
library/scripts/people-groups/build-points.mjs and staged into the tree
by generate-tree. It falls back to the old file on an older tree.
- Pins no longer wait for the live prayer API. Every pin draws by GSEC
from the file, and the DOXA overlay recolours when the API answers. The
DOXA count reads "…" until then, not 0.
- Named style 'paper' (Mapbox light-v11 / MapLibre positron) instead of
'ink'. The four categories keep their meaning; yellow and green are a
step darker, and pins get a thin dark ring, so they read on near-white.
- Its words are in all 11 locales (allPeopleGroups.json), with a guarded
useI18n and values passed to vue-i18n so {n} is not blanked.
Measured on a served built tree, 3 fresh runs each, median time to first
rendered pins: 8.3 s before, 5.2 s after, on localhost. This box renders
GL in software, so most of the remaining time is map start-up; the 10x
smaller download matters more on a real connection.
DOXA VISION CARD. The Driver: "the data doesn't make sense … super false
information". The card rotated four typed-in figures with no source.
It is now a proportional funnel, every number computed from data by
library/scripts/people-groups/build-vision-funnel.mjs:
12,379 people groups (IMB rows: one group in one country)
7,341 unreached (IMB LostnessPriority 0-2, < 2% evangelical)
4,754 frontier (LostnessPriority 0, < 0.1% evangelical)
2,107 DOXA groups (the DOXA prayer list, snapshot saved in data/;
1,745 of them frontier)
The first three nest; DOXA groups do not all sit inside frontier, so the
card says how many do. The rules are on the card ("How these are
counted") and in HOW-THE-NUMBERS-ARE-COUNTED.md, which also explains why
the total is not the 16-17 thousand of Joshua Project's count. Material
light, all 11 locales, right-to-left in Arabic, sources and dates shown.
The old fake stats are removed from the instances file, the frontier
page, the manifest, the staging page and the gallery.
CHECKS.
- check:vision-card-numbers recomputes the funnel independently (own CSV
reader, the published rules) and compares with vision-funnel.json and,
with --url, the rendered bars. Negative-tested: a corrupted count exits
1. On the built tree: bars 12,379 / 7,341 / 4,754 / 2,107 and "1,745 of
them are frontier", all matching.
- check:map-embed-cells measures PRODUCTION-MATRIX cells B and C for the
seven gallery maps on a foreign origin; C proves the host's token is
used by handing the host a distinct token and checking every Mapbox
request. 14 of 14 pass.
55 lines
2.7 KiB
JavaScript
55 lines
2.7 KiB
JavaScript
#!/usr/bin/env node
|
||
/**
|
||
* build-points.mjs — the COMPACT point file All People Groups renders from.
|
||
*
|
||
* node library/scripts/people-groups/build-points.mjs
|
||
* reads data/people-groups/people-groups-slim.json (12,379 rows × 22 keys, ~7.5 MB)
|
||
* writes data/people-groups/people-groups-points.json (only the 10 fields the map uses)
|
||
*
|
||
* WHY. The map downloaded and parsed the whole slim file — every column, as one object per row — to
|
||
* draw ten fields. That, plus waiting on the live prayer API before drawing anything, is most of why
|
||
* the Driver found it "not even loading, takes a very long time". This file keeps the same rows and
|
||
* values in column order, with the repetitive strings (country, religion, evangelical level,
|
||
* language) stored once in dictionaries and referenced by index, and coordinates at 3 decimals
|
||
* (~100 m, far below a pin's size at any zoom this map shows).
|
||
*
|
||
* Deterministic: same input, byte-identical output. Re-run after refreshing the slim file.
|
||
*/
|
||
import { readFileSync, writeFileSync } from 'node:fs'
|
||
import { resolve, dirname } from 'node:path'
|
||
import { fileURLToPath } from 'node:url'
|
||
|
||
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../../..')
|
||
const SRC = resolve(ROOT, 'data/people-groups/people-groups-slim.json')
|
||
const OUT = resolve(ROOT, 'data/people-groups/people-groups-points.json')
|
||
|
||
const slim = JSON.parse(readFileSync(SRC, 'utf8'))
|
||
const dicts = { country: [], religion: [], evangelical: [], language: [] }
|
||
const idx = { country: new Map(), religion: new Map(), evangelical: new Map(), language: new Map() }
|
||
const ref = (k, v) => { const s = String(v || ''); let i = idx[k].get(s); if (i === undefined) { i = dicts[k].length; dicts[k].push(s); idx[k].set(s, i) } return i }
|
||
const r3 = (x) => Math.round(Number(x) * 1000) / 1000
|
||
|
||
const rows = []
|
||
for (const r of slim.rows || []) {
|
||
const lat = Number(r.Lat), lng = Number(r.Long)
|
||
if (!Number.isFinite(lat) || !Number.isFinite(lng) || (lat === 0 && lng === 0)) continue
|
||
rows.push([
|
||
r3(lng), r3(lat),
|
||
r.GSEC === '' || r.GSEC == null ? null : Number(r.GSEC),
|
||
String(r.ROP3Code || ''),
|
||
String(r.Name || ''),
|
||
ref('country', r.CountryName),
|
||
Number(r.Population) || 0,
|
||
ref('language', r.LanguageName),
|
||
ref('religion', r.ReligionName),
|
||
ref('evangelical', r.EvangelicalLevel),
|
||
])
|
||
}
|
||
const out = {
|
||
meta: { ...(slim.meta || {}), derivedFrom: 'people-groups-slim.json via library/scripts/people-groups/build-points.mjs', rows: rows.length },
|
||
cols: ['lng', 'lat', 'gsec', 'rop3', 'name', 'country', 'population', 'language', 'religion', 'evangelical'],
|
||
dicts,
|
||
rows,
|
||
}
|
||
writeFileSync(OUT, JSON.stringify(out))
|
||
console.log(`people-groups-points.json: ${rows.length} rows, ${(JSON.stringify(out).length / 1e6).toFixed(2)} MB`)
|