nx_supp_ingredient.nx source
↩ module page · 232 lines · 9667 B
1// nx_supp_ingredient.nx -- SUPPLEMENT GTM SUITE / INGREDIENT CATALOG rung.
2// The input side of taking a supplement to market: what an ingredient IS
3// legally, what dose the clinical literature actually used, how much volume
4// that dose occupies, and what it costs.
5//
6// THE REGULATORY CLASS IS THE MOST IMPORTANT FIELD, and it is not advice --
7// it decides whether a product can legally exist. Two exclusions do the work:
8//
9// DRUG PRECLUSION (21 USC 321(ff)(3)(B)): an article approved as a drug, or
10// authorised for investigation as a new drug with substantial public
11// clinical trials, CANNOT be a dietary ingredient. Oxytocin (approved as
12// Pitocin) and bremelanotide (approved as Vyleesi) are on the wrong side of
13// that line permanently. A compounded oxytocin troche is a PRESCRIPTION
14// product dispensed by a pharmacy -- it is not a supplement business.
15//
16// NOT A DIETARY INGREDIENT AT ALL: DSHEA's definition is a closed list
17// (vitamin, mineral, herb/botanical, amino acid, dietary substance used to
18// supplement the diet, or a concentrate/metabolite/extract of those).
19// A synthetic signalling peptide such as Kisspeptin-10 or BPC-157 is none
20// of them -- it is not an "amino acid" any more than a protein drug is.
21// FDA has said so directly, and BPC-157 was placed on the 503A category-2
22// list in 2023 as not eligible even for compounding.
23//
24// So this catalog REFUSES those by construction, in the same way
25// nx_ferment_safety refuses an unsafe ferment: a structural verdict, not a
26// warning string a formulator can scroll past. The nine botanicals and
27// amino acids on the user's list ARE lawful dietary ingredients and are
28// catalogued normally.
29//
30// COSTS ARE INDICATIVE BULK RANGES, NOT QUOTES. They move with harvest,
31// origin, assay, and volume, and a branded standardised extract is priced by
32// its owner. si_cost_is_indicative() exists so no downstream model can quietly
33// present these as a purchase price. Get a real quote before committing.
34//
35// DOSES ARE THE LOW END OF THE CLINICALLY STUDIED RANGE, which is the honest
36// floor for a "clinically dosed" claim -- not a marketing dose.
37//
38// Units: dose in mg, bulk density in mg per mL, cost in CENTS per kg.
39//
40// Grounding (cited; researcher-groundable):
41// dshea_21usc321_ff_dietary_ingredient_definition
42// fda_drug_preclusion_clause_321_ff_3_B
43// fda_503a_category2_bpc157_2023
44// clinical_dose_ranges_botanical_sexual_function_trials
45// bulk_botanical_extract_price_ranges_indicative
46//
47// genealogy_id: supplement_gtm + nishi_food_science_suite
48
49import "nx_syscalls.nx"
50const SI_MAGIC_3000: i64 = 3000
51const SI_MAGIC_1500: i64 = 1500
52const SI_MAGIC_2000: i64 = 2000
53const SI_MAGIC_150000: i64 = 150000
54const SI_MAGIC_15000: i64 = 15000
55const SI_MAGIC_6000: i64 = 6000
56const SI_MAGIC_9000: i64 = 9000
57const SI_MAGIC_18000: i64 = 18000
58const SI_MAGIC_1000000: i64 = 1000000
59
60// ===== Regulatory class (sealed) ======================================
61
62const SI_CLASS_UNKNOWN: i64 = 0 // fail-closed: never marketable
63const SI_CLASS_ODI: i64 = 1 // old dietary ingredient (pre-1994)
64const SI_CLASS_NDI: i64 = 2 // new dietary ingredient, notified
65const SI_CLASS_DRUG: i64 = 3 // approved drug -> precluded
66const SI_CLASS_NOT_DIETARY: i64 = 4 // not a dietary ingredient at all
67
68// ===== Catalog ========================================================
69
70const SI_L_CITRULLINE: i64 = 0
71const SI_L_ARGININE: i64 = 1
72const SI_PYCNOGENOL: i64 = 2
73const SI_ASHWAGANDHA: i64 = 3
74const SI_MACA: i64 = 4
75const SI_TRIBULUS: i64 = 5
76const SI_FENUGREEK: i64 = 6
77const SI_PANAX_GINSENG: i64 = 7
78const SI_GINKGO: i64 = 8
79const SI_KISSPEPTIN10: i64 = 9
80const SI_OXYTOCIN: i64 = 10
81const SI_BREMELANOTIDE: i64 = 11
82const SI_BPC157: i64 = 12
83const SI_N: i64 = 13
84
85const SI_INVALID: i64 = 0 - 1
86
87func si_valid_id(id: i64) -> i64 {
88 if id < 0 { return 0 }
89 if id >= SI_N { return 0 }
90 return 1
91}
92
93func si_name(id: i64) -> *u8 {
94 if id == SI_L_CITRULLINE { return "L-Citrulline" as *u8 }
95 if id == SI_L_ARGININE { return "L-Arginine" as *u8 }
96 if id == SI_PYCNOGENOL { return "Pycnogenol (pine bark)" as *u8 }
97 if id == SI_ASHWAGANDHA { return "Ashwagandha KSM-66" as *u8 }
98 if id == SI_MACA { return "Maca root" as *u8 }
99 if id == SI_TRIBULUS { return "Tribulus terrestris" as *u8 }
100 if id == SI_FENUGREEK { return "Fenugreek extract" as *u8 }
101 if id == SI_PANAX_GINSENG { return "Panax ginseng extract" as *u8 }
102 if id == SI_GINKGO { return "Ginkgo biloba extract" as *u8 }
103 if id == SI_KISSPEPTIN10 { return "Kisspeptin-10" as *u8 }
104 if id == SI_OXYTOCIN { return "Oxytocin" as *u8 }
105 if id == SI_BREMELANOTIDE { return "Bremelanotide" as *u8 }
106 if id == SI_BPC157 { return "BPC-157" as *u8 }
107 return "UNKNOWN" as *u8
108}
109
110// The field that decides whether a product can exist.
111func si_class(id: i64) -> i64 {
112 if id == SI_L_CITRULLINE { return SI_CLASS_ODI }
113 if id == SI_L_ARGININE { return SI_CLASS_ODI }
114 if id == SI_PYCNOGENOL { return SI_CLASS_ODI }
115 if id == SI_ASHWAGANDHA { return SI_CLASS_ODI }
116 if id == SI_MACA { return SI_CLASS_ODI }
117 if id == SI_TRIBULUS { return SI_CLASS_ODI }
118 if id == SI_FENUGREEK { return SI_CLASS_ODI }
119 if id == SI_PANAX_GINSENG { return SI_CLASS_ODI }
120 if id == SI_GINKGO { return SI_CLASS_ODI }
121 if id == SI_KISSPEPTIN10 { return SI_CLASS_NOT_DIETARY }
122 if id == SI_OXYTOCIN { return SI_CLASS_DRUG }
123 if id == SI_BREMELANOTIDE { return SI_CLASS_DRUG }
124 if id == SI_BPC157 { return SI_CLASS_NOT_DIETARY }
125 return SI_CLASS_UNKNOWN
126}
127
128// May this be sold as a dietary supplement ingredient at all?
129// UNKNOWN is NOT marketable -- an uncatalogued substance is a research task,
130// never a default yes.
131func si_is_lawful_dietary(id: i64) -> i64 {
132 let c: i64 = si_class(id)
133 if c == SI_CLASS_ODI { return 1 }
134 if c == SI_CLASS_NDI { return 1 }
135 return 0
136}
137
138// Low end of the clinically studied daily dose, mg. Zero for anything not
139// lawfully usable -- there is no "dose" for a product that cannot ship.
140func si_clinical_dose_mg(id: i64) -> i64 {
141 if id == SI_L_CITRULLINE { return SI_MAGIC_3000 }
142 if id == SI_L_ARGININE { return SI_MAGIC_3000 }
143 if id == SI_PYCNOGENOL { return 60 }
144 if id == SI_ASHWAGANDHA { return 600 }
145 if id == SI_MACA { return SI_MAGIC_1500 }
146 if id == SI_TRIBULUS { return 500 }
147 if id == SI_FENUGREEK { return 600 }
148 if id == SI_PANAX_GINSENG { return 400 }
149 if id == SI_GINKGO { return 120 }
150 return 0
151}
152
153// Bulk (tapped) density, mg per mL. This is what turns a dose into a VOLUME,
154// and volume is what decides the delivery format.
155func si_density_mg_per_ml(id: i64) -> i64 {
156 if id == SI_L_CITRULLINE { return 700 }
157 if id == SI_L_ARGININE { return 650 }
158 if id == SI_PYCNOGENOL { return 500 }
159 if id == SI_ASHWAGANDHA { return 550 }
160 if id == SI_MACA { return 500 }
161 if id == SI_TRIBULUS { return 550 }
162 if id == SI_FENUGREEK { return 600 }
163 if id == SI_PANAX_GINSENG { return 500 }
164 if id == SI_GINKGO { return 500 }
165 return 0
166}
167
168// Indicative bulk cost, CENTS per kilogram. See si_cost_is_indicative.
169func si_cost_cents_per_kg(id: i64) -> i64 {
170 if id == SI_L_CITRULLINE { return SI_MAGIC_3000 }
171 if id == SI_L_ARGININE { return SI_MAGIC_2000 }
172 if id == SI_PYCNOGENOL { return SI_MAGIC_150000 }
173 if id == SI_ASHWAGANDHA { return SI_MAGIC_15000 }
174 if id == SI_MACA { return SI_MAGIC_3000 }
175 if id == SI_TRIBULUS { return SI_MAGIC_6000 }
176 if id == SI_FENUGREEK { return SI_MAGIC_9000 }
177 if id == SI_PANAX_GINSENG { return SI_MAGIC_15000 }
178 if id == SI_GINKGO { return SI_MAGIC_18000 }
179 return 0
180}
181
182// Always 1. Present so a downstream model cannot silently present a catalog
183// figure as a purchase price; a quote is a separate, human step.
184func si_cost_is_indicative(id: i64) -> i64 {
185 return 1
186}
187
188// Cost in cents of a given dose, from the per-kg figure. mg -> kg is 1e6.
189func si_dose_cost_cents(id: i64, dose_mg: i64) -> i64 {
190 if si_valid_id(id) != 1 { return 0 }
191 if dose_mg <= 0 { return 0 }
192 let per_kg: i64 = si_cost_cents_per_kg(id)
193 return dose_mg * per_kg / SI_MAGIC_1000000
194}
195
196// Volume a dose occupies, in MICROLITRES. REFUSES on a density-less entry
197// rather than dividing by zero or reporting a weightless powder.
198func si_dose_volume_ul(id: i64, dose_mg: i64) -> i64 {
199 if si_valid_id(id) != 1 { return SI_INVALID }
200 if dose_mg < 0 { return SI_INVALID }
201 let d: i64 = si_density_mg_per_ml(id)
202 if d <= 0 { return SI_INVALID }
203 return dose_mg * 1000 / d
204}
205
206// ===== Capsule geometry ===============================================
207//
208// Standard two-piece capsule shell volumes, microlitres. Fill weight is
209// VOLUME x DENSITY, not a fixed milligram figure -- which is why a dense
210// amino acid and a fluffy botanical extract do not fit the same shell in
211// the same amount.
212
213const SI_CAP_000: i64 = 1370
214const SI_CAP_00: i64 = 950
215const SI_CAP_0: i64 = 680
216const SI_CAP_1: i64 = 500
217const SI_CAP_2: i64 = 370
218const SI_CAP_3: i64 = 300
219
220// Practical fill is below shell volume: powder must flow and tamp, and an
221// overfilled shell will not close. 90% is the usual working ceiling.
222const SI_CAP_FILL_PERMIL: i64 = 900
223
224func si_capsule_usable_ul(shell_ul: i64) -> i64 {
225 if shell_ul <= 0 { return 0 }
226 return shell_ul * SI_CAP_FILL_PERMIL / 1000
227}
228
229func si_capsule_fill_mg(shell_ul: i64, density_mg_per_ml: i64) -> i64 {
230 let usable: i64 = si_capsule_usable_ul(shell_ul)
231 return usable * density_mg_per_ml / 1000
232}