home · contact · privacy
In scraper, check for dates being contiguous.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 24 Jul 2020 14:39:23 +0000 (16:39 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 24 Jul 2020 14:39:23 +0000 (16:39 +0200)
scrape.py

index 7c7196c93eef2cde7adc6a1586b1c42d7c394443..41a0db9d3c44a5781a66d7dbf02be6200c2df34c 100755 (executable)
--- a/scrape.py
+++ b/scrape.py
@@ -204,8 +204,10 @@ for date in dates_sorted:
     for district in [d for d in districts_sorted if not d=='sum']:
         prev_date = date - datetime.timedelta(days=1)
         if prev_date not in dates_sorted:
-            # TODO: ensure dates until end of list are continuous
-            continue
+           if prev_date >= date_limit:
+              raise Exception('Dates not contiguous: %s missing', prev_date)
+           else:
+              continue
         prev_total = data[date - datetime.timedelta(days=1)][district]['total']
         cur_total = data[date][district]['total']
         if cur_total - data[date][district]['growth'] != prev_total: