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

Nijz schools dashboard #51

Draft
wants to merge 102 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
27024c5
test: adjust vaccination by day assertion data
jalezi Aug 23, 2021
f606839
Merge remote-tracking branch 'upstream/master'
jalezi Aug 23, 2021
d3f5ff7
test: adjust vacs date range assertion data
jalezi Aug 23, 2021
50a8f1a
feat(vaccines_supplied_by_manufacturer): handle ...
jalezi Sep 6, 2021
0924261
Merge remote-tracking branch 'upstream/master'
jalezi Sep 6, 2021
b6920d6
test: adjust assert data due to NIJZ change & ...
jalezi Sep 9, 2021
c97cbd8
Merge remote-tracking branch 'upstream/master'
jalezi Sep 10, 2021
79b9389
test: adjust assert data due to unusual NIJZ decrease
jalezi Sep 10, 2021
51b38de
test: adjust assert data due to unusual NIJZ decrease
jalezi Sep 11, 2021
295d40a
Merge branch 'master' into master
jalezi Sep 11, 2021
cf476f0
Merge remote-tracking branch 'upstream/master'
jalezi Sep 14, 2021
ee61264
fix upstream merge
jalezi Sep 14, 2021
dce39b8
test: add calculated delta
jalezi Sep 14, 2021
598c858
test: remove getDelta() & adjust expected values..
jalezi Sep 15, 2021
5906e30
Merge remote-tracking branch 'upstream/master'
jalezi Sep 15, 2021
488e9b3
Merge remote-tracking branch 'upstream/master'
jalezi Sep 16, 2021
a0c724c
Feat: add vaccinations_in_range_by_age_group_by_gender()
jalezi Sep 16, 2021
bbe97e7
Merge remote-tracking branch 'upstream/master'
jalezi Sep 17, 2021
69ed8f2
Merge branch 'master' into nijz-schools
jalezi Sep 17, 2021
a8517ca
test: nijz schools dashboard
jalezi Sep 17, 2021
0b32955
feat(enums): + SchoolGroup, + SchoolTriadaGroups
jalezi Sep 17, 2021
3a0eaa7
feat(data): add nijz schools model ver & headers
jalezi Sep 17, 2021
0c59275
feat(types): add school types
jalezi Sep 17, 2021
601578b
feat: add school commands
jalezi Sep 17, 2021
7e87ed9
feat: add schools parsers
jalezi Sep 17, 2021
fafce10
feat: add schools requests
jalezi Sep 17, 2021
bd22e68
feat: add scrape nijz schools dashboard funcs
jalezi Sep 17, 2021
d1a2843
test: adjust expectations and raise assertion diff
jalezi Sep 17, 2021
fb6492f
Merge remote-tracking branch 'upstream/master'
jalezi Sep 18, 2021
4a18e98
test_ lower expectations
jalezi Sep 18, 2021
8925200
Merge branch 'fix-test' into nijz-schools
jalezi Sep 18, 2021
0c00107
Merge remote-tracking branch 'upstream/master'
jalezi Sep 18, 2021
25ff7d4
Merge branch 'master' into nijz-schools
jalezi Sep 18, 2021
c3a781f
Merge remote-tracking branch 'upstream/master'
jalezi Sep 20, 2021
eab66ad
Merge branch 'master' into nijz-schools
jalezi Sep 20, 2021
6b84b43
Merge remote-tracking branch 'upstream/master'
jalezi Sep 21, 2021
db700e5
Merge branch 'master' into nijz-schools
jalezi Sep 21, 2021
5d43362
test: lower expectations
jalezi Sep 21, 2021
ba07fee
test: lower expectations
jalezi Sep 23, 2021
845124e
Merge remote-tracking branch 'upstream/master'
jalezi Sep 23, 2021
609be27
Merge branch 'master' into test-adjust
jalezi Sep 23, 2021
9962957
Merge remote-tracking branch 'upstream/master'
jalezi Sep 23, 2021
d87e37c
Merge branch 'master' into test-adjust
jalezi Sep 23, 2021
2288535
Merge branch 'master' into nijz-schools
jalezi Sep 23, 2021
747d88c
test: lower expectations
jalezi Sep 24, 2021
dbe37a2
Merge branch 'test-adjust' into nijz-schools
jalezi Sep 24, 2021
85d83ae
test: lower expectations
jalezi Sep 24, 2021
fc82f6f
Merge branch 'test-adjust' into nijz-schools
jalezi Sep 24, 2021
11f1079
test: lower expectations
jalezi Sep 24, 2021
bf818fa
Merge remote-tracking branch 'upstream/master'
jalezi Sep 25, 2021
6b48c4e
test: lower expectations
jalezi Sep 25, 2021
bc7bd11
Merge branch 'master' into test-adjust
jalezi Sep 25, 2021
466b403
Merge branch 'test-adjust' into nijz-schools
jalezi Sep 25, 2021
e071bf0
Merge remote-tracking branch 'upstream/master'
jalezi Sep 25, 2021
e8c8947
test: lower expectations
jalezi Sep 28, 2021
4e406d6
Merge branch 'test-adjust' into nijz-schools
jalezi Sep 28, 2021
093afdf
test: lower expectations
jalezi Sep 28, 2021
ecd47ae
Merge remote-tracking branch 'upstream/master'
jalezi Sep 29, 2021
7c772c1
test: pfizer used on 2021-03-16 lower expectations
jalezi Sep 29, 2021
dc18207
Merge branch 'test-adjust' into nijz-schools
jalezi Sep 29, 2021
80a3d00
Merge remote-tracking branch 'upstream/master'
jalezi Sep 29, 2021
597ed3e
Merge branch 'master' into nijz-schools
jalezi Sep 29, 2021
46028bb
test: lower expectations
jalezi Sep 30, 2021
e73eb1e
Merge branch 'test-adjust' into nijz-schools
jalezi Sep 30, 2021
ff8b0b4
Merge remote-tracking branch 'upstream/master'
jalezi Sep 30, 2021
920d92d
Merge branch 'master' into nijz-schools
jalezi Sep 30, 2021
078e9b8
test: adjust expectations range age group gender
jalezi Sep 30, 2021
53f4aac
test: lower expectations
jalezi Oct 1, 2021
2498b3f
Merge branch 'test-adjust' into nijz-schools
jalezi Oct 1, 2021
e324f5b
Merge remote-tracking branch 'upstream/master'
jalezi Oct 1, 2021
049cd46
Merge branch 'test-adjust' into nijz-schools
jalezi Oct 1, 2021
3952c03
Merge remote-tracking branch 'upstream/master'
jalezi Oct 2, 2021
adb46bc
Merge branch 'test-adjust' into nijz-schools
jalezi Oct 2, 2021
dbd0724
Test: lower expectations
jalezi Oct 5, 2021
a912092
Merge branch 'test-adjust' into nijz-schools
jalezi Oct 5, 2021
f7e0798
Merge remote-tracking branch 'upstream/master'
jalezi Oct 5, 2021
b0274d9
Test: lower expectations again
jalezi Oct 5, 2021
ba77633
Merge branch 'test-adjust' into nijz-schools
jalezi Oct 5, 2021
944c030
Merge remote-tracking branch 'upstream/master'
jalezi Oct 5, 2021
a1f1e54
Test: lower expectations again
jalezi Oct 7, 2021
8f07245
Merge branch 'test-adjust' into nijz-schools
jalezi Oct 7, 2021
be2abcd
Merge remote-tracking branch 'upstream/master'
jalezi Oct 8, 2021
0b1eaed
Merge branch 'master' into nijz-schools
jalezi Oct 8, 2021
3ed8b19
Test: lower expectations again
jalezi Oct 8, 2021
1b847d3
Merge remote-tracking branch 'upstream/master'
jalezi Oct 9, 2021
75ddc67
Merge branch 'master' into nijz-schools
jalezi Oct 9, 2021
e5c0866
test lower pfizer expectation
jalezi Oct 13, 2021
25289db
Merge branch 'fix-test-expectations' into nijz-schools
jalezi Oct 13, 2021
76be975
Merge remote-tracking branch 'upstream/master'
jalezi Oct 13, 2021
fd43003
Merge branch 'master' into fix-test-expectations
jalezi Oct 13, 2021
c66454a
test lower expectations
jalezi Oct 13, 2021
e349cd2
Merge branch 'fix-test-expectations' into nijz-schools
jalezi Oct 13, 2021
59474aa
Merge remote-tracking branch 'upstream/master'
jalezi Oct 14, 2021
d4e6938
test lower expectations manu used
jalezi Oct 14, 2021
0b54401
Merge branch 'fix-test-expectations' into nijz-schools
jalezi Oct 14, 2021
b1315e5
Moar tolerance
stefanb Oct 14, 2021
9831572
Merge remote-tracking branch 'upstream/master'
jalezi Oct 16, 2021
0667f29
Merge branch 'master' into fix-test-expectations
jalezi Oct 16, 2021
d5af114
Merge branch 'master' into nijz-schools
jalezi Oct 16, 2021
d60a4a1
test lower expectatitions
jalezi Oct 16, 2021
505d5bb
test lower male second dose expectatitions...
jalezi Oct 19, 2021
03ac3e1
Merge branch 'fix-test-expectations' into nijz-schools
jalezi Oct 19, 2021
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
150 changes: 150 additions & 0 deletions cepimose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
_source,
_vaccinations_dashboard_headers,
_lab_dashboard_headers,
_schools_dashboard_headers,
_vaccinations_by_day_req,
_vaccinations_by_age_req,
_vaccines_supplied_and_used_req,
Expand All @@ -20,6 +21,7 @@
_vaccination_by_manufacturer_supplied_used_requests,
_vaccinations_gender_by_date_requests,
_create_vaccinations_data_range_request,
_create_in_range_age_group_gender_requests,
_vaccinations_by_manufacturer_used_request,
_lab_start_ts_req,
_lab_end_ts_req,
Expand All @@ -37,6 +39,9 @@
_lab_cases_avg_7Days_req,
_lab_HAT_tests_performed_req,
)
import cepimose.schools_requests as schools_requests
import cepimose.schools_parsers as schools_parsers

from .parser import (
_parse_vaccinations_by_age,
_parse_vaccinations_by_day,
Expand All @@ -57,16 +62,19 @@
_parse_single_data,
)


from .types import (
VaccinationByAgeRow,
VaccinationByDayRow,
VaccinationDose,
VaccinationsByGender,
VaccinationsDateRangeByGroup,
VaccinationsDoses,
VaccineSupplyUsage,
VaccinationByRegionRow,
VaccinationByManufacturerRow,
VaccinationAgeGroupByRegionOnDay,
VaccinationsInDateRangeAgeGroupGender,
LabDashboard,
)

Expand Down Expand Up @@ -473,6 +481,35 @@ def vaccinations_date_range(
return result


def vaccinations_in_range_by_age_group_by_gender(
start_date=datetime.datetime(2020, 12, 26),
end_date=datetime.datetime.today().date(),
) -> "dict[AgeGroup]":
requests = _create_in_range_age_group_gender_requests(start_date, end_date)
result = {}
for [age_group, gender_requests] in requests.items():
group = VaccinationsInDateRangeAgeGroupGender(
date_start=start_date,
date_end=end_date,
age_group=age_group,
male=VaccinationsDoses(),
female=VaccinationsDoses(),
)

doses = [
_get_data(_request, _parse_single_data)
for _request in gender_requests.values()
]
[
group.male.dose1,
group.male.dose2,
group.female.dose1,
group.female.dose2,
] = doses
result[age_group] = group
return result


# DASHBOARD LAB


Expand Down Expand Up @@ -714,3 +751,116 @@ def get_lab_dashboard() -> LabDashboard:
)

return result


# DASHBOARD SCHOOLS PAGE 1


def schools_timestamp():
return _get_data(
schools_requests._schools_timestamp_req,
_parse_vaccinations_timestamp,
_schools_dashboard_headers,
)


def schools_date_range_timestamps():
return _get_data(
schools_requests._schools_date_range_timestamps_req,
schools_parsers._parse_schools_date_range_timestamps,
_schools_dashboard_headers,
)


def schools_confirmed_and_active_cases():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_confirmed_and_active_cases_req,
schools_parsers._parse_schools_confirmed_and_active_cases,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


def schools_age_group():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_age_group_req,
schools_parsers._parse_schools_age_group,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


def schools_age_group_confirmed_weekly():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_age_group_confirmed_weekly_req,
schools_parsers._parse_schools_age_group_confirmed_weekly,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


def schools_age_groups_triada():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_age_groups_triada_req,
schools_parsers._parse_schools_age_groups_triada,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


def schools_age_group_percent_per_capita_weekly():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_age_group_percent_per_capita_weekly_req,
schools_parsers._parse_schools_age_group_percent_per_capita_weekly,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


def schools_age_groups_percent_triada_weekly():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_age_groups_percent_triada_weekly_req,
schools_parsers._parse_schools_age_groups_percent_triada_weekly,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


def schools_age_group_percent_weekly():
timestamp = schools_timestamp()
date_range_ts = schools_date_range_timestamps()

data = _get_data(
schools_requests._schools_age_group_percent_weekly_req,
schools_parsers._parse_schools_age_group_percent_weekly,
_schools_dashboard_headers,
)

return {"data": data, "ts": timestamp, "date_range_ts": date_range_ts}


# TODO DASHBOARD SCHOOLS PAGE 2
Loading