Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quicker quickstart #55

Merged
merged 6 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions samples/Bunny/bunny-demo.compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: bunny-demo

services:
db:
image: postgres:16
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: omop

omop-lite:
image: ghcr.io/health-informatics-uon/omop-lite
depends_on:
- db
environment:
DB_PASSWORD: postgres
DB_NAME: omop
SYNTHETIC: true

bunny:
image: ghcr.io/health-informatics-uon/hutch/bunny:edge
environment:
DATASOURCE_DB_USERNAME: postgres
DATASOURCE_DB_PASSWORD: postgres
DATASOURCE_DB_DATABASE: omop
DATASOURCE_DB_DRIVERNAME: postgresql
DATASOURCE_DB_SCHEMA: omop
DATASOURCE_DB_PORT: 5432
DATASOURCE_DB_HOST: db
BUNNY_LOGGER_LEVEL: DEBUG
depends_on:
omop-lite:
condition: service_completed_successfully
86 changes: 49 additions & 37 deletions website/pages/bunny/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
import { Steps } from "nextra/components";
import { Callout } from "nextra/components";

# Quickstart

The quickest way to run Bunny is to use the provided [Bunny Image](https://github.com/Health-Informatics-UoN/hutch-bunny/pkgs/container/hutch%2Fbunny) command line interface to run a query against your existing OMOP database. This way you don't need an upstream Task API to connect to yet.
The easiest way to run Bunny is by using the provided [Bunny Image](https://github.com/Health-Informatics-UoN/hutch-bunny/pkgs/container/hutch%2Fbunny) command line interface to query an OMOP CDM database, without needing an upstream Task API.

This guide will help you quickly set up a local OMOP CDM database and run a query against it.

## Prerequisites

- A [OMOP CDM](developers/omop_cdm) database
- Docker

## Setup
## Run a query

<Steps>
### Configuration
You'll need to set some environment variables to connect the container to the database, you can create a `.env` file with your database details:

```bash copy filename=".env"
DATASOURCE_DB_USERNAME=postgres
DATASOURCE_DB_PASSWORD=postgres
DATASOURCE_DB_DATABASE=postgres
DATASOURCE_DB_DRIVERNAME=postgresql
DATASOURCE_DB_SCHEMA=public
DATASOURCE_DB_PORT=5432
DATASOURCE_DB_HOST=localhost
### Get the Demo Compose file

Download the [sample Bunny Demo Compose](https://raw.githubusercontent.com/Health-Informatics-UoN/hutch/refs/heads/main/samples/Bunny/bunny-demo.compose.yml) file by running the command:

```bash copy
curl -O https://raw.githubusercontent.com/Health-Informatics-UoN/hutch/refs/heads/main/samples/Bunny/bunny-demo.compose.yml
```

See [configuration](config) for further details.
Or manually saving it to a file `bunny-demo.compose.yml`

### Run the Compose file

### Sample query file
This will start the database, initialise it with a synthetic OMOP CDM dataset, and run a query against it.

For ease, the sample query is a .json file:
```bash copy
docker compose -f bunny-demo.compose.yml run --entrypoint uv bunny run bunny --body tests/queries/availability.json
```

This will take a minute or so to download the images and start the containers.

The query file is a JSON file that contains the query to run, which is a simple cohort definition, querying the `Person` table for `8507`.

```json copy filename="availability.json"
{
Expand Down Expand Up @@ -61,34 +65,42 @@ For ease, the sample query is a .json file:
}
```

## Run a query
<Callout emoji="🎉">Congratulations on your first Bunny query!</Callout>

You can run the query command directly against the Container, by mounting its volume and passing the arguments.
### View the results

```bash copy
docker run \
-v $(pwd)/availability.json:/availability.json \
-v $(pwd)/output.json:/output.json \
--env-file .env \
--entrypoint uv \
ghcr.io/health-informatics-uon/hutch/bunny:edge \
run bunny --body /availability.json
You should see output like the following:

```json
{
"status": "ok",
"protocolVersion": "v2",
"uuid": "unique_id",
"queryResult": {
"count": 44,
"datasetCount": 0,
"files": []
},
"message": "",
"collection_id": "collection_id"
}
```

If you're running your OMOP CDM database in Docker, then you'll need to add the Bunny container to the same network to access it. You can do this by adding the `network` argument to the run command.
That contains the **results** of the query, which was 44.

### Clean up

```bash copy
docker run \
--network omop-cdm \
-v $(pwd)/availability.json:/availability.json \
-v $(pwd)/output.json:/output.json \
--env-file .env \
--entrypoint uv \
ghcr.io/health-informatics-uon/hutch/bunny:edge \
run bunny --body /availability.json
docker compose -f bunny-demo.compose.yml down
```

Your results should be available in `output.json`
This will stop the database and remove the containers.

To remove the images, run:

```bash copy
docker rmi -f ghcr.io/health-informatics-uon/omop-lite:latest ghcr.io/health-informatics-uon/hutch/bunny:edge
```

</Steps>

Expand Down
12 changes: 9 additions & 3 deletions website/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Cards } from 'nextra/components'
import { Rabbit, Repeat, Lock } from "lucide-react";

![](/images/hutch-logo-colour.svg)

# Welcome to Hutch
Hutch provides tools for federated activities in secure environments.
### Hutch provides tools for federated activities in secure environments.

You can find the documentation for the Hutch implementation of the Executing Agent module of the TRE-FX stack at [Hutch TRE-FX](https://health-informatics-uon.github.io/hutch-trefx/).
<Cards>
<Cards.Card title="Bunny" icon={<Rabbit />} href="/bunny" />
<Cards.Card title="Relay" icon={<Repeat />} href="/relay"/>
<Cards.Card title="TRE-FX" icon={<Lock />} href="https://health-informatics-uon.github.io/hutch-trefx/"/>

</Cards>