The corr command line#
corr is installed with corr-vars (uv add corr-vars or
pip install corr-vars). It helps build a study with a coding agent (Claude
Code, OpenCode): it scaffolds a study, looks up concepts, writes a
privacy-safe codebook of a saved cohort and, when patient-level data live on a
separate server, moves the code there and the aggregated results back. Every
command works on its own; none needs the whole workflow.
Quick start with the demo data#
corr init --demo builds a study on the public, fully synthetic
charite_demo dataset and the public demo Concepts API. It needs no account,
no key and no server, so it runs anywhere:
uv tool install corr-vars # or: pipx install corr-vars
corr init --demo my-study
cd my-study
uv sync
uv run pre-commit install
# now ask your coding agent to build the study
The study holds corr.toml, pyproject.toml, AGENTS.md,
config.py, extraction/, analysis/, exploration/, output/
(ignored by git) and output_agg/, plus the agent skill in
.claude/skills/corr/. Its corr.toml names the demo project and the public
demo key, and has no [server] table: a demo study runs locally only.
Working with a separate data server#
When the data may not leave a server, the study is written on a laptop and run on the server; only aggregated output comes back:
laptop server
────── ──────
corr init my-study --host H
agent writes extraction/ analysis/
corr push ─────────────────────────▶ python -m extraction.main
(writes output/cohort.corr3 and
output_agg/codebook.md)
corr pull ◀───── output_agg/ only ──
agent reads the codebook, writes the analysis, repeat
People working directly on the data machine need none of this; for them the
useful part is Cohort.codebook()
or corr codebook.
Commands#
corr init <dir> (--demo | --host H) [--project P] [--source S] [--url URL] [--remote-path PATH] [--no-git]Scaffold a study into a new or empty directory and run
git init(--no-gitskips it). With--demothe study usescharite_demoand the public demo key. Without it,corr initneeds a Concepts API key (it asks for one when none is stored, seecorr login) and a project: it asks when the key can read several.--hostis required without--demo(and refused with it): the server forcorr push/corr pull(anythingsshaccepts);--remote-pathis the study root there (default~/studies/<name>).--sourcenames the data source whose routing picks the Concepts API (defaultcharite_demo);--urloverrides the endpoint.corr loginPrompt for a Concepts API key, check it with
GET /projectsand store it in~/.config/corr/.env($XDG_CONFIG_HOME/corr/.env; mode 600). On a data server, run it there as well. The key is never stored in a study.corr skill install [dir]Copy the agent skill into
<dir>/.claude/skills/corr/of any project (default: the current directory), replacing an older copy. Run it again after upgrading corr-vars. OpenCode reads the same directory.corr concepts search <term>/corr concepts show <name>Look up concepts before writing code.
searchranks names, description and documentation by relevance (--status,--only-source,--type,--limitup to 200,--json).showprints a concept’s documentation and each source’sjsonandpydefinition. The project comes from--project,corr.tomlorCORR_CONCEPTS_PROJECT; the endpoint from--url, or from the routing of--source/ the study’ssource(see Concepts API). Outside a study, query the demo API with--source charite_demo --project demo.corr codebook <file.corr3> [-o DIR] [--min-count K]Write
codebook.mdandcodebook.jsonfor a saved cohort (default directory:output_agg/of the study, or of the working directory). See Codebook for what it contains and what it leaves out.corr push [--dry-run] [-y/--yes]/corr pull [--dry-run]rsync the study code to
[server]incorr.tomland fetchoutput_agg/back.output*/,*.corr3,.env,.git/,.venv/and caches are never pushed. Server files that no longer exist locally are listed and deleted only after you confirm (--yesskips the question; without a terminal they are kept). Nothing runs on the server: you run the scripts there yourself. Needsrsyncandssh; on Windows use WSL.
corr --version prints the installed version; corr <command> --help lists
every option.
corr.toml#
[study]
name = "my-study"
project = "my_project" # Concepts API project
source = "my_source" # data source; its routing picks the Concepts API
[server]
host = "data-server" # anything ssh accepts
path = "~/studies/my-study" # study root on the server
It holds no per-user data and is pushed with the code. A demo study has
source = "charite_demo", the public demo api_key under [study] and
no [server] table.
API key lookup#
An explicit Cohort(api_key=...), then the CORR_CONCEPTS_API_KEY
environment variable, then CORR_CONCEPTS_API_KEY in ~/.config/corr/.env.