Skip to content

Commit 7acfec6

Browse files
authored
Merge pull request #870 from cmu-delphi/release/delphi-epidata-0.3.13
Release Delphi Epidata 0.3.13
2 parents 5514286 + cd2f2bc commit 7acfec6

File tree

13 files changed

+46
-24
lines changed

13 files changed

+46
-24
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.3.12
2+
current_version = 0.3.13
33
commit = False
44
tag = False
55

src/acquisition/covidcast/csv_importer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class CsvImporter:
4343
"val": float,
4444
"se": float,
4545
"sample_size": float,
46-
"missing_val": int,
47-
"missing_se": int,
48-
"missing_sample_size": int
46+
"missing_val": "Int64",
47+
"missing_se": "Int64",
48+
"missing_sample_size": "Int64"
4949
}
5050

5151
# NOTE: this should be a Python 3.7+ `dataclass`, but the server is on 3.4

src/acquisition/covidcast/database.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ def delete_batch(self, cc_deletions):
326326
'''
327327

328328
drop_tmp_table_sql = f'DROP TABLE {tmp_table_name}'
329+
total = None
329330
try:
330331
self._cursor.execute(create_tmp_table_sql)
331332
self._cursor.execute(amend_tmp_table_sql)
@@ -337,12 +338,18 @@ def delete_batch(self, cc_deletions):
337338
raise Exception(f"Bad deletions argument: need a filename or a list of tuples; got a {type(cc_deletions)}")
338339
self._cursor.execute(add_id_sql)
339340
self._cursor.execute(delete_sql)
341+
total = self._cursor.rowcount
340342
self._cursor.execute(fix_latest_issue_sql)
341343
self._connection.commit()
344+
345+
if total == -1:
346+
# the SQL connector does not support returning number of rows affected (see PEP 249)
347+
total = None
342348
except Exception as e:
343349
raise e
344350
finally:
345351
self._cursor.execute(drop_tmp_table_sql)
352+
return total
346353

347354
def compute_covidcast_meta(self, table_name='covidcast', use_index=True):
348355
"""Compute and return metadata on all non-WIP COVIDcast signals."""

src/acquisition/covidcast/delete_batch.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# standard library
44
import argparse
5+
import glob
56
import os
67
import time
78

@@ -22,19 +23,21 @@ def get_argument_parser():
2223
help="filename for log output (defaults to stdout)")
2324
return parser
2425

25-
def handle_file(deletion_file, database):
26+
def handle_file(deletion_file, database, logger):
2627
logger.info("Deleting from csv file", filename=deletion_file)
2728
rows = []
2829
with open(deletion_file) as f:
2930
for line in f:
30-
rows.append(line.strip().split(","))
31+
fields = line.strip().split(",")
32+
if len(fields) < 9: continue
33+
rows.append(fields + ["day"])
3134
rows = rows[1:]
3235
try:
3336
n = database.delete_batch(rows)
3437
logger.info("Deleted database rows", row_count=n)
3538
return n
3639
except Exception as e:
37-
logger.exception('Exception while deleting rows:', e)
40+
logger.exception('Exception while deleting rows', exception=e)
3841
database.rollback()
3942
return 0
4043

@@ -49,7 +52,11 @@ def main(args):
4952

5053
try:
5154
for deletion_file in sorted(glob.glob(os.path.join(args.deletion_dir, '*.csv'))):
52-
all_n += handle_file(deletion_file)
55+
n = handle_file(deletion_file, database, logger)
56+
if n is not None:
57+
all_n += n
58+
else:
59+
all_n = "rowcount unsupported"
5360
finally:
5461
database.disconnect(True)
5562

src/client/delphi_epidata.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Epidata <- (function() {
1515
# API base url
1616
BASE_URL <- 'https://delphi.cmu.edu/epidata/api.php'
1717

18-
client_version <- '0.3.12'
18+
client_version <- '0.3.13'
1919

2020
# Helper function to cast values and/or ranges to strings
2121
.listitem <- function(value) {

src/client/delphi_epidata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323
})(this, function (exports, fetchImpl, jQuery) {
2424
const BASE_URL = "https://delphi.cmu.edu/epidata/";
25-
const client_version = "0.3.12";
25+
const client_version = "0.3.13";
2626

2727
// Helper function to cast values and/or ranges to strings
2828
function _listitem(value) {

src/client/packaging/npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "delphi_epidata",
33
"description": "Delphi Epidata API Client",
44
"authors": "Delphi Group",
5-
"version": "0.3.12",
5+
"version": "0.3.13",
66
"license": "MIT",
77
"homepage": "https://github.com/cmu-delphi/delphi-epidata",
88
"bugs": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .delphi_epidata import Epidata
22

33
name = 'delphi_epidata'
4-
__version__ = '0.3.12'
4+
__version__ = '0.3.13'

src/client/packaging/pypi/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="delphi_epidata",
8-
version="0.3.12",
8+
version="0.3.13",
99
author="David Farrow",
1010
author_email="[email protected]",
1111
description="A programmatic interface to Delphi's Epidata API.",

src/server/_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
load_dotenv()
77

8-
VERSION = "0.3.12"
8+
VERSION = "0.3.13"
99

1010
MAX_RESULTS = int(10e6)
1111
MAX_COMPATIBILITY_RESULTS = int(3650)

0 commit comments

Comments
 (0)