How johnpaulpatigas/pfas-digital-playground works
PFAS toxicokinetic modeling playground for exploring exposure and population risk among Filipino women. Users configure cohort and exposure parameters, choose a PFAS compound and sampling method, then run simulations and inspect risk summaries, sensitivity, charts, and exports. The app also provides a method-comparison view and scientific/reference pages. The principal flow is evidenced by the routed pages, PlaygroundPage, and simulation modules; chart and analysis relationships rely on the SOURCE INDEX where full source was not excerpted. The worker implementation is included, but its dispatch path is not asserted.
Main entry points: PlaygroundPage.tsx Playground page · runSimulationAsync.ts Async runner · App.tsx App routes · toxicokinetics.ts Toxicokinetics
Components 26
Application and pages
- App routes
src/App.tsx - Home page
src/pages/HomePage.tsx - Playground page
src/pages/PlaygroundPage.tsx - Method comparison
src/pages/ComparePage.tsx - Documentation
src/pages/DocsPage.tsx - Scientific guide
src/pages/ScientificGuidePage.tsx
Scenario and controls
- Cohort presets
src/features/scenarios/presets.ts - Parameter controls
src/features/playground/ParameterSidebar.tsx - Distribution selector
src/features/playground/DistributionSelector.tsx - Parameter guide
src/features/playground/ParameterGuideModal.tsx - Simulation state
src/stores/useSimulationStore.ts
Simulation engine
- PFAS profiles
src/simulation/pfasCompounds.ts - Async runner
src/simulation/runSimulationAsync.ts - Simulation worker
src/simulation/workers/simulationWorker.ts - Monte Carlo
src/simulation/monteCarlo.ts - Latin hypercube
src/simulation/latinHypercube.ts - Hybrid sampler
src/simulation/monteCarloLhs.ts - Distribution sampling
src/simulation/distributions.ts - Toxicokinetics
src/simulation/toxicokinetics.ts
Results and analysis
- Statistics
src/simulation/statistics.ts - Summary panel
src/features/statistics/SummaryPanel.tsx - Exceedance analysis
src/features/playground/ExceedanceAnalyzer.tsx - Simulation charts
src/features/charts - Data export
src/utils/exportUtils.ts - Execution console
src/features/playground/SimulationConsole.tsx
Other components
- User
Connections 42
- User → App routes: opens app
src/App.tsx - App routes → Home page: routes to
src/App.tsx - App routes → Playground page: routes to
src/App.tsx - App routes → Method comparison: routes to
src/App.tsx - App routes → Documentation: routes to
src/App.tsx - App routes → Scientific guide: routes to
src/App.tsx - User → Playground page: configures and runs
src/pages/PlaygroundPage.tsx - Playground page → Parameter controls: renders
src/pages/PlaygroundPage.tsx - Playground page → Summary panel: renders
src/pages/PlaygroundPage.tsx - Playground page → Exceedance analysis: renders
src/pages/PlaygroundPage.tsx - Playground page → Simulation charts: renders
src/pages/PlaygroundPage.tsx - Playground page → Data export: uses
src/pages/PlaygroundPage.tsx - Playground page → Execution console: renders
src/pages/PlaygroundPage.tsx - Parameter controls → Simulation state: updates
src/features/playground/ParameterSidebar.tsx - Parameter controls → Distribution selector: renders
src/features/playground/ParameterSidebar.tsx - Parameter controls → Cohort presets: loads cohort presets
src/features/playground/ParameterSidebar.tsx - Parameter guide → Cohort presets: uses cohort presets
src/features/playground/ParameterGuideModal.tsx - Parameter guide → Simulation state: reads state
src/features/playground/ParameterGuideModal.tsx - Playground page → Async runner: executes simulation
src/pages/PlaygroundPage.tsx - Async runner → Monte Carlo: dispatches by method
src/simulation/runSimulationAsync.ts - Async runner → Latin hypercube: dispatches by method
src/simulation/runSimulationAsync.ts - Async runner → Hybrid sampler: dispatches by method
src/simulation/runSimulationAsync.ts - Monte Carlo → Distribution sampling: samples from
src/simulation/monteCarlo.ts - Latin hypercube → Distribution sampling: samples from
src/simulation/latinHypercube.ts - Hybrid sampler → Monte Carlo: uses
src/simulation/monteCarloLhs.ts - Hybrid sampler → Latin hypercube: uses
src/simulation/monteCarloLhs.ts - Monte Carlo → Toxicokinetics: calculates outcomes
src/simulation/monteCarlo.ts - Latin hypercube → Toxicokinetics: calculates outcomes
src/simulation/latinHypercube.ts - Async runner → Statistics: calculates summaries
src/simulation/runSimulationAsync.ts - Async runner → Toxicokinetics: calculates compound summaries
src/simulation/runSimulationAsync.ts - Toxicokinetics → PFAS profiles: uses profiles
src/simulation/toxicokinetics.ts - Async runner → Simulation state: returns results to page
src/pages/PlaygroundPage.tsx - Summary panel → Simulation state: reads results
src/features/statistics/SummaryPanel.tsx - Simulation charts → Simulation state: reads results
src/features/charts/CDFChart.tsx - Exceedance analysis → Toxicokinetics: uses risk calculations
src/features/playground/ExceedanceAnalyzer.tsx - Method comparison → Async runner: runs comparisons
src/pages/ComparePage.tsx - Method comparison → Statistics: uses statistics
src/pages/ComparePage.tsx - Simulation worker → Monte Carlo: dispatches sampling
src/simulation/workers/simulationWorker.ts - Simulation worker → Latin hypercube: dispatches sampling
src/simulation/workers/simulationWorker.ts - Simulation worker → Hybrid sampler: dispatches sampling
src/simulation/workers/simulationWorker.ts - Simulation worker → Statistics: calculates summaries
src/simulation/workers/simulationWorker.ts - Simulation worker → Toxicokinetics: calculates compound summaries
src/simulation/workers/simulationWorker.ts