nx_cell_lib.nx
buildroot/runtime/nx_cell_lib.nx
about
nx_cell_lib.nx -- ORGANISATION AND PLACE CELLS AS ROWS (shared lib, 2026-08-24).
A CELL is one node of the hierarchy a feedback surface rolls up through: a congregation, an agency, a
nonprofit program (organisation cells) or a locality, region, nation (place cells). One record kind,
one key family, one parent pointer -- the tenant row every multi-organisation surface needs and none
had (absence proven 2026-08-24: no tenant lib in 23,167 sources). Composes the survey engine's store
discipline: canon-encoded records on the append-only seg_store, latest version wins, history kept.
key "cell:<id>"
fields type=cell id kind name parent denom usec
id a-z 0-9 only, 1..CEL_ID_MAX -- no dash, so "<instrument>-<cell>" survey ids split without
ambiguity; CEL_ID_MAX is DERIVED: the engine's survey-id bound is 40 (se_id_ok) and the
instrument name is bounded at CEL_INST_MAX, so CEL_INST_MAX + 1 + CEL_ID_MAX == 40.
kind must appear in the caller-supplied comma list (conf data, never a literal here)
parent another cell id that EXISTS, or "-" for a root; an unknown parent REFUSES by name
denom declared denominator (roster size, population) for post-stratification; 0 = undeclared
license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_survey_engine.nx
imported by: nx_communitypulse.nx
structs
| none |
consts
| 19 | const CEL_SURVEY_ID_MAX: i64 = 40 // se_id_ok's bound, restated once so the derivation below is visible |
| 20 | const CEL_INST_MAX: i64 = 15 |
| 21 | const CEL_ID_MAX: i64 = 24 // CEL_SURVEY_ID_MAX - CEL_INST_MAX - 1 (the dash) |
| 22 | const CEL_KEY_CAP: i64 = 64 |
| 23 | const CEL_FIELDS: i64 = 16 |
| 24 | const CEL_NUM_BYTES: i64 = 32 |
| 25 | const CEL_WORD: i64 = 8 |
| 26 | const CEL_OK: i64 = 0 |
| 27 | const CEL_ERR_ID: i64 = 0 - 1 |
| 28 | const CEL_ERR_KIND: i64 = 0 - 2 |
| 29 | const CEL_ERR_PARENT: i64 = 0 - 3 |
| 30 | const CEL_ERR_DENOM: i64 = 0 - 4 |
| 31 | const CEL_ERR_STORE: i64 = 0 - 5 |
| 32 | const CEL_ERR_NAME: i64 = 0 - 6 |
| 33 | const CEL_ROOT: *u8 = "-" |
| 34 | const CEL_ASCII_A: i64 = 97 |
| 35 | const CEL_ASCII_Z: i64 = 122 |
| 36 | const CEL_ASCII_0: i64 = 48 |
| 37 | const CEL_ASCII_9: i64 = 57 |
| 38 | const CEL_ASCII_COMMA: i64 = 44 |
| 39 | const CEL_ASCII_DASH: i64 = 45 |
functions
| 41 | func cel_id_ok(s: *u8) -> i64 |
| 55 | func cel_inst_ok(s: *u8) -> i64 |
| 61 | func cel_kind_ok(kind: *u8, kinds: *u8) -> i64 |
| 83 | func cel_key(id: *u8, out: *u8) -> i64 |
| 90 | func cel_survey_id(inst: *u8, id: *u8, out: *u8) -> i64 |
| 97 | func cel_get(prefix: *u8, id: *u8, ks: *i64, vs: *i64, maxf: i64) -> i64 |
| 102 | func cel_field(ks: *i64, vs: *i64, nf: i64, key: *u8) -> *u8 { return sv_get(ks, vs, nf, key) } |
| 103 | func cel_field_n(ks: *i64, vs: *i64, nf: i64, key: *u8, dflt: i64) -> i64 { return se_field_n(ks, vs, nf, key, dflt) } |
| 106 | func cel_put(prefix: *u8, id: *u8, kind: *u8, name: *u8, parent: *u8, denom: i64, kinds: *u8) -> i64 |
| 142 | func cel_list(prefix: *u8, kout: *i64, vout: *i64, lout: *i64, cap: i64) -> i64 |