nx_cgmp.nx
buildroot/runtime/nx_cgmp.nx
about
nx_cgmp.nx -- GTM SUITE / 21 CFR 111 cGMP READINESS rung. Deepens the
plan engine's coarse "manufacturing / identity" attestations into the real
sub-part checklist a dietary-supplement contract manufacturer is audited
against -- so the plan can say not "qualify a cGMP facility" but exactly
which requirements are missing, worst-first.
THE ORDERING IS BY WHAT DRAWS A WARNING LETTER. FDA 483 observations and
warning letters cluster on a knowable few requirements: no established
specifications, no 100% identity testing of incoming components, no master
manufacturing record, no batch record, no quality-control unit. Those are
tagged CRITICAL and a facility is not audit-ready while any is open --
cgmp_first_critical_gap returns the worst one first, the same kill-order
discipline as the production-readiness engine it feeds.
EVERY REQUIREMENT IS AN OPERATOR ATTESTATION, HONESTLY. This organ cannot
inspect a plant; it tracks which requirements are DECLARED met and scores
the gap, weighting CRITICAL > MAJOR > MINOR. It replaces a single yes/no
"gmp_qualified" flag with an actionable breakdown, not with a pretense of
having audited anything.
THE CITATIONS ARE REAL so a plan line points at the actual regulation.
Grounding (cited; researcher-groundable):
fda_21cfr111_current_good_manufacturing_practice_dietary_supplements
111_70_specifications · 111_75_component_identity_testing
111_205_master_manufacturing_record · 111_255_batch_production_record
111_65_quality_control_operations · fda_483_warning_letter_cgmp_patterns
genealogy_id: supplement_gtm + service_infrastructure
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_cgmp_test.nx
structs
| 122 | struct NxCgmpState |
consts
| 35 | const CG_MINOR: i64 = 1 |
| 36 | const CG_MAJOR: i64 = 2 |
| 37 | const CG_CRITICAL: i64 = 3 |
| 41 | const CG_SPECIFICATIONS: i64 = 0 // 111.70 established specs |
| 42 | const CG_ID_TESTING: i64 = 1 // 111.75(a)(1)(i) 100% component identity |
| 43 | const CG_SUPPLIER_QUAL: i64 = 2 // 111.75(a)(2) supplier qualification |
| 44 | const CG_FINISHED_TESTING: i64 = 3 // 111.75(c) finished-product to spec |
| 45 | const CG_MMR: i64 = 4 // 111.205 master manufacturing record |
| 46 | const CG_BPR: i64 = 5 // 111.255 batch production record |
| 47 | const CG_QC_UNIT: i64 = 6 // 111.65 quality-control operations |
| 48 | const CG_RESERVE_SAMPLES: i64 = 7 // 111.83 reserve samples |
| 49 | const CG_TRAINED_PERSONNEL: i64 = 8 // 111.13 trained personnel |
| 50 | const CG_SANITARY_PLANT: i64 = 9 // 111.15 sanitary physical plant |
| 51 | const CG_CALIBRATED_EQUIP: i64 = 10 // 111.27 calibrated equipment |
| 52 | const CG_LAB_CONTROLS: i64 = 11 // 111.320 laboratory controls |
| 53 | const CG_COMPLAINTS: i64 = 12 // 111.560 product complaint handling |
| 54 | const CG_RECORDS: i64 = 13 // 111.605 records retention |
| 55 | const CG_N: i64 = 14 |
functions
| 57 | func cg_valid(id: i64) -> i64 |
| 63 | func cg_name(id: i64) -> *u8 called by 1: main |
| 81 | func cg_citation(id: i64) -> *u8 called by 1: main |
| 100 | func cg_criticality(id: i64) -> i64 |
| 126 | func nx_cgmp_new() -> *NxCgmpState |
| 132 | func cg_set_met(s: *NxCgmpState, id: i64) -> i64 |
| 139 | func cg_is_met(s: *NxCgmpState, id: i64) -> i64 |
| 148 | func cg_set_all(s: *NxCgmpState) -> i64 |
| 161 | func cg_first_critical_gap(s: *NxCgmpState) -> i64 |
| 175 | func cg_critical_gaps(s: *NxCgmpState) -> i64 |
| 187 | func cg_total_gaps(s: *NxCgmpState) -> i64 |
| 199 | func cg_audit_ready(s: *NxCgmpState) -> i64 |
| 206 | func cg_total_weight() -> i64 |
| 216 | func cg_readiness_permil(s: *NxCgmpState) -> i64 |
| 232 | func cg_identity_dimension_met(s: *NxCgmpState) -> i64 |