code wiki / _hdl_build / nx_food_clean_source.nx

nx_food_clean_source.nx

buildroot/runtime/_hdl_build/nx_food_clean_source.nx

8756 B132 linesdepth 6pulls 7 transitivereach 6 importersview sourcekind librarytopic food
docsdependenciesstructsconstsfunctions

about

nx_food_clean_source.nx -- LIB: the CLEAN-SOURCING badge that joins the stir-fry SITE to the impact ECONOMICS (operator: "we gain more profit and they spend less via them buying from us"). For the vegetables in a chosen build that Nishi grows regeneratively (present in the impact catalog), it aggregates the per-item customer savings vs conventional and renders a sovereign no-JS "Clean sourcing" section for the recommendation page -- so the diner SEES, on the same page that picks their dish, that the produce we source is cleaner AND cheaper. HONEST BY CONSTRUCTION: only ingredients ACTUALLY in the catalog count (im_field_int < 0 == absent), the section states how many, and a non-catalog ingredient is reported as not-yet-covered -- never a faked number. The seeded estimates VARY truthfully (onion/garlic are low-residue even conventionally -> small clean gap; bok choy / snow peas higher -> larger gap), so the badge cannot greenwash. Reuses nx_impact accessors; integer cents only (no float); each record CITEs the regenerative-agriculture corpus. license_tier: ORIGINAL

dependencies 4 imports · 2 importers

nx_impact.nx nx_food_science.nx nx_seg_store.nx nx_syscalls.nx nx_food_clean_source.nx nx_food_clean_source_gate.nx nx_food_site.nx

imports: nx_impact.nxnx_food_science.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_food_clean_source_gate.nxnx_food_site.nx

structs

none

consts

none

functions

19func fc_covered(prefix: *u8, slug: *u8) -> i64
27func fc_seed_veg(prefix: *u8) -> i64
65func fc_build_savings(prefix: *u8, h: *i64, build: *i64, roles: *i64, nb: i64) -> i64
80func fc_build_covered(prefix: *u8, h: *i64, build: *i64, roles: *i64, nb: i64) -> i64
called by 2: fc_render_badgemain calls 1: fc_covered
97func fc_render_badge(prefix: *u8, h: *i64, build: *i64, roles: *i64, nb: i64, out: *u8, off: i64) -> i64