nx_haccp.nx
buildroot/runtime/nx_haccp.nx
about
nx_haccp.nx -- FOOD-SCIENCE SUITE / REGULATORY (HACCP) rung. Turns the
safety + preservation science into the HACCP framework: for each process
step it names the hazard, decides whether the step is a CRITICAL CONTROL
POINT (CCP) or a prerequisite (PRP), sets the grounded CRITICAL LIMIT,
monitors an observation against it, and HALTS the batch when a CCP is
breached (the never-poison law applied to a whole process).
Grounded critical limits (FDA Food Code 2022):
cook poultry 74 C (165 F) / ground 71 / whole cut + seafood 63
reheat 74 C; hot-hold >= 57 C (135 F); cold-hold <= 5 C (41 F)
two-stage cooling 57->21 C in <= 2 h, then 21->5 C in <= 4 h
low-acid canning: 12-D botulinum cook (composes nx_preservation)
acidification: pH <= 4.6 (composes the ferment never-poison line)
THE exceed: a paper HACCP binder lists limits; this MONITORS an
observation against the grounded limit and HALTS by construction when a
CCP fails -- and it reuses the SAME preservation/ferment science the rest
of the suite runs on (one source of truth, not a re-typed chart).
genealogy_id: codex_haccp_7_principles + fda_food_code_2022 + nishi_never_poison
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_preservation.nx
imported by: nx_haccp_test.nx
structs
| none |
consts
| 27 | const HC_RECEIVE: i64 = 0 |
| 28 | const HC_STORE: i64 = 1 |
| 29 | const HC_PREP: i64 = 2 |
| 30 | const HC_COOK: i64 = 3 |
| 31 | const HC_COOL: i64 = 4 |
| 32 | const HC_HOT_HOLD: i64 = 5 |
| 33 | const HC_COLD_HOLD: i64 = 6 |
| 34 | const HC_REHEAT: i64 = 7 |
| 35 | const HC_CAN: i64 = 8 |
| 36 | const HC_ACIDIFY: i64 = 9 |
| 37 | const HC_SERVE: i64 = 10 |
| 38 | const HC_STEP_N: i64 = 11 |
| 40 | const HC_HAZ_NONE: i64 = 0 |
| 41 | const HC_HAZ_BIO: i64 = 1 // pathogens |
| 42 | const HC_HAZ_CHEM: i64 = 2 // allergens, toxins, residues |
| 43 | const HC_HAZ_PHYS: i64 = 3 // glass, metal, bone |
| 45 | const HC_CCP_NO: i64 = 0 // prerequisite program (PRP) |
| 46 | const HC_CCP_YES: i64 = 1 // critical control point |
| 48 | const HC_OK: i64 = 0 |
| 49 | const HC_HALT: i64 = 1 // CCP breached -> never-poison halt |
| 52 | const HC_FOOD_POULTRY: i64 = 0 |
| 53 | const HC_FOOD_GROUND: i64 = 1 |
| 54 | const HC_FOOD_WHOLE: i64 = 2 |
| 55 | const HC_FOOD_SEAFOOD: i64 = 3 |
| 59 | const HC_COOK_POULTRY_C: i64 = 74 |
| 60 | const HC_COOK_GROUND_C: i64 = 71 |
| 61 | const HC_COOK_WHOLE_C: i64 = 63 |
| 62 | const HC_REHEAT_C: i64 = 74 |
| 63 | const HC_HOT_HOLD_C: i64 = 57 |
| 64 | const HC_COLD_HOLD_C: i64 = 5 |
| 65 | const HC_COOL_S1_HOURS: i64 = 2 // 57 C -> 21 C within 2 h |
| 66 | const HC_COOL_S2_HOURS: i64 = 4 // 21 C -> 5 C within 4 h |
| 67 | const HC_ACIDIFY_PH: i64 = 4600 |
functions
| 71 | func haccp_primary_hazard(step: i64) -> i64 called by 1: main |
| 87 | func haccp_is_ccp(step: i64) -> i64 called by 1: main |
| 100 | func haccp_cook_limit(food_class: i64) -> i64 |
| 109 | func haccp_cook_admit(observed_c: i64, food_class: i64) -> i64 |
| 115 | func haccp_cool_admit(stage1_hours: i64, stage2_hours: i64) -> i64 called by 1: main |
| 121 | func haccp_hot_hold_admit(observed_c: i64) -> i64 called by 1: main |
| 126 | func haccp_cold_hold_admit(observed_c: i64) -> i64 called by 1: main |
| 131 | func haccp_reheat_admit(observed_c: i64) -> i64 |
| 137 | func haccp_can_admit(hold_mmin: i64, d_mmin: i64) -> i64 |
| 143 | func haccp_acidify_admit(ph_milli: i64) -> i64 called by 1: main |