Skip to content

Commit

Permalink
Improve developer setup (#68)
Browse files Browse the repository at this point in the history
* Add availability json

* Update gitinogre

* Add omop-lite

* Add contributing

* Update gitignore

* Add main method and VSCode debug configurations

* Add distribution query test configuration

* Improve launch json
  • Loading branch information
AndyRae authored Feb 4, 2025
1 parent 87598d1 commit 90f6465
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,5 @@ cython_debug/

# PyPI configuration file
.pypirc

output.json
40 changes: 40 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Bunny Daemon",
"type": "debugpy",
"request": "launch",
"module": "hutch_bunny.daemon",
"justMyCode": true,
"console": "integratedTerminal"
},
{
"name": "Bunny CLI Availability",
"type": "debugpy",
"request": "launch",
"module": "hutch_bunny.cli",
"args": [
"--body",
"tests/queries/availability.json",
],
"justMyCode": true,
"console": "integratedTerminal"
},
{
"name": "Bunny CLI Distribution",
"type": "debugpy",
"request": "launch",
"module": "hutch_bunny.cli",
"args": [
"--body",
"tests/queries/distribution.json",
],
"justMyCode": true,
"console": "integratedTerminal"
}
]
}
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Contributing

Thanks for your interest in contributing!

Please find guidance to contributing to Bunny in our [documentation](https://health-informatics-uon.github.io/hutch/contributing).
10 changes: 10 additions & 0 deletions dev.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ services:
- 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

adminer:
image: wodby/adminer
Expand Down
4 changes: 4 additions & 0 deletions src/hutch_bunny/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ def main() -> None:
)
save_to_output(result, args.output)
logger.info(f"Saved results to {args.output}")


if __name__ == "__main__":
main()
5 changes: 5 additions & 0 deletions src/hutch_bunny/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from hutch_bunny.core.logger import logger
from hutch_bunny.core.setting_database import setting_database


def main() -> None:
settings.log_settings()
# Setting database connection
Expand Down Expand Up @@ -74,3 +75,7 @@ def main() -> None:
logger.info("Got http status code: %s", response.status_code)

time.sleep(settings.POLLING_INTERVAL)


if __name__ == "__main__":
main()
26 changes: 26 additions & 0 deletions tests/queries/availability.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"task_id": "job-2023-01-13-14: 20: 38-project",
"project": "project_id",
"owner": "user1",
"cohort": {
"groups": [
{
"rules": [
{
"varname": "OMOP",
"varcat": "Person",
"type": "TEXT",
"oper": "=",
"value": "8507"
}
],
"rules_oper": "AND"
}
],
"groups_oper": "OR"
},
"collection": "collection_id",
"protocol_version": "v2",
"char_salt": "salt",
"uuid": "unique_id"
}
7 changes: 7 additions & 0 deletions tests/queries/distribution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"code": "GENERIC",
"analysis": "DISTRIBUTION",
"uuid": "59952952-c187-432a-981a-b3d35e1a7087",
"collection": "RQ-CC-xuihj7ll-kjlj-3989-b201-587934a89797",
"owner": "user1"
}

0 comments on commit 90f6465

Please sign in to comment.