code wiki / _hdl_build / nx_lineage.nx
nx_lineage.nx
buildroot/runtime/_hdl_build/nx_lineage.nx
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
imports: nx_food_science.nxnx_seg_store.nxnx_syscalls.nx
imported by: nx_lineage_deep.nxnx_lineage_gate.nxnx_link.nx
structs
| none |
consts
| 22 | const ST_SEED: i64 = 1 |
| 23 | const ST_SOWN: i64 = 2 |
| 24 | const ST_SPROUT: i64 = 3 |
| 25 | const ST_GROW: i64 = 4 |
| 26 | const ST_HARVEST: i64 = 5 |
| 27 | const ST_PROCESS: i64 = 6 |
| 28 | const ST_DISTRIBUTE: i64 = 7 |
| 29 | const ST_EAT: i64 = 8 |
functions
| 31 | func ln_stage_label(code: i64) -> *u8 called by 1: ln_render_passport |
| 44 | func 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 } |
| 45 | func 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 } |
| 46 | func 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 } |
| 47 | func ln_stage_key(id: *u8, seq: i64, out: *u8) -> i64 |
| 57 | func ln_put(prefix: *u8, key: *u8, val: *u8) -> i64 called by 4: ln_addln_add_stageln_seed_configln_set_gene calls 5: fd_streq_storess_beginss_addfd_seg_nextss_commit |
| 69 | func 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 |
| 86 | func ln_field_str(prefix: *u8, id: *u8, f: i64, out: *u8) -> i64 |
| 93 | func ln_exists(prefix: *u8, id: *u8) -> i64 |
| 102 | func ln_ancestry(prefix: *u8, id: *u8, out: *u8) -> i64 |
| 131 | func ln_stagen(prefix: *u8, id: *u8) -> i64 called by 4: ln_find_stageln_add_stageln_render_passportmain calls 4: sys_mmapln_stagen_keyss_getfd_atoi |
| 139 | func ln_find_stage(prefix: *u8, id: *u8, code: i64) -> i64 called by 2: ln_add_stageln_reached_plate calls 6: ln_stagensys_mmapln_stage_keyss_getfd_fieldfd_atoi |
| 156 | func ln_add_stage(prefix: *u8, id: *u8, code: i64, date: *u8, loc: *u8, actor: *u8, note: *u8) -> i64 |
| 175 | func ln_stage_field(prefix: *u8, id: *u8, seq: i64, f: i64, out: *u8) -> i64 |
| 182 | func ln_stage_code(prefix: *u8, id: *u8, seq: i64) -> i64 |
| 189 | func ln_reached_plate(prefix: *u8, id: *u8) -> i64 { if ln_find_stage(prefix, id, ST_EAT) >= 0 { return 1 } return 0 } |
| 193 | func ln_seed_config(prefix: *u8) -> i64 |
| 199 | func ln_set_gene(prefix: *u8, id: *u8, germ: i64, disease: i64, nutrient: i64, yield: i64, vigor: i64, tested_by: *u8, cite: *u8) -> i64 |
| 213 | func ln_gene_int(prefix: *u8, id: *u8, f: i64) -> i64 |
| 222 | func ln_gene_str(prefix: *u8, id: *u8, f: i64, out: *u8) -> i64 |
| 229 | func ln_cfg_int(prefix: *u8, key: *u8, f: i64) -> i64 |
| 238 | func ln_quality_score(prefix: *u8, id: *u8) -> i64 called by 7: ln_is_superiorln_plate_qualityln_render_passportld_render_lotmainlk_render_item+1 calls 2: ln_gene_intln_cfg_int |
| 255 | func ln_is_superior(prefix: *u8, id: *u8) -> i64 called by 6: ln_render_passportld_render_lotmainmainlk_render_itemmain calls 2: ln_quality_scoreln_cfg_int |
| 264 | func ln_plate_quality(prefix: *u8, id: *u8) -> i64 |
| 270 | func ln_render_passport(prefix: *u8, id: *u8, out: *u8) -> i64 |