A minimal Plumber API that runs brms/Stan fits for seroCOP on the server and returns JSON + base64 plots. This supports the hybrid approach recommended by Alix: browser for UI, server for model fitting.
GET /health: basic health check and seroCOP versionPOST /fit: multipart/form-data upload withcsvfile and options
csv(file): CSV datasetinfected_col(string, defaultinfected): binary outcome columntire_col(string, optional): biomarker/titre column; if omitted, first numeric column is chosenchains(int, default 2): Stan chainsiter(int, default 1000): iterations per chain
R -e "pr <- plumber::plumb('plumber.R'); pr$run(host='0.0.0.0', port=8001)"Or with Docker.
The included Dockerfile uses rocker/r-ver and installs system deps + R packages.
# Build
docker build -t serocop-api:latest ./seroCOP-api
# Run
docker run --rm -p 8001:8001 serocop-api:latestcurl -X POST \
-F csv=@examples/example_data.csv \
-F infected_col=infected \
-F chains=2 \
-F iter=1000 \
http://localhost:8001/fit- In the browser, detect if the dataset requires server fitting (i.e., brms/Stan). If yes, POST to
/fitand render returned plot and metrics. - For small demos, keep the client-side simplified glm path; otherwise offload to this API.