-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- '.github/workflows/tests.yml' | ||
- 'src/obr/**.py' | ||
- 'pyproject.toml' | ||
- 'uv.lock' | ||
pull_request: | ||
paths: | ||
- '.github/workflows/tests.yml' | ||
- 'src/obr/**.py' | ||
- 'pyproject.toml' | ||
- 'uv.lock' | ||
jobs: | ||
ci: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v5 | ||
- name: Setup uv | ||
run: curl -LsSf https://astral.sh/uv/0.4.0/install.sh | sh | ||
- name: Install the project | ||
run: uv sync --all-extras --dev | ||
- name: Run tests | ||
run: uv run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[project] | ||
name = "obr" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.10" | ||
dependencies = [ | ||
"chevron>=0.14.0", | ||
"pandas>=2.2.2", | ||
"python-dateutil>=2.9.0.post0", | ||
"plotly>=5.23.0", | ||
"boto3>=1.35.8", | ||
] | ||
scripts = { obr = "obr:main" } | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"pytest>=8.3.2", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import sys | ||
import argparse | ||
from .util import build | ||
from .outbreaks import OUTBREAKS | ||
|
||
|
||
def abort(msg): | ||
print(msg) | ||
sys.exit(1) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="Global.health outbreak report creator" | ||
) | ||
parser.add_argument("outbreak", help="Outbreak name") | ||
parser.add_argument("url", help="Data URL") | ||
parser.add_argument("-b", "--bucket", help="S3 bucket to write outbreak report to") | ||
parser.add_argument( | ||
"--cloudfront", help="Cloudfront distribution which should be invalidated" | ||
) | ||
|
||
args = parser.parse_args() | ||
if args.outbreak not in OUTBREAKS: | ||
abort(f"Outbreak not supported: {args.outbreak}") | ||
|
||
build( | ||
args.outbreak, | ||
args.url, | ||
OUTBREAKS[args.outbreak], | ||
output_bucket=args.bucket, | ||
cloudfront_distribution=args.cloudfront, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
Outbreak configurations | ||
""" | ||
|
||
from ..plots import ( | ||
get_counts, | ||
plot_epicurve, | ||
plot_timeseries_location_status, | ||
plot_age_gender, | ||
plot_delay_distribution, | ||
) | ||
|
||
outbreak_marburg = [ | ||
("data", get_counts), | ||
("figure/epicurve", plot_epicurve), | ||
( | ||
"figure/epicurve_location_status", | ||
plot_timeseries_location_status, | ||
dict(admin_column="Location_District"), | ||
), | ||
("figure/age_gender", plot_age_gender), | ||
( | ||
"figure/delay_distribution_consult", | ||
plot_delay_distribution, | ||
dict( | ||
col="Date_of_first_consult", | ||
title="Delay to consultation from onset", | ||
index="A", | ||
max_delay_days=20, | ||
), | ||
), | ||
( | ||
"figure/delay_distribution_death", | ||
plot_delay_distribution, | ||
dict( | ||
col="Date_death", | ||
title="Delay to death from onset", | ||
index="B", | ||
max_delay_days=20, | ||
), | ||
), | ||
] | ||
|
||
OUTBREAKS = {"marburg": outbreak_marburg} | ||
__all__ = ["OUTBREAKS"] |
Oops, something went wrong.