Closed klenwell closed 3 years ago
How to quickly catch and work around the issue:
$ git diff master..tmp-20200926-oc
diff --git a/covid_app/services/oc_health_service.py b/covid_app/services/oc_health_service.py
index 172a481..b32dc1a 100644
--- a/covid_app/services/oc_health_service.py
+++ b/covid_app/services/oc_health_service.py
@@ -80,7 +80,11 @@ class OCHealthService:
@cached_property
def rt_extract(self):
- return Covid19ProjectionsExtract.oc_effective_reproduction()
+ try:
+ return Covid19ProjectionsExtract.oc_effective_reproduction()
+ except Exception as e:
+ print("There was an error with Rt extract: {}".format(e))
+ return {}
@cached_property
def daily_csv_rows(self):
diff --git a/covid_app/services/us_health_service.py b/covid_app/services/us_health_service.py
index 91e3dfc..1ce4e30 100644
--- a/covid_app/services/us_health_service.py
+++ b/covid_app/services/us_health_service.py
@@ -55,7 +55,11 @@ class USHealthService:
@cached_property
def rt_rates(self):
- return Covid19ProjectionsExtract.us_effective_reproduction()
+ try:
+ return Covid19ProjectionsExtract.us_effective_reproduction()
+ except Exception as e:
+ print("There was an error with Rt extract: {}".format(e))
+ return {}
This will allow you to produce the CSV file with the Rt column blank.
Fixed by PR #33.
Underlying issue: parser uses a sort of binary search approach to extract data. It was relying on a linebreak in web page HTML that disappeared. So I found a more reliable marker.
I suspect something changed in the way the embedded data is structured.
Data for OC comes from here:
The error: