code wiki / _hdl_build / nx_lineage.nx

nx_lineage.nx

buildroot/runtime/_hdl_build/nx_lineage.nx

17903 B334 linesdepth 4pulls 5 transitivereach 7 importersview sourcekind librarytopic lineage
docsdependenciesstructsconstsfunctions

about

nx_lineage.nx -- LIB: SEED-TO-FEED traceability (R0 of the seed-to-feed workstream). The sovereign provenance substrate the operator asked for: "from the beginning up from seeds and the swapping and the genealogy of the seeds ... a full complete from seed to feed (eating) type of thing for all plants, animals, etc ... the ability to have [things] genetically tested for inferiority or superiority aka you are what you eat." THREE aspects of ONE traceable organism (seed / plant / animal): (1) GENEALOGY -- parent_a/parent_b lineage + origin (saved/swapped/bought) + source = seed swapping recorded. (2) LIFECYCLE -- an ADDITIVE chain of custody seed->sown->sprout->grow->harvest->process->distribute->eat (rule 13: history is sacred -- stage events are immutable distinct keys, never overwritten). (3) GENETIC QUALITY -- a superiority/inferiority SCORE computed from RECORDED trait markers (germination, disease-resistance, nutrient-density, yield, vigor). HONEST: the software does NOT sequence DNA; it records results from real lab/field tests (the `tested_by` provenance) and SCORES them -- data-driven weights/threshold in the store (rule 11), nutrient-density weighted highest = "you are what you eat". Sovereign seg-store (knowledge/store/bio-*, NO TSV file), integer-only (no float). "-" sentinel for no-parent (never store "" -- it aliases another literal's bytes). license_tier: ORIGINAL

dependencies 3 imports · 3 importers

nx_food_science.nx nx_seg_store.nx nx_syscalls.nx nx_lineage.nx nx_lineage_deep.nx nx_lineage_gate.nx nx_link.nx

imports: nx_food_science.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_lineage_deep.nxnx_lineage_gate.nxnx_link.nx

structs

none

consts

22const ST_SEED: i64 = 1
23const ST_SOWN: i64 = 2
24const ST_SPROUT: i64 = 3
25const ST_GROW: i64 = 4
26const ST_HARVEST: i64 = 5
27const ST_PROCESS: i64 = 6
28const ST_DISTRIBUTE: i64 = 7
29const ST_EAT: i64 = 8

functions

31func ln_stage_label(code: i64) -> *u8
called by 1: ln_render_passport
44func ln_org_key(id: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "bio:org:" as *u8); o = as_append(out, o, id); out[o] = 0 as u8; return o }
45func ln_gene_key(id: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "bio:gene:" as *u8); o = as_append(out, o, id); out[o] = 0 as u8; return o }
46func ln_stagen_key(id: *u8, out: *u8) -> i64 { var o: i64 = 0; o = as_append(out, o, "bio:stagen:" as *u8); o = as_append(out, o, id); out[o] = 0 as u8; return o }
called by 2: ln_stagenln_add_stage calls 1: as_append
47func ln_stage_key(id: *u8, seq: i64, out: *u8) -> i64
57func ln_put(prefix: *u8, key: *u8, val: *u8) -> i64
69func ln_add(prefix: *u8, id: *u8, name: *u8, kind: *u8, variety: *u8, gen: i64, parent_a: *u8, parent_b: *u8, origin: *u8, source: *u8, cite: *u8) -> i64
86func ln_field_str(prefix: *u8, id: *u8, f: i64, out: *u8) -> i64
93func ln_exists(prefix: *u8, id: *u8) -> i64
102func ln_ancestry(prefix: *u8, id: *u8, out: *u8) -> i64
131func ln_stagen(prefix: *u8, id: *u8) -> i64
139func ln_find_stage(prefix: *u8, id: *u8, code: i64) -> i64
156func ln_add_stage(prefix: *u8, id: *u8, code: i64, date: *u8, loc: *u8, actor: *u8, note: *u8) -> i64
175func ln_stage_field(prefix: *u8, id: *u8, seq: i64, f: i64, out: *u8) -> i64
182func ln_stage_code(prefix: *u8, id: *u8, seq: i64) -> i64
189func ln_reached_plate(prefix: *u8, id: *u8) -> i64 { if ln_find_stage(prefix, id, ST_EAT) >= 0 { return 1 } return 0 }
called by 2: ln_plate_qualitymain calls 1: ln_find_stage
193func ln_seed_config(prefix: *u8) -> i64
called by 3: mainmainmain calls 1: ln_put
199func ln_set_gene(prefix: *u8, id: *u8, germ: i64, disease: i64, nutrient: i64, yield: i64, vigor: i64, tested_by: *u8, cite: *u8) -> i64
213func ln_gene_int(prefix: *u8, id: *u8, f: i64) -> i64
222func ln_gene_str(prefix: *u8, id: *u8, f: i64, out: *u8) -> i64
229func ln_cfg_int(prefix: *u8, key: *u8, f: i64) -> i64
238func ln_quality_score(prefix: *u8, id: *u8) -> i64
255func ln_is_superior(prefix: *u8, id: *u8) -> i64
264func ln_plate_quality(prefix: *u8, id: *u8) -> i64
270func ln_render_passport(prefix: *u8, id: *u8, out: *u8) -> i64