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

yaml config #8

Merged
merged 7 commits into from
Oct 17, 2024
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
17 changes: 17 additions & 0 deletions outbreaks/includes/mpox-2024/2024-10-17_footnotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Footnotes for Africa CDC (ACDC) Epidemic Intelligence Weekly Report, 12 October
2024 and WHO 2022-24 Mpox (Monkeypox) Outbreak: Global Trends Dashboard. Users
should refer to
[GitHub](https://github.com/globaldothealth/outbreak-data/issues?q=is%3Aissue+is%3Aopen+label%3A%22mpox+2024%22)
to review all Open and Closed Issues.

- **DRC**: G.h case counts, for suspected and confirmed cases, now align with
WHO’s dashboard data [starting with data as of 2024-10-13]. Africa CDC has not
reported suspected counts for two report cycles.
- **Burundi**: G.h case counts, for suspected and confirmed cases, now align
with WHO’s dashboard data [starting with data as of 2024-10-13]. Africa CDC
case counts trail behind WHO counts.
- **Uganda**: G.h will only provide confirmed case counts for Uganda moving
forward.
- **Kenya**: location of death is not provided by source. G.h is unable to
capture this death in a linelist format. Deaths by country are provided in a
table format in our briefing report.
24 changes: 24 additions & 0 deletions outbreaks/marburg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: marburg
id: GHL2023.D11.1D60.1
description: Marburg 2023 Equatorial Guinea
schema: https://raw.githubusercontent.com/globaldothealth/outbreak-schema/main/outbreak.schema.json
plots:
data/get_counts:
date_col: Data_up_to
figure/epicurve:
title: Date of symptom onset
date_col: Date_onset_estimated
groupby_col: Case_status
figure/epicurve_location_status:
admin_column: Location_District
figure/age_gender:
figure/delay_distribution_consult:
col: Date_of_first_consult
title: Delay to consultation from onset
index: A
max_delay_days: 20
figure/delay_distribution_death:
col: Date_death
title: Delay to death from onset
index: B
max_delay_days: 20
33 changes: 33 additions & 0 deletions outbreaks/mpox-2024.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: mpox-2024
id: GHL2024.D11.1E71
description: Mpox 2024
url: https://mpox-2024.s3.eu-central-1.amazonaws.com/latest.csv
schema: https://raw.githubusercontent.com/globaldothealth/outbreak-schema/main/GHL2024.D11.1E71.schema.json
plots:
data/get_counts:
date_col: Date_entry
figure/age_gender:
table/clades/source_databutton:
link: https://worldhealthorg.shinyapps.io/mpx_global
button_text: Download MPXV clades
rename_columns:
country: Country
iso3: ISO3
clade_status: Clade status
table/aggregate/mpox_2024_aggregate:
data/get_countries_with_status:
country_col: Location_Admin0
statuses: [confirmed, suspected]
date/get_countries_with_anyof_statuses:
country_col: Location_Admin0
statuses: [confirmed, suspected]
figure/epicurve_source_report:
title: Date of report in primary source
date_col: Date_report_source_I
groupby_col: Case_status
values: [confirmed, suspected]
figure/epicurve_confirmed:
title: Date of case confirmation
date_col: Date_confirmation
groupby_col: Case_status
values: [confirmed]
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
This report may be cited as:
</p>
<p class="citation-text">
Global.health {{ description }} briefing report, published {{ published_date }},<br>
retrieved from https://reports.global.health/{{ name }}/{{ published_date }}.html
Global.health {{ description }} briefing report, published {{ published_date }}, retrieved from<br>
https://reports.global.health/{{ name }}/{{ published_date }}.html
</p>
<p>If you cite this report, please also cite the relevant sources, which are
mentioned in our <a href="https://github.com/globaldothealth/outbreak-data/wiki/{{ id }}">outbreak information page</a>.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@
<figcaption><strong>Table 2</strong>: MPXV clade distribution, source:
<a href="https://worldhealthorg.shinyapps.io/mpx_global/">WHO Mpox briefing report</a></figcaption>
</figure>

{{#footnotes}}
<h2>Footnotes</h2>
{{{ footnotes }}}
{{/footnotes}}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ dependencies = [
"fastjsonschema>=2.20.0",
"requests>=2.32.3",
"pygsheets>=2.0.6",
"pyyaml>=6.0.2",
"mistune>=3.0.2",
"python-dotenv>=1.0.1",
]
scripts = { olm = "olm:main" }

Expand Down
32 changes: 15 additions & 17 deletions src/olm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from pathlib import Path

import requests
from dotenv import load_dotenv

from .report import make_report
from .lint import lint
from .outbreaks import OUTBREAKS
from .util import msg_ok, msg_fail, bold_brackets
from .outbreaks import OUTBREAKS, OUTBREAKS_PATH, Outbreak

load_dotenv()

USAGE = """[olm]: [O]ffice for [L]inelist [M]anagement

Expand Down Expand Up @@ -80,35 +81,32 @@ def main():
match args.command:
case "list":
for outbreak in OUTBREAKS:
outbreak = Outbreak(OUTBREAKS_PATH / f"{outbreak}.yml")
print(
f"\033[1m{outbreak:12s} \033[0m{OUTBREAKS[outbreak]['description']} [{OUTBREAKS[outbreak]['id']}]"
f"\033[1m{outbreak:12s} \033[0m{outbreak.description} [{outbreak.id}]"
)
case "get":
if "url" not in OUTBREAKS[args.outbreak]:
outbreak = Outbreak(OUTBREAKS_PATH / f"{args.outbreak}.yml")
if outbreak.url is None:
abort(f"no data URL found for {bold_outbreak}")
output_file = f"{args.outbreak}.csv"
if (
res := requests.get(OUTBREAKS[args.outbreak]["url"])
).status_code == 200:
if (res := requests.get(outbreak.url)).status_code == 200:
Path(output_file).write_text(res.text)
msg_ok("get", "wrote " + output_file)
case "lint":
outbreak = Outbreak(OUTBREAKS_PATH / f"{args.outbreak}.yml", args.data)
ignore_keys = args.ignore.split(",") if args.ignore is not None else []
if (
lint_result := lint(args.outbreak, args.data, args.schema, ignore_keys)
).ok:
if (lint_result := outbreak.lint(ignore_keys)).ok:
msg_ok("lint", "succeeded for " + bold_outbreak)
else:
msg_fail("lint", "failed for " + bold_outbreak)
print(lint_result)
sys.exit(2)
case "report":
make_report(
args.outbreak,
args.data or OUTBREAKS[args.outbreak]["url"],
OUTBREAKS[args.outbreak],
output_bucket=args.bucket,
cloudfront_distribution=args.cloudfront,
outbreak = Outbreak(OUTBREAKS_PATH / f"{args.outbreak}.yml", args.data)
outbreak.make_report(
args.bucket,
args.cloudfront,
)
if args.open and (Path(args.outbreak + ".html")).exists():
webbrowser.open("file://" + str(Path.cwd() / (args.outbreak + ".html")))
Expand Down
39 changes: 0 additions & 39 deletions src/olm/lint.py

This file was deleted.

Loading