code wiki / (root) / nx_cgmp.nx

nx_cgmp.nx

buildroot/runtime/nx_cgmp.nx

9428 B236 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_cgmp.nx nx_cgmp_test.nx

imports: nx_syscalls.nx

imported by: nx_cgmp_test.nx

structs

122struct NxCgmpState

consts

35const CG_MINOR: i64 = 1
36const CG_MAJOR: i64 = 2
37const CG_CRITICAL: i64 = 3
41const CG_SPECIFICATIONS: i64 = 0 // 111.70 established specs
42const CG_ID_TESTING: i64 = 1 // 111.75(a)(1)(i) 100% component identity
43const CG_SUPPLIER_QUAL: i64 = 2 // 111.75(a)(2) supplier qualification
44const CG_FINISHED_TESTING: i64 = 3 // 111.75(c) finished-product to spec
45const CG_MMR: i64 = 4 // 111.205 master manufacturing record
46const CG_BPR: i64 = 5 // 111.255 batch production record
47const CG_QC_UNIT: i64 = 6 // 111.65 quality-control operations
48const CG_RESERVE_SAMPLES: i64 = 7 // 111.83 reserve samples
49const CG_TRAINED_PERSONNEL: i64 = 8 // 111.13 trained personnel
50const CG_SANITARY_PLANT: i64 = 9 // 111.15 sanitary physical plant
51const CG_CALIBRATED_EQUIP: i64 = 10 // 111.27 calibrated equipment
52const CG_LAB_CONTROLS: i64 = 11 // 111.320 laboratory controls
53const CG_COMPLAINTS: i64 = 12 // 111.560 product complaint handling
54const CG_RECORDS: i64 = 13 // 111.605 records retention
55const CG_N: i64 = 14

functions

57func cg_valid(id: i64) -> i64
called by 2: cg_set_metcg_is_met
63func cg_name(id: i64) -> *u8
called by 1: main
81func cg_citation(id: i64) -> *u8
called by 1: main
100func cg_criticality(id: i64) -> i64
126func nx_cgmp_new() -> *NxCgmpState
called by 1: main calls 1: sys_mmap
132func cg_set_met(s: *NxCgmpState, id: i64) -> i64
called by 2: cg_set_allmain calls 1: cg_valid
139func cg_is_met(s: *NxCgmpState, id: i64) -> i64
148func cg_set_all(s: *NxCgmpState) -> i64
called by 1: main calls 1: cg_set_met
161func cg_first_critical_gap(s: *NxCgmpState) -> i64
175func cg_critical_gaps(s: *NxCgmpState) -> i64
called by 1: main calls 2: cg_criticalitycg_is_met
187func cg_total_gaps(s: *NxCgmpState) -> i64
called by 1: main calls 1: cg_is_met
199func cg_audit_ready(s: *NxCgmpState) -> i64
called by 1: main calls 1: cg_first_critical_gap
206func cg_total_weight() -> i64
called by 1: cg_readiness_permil calls 1: cg_criticality
216func cg_readiness_permil(s: *NxCgmpState) -> i64
232func cg_identity_dimension_met(s: *NxCgmpState) -> i64
called by 1: main calls 1: cg_is_met