How pmsims-package/pmsims works
Main components
• Core R package (the “pmsims engine”)
• Data generators module (R/data_generators.R)
• Model generators module (R/model_generators.R)
• Metric generators module (R/metric_generators.R & calculate_metrics_perf.R)
• Surrogate models & tuning modules (R/surrogate_models.R, R/*_tuning.R)
• Simulation wrappers & orchestrator (R/simulate_*.R, pmsims_objective_function.R)
• Plotting & reporting (R/plotting.R, R/summary.R)
• Input validation & printing (R/input_validation.R, R/print.R)
• External R ecosystem
• Base R & CRAN dependencies (stats, graphics, etc.)
• User‐supplied functions or models
• Documentation site (pkgdown)
• Docs content (docs/*, pkgdown.yml)
• Vignettes (vignettes/*.Rmd)
• Testing suite
• Unit tests (tests/testthat/*.R)
• Test runner (tests/testthat.R)
• CI/CD pipelines (GitHub Actions)
• R-CMD-check, formatting, coverage, pkgdown deploy
• Docker environment
• docker/Dockerfile for reproducible builds
Relationships and data flow
• “User script or R session” → calls “pmsims engine” APIs → internal flow:
Data generators → Model generators → Metric generators → Tuning loops → Summaries/Plots → Returned R objects/plots
• CI/CD: push to GitHub → triggers workflows → runs tests against the engine → builds pkgdown site → optional Docker build
• Documentation: pkgdown pipeline reads R source & man/ Rd files → outputs HTML under docs/ → served on GitHub Pages
• Docker: encapsulates R environment + pmsims code → used for CI or local reproducibility
Architectural patterns & design principles
• Modular code organization: each R script implements a single concern (e.g., data gen, tuning)
• Dependency injection: user can plug in custom data‐ or model‐generators
• Separation of concerns:
• Core simulation logic vs. metrics vs. plotting
• Testing and docs outside core package
• CI as code: GitHub Actions workflows centrally orchestrate checks, builds, and deployment
Technologies & frameworks
• R (language & runtime)
• testthat (unit testing)
• pkgdown (documentation site generator)
• GitHub Actions (CI/CD)
• Docker (reproducible environment)
• remotes (GitHub install)
Elements
• Tests & CI (another)
• Docs & website (another)
• Docker environment (another)
• Notes on the side for technologies (e.g., “testthat,” “pkgdown,” “Dockerfile”)