Skip to content

Commit 188c35b

Browse files
authored
#539 Add i18n function and Japanese resource to streamlit chime
* Add i18n function and Japanese resource to streamlit chime * Remove package names from requirements.txt * Fix default locale * Update some Japanese translations
1 parent cbafcdd commit 188c35b

File tree

13 files changed

+478
-209
lines changed

13 files changed

+478
-209
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ WORKDIR /app
44
COPY README.md .
55
COPY setup.cfg .
66
COPY setup.py .
7+
COPY MANIFEST.in .
78
COPY .streamlit .streamlit
89
COPY defaults defaults
910
COPY src src

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include src/penn_chime/locales/*.yml

Pipfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ dash = "*"
1616
dash-bootstrap-components = "*"
1717
gunicorn = "*"
1818
PyYAML = "*"
19+
python-i18n = "*"
20+
gspread="*"
21+
oauth2client="*"
1922

2023
[requires]
2124
python_version = "3.7"

Pipfile.lock

Lines changed: 151 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"pyyaml",
3535
"streamlit",
3636
"gspread",
37-
"oauth2client"
37+
"oauth2client",
38+
"python-i18n"
3839
],
3940
classifiers=[
4041
"Programming Language :: Python :: 3",

src/penn_chime/locales/en.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
en:
2+
app-new-admissions-title: "New Admissions"
3+
app-new-admissions-text: "Projected number of **daily** COVID-19 admissions."
4+
app-admitted-patients-title: "Admitted Patients (Census)"
5+
app-admitted-patients-text: "Projected **census** of COVID-19 patients, accounting for arrivals and discharges."
6+
app-SIR-title: "Susceptible, Infected, and Recovered"
7+
app-SIR-text: "The number of susceptible, infected, and recovered individuals in the hospital catchment region at any given moment"
8+
charts-date: "Date"
9+
charts-daily-admissions: "Daily admissions"
10+
charts-census: "Census"
11+
charts-count: "Count"
12+
presentation-infected-population-warning: "(Warning: The number of estimated infections is greater than the total regional population. Please verify the values entered in the sidebar.)"
13+
presentation-header: |+
14+
<link rel="stylesheet" href="https://www1.pennmedicine.org/styles/shared/penn-medicine-header.css">
15+
<div class="penn-medicine-header__content">
16+
<a href="https://www.pennmedicine.org" class="penn-medicine-header__logo"
17+
title="Go to the Penn Medicine home page">Penn Medicine</a>
18+
<a id="title" class="penn-medicine-header__title">COVID-19 Hospital Impact Model for Epidemics (CHIME)</a>
19+
</div>
20+
presentation-notice: |+
21+
**Notice**: *There is a high
22+
degree of uncertainty about the details of COVID-19 infection, transmission, and the effectiveness of social distancing
23+
measures. Long-term projections made using this simplified model of outbreak progression should be treated with extreme caution.*
24+
presentation-developed-by: |+
25+
This tool was developed by [Predictive Healthcare](http://predictivehealthcare.pennmedicine.org/) at
26+
Penn Medicine to assist hospitals and public health officials with hospital capacity planning.
27+
Please read [How to Use CHIME]({docs_url}) to customize inputs for your region.
28+
presentation-estimated-number-of-infection: |+
29+
The estimated number of currently infected individuals is **{total_infections:.0f}**. This is based on current inputs for
30+
Hospitalizations (**{current_hosp}**), Hospitalization rate (**{hosp_rate:.0%}**), Regional population (**{S}**),
31+
and Hospital market share (**{market_share:.0%}**).
32+
33+
{infected_population_warning_str}
34+
35+
An initial doubling time of **{doubling_time}** days and a recovery time of **{recovery_days}** days imply an $R_0$ of
36+
**{r_naught:.2f}** and daily growth rate of **{daily_growth:.2f}%**.
37+
38+
{mitigation_str}
39+
presentation-mitigation-rt-less-then-1: |+
40+
**Mitigation**: A **{relative_contact_rate:.0%}** reduction in social contact after the onset of the
41+
outbreak **halves the infections every {doubling_time_t:.1f}** days, implying an effective $R_t$ of **${r_t:.2f}$**
42+
and daily growth rate of **{daily_growth_t:.2f}%**.
43+
presentation-mitigation-rt-more-then-equal-1: |+
44+
**Mitigation**: A **{relative_contact_rate:.0%}** reduction in social contact after the onset of the
45+
outbreak **reduces the doubling time to {doubling_time_t:.1f}** days, implying an effective $R_t$ of **${r_t:.2f}$**
46+
and daily growth rate of **{daily_growth_t:.2f}%**.
47+
presentation-current-hospitalized: "Currently hospitalized COVID-19 patients"
48+
presentation-n-days: "Number of days to project"
49+
presentation-doubling-time: "Doubling time in days (up to today)"
50+
presentation-current-date: "Current date (default is today)"
51+
presentation-date-first-hospitalized: "Date of first hospitalized case (enter this date to have CHIME estimate the initial doubling time)"
52+
presentation-mitigation-date: "Date of social distancing measures effect (may be delayed from implementation)"
53+
presentation-relative-contact-rate: "Social distancing (% reduction in social contact going forward)"
54+
presentation-hospitalized-rate: "Hospitalization %(total infections)"
55+
presentation-icu-rate: "ICU %(total infections)"
56+
presentation-ventilated-rate: "Ventilated %(total infections)"
57+
presentation-hospitalized-days: "Average hospital length of stay (in days)"
58+
presentation-icu-days: "Average days in ICU"
59+
presentation-ventilated-days: "Average days on ventilator"
60+
presentation-market-share: "Hospital market share (%)"
61+
presentation-population: "Regional population"
62+
presentation-infectious-days: "Infectious days"
63+
presentation-max-y-axis-set: "Set the Y-axis on graphs to a static value"
64+
presentation-max-y-axis: "Y-axis static value"
65+
presentation-hospital-parameters: "Hospital Parameters"
66+
presentation-spread-and-contact-parameters: "Spread and Contact Parameters"
67+
presentation-first-hospitalized-check: "I know the date of the first hospitalized case."
68+
presentation-social-distancing-implemented: "Social distancing measures have been implemented"
69+
presentation-severity-parameters: "Severity Parameters"
70+
presentation-display-parameters: "Display Parameters"
71+
presentation-subscribe: "Subscribe"
72+
presentation-enter-email: "Enter Email"
73+
presentation-enter-name: "Enter Name"
74+
presentation-enter-affiliation: "Enter Affiliation"
75+
presentation-submit: "Submit"
76+
presentation-references-acknowledgements: "References & Acknowledgements"
77+
presentation-references-acknowledgements-text: |+
78+
* AHA Webinar, Feb 26, James Lawler, MD, an associate professor University of Nebraska Medical Center, What Healthcare Leaders Need To Know: Preparing for the COVID-19
79+
* We would like to recognize the valuable assistance in consultation and review of model assumptions by Michael Z. Levy, PhD, Associate Professor of Epidemiology, Department of Biostatistics, Epidemiology and Informatics at the Perelman School of Medicine
80+
* Finally we'd like to thank [Code for Philly](https://codeforphilly.org/) and the many members of the open-source community that [contributed](https://github.com/CodeForPhilly/chime/graphs/contributors) to this project.
81+
presentation-copyright: "© 2020, The Trustees of the University of Pennsylvania"
82+
presentation-download: |+
83+
<a download="{filename}" href="data:file/csv;base64,{csv}">Download {filename}</a>
84+
admits_hospitalized: "Hospitalized Admissions"
85+
admits_icu: "ICU Admissions"
86+
admits_ventilated: "Ventilated Admissions"
87+
census_hospitalized: "Hospitalized Census"
88+
census_icu: "ICU Census"
89+
census_ventilated: "Ventilated Census"
90+
susceptible: "Susceptible"
91+
infected: "Infected"
92+
recovered: "Recovered"
93+
day: "Day"
94+
date: "Date"

src/penn_chime/locales/ja.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
ja:
2+
app-new-admissions-title: "新規入院患者数"
3+
app-new-admissions-text: "**日毎の**COVID-19関連新規入院患者数予測"
4+
app-admitted-patients-title: "累計入院患者数"
5+
app-admitted-patients-text: "入院と退院を考慮したCOVID-19患者の予測**累計患者数**"
6+
app-SIR-title: "感受性保持者、感染者と回復者"
7+
app-SIR-text: "与えられた時間範囲での、病院の担当範囲領域における感受性保持者、感染者と回復者の人数"
8+
charts-date: "日付"
9+
charts-daily-admissions: "毎日の新規入院患者数"
10+
charts-census: "累計患者数"
11+
charts-count: "人数"
12+
presentation-infected-population-warning: "(警告:推定感染者数が地域の人口を上回っています。サイドバーに入力された値を確認してください。)"
13+
presentation-header: |+
14+
<link rel="stylesheet" href="https://www1.pennmedicine.org/styles/shared/penn-medicine-header.css">
15+
16+
<div class="penn-medicine-header__content">
17+
<a href="https://www.pennmedicine.org" class="penn-medicine-header__logo"
18+
title="Penn Medicineのホームページへ行く">Penn Medicine</a>
19+
<a id="title" class="penn-medicine-header__title">COVID-19における伝染病の病院影響モデル</a>
20+
</div>
21+
presentation-notice: |+
22+
**重要**: COVID-19の感染、伝播、
23+
社会的遠距離戦略の厳密な有効性については、まだ多くの不確実な点があります。
24+
この簡略化されたアウトブレイク進行モデルを用いた長期予測は、細心の注意を払って取り扱ってください。
25+
presentation-developed-by: |+
26+
このツールはペンシルバニア州立大学の医療部門であるPenn Medicineの、[予測医療チーム](http://predictivehealthcare.pennmedicine.org/)によって、
27+
病院や公衆衛生担当者の収容能力把握を支援するために開発されました。
28+
地域の状況に応じたデータにカスタマイズするには、「[CHIMEの使い方]({docs_url})」をご覧ください。
29+
presentation-estimated-number-of-infection: |+
30+
現在の予測感染者人数は**{total_infections:.0f}**人です。
31+
この結果は入院患者数(**{current_hosp}**)、患者の入院割合(**{hosp_rate:.0%}**)、地域の人口(**{S}**)および病院の患者シェア(**{market_share:.0%}**)を元に計算されています。
32+
33+
{infected_population_warning_str}
34+
35+
初期倍加時間が**{doubling_time}**日で、回復までの時間が**{recovery_days}**日であれば、$R_0$は**{r_naught:.2f}**となり、
36+
日々の増加率は**{daily_growth:.2f}%**となります。
37+
38+
{mitigation_str}
39+
presentation-mitigation-rt-less-then-1: |+
40+
**緩和**: アウトブレイク発生後の社会的接触が**{relative_contact_rate:.0%}**減少すると、**感染の半減期は{doubling_time_t:.1f}**日となり、
41+
実効$R_t$は**${r_t:.2f}$**、日々の増加率は**{daily_growth_t:.2f}%**となります。
42+
presentation-mitigation-rt-more-then-equal-1: |+
43+
**緩和**: アウトブレイク発生後の社会的接触が**{relative_contact_rate:.0%}**減少すると、**倍加時間は改善されて{doubling_time_t:.1f}**日となり、
44+
実効$R_t$は**${r_t:.2f}$**、日々の増加率は**{daily_growth_t:.2f}%**となります。
45+
presentation-current-hospitalized: "現在入院しているCOVID-19患者数"
46+
presentation-n-days: "予測する日数"
47+
presentation-doubling-time: "今日までの倍加時間 (日数)"
48+
presentation-current-date: "今の日付 (初期値は今日)"
49+
presentation-date-first-hospitalized: "最初の入院患者が発生した日付 (CHIMEが初期倍加時間を推定するために使います)"
50+
presentation-mitigation-date: "社会的距離戦略が効果を発揮し始めた日付 (おそらく実施日よりも遅れます)"
51+
presentation-relative-contact-rate: "社会的距離戦略 (今後の社会的接触の減少率 %)"
52+
presentation-hospitalized-rate: "入院患者率 %(総感染者数比)"
53+
presentation-icu-rate: "集中治療患者率 %(総感染者数比)"
54+
presentation-ventilated-rate: "人工呼吸患者率 %(総感染者数比)"
55+
presentation-hospitalized-days: "平均入院日数"
56+
presentation-icu-days: "平均集中治療日数"
57+
presentation-ventilated-days: "平均人工呼吸治療日数"
58+
presentation-market-share: "病院の患者シェア率 (%)"
59+
presentation-population: "地域の人口"
60+
presentation-infectious-days: "感染力を持つ期間 (日数)"
61+
presentation-max-y-axis-set: "グラフのY軸最大値を固定値にします"
62+
presentation-max-y-axis: "Y軸固定値"
63+
presentation-hospital-parameters: "病院パラメータ"
64+
presentation-spread-and-contact-parameters: "感染と接触のパラメータ"
65+
presentation-first-hospitalized-check: "最初の入院事例の日付が既知の場合"
66+
presentation-social-distancing-implemented: "社会的距離戦略が導入済みの場合"
67+
presentation-severity-parameters: "深刻度パラメータ"
68+
presentation-display-parameters: "表示パラメータ"
69+
presentation-subscribe: "購読"
70+
presentation-enter-email: "メールアドレス"
71+
presentation-enter-name: "名前"
72+
presentation-enter-affiliation: "所属"
73+
presentation-submit: "送信"
74+
presentation-references-acknowledgements: "参考資料と謝辞"
75+
presentation-references-acknowledgements-text: |+
76+
* アメリカ病院協会(AHA)ウェビナー、2月26日、James Lawler医師 (ネブラスカ大学医療センター准教授)、「COVID-19への準備として、医療リーダーが知っておくべきこと」
77+
* ペレルマン医科大学の生物統計学・疫学・疫学・情報学部門の疫学准教授であるMichael Z.Levy博士による、モデル仮説の検討とレビューにおける貴重な支援をここに特筆いたします。
78+
* 最後に、[Code for Philly](https://codeforphilly.org/)と、このプロジェクトに[貢献](https://github.com/CodeForPhilly/chime/graphs/contributors)してくれたオープンソースコミュニティの多くのメンバーに感謝いたします。
79+
presentation-copyright: "© 2020, The Trustees of the University of Pennsylvania"
80+
presentation-download: |+
81+
<a download="{filename}" href="data:file/csv;base64,{csv}">{filename} をダウンロード</a>
82+
admits_hospitalized: "新規入院患者数"
83+
admits_icu: "新規集中治療患者数"
84+
admits_ventilated: "新規人工呼吸患者数"
85+
census_hospitalized: "累計入院患者数"
86+
census_icu: "累計集中治療患者数"
87+
census_ventilated: "累計人工呼吸患者数"
88+
susceptible: "感受性保持者数"
89+
infected: "感染者数"
90+
recovered: "回復者数"
91+
day: "日数"
92+
date: "日付"

src/penn_chime/model/parameters.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
from __future__ import annotations
8+
import i18n
89

910
from argparse import ArgumentParser
1011
from collections import namedtuple
@@ -424,14 +425,17 @@ def __init__(self, **kwargs):
424425
Date(key='mitigation_date', value=self.mitigation_date)
425426

426427
self.labels = {
427-
"hospitalized": "Hospitalized",
428-
"icu": "ICU",
429-
"ventilated": "Ventilated",
430-
"day": "Day",
431-
"date": "Date",
432-
"susceptible": "Susceptible",
433-
"infected": "Infected",
434-
"recovered": "Recovered",
428+
"admits_hospitalized": i18n.t("admits_hospitalized"),
429+
"admits_icu": i18n.t("admits_icu"),
430+
"admits_ventilated": i18n.t("admits_ventilated"),
431+
"census_hospitalized": i18n.t("census_hospitalized"),
432+
"census_icu": i18n.t("census_icu"),
433+
"census_ventilated": i18n.t("census_ventilated"),
434+
"day": i18n.t("day"),
435+
"date": i18n.t("date"),
436+
"susceptible" :i18n.t("susceptible"),
437+
"infected": i18n.t("infected"),
438+
"recovered": i18n.t("recovered")
435439
}
436440

437441
self.dispositions = {

0 commit comments

Comments
 (0)