Fix NAFLD/NASH model + Shiny app errors and improve navbar contrast#7
Open
mingushin3 wants to merge 2 commits into
Open
Fix NAFLD/NASH model + Shiny app errors and improve navbar contrast#7mingushin3 wants to merge 2 commits into
mingushin3 wants to merge 2 commits into
Conversation
…ontrast mrgsolve model (nafld_mrgsolve_model.R): - Remove compartments from CAPTURE block (mrgsolve >=1.0 rejects them; compartment amounts are returned automatically) Shiny app (nafld_shiny_app.R): - Remove compartments from CAPTURE block - TABLE: use TIME instead of lowercase time (collided with C library time()) - Remove apostrophes from an in-model comment that prematurely closed the single-quoted R model string (caused "unexpected symbol") - Hoist valueBox_shiny() above the ui object (UI called it at build time) - Replace deprecated page_navbar bg= with navbar_options(bg=, theme=) - High-contrast navbar: deep-maroon bar, light tab labels, white-pill active tab, white brand title (via bs_add_rules) Verified: both models parse, compile, and simulate; Shiny UI builds with no errors or warnings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…el for stability req() error (Scenario Comparison / Endpoint Summary tabs): - mrgsolve exports a req() S3 generic that masks shiny::req() (loaded earlier), so req(input$compare_arms) hit mrgsolve's generic -> "no applicable method for req applied to character". Qualified all four server calls as shiny::req(). Model divergence (placebo grew ~10x/week to ~1e+85): - Root cause: disease pools were not initialized at their own steady state (absolute production terms) and the steatosis->Kupffer->TNFa->IR->DNL->fat positive-feedback loop was unbounded. - Re-calibrated BOTH nafld_mrgsolve_model.R and nafld_shiny_app.R to steady-state-consistent indirect-response (turnover) form (kin = KOUT*baseline) with fold-change-normalized, saturable drivers and loop gain << 1 (Dayneka 1993; Jusko & Ko 1994; Woo 2009; Angeli-Ferrell-Sontag 2004; Maldonado 2022). - LIVER_FAT influx split into DNL + adipose-NEFA(weight); Kupffer drive saturable; ALT injury is now a sum (not product) of normalized drivers; collagen made the slowest pool. INS_RES/BODY_WT/ADIPONECTIN already correct (set-point form). - Remapped the Fibrosis-tab sliders/param() to the new sensitivity names (GTGF_HSC, GHSC_COL, GLIP_KUP, GKUP_TGF) and adjusted ranges. - Added nafld_model_design_brief.md documenting the literature basis. Verified (R, mrgsolve 2.0.1): placebo flat to machine precision for all 11 states over 72 wk; perturbation recovers to baseline; no divergence in any arm; drug directions clinically correct (resmetirom -40% liver fat ~ MAESTRO, semaglutide lowers fat/HOMA-IR/weight & raises adiponectin, OCA lowers fibrosis, triple best); fibrosis-tab live-param path works. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
Thank you for your review and update. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a chain of errors that prevented the NAFLD/NASH mrgsolve model and Shiny app from running under current package versions (mrgsolve 2.0.1, bslib 0.11.0), and improves navbar readability.
Changes
nafld_mrgsolve_model.R$CAPTUREblock. mrgsolve ≥1.0 rejects compartments in$CAPTURE(their amounts are already returned automatically). Derived$TABLEvariables are kept.nafld_shiny_app.R$CAPTURE(same rule).$TABLE: useTIMEinstead of lowercasetime, which collided with the C librarytime()function and broke C++ compilation.unexpected symbolparse error).valueBox_shiny()above theuiobject, since the UI calls it at build time (was defined afterui, causingcould not find function).page_navbar(bg=)withnavbar_options(bg=, theme=)(bslib ≥0.9.0).bs_add_rules().Verification
uiobject builds and renders to HTML (Sass compiles) with no errors and no warnings;serveris a valid function.🤖 Generated with Claude Code