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

Initialise the repo with a current snapshot of Bunny #1

Merged
merged 7 commits into from
Jan 10, 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
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**/.dockerignore
**/.env
**/.venv
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

[*.py]
indent_size = 4 # pep8
profile = black
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
171 changes: 171 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# PyPI configuration file
.pypirc
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"test"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ghcr.io/astral-sh/uv:bookworm-slim

COPY . /app
WORKDIR /app

RUN uv sync --frozen

ENTRYPOINT ["uv", "run", "bunny-daemon"]
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# hutch-bunny
[![Hutch][hutch-logo]][hutch-repo]

# 🐇 Hutch Bunny ![MIT License][license-badge]

| | | |
|-|-|-|
| ![Python][python-badge] | [![Bunny Docker Images][docker-badge]][bunny-containers] | [![Bunny Docs][docs-badge]][bunny-docs] |

An HDR UK Cohort Discovery Task Resolver.

Fetches and resolves Availability and Distribution Queries against an OMOP-CDM database.

[hutch-logo]: https://raw.githubusercontent.com/HDRUK/hutch/main/assets/Hutch%20splash%20bg.svg
[hutch-repo]: https://github.com/health-informatics-uon/hutch

[bunny-docs]: https://health-informatics-uon.github.io/hutch/bunny
[bunny-containers]: https://github.com/Health-Informatics-UoN/hutch-cohort-discovery/pkgs/container/hutch%2Fbunny

[license-badge]: https://img.shields.io/github/license/health-informatics-uon/hutch-cohort-discovery.svg
[python-badge]: https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white
[docker-badge]: https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white
[docs-badge]: https://img.shields.io/badge/docs-black?style=for-the-badge&labelColor=%23222
[readme-badge]: https://img.shields.io/badge/readme-lightgrey?style=for-the-badge&labelColor=%23222
76 changes: 76 additions & 0 deletions dev.compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: hutch-bunny-dev

services:
db:
image: postgres:16
restart: always
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: postgres

adminer:
image: wodby/adminer
depends_on:
- db
restart: always
ports:
- 9000:9000
environment:
ADMINER_DEFAULT_DB_DRIVER: pgsql
ADMINER_DEFAULT_DB_HOST: db
ADMINER_DESIGN: pepa-linha

rabbitmq:
image: rabbitmq:3-management
ports:
- 5672:5672
- 15672:15672
environment:
RABBITMQ_DEFAULT_USER: user
RABBITMQ_DEFAULT_PASS: password

relay:
image: ghcr.io/health-informatics-uon/hutch/relay:dev-latest
depends_on:
- rabbitmq
- db
restart: always
ports:
- 8080:8080
- 8081:8081
environment:
DOTNET_Environment: Development
ConnectionStrings__Default: Server=db;Port=5432;Database=hutch-relay;User Id=postgres;Password=postgres
RelayTaskQueue__ConnectionString: amqp://user:password@rabbitmq:5672
Obfuscation__LowNumberSuppressionThreshold: 0
Obfuscation__RoundingTarget: 0
UpstreamTaskApi__BaseUrl: https://<task_api_host>
UpstreamTaskApi__CollectionId: collection_id
UpstreamTaskApi__Username: username
UpstreamTaskApi__Password: password
Database__ApplyMigrationsOnStartup: true

bunny:
build:
context: .
dockerfile: Dockerfile
depends_on:
- db
- relay
restart: always
environment:
DATASOURCE_DB_USERNAME: postgres
DATASOURCE_DB_PASSWORD: postgres
DATASOURCE_DB_DATABASE: hutch-omop
DATASOURCE_DB_DRIVERNAME: postgresql
DATASOURCE_DB_SCHEMA: public
DATASOURCE_DB_PORT: 5432
DATASOURCE_DB_HOST: db
TASK_API_BASE_URL: http://relay:8080/
TASK_API_USERNAME: username
TASK_API_PASSWORD: password
LOW_NUMBER_SUPPRESSION_THRESHOLD:
ROUNDING_TARGET:
POLLING_INTERVAL: 5
COLLECTION_ID: collection_id
22 changes: 22 additions & 0 deletions dev.standalone.compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: hutch-bunny-standalone-dev

services:
bunny:
build:
context: .
dockerfile: Dockerfile
environment:
DATASOURCE_DB_USERNAME: postgres
DATASOURCE_DB_PASSWORD: postgres
DATASOURCE_DB_DATABASE: hutch-omop
DATASOURCE_DB_SCHEMA: public
DATASOURCE_DB_PORT: 5432
DATASOURCE_DB_HOST: host.docker.internal
TASK_API_BASE_URL: https://<task_api_host>/link_connector_api
TASK_API_USERNAME: username
TASK_API_PASSWORD: password
COLLECTION_ID: collection_id
TASK_API_TYPE: a
LOW_NUMBER_SUPPRESSION_THRESHOLD:
ROUNDING_TARGET:
POLLING_INTERVAL: 5
Loading