Offline AI support for public health analysis

An R coding assistant that runs on your own laptop. Ask for code in plain English inside RStudio, and get tested, checked R for spatial epidemiology, with no internet connection, no cloud account and no data leaving the machine.

Prototype: coming soon Code on GitHub: coming soon
Analogue AI Side A offline R assistant runs on your laptop
Works with no internet Data stays on your laptop 37 tested recipes, plus your own Open source
Side A

What it does

A chat panel in RStudio's Viewer, like asking a colleague who knows R and spatial epidemiology, except it never needs the internet.

  1. A1

    Ask in plain English

    "Calculate monthly malaria incidence per 1,000 people for each district, with 95% confidence intervals, and map the latest month." It sees the objects and column names in your R session, so the code uses your real case and population data.

  2. A2

    Built from tested recipes

    Rates with exact intervals, age standardisation, epidemic curves, outbreak thresholds, OpenStreetMap, rasters and zonal statistics, catchments, neighbours, BYM2 disease mapping and spatial cross-validation.

  3. A3

    Checked before you see it

    Every function and argument is checked against the packages you have installed, and every column against your tables. Invented names, hand-written formulas and sf objects saved as broken CSVs are sent back for correction.

  4. A4

    Run, fix and carry on

    Run code in your own session from the chat. See the plot, the objects it made and the files it saved. A missing package prefix gets a one-click fix; other errors go back with the message.

  5. A5

    Organised projects

    Each chat gets a project folder with code, plots, tables, models, data and the conversation. Every script starts with a setup block, so it runs on its own and moves with one line changed.

  6. A6

    Grows with your work

    It starts with 37 tested recipes and adapts as you use it. Save the scripts you trust as your own recipes, or point it at a folder of your code, and it draws on them alongside the built-in ones, in your style and with your function names. A programme or government team can keep one shared folder of approved scripts, so everyone's code starts from the same methods.

  7. A7

    A printed book for the worst days

    The recipes also come as a Word book, so the methods are there even when the laptop's battery is not.

Side B

How it works

AI coding assistants have become part of everyday analysis: they write, explain and debug code in seconds. But they run on remote servers, so they stop working when the internet does, and every question and every line of code goes to someone else's computer.

Models small enough to run on a laptop avoid both problems, but they make more mistakes. Analogue AI closes that gap by not relying on the model alone: the app does the steering. It finds tested recipes for the task, checks every answer against your installed packages and your data, and only then shows you the code.

B1

Find

Searches the recipes and your own scripts for the parts of your question.

B2

Write

A local model (via Ollama) writes code from those recipes, using your objects.

B3

Check

Functions, arguments, columns, packages and formulas, corrected up to twice.

B4

Run

In your R session, with outputs saved to the project folder.

B5

Next

Suggests the usual next step: standardise, add neighbours, smooth.

Always read the code before you rely on it. The checks catch many errors, not all; the recipes are where the statistics are known to be right.

Liner notes

Why offline

When the network or power goes

Storms, floods and outages cut connections just when analysis is needed. Analogue AI needs no internet, and runs on a laptop battery, a power bank or a small solar charger.

When the data are sensitive

Health data and code never leave the machine: no third-party server, API key or cloud account. Your data-sharing agreements and storage rules still apply.

When resources are tight

It uses a small open model on an ordinary laptop, with no dependence on data-centre capacity, and an offline copy of the R packages it needs.

Track list

37 tested recipes

Core spatial and data workNew: epidemiology and surveillance

Each recipe is a set of R functions that take your own data and column names, check their inputs, and stop with a plain message when something is wrong. All of them run in an automated test suite (168 checks) before every release.

  • Rates and proportions with exact Poisson and Wilson intervals
  • Direct and indirect standardisation with the WHO world population
  • Seasonal and moving-baseline outbreak thresholds
  • Neighbour lists that handle islands
  • BYM2 disease mapping with INLA, when it is installed
  • Random forest and model comparison with spatial cross-validation
Getting started

Install

Analogue AI is still in testing, and the package will be available to download soon. This is how setup will work: once while you are online, and after that everything works offline.

R4.x, with RStudio
OllamaFree app that runs the model on your laptop
Modelqwen2.5-coder:7b, about 5 GB in memory
Laptop16 GB memory recommended; 8 GB works for short tasks
DiskKeep 15 to 20 GB free while the model runs
# in a terminal: get the model
ollama pull qwen2.5-coder:7b
ollama pull nomic-embed-text

# in R: install and start
install.packages("analogueai_0.7.4.tar.gz",
                 repos = NULL, type = "source")
library(analogueai)
ollama_status()
launch_assistant()

The setup script, prepare_offline.R, also caches the R packages, documentation and an offline copy of the recipe book.

Status

In development and testing

Analogue AI is currently at the prototype development and testing stage, and will be ready for use soon. The prototype was built in November 2026 and is being tested on routine spatial epidemiology tasks, including incidence rates, maps and neighbour structures, with a 7-billion-parameter model on a 16 GB MacBook Air. Each round of testing has shaped the checks above.

It is designed for analysts working where connectivity, power or data rules make cloud AI tools impractical. It will be released as open source; the licence and the public code repository are being finalised.