Skip to content

Commit

Permalink
FIX dashboards queries (#71)
Browse files Browse the repository at this point in the history
* fix lab dashboard queries

* add vaccinations new query model

* add third_dose property to VaccinationByDayRow

* fix _parse_vaccinations_by_day() and test

* fix data vaccination_supplied_by_manufacturer

* test vaccination_supplied_by_manufacturer

update assertion data row

* fix data vaccinations_by_region_by_day()

change parser to _parse_vaccinations_by_day

* test vaccinations_by_region_by_day adjust ...

...expectations

* add new R values: 2, 6

_parse_vaccinations_by_day()

* fix _get_default_by_age_group_command()

add new query

* use _parse_vaccinations_by_day in...

... vaccinations_by_age_group()

* !test vaccinations_by_age_group adjust assertions

we need more test for certain age groups where R == 2 || 6

R == 2
AgeGroup.GROUP_75_79 on 2021-10-10
AgeGroup.GROUP_80_84 on 2021-10-10

* fix manufacturer used query

* fix manufacturer used parser due to new query

see: c1a068e

* test fix manufacrurer used assertions

* test skip not importatant tests

* vaccinations_by_manufacturer_used: added test for timestamps

* fix absurdly high numbers (eg leaked timestamps)

* vaccinations_by_manufacturer_used: added test for

2021-01-29: R=30
2021-10-13: R=28

* test: lab test sanity checks

* fix lab PCR and HAT today queries

Co-authored-by: Štefan Baebler <stefan.baebler@gmail.com>
  • Loading branch information
jalezi and stefanb authored Oct 21, 2021
1 parent 2a2c8b6 commit 0de6c67
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 297 deletions.
9 changes: 4 additions & 5 deletions cepimose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,11 @@ def vaccinations_by_age_group(
key_value = _vaccination_by_age_group_requests.items()
for key, req_list in key_value:
req = req_list[0]

obj[key] = _get_data(req, _parse_vaccinations_by_age_group)
obj[key] = _get_data(req, _parse_vaccinations_by_day)
return obj

req = _vaccination_by_age_group_requests[group][0]
return _get_data(req, _parse_vaccinations_by_age_group)
return _get_data(req, _parse_vaccinations_by_day)


# by region by day
Expand All @@ -217,12 +216,12 @@ def vaccinations_by_region_by_day(
key_value = _vaccinations_by_region_by_day_requests.items()
for key, req_list in key_value:
req = req_list[0]
doses = _get_data(req, _parse_vaccinations_by_region_by_day)
doses = _get_data(req, _parse_vaccinations_by_day)
obj[key] = doses
return obj

req = _vaccinations_by_region_by_day_requests[region][0]
doses = _get_data(req, _parse_vaccinations_by_region_by_day)
doses = _get_data(req, _parse_vaccinations_by_day)
obj[region] = doses

return obj
Expand Down
24 changes: 13 additions & 11 deletions cepimose/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,31 +502,33 @@ def _get_default_manufacturer_used_command(manu: Manufacturer):
"Name": "Calendar.Date",
},
{
"Column": _get_Column("s", "Cepivo_Ime"),
"Name": "Sifrant_Cepivo.Cepivo_Ime",
"Measure": _get_Column("c", "Weight for 1"),
"Name": "eRCO_​​podatki.Weight for 1",
},
{
"Measure": _get_Column("c", "Weight for 2"),
"Name": "eRCO_​​podatki.Weight for 2",
},
{
"Measure": _get_Column("c", "Weight for 2"),
"Name": "eRCO_​​podatki.Weight for 2",
},
{
"Aggregation": {
"Expression": {"Column": _get_Column("c", "Weight")},
"Expression": {"Column": _get_Column("c", "weight")},
"Function": 0,
},
"Name": "Sum(eRCO_podatki_ed.Weight)",
},
],
"Where": [
_get_Condition_Comparison_With_DateSpan("c1", 2),
_get_Condition_Not_Expression(),
_get_Condition_In_Expression("Cepivo_Ime", "s", manu.value),
],
},
"Binding": {
"Primary": {"Groupings": [{"Projections": [0, 2]}]},
"Secondary": {"Groupings": [{"Projections": [1]}]},
"DataReduction": {
"DataVolume": 4,
"Primary": {"Sample": {}},
"Secondary": {"Top": {}},
},
"Primary": {"Groupings": [{"Projections": [0, 1, 2, 3, 4]}]},
"DataReduction": {"DataVolume": 4, "Primary": {"Sample": {}}},
"Version": 1,
},
**_ExecutionMetrics,
Expand Down
Loading

0 comments on commit 0de6c67

Please sign in to comment.