# Score a Disease Surveillance Model Inside Snowflake, Without Moving > Technical blog post by Marissa Pierce, published June 24, 2026. Demonstrates a complete end-to-end workflow for public health and science teams to run R and Python disease surveillance models inside Snowflake using the Posit Team Native App — without exporting protected data. Covers HIPAA/FISMA compliance, in-database computation, reproducibility for peer review, and deployment of interactive applications to program leadership. Audience: epidemiologists, public health data scientists, and IT/compliance teams in government and regulated environments. ## Core Problem Addressed Surveillance teams commonly have protected data (case data, vital records, environmental monitoring) in a governed Snowflake warehouse, but model development happens outside: local R installs, shared drives, data extracts that create new copies of protected data to track and destroy. Every copy creates compliance exposure and makes reproducing a published incidence estimate harder. The Posit Team Native App removes this constraint by running the entire toolchain inside Snowflake's security boundary. ## Architecture The Posit Team Native App runs Posit Workbench, Posit Connect, and Posit Package Manager on Snowpark Container Services inside the customer's own Snowflake account. Analysts open Positron Pro, RStudio Pro, JupyterLab, or VS Code from a browser; the session is a container running under a Snowflake service role. Authentication uses OAuth tokens rather than stored credentials. Snowflake RBAC, masking policies, and row access policies govern everything — both the underlying data and the analytical toolchain. ## The Five-Step Workflow (R, with Python equivalents) **Step 1 — Query with `dbplyr`:** Reference warehouse tables as lazy data frames. `dplyr` code translates to Snowflake SQL, so aggregations (`COUNT`, `MEDIAN`) run in the warehouse. Nothing executes until explicitly called. Use `show_query()` to inspect the generated SQL. **Step 2 — Fit with `tidymodels`:** Pull a reproducible sample into R with `collect()`. Fit a model (example uses linear regression for incidence) using a `tidymodels` recipe and workflow. Include `step_other()` to handle unseen county levels at scoring time. **Step 3 — Score in-database with `orbital`:** `orbital` translates the fitted `tidymodels` workflow into SQL equations. Calling `predict(incidence_orbital, county_weeks)` produces a SQL `SELECT` statement. The arithmetic runs inside Snowflake across every county and week — turning an overnight single-machine batch into a query that returns in seconds or minutes. Write results back with `compute()` to persist as a governed table. Works equivalently for scikit-learn (Python) pipelines. **Step 4 — Publish with Posit Connect:** Connect runs inside the same Snowflake account. A Shiny application reading from the scored table can be deployed with `rsconnect::deployApp()` or the Posit Publisher IDE extension. Users authenticate against Snowflake; Connect passes identity through to the database, so a user who can only see one jurisdiction's data in the warehouse sees only that jurisdiction in the app. **Step 5 — Pin for reproducibility:** Code versioned in Git + package versions pinned via Posit Package Manager + training data pinned to a Snowflake Time Travel snapshot (AT TIMESTAMP). A peer reviewer gets a commit hash, a package snapshot, and a timestamp — not an archaeology project. ## Compliance and Governance Running inside Snowflake answers the four questions HIPAA, FISMA, and peer review all require: 1. What data went in? — query history tied to Snowflake user and role 2. What code and package versions produced the output? — Posit Connect deployment bundles pinned to Package Manager snapshots 3. Who saw it, and when? — Workbench session logs (start, stop, resource usage) + Connect audit logs 4. Can the result be reproduced? — Git + Package Manager + Snowflake Time Travel No data leaves the Snowflake account. Output tables are governed by the same RBAC as source data. ## Key R Packages Used - `DBI` / `odbc` — database connection (OAuth token from environment) - `dplyr` / `dbplyr` — lazy data frame queries that translate to Snowflake SQL - `tidymodels` — model fitting on a collected sample - `orbital` — translates fitted tidymodels (or scikit-learn) workflows to SQL for in-database scoring - `shiny` — interactive application for program leadership ## Posit Products Referenced - **Posit Team Native App** — Packages Workbench, Connect, and Package Manager as a Snowflake Native App on Snowpark Container Services - **Posit Workbench** — IDE environment (Positron Pro, RStudio Pro, JupyterLab, VS Code) - **Posit Connect** — Deployment platform for Shiny apps, APIs, Quarto reports; runs inside the same Snowflake account - **Posit Package Manager** — Curated R/Python/VS Code package repositories with OSV vulnerability data, pre-built binaries, and date-based snapshots for reproducibility ## Relevant Links - [Posit + Snowflake partnership page](https://posit.co/solutions/snowflake) - [Posit Team Native App on Snowflake Marketplace (30-day free trial)](https://app.snowflake.com/marketplace/listing/GZTSZMCB9S/posit-pbc-posit-team) - [Posit Team Native App documentation](https://docs.posit.co/partnerships/snowflake/posit-team/) - [orbital documentation](https://orbital.tidymodels.org/) - [dbplyr documentation](https://dbplyr.tidyverse.org/) - [Posit Workbench Connected App](https://app.snowflake.com/marketplace/listing/GZTSZ4NH3GCE/posit-pbc-posit-workbench-connected-app) - [Posit Connect Connected App](https://app.snowflake.com/marketplace/listing/GZTSZ4NH3GK2/posit-pbc-posit-connect-connected-app) - [Posit Package Manager Connected App](https://app.snowflake.com/marketplace/listing/GZTSZ4NH3GK6/posit-pbc-posit-package-manager-connected-app) - [Schedule a demo](https://posit.co/schedule-a-call) - [Posit Community forum](https://forum.posit.co/)