nx_supp_formula.nx
buildroot/runtime/nx_supp_formula.nx
about
nx_supp_formula.nx -- SUPPLEMENT GTM SUITE / FORMULATION + FEASIBILITY rung.
Takes a product concept and runs it all the way to a go/no-go: is it legal,
does it physically fit a dosage form, what does it cost to make, and does
it clear a margin at the price you want to sell it for. Then it runs the
same arithmetic BACKWARDS -- from a retail price and a target margin to the
ingredient budget you actually have to spend.
THREE GATES, IN THE ORDER THAT ACTUALLY KILLS PRODUCTS.
1. LEGAL. One precluded ingredient and there is no product, regardless of
how good the formula is. sf_regulatory_verdict NAMES the blocking
ingredient rather than returning a bare no -- the same discipline as the
hurdle model naming which barrier holds, because "rejected" without
"why" gets argued with instead of fixed.
2. PHYSICAL. A dose is a VOLUME before it is a number on a label. Run the
clinically studied doses of a full botanical + amino stack and it comes
to roughly ten and a half millilitres -- ELEVEN size-00 capsules per
serving. Nobody takes eleven capsules. This is the arithmetic behind
why so much of the category is under-dosed: the label dose was chosen to
fit the capsule, not to match the trial. The honest response is to
change the FORMAT, not to quietly cut the dose, and sf_capsules_needed
makes that choice explicit instead of accidental.
3. ECONOMIC. At eleven capsules a serving the shells and the encapsulation
labour cost about as much as the actives do, so the format decision is
also the margin decision -- chemistry and cost point the same way.
FAIRY-DUSTING IS DETECTED, NOT ACCOMMODATED. sf_dose_adequacy_permil
compares each dose against the low end of the clinically studied range, so
a formula carrying a token 50 mg of something trialled at 600 mg is flagged
as what it is. Threshold in a named constant, not buried in a branch.
COSTS ARE INDICATIVE (see nx_supp_ingredient). Conversion figures are
typical contract-manufacturer rates and move with run size; treat every
number here as a model to be replaced by quotes, not as a budget.
Units: mg, microlitres, CENTS. Margins and adequacy in per-mil.
Grounding (cited; researcher-groundable):
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_supp_ingredient.nx
imported by: nx_gtm_svc.nxnx_prodready.nx
structs
| 79 | struct NxSuppFormula |
consts
| 49 | const SF_MAGIC_1000000: i64 = 1000000 |
| 53 | const SF_REFUSED_EMPTY: i64 = 0 |
| 54 | const SF_MARKETABLE: i64 = 1 |
| 55 | const SF_REFUSED_DRUG: i64 = 2 |
| 56 | const SF_REFUSED_NOT_DIETARY: i64 = 3 |
| 57 | const SF_REFUSED_UNKNOWN: i64 = 4 |
| 61 | const SF_FORMAT_CAPSULE: i64 = 1 |
| 62 | const SF_FORMAT_POWDER: i64 = 2 |
| 65 | const SF_SHELL_COST_CENTS: i64 = 1 // per capsule shell |
| 66 | const SF_ENCAP_COST_CENTS: i64 = 2 // per capsule filled (rounded up) |
| 67 | const SF_BOTTLE_COST_CENTS: i64 = 50 |
| 68 | const SF_LABEL_COST_CENTS: i64 = 15 |
| 69 | const SF_POWDER_SCOOP_CENTS: i64 = 10 |
| 72 | const SF_FAIRY_DUST_PERMIL: i64 = 500 |
| 75 | const SF_DSHEA_DISCLAIMER_REQUIRED: i64 = 1 |
functions
| 85 | func nx_supp_formula_new() -> *NxSuppFormula |
| 95 | func sf_set_dose(f: *NxSuppFormula, id: i64, dose_mg: i64) -> i64 |
| 108 | func sf_set_clinical(f: *NxSuppFormula, id: i64) -> i64 |
| 113 | func sf_dose_of(f: *NxSuppFormula, id: i64) -> i64 |
| 122 | func sf_first_blocking(f: *NxSuppFormula) -> i64 |
| 138 | func sf_regulatory_verdict(f: *NxSuppFormula) -> i64 |
| 149 | func sf_is_marketable(f: *NxSuppFormula) -> i64 |
| 157 | func sf_total_mass_mg(f: *NxSuppFormula) -> i64 |
| 170 | func sf_total_volume_ul(f: *NxSuppFormula) -> i64 |
| 189 | func sf_capsules_needed(f: *NxSuppFormula, shell_ul: i64) -> i64 |
| 201 | func sf_fits_in_capsules(f: *NxSuppFormula, shell_ul: i64, max_caps: i64) -> i64 |
| 211 | func sf_bulkiest_ingredient(f: *NxSuppFormula) -> i64 |
| 233 | func sf_dose_adequacy_permil(f: *NxSuppFormula, id: i64) -> i64 |
| 240 | func sf_is_fairy_dusted(f: *NxSuppFormula, id: i64) -> i64 |
| 249 | func sf_count_fairy_dusted(f: *NxSuppFormula) -> i64 |
| 262 | func sf_actives_cost_cents(f: *NxSuppFormula) -> i64 |
| 278 | func sf_conversion_cost_cents(f: *NxSuppFormula, servings: i64, format: i64, shell_ul: i64) -> i64 called by 2: sf_cogs_per_bottle_centssf_actives_budget_per_serving_cents calls 1: sf_capsules_needed |
| 289 | func sf_cogs_per_bottle_cents(f: *NxSuppFormula, servings: i64, format: i64, shell_ul: i64) -> i64 called by 2: gtm_formula_assesspr_economics_ok calls 2: sf_conversion_cost_centssf_actives_cost_cents |
| 298 | func sf_gross_margin_permil(retail_cents: i64, cogs_cents: i64) -> i64 |
| 313 | func sf_cogs_budget_cents(retail_cents: i64, target_margin_permil: i64) -> i64 called by 1: sf_actives_budget_per_serving_cents |
| 324 | func sf_actives_budget_per_serving_cents(f: *NxSuppFormula, retail_cents: i64, target_margin_permil: i64, servings: i64, format: i64, shell_ul: i64) -> i64 |
| 335 | func sf_max_dose_for_budget_mg(id: i64, budget_cents: i64) -> i64 |
| 344 | func sf_clinical_dose_affordable(id: i64, budget_cents: i64) -> i64 |