Skip to content

Commit

Permalink
report: move out common header and footer
Browse files Browse the repository at this point in the history
  • Loading branch information
abhidg committed Sep 8, 2024
1 parent 63fbb47 commit 39ec0ee
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 338 deletions.
5 changes: 1 addition & 4 deletions src/olm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ def main():
make_report(
args.outbreak,
args.data or OUTBREAKS[args.outbreak]["url"],
OUTBREAKS[args.outbreak]["plots"],
date_columns=OUTBREAKS[args.outbreak].get(
"additional_date_columns", []
),
OUTBREAKS[args.outbreak],
output_bucket=args.bucket,
cloudfront_distribution=args.cloudfront,
)
Expand Down
12 changes: 2 additions & 10 deletions src/olm/outbreaks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Outbreak configurations
"""

from typing import TypedDict, Callable, Any, NotRequired
import pandas as pd
from ..plots import (
get_counts,
Expand All @@ -14,18 +13,11 @@
plot_age_gender,
plot_delay_distribution,
)
from ..types import OutbreakInfo
from ..util import read_csv
from ..sources import source_databutton


class OutbreakInfo(TypedDict):
id: str
description: str
plots: list[tuple[str, Callable[..., Any], dict[str, Any]]]
additional_date_columns: NotRequired[list[str]]
url: NotRequired[str]


outbreak_marburg = [
("data", get_counts, {"date_col": "Data_up_to"}),
(
Expand Down Expand Up @@ -119,7 +111,7 @@ class OutbreakInfo(TypedDict):
OUTBREAKS: dict[str, OutbreakInfo] = {
"marburg": {
"id": "GHL2023.D11.1D60.1",
"description": "Marburg 2023",
"description": "Marburg 2023 Equatorial Guinea",
"plots": outbreak_marburg,
"additional_date_columns": ["Data_up_to"],
},
Expand Down
7 changes: 7 additions & 0 deletions src/olm/outbreaks/_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<p><strong>Data accessibility and reproducibility</strong>: All data
used in this report are available from our data repository Should you identify any issues or have questions please
raise an issue on <a href="https://github.com/globaldothealth/outbreak-data">GitHub</a> or write to
us: <a href="mailto:info@global.health">info@global.health</a>.</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>.
</main></body></html>
35 changes: 35 additions & 0 deletions src/olm/outbreaks/_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ description }} Outbreak - {{ published_date }}</title>
<meta name="description" content="{{ description }} outbreak briefing report from Global.health">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://reports.global.health/style.css">
<link rel="shortcut icon" type="image/x-icon"
href="https://global.health/wp-content/uploads/2020/10/gs-favicon-green.png">
<link rel="apple-touch-icon" href="https://global.health/wp-content/uploads/2020/10/gs-favicon-green.png">
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
</head>

<body>
<nav>
<ul>
<li><a href="{{ data_url }}">Data</a></li>
<li><a href="https://github.com/globaldothealth/outbreak-data/wiki/{{ id }}">GitHub</a></li>
</ul>
<img class="logo" src="https://global.health/wp-content/uploads/2020/07/gh-logo-full-black.png"
alt="Global.health logo"></li>
</nav>
<main>
<h1>{{ description }} Outbreak</h1>
<p class="byline">From the <a href="https://global.health">Global.health</a> team (<a
href="mailto:info@global.health">info@global.health</a>). Published on {{ published_date}}
</p>
<h2>Summary</h2>
{{#info}}
<div class="info">
<p>{{ info }}</p>
</div>
{{/info}}
165 changes: 57 additions & 108 deletions src/olm/outbreaks/marburg.html
Original file line number Diff line number Diff line change
@@ -1,108 +1,57 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Marburg 2023 Equatorial Guinea Outbreak - {{ published_date }}</title>
<meta name="description" content="Marburg 2023 outbreak briefing report from Global.health">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://www.monkeypox.global.health/style.css">
<link rel="shortcut icon" type="image/x-icon"
href="https://global.health/wp-content/uploads/2020/10/gs-favicon-green.png">
<link rel="apple-touch-icon" href="https://global.health/wp-content/uploads/2020/10/gs-favicon-green.png">
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
</head>

<body>
<nav>
<ul>
<li><a href="https://l66noa47nk.execute-api.eu-central-1.amazonaws.com/web">Data</a></li>
<li><a href="https://github.com/globaldothealth/marburg">GitHub</a></li>
</ul>
<img class="logo" src="https://global.health/wp-content/uploads/2020/07/gh-logo-full-black.png"
alt="Global.health logo"></li>
</nav>
<main>
<h1>Marburg 2023 Equatorial Guinea Outbreak<br>{{ published_date }}</h1>
<p class="byline">From the <a href="https://global.health">Global.health</a> team (<a
href="mailto:info@global.health">info@global.health</a>)
</p>

<h2>Summary</h2>

{{#info}}
<div class="info">
<p>{{ info }}</p>
</div>
{{/info}}

<p class="summary">
<strong>{{ n_confirmed }}</strong> confirmed and <strong>{{ n_probable }}</strong>
probable cases as of {{ date }}
</p>

<figure>

{{{ epicurve }}}

<figcaption>
<strong>Figure 1</strong>: Number of cumulative confirmed and probable cases
by date of onset. Where date of onset is not available, it is
estimated from the date of first consult/hospitalisation or date
of death, by shifting the value by the delay distribution mean.
Only cases where date of onset is known or can be estimated are shown.
</figcaption>
</figure>

<figure>

{{{ epicurve_location_status }}}

<figcaption>
<strong>Figure 2</strong>: Number of cumulative confirmed and probable cases
stratified by district. Date of onset is estimated when not available as in Figure 1.
Only cases where date of onset is known or can be estimated and have a corresponding
district are shown.
</figcaption>
</figure>

<figure>

{{{ age_gender }}}
<figcaption>
<strong>Figure 3</strong>: Age and gender distribution of
Marburg 2023 confirmed cases in Equatorial Guinea.
{{ pc_valid_age_gender }}% of confirmed cases include
sufficient metadata to be included in this figure. When reported
age ranges span multiple age categories, counts are evenly
distributed among the categories that capture the reported age
range.
</figcaption>
</figure>

<figure>

{{{ delay_distribution_consult }}}

{{{ delay_distribution_death }}}

<figcaption>
<strong>Figure 4</strong>: Delay distributions from date of
symptom onset A) Between onset and first consult B) Between
onset and death. Only includes cases that have both date of onset
and either date of first consult (A) or date of death (B).
</figcaption>
</figure>

<p><strong>Data accessibility and reproducibility</strong>: All data
used in this report are available from our <a
href="https://l66noa47nk.execute-api.eu-central-1.amazonaws.com/web">data
repository</a>. Should you identify any issues or have questions please
raise an issue on <a href="https://github.com/globaldothealth/marburg">GitHub</a> or write to
us: <a href="mailto:info@global.health">info@global.health</a>.</p>

</main>
</body>

</html>
<p class="summary">
<strong>{{ n_confirmed }}</strong> confirmed and <strong>{{ n_probable }}</strong>
probable cases as of {{ date }}
</p>

<figure>

{{{ epicurve }}}

<figcaption>
<strong>Figure 1</strong>: Number of cumulative confirmed and probable cases
by date of onset. Where date of onset is not available, it is
estimated from the date of first consult/hospitalisation or date
of death, by shifting the value by the delay distribution mean.
Only cases where date of onset is known or can be estimated are shown.
</figcaption>
</figure>

<figure>

{{{ epicurve_location_status }}}

<figcaption>
<strong>Figure 2</strong>: Number of cumulative confirmed and probable cases
stratified by district. Date of onset is estimated when not available as in Figure 1.
Only cases where date of onset is known or can be estimated and have a corresponding
district are shown.
</figcaption>
</figure>

<figure>

{{{ age_gender }}}
<figcaption>
<strong>Figure 3</strong>: Age and gender distribution of
Marburg 2023 confirmed cases in Equatorial Guinea.
{{ pc_valid_age_gender }}% of confirmed cases include
sufficient metadata to be included in this figure. When reported
age ranges span multiple age categories, counts are evenly
distributed among the categories that capture the reported age
range.
</figcaption>
</figure>

<figure>

{{{ delay_distribution_consult }}}

{{{ delay_distribution_death }}}

<figcaption>
<strong>Figure 4</strong>: Delay distributions from date of
symptom onset A) Between onset and first consult B) Between
onset and death. Only includes cases that have both date of onset
and either date of first consult (A) or date of death (B).
</figcaption>
</figure>
Loading

0 comments on commit 39ec0ee

Please sign in to comment.