UPG Neighbor: an unplaced group reads ring -1, so it can never pass for a reached one
This commit is contained in:
parent
140a25e4d7
commit
6c346e603a
5 changed files with 12 additions and 9 deletions
File diff suppressed because one or more lines are too long
|
|
@ -191,7 +191,7 @@ const newIdx = new Map(shipped.map((g, j) => [g.i, j]))
|
|||
const COLS = ['pgid', 'name', 'iso3', 'country', 'lat', 'lng', 'pop', 'reached', 'evPct', 'believers', 'lang', 'langName',
|
||||
'family', 'ethne', 'cluster', 'clusterName', 'bloc', 'blocName', 'religion', 'engaged', 'bible', 'film', 'audio', 'radio',
|
||||
// rop3 + iso3 is the join key other plugins hold (DX groups: rop3 + country). ring = centered-set ring 1-10
|
||||
// (0 = reached or no relation); ringNb = the shipped row of the reached group that sets it (-1 = none).
|
||||
// (0 = REACHED, the centre; -1 = unreached with no relation, unplaced: never drawn as a ring); ringNb = the shipped row of the reached group that sets it (-1 = none).
|
||||
'rop3', 'ring', 'ringNb']
|
||||
// Repeated strings are dictionary-encoded (the value in the row is an index into dict[col]); this
|
||||
// halves the file. A reader decodes with dict[col][row[j]].
|
||||
|
|
@ -201,7 +201,7 @@ const dictIdx = Object.fromEntries(DICT_COLS.map((c) => [c, new Map()]))
|
|||
const enc = (c, v) => { const m = dictIdx[c]; if (!m.has(v)) { m.set(v, dict[c].length); dict[c].push(v) } return m.get(v) }
|
||||
const rows = shipped.map((g) => COLS.map((c) => {
|
||||
const rg = ringOfU.get(g.i)
|
||||
if (c === 'ring') return rg ? rg[0] : 0
|
||||
if (c === 'ring') return rg ? rg[0] : g.reached ? 0 : -1 // 0 = reached (the centre), -1 = unplaced
|
||||
if (c === 'ringNb') return rg ? newIdx.get(rg[1]) : -1
|
||||
const v = g[c]
|
||||
if (DICT_COLS.includes(c)) return enc(c, v)
|
||||
|
|
@ -227,7 +227,7 @@ const out = {
|
|||
e2: 'different language, same ROP2 people cluster, or same LanguageFamily within the same ROP1 affinity bloc',
|
||||
e3: `none of the above, within ${NEAR_KM} km or in the same country`,
|
||||
p: 'P-level of an unreached group = the smallest E-level any reached neighbor reaches it at',
|
||||
rings: 'columns ring + ringNb on every row (ring 0 = reached or none; ringNb -1 = none). 1-3 same LanguageCode, 4-6 same LanguageName root (text before the comma), 7-9 same LanguageFamily, each x culture same ROP25 / near ROP2 / different; 10 = same country or within 600 km. Closest = lowest ring, then believers / (1 + (km/500)^2). Rule: src/rings.js',
|
||||
rings: 'columns ring + ringNb on every row (ring 0 = reached, the centre; ring -1 = unreached with no relation, unplaced; ringNb -1 = none). 1-3 same LanguageCode, 4-6 same LanguageName root (text before the comma), 7-9 same LanguageFamily, each x culture same ROP25 / near ROP2 / different; 10 = same country or within 600 km. Closest = lowest ring, then believers / (1 + (km/500)^2). Rule: src/rings.js',
|
||||
kept: KEEP, rank: `inside one E-level: stronger match kind first (E-2: people cluster before language family), then estimated believers / (1 + (km/${HALF_KM})^2)`,
|
||||
},
|
||||
believersEst: 'Population x midpoint of the evangelical band: an order of magnitude for sizing an audience, not a count',
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ function decode(raw) {
|
|||
const unreached = groups.filter((g) => !g.reached)
|
||||
for (const u of unreached) {
|
||||
u.p = pLevel(u)
|
||||
// centered-set ring (src/rings.js): u.ring 1-10 arrives as a column (0 = none); ringNeighbor = the reached group that sets it
|
||||
// centered-set ring (src/rings.js): u.ring 1-10 arrives as a column (-1 = unplaced; reached rows carry 0, the centre); ringNeighbor = the reached group that sets it
|
||||
u.ringNeighbor = u.ringNb >= 0 ? groups[u.ringNb] : null
|
||||
}
|
||||
const bridgeList = bridges.map((b) => {
|
||||
|
|
|
|||
|
|
@ -70,9 +70,12 @@ export function closestReached(u, idx, opts = {}) {
|
|||
return { ring: bestRing, neighbor: best }
|
||||
}
|
||||
|
||||
/** Per-ring counts for any set of groups (a UPG-100 list, a fork's own set): { 1: n, …, 10: n, 0: n }. */
|
||||
/**
|
||||
* Per-ring counts for any set of groups (a UPG-100 list, a fork's own set):
|
||||
* { 1: n, …, 10: n, none: n }. `none` = no relation found; it is never a ring.
|
||||
*/
|
||||
export function ringCounts(groups, ringFor) {
|
||||
const out = Object.fromEntries([0, ...RINGS].map((r) => [r, 0]))
|
||||
for (const g of groups) out[ringFor(g) || 0]++
|
||||
const out = Object.fromEntries([...RINGS, 'none'].map((r) => [r, 0]))
|
||||
for (const g of groups) { const r = ringFor(g); out[r >= 1 && r <= 10 ? r : 'none']++ }
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue