Skip to content

Commit e5da0ea

Browse files
authored
Merge pull request #627 from cmu-delphi/release/delphi-epidata-0.1.4
Release Delphi Epidata 0.1.4
2 parents f2636d7 + a234bab commit e5da0ea

File tree

9 files changed

+41
-9
lines changed

9 files changed

+41
-9
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.1.3
2+
current_version = 0.1.4
33
commit = False
44
tag = False
55

src/acquisition/covidcast/csv_importer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def find_issue_specific_csv_files(scan_dir, glob=glob):
9292
issue_date_value = int(issuedir_match.group(2))
9393
issue_date = CsvImporter.is_sane_day(issue_date_value)
9494
if issue_date:
95-
logger.info('processing csv files from issue date: "' + str(issue_date) + '", directory', path)
95+
logger.info(event='processing csv files from issue', detail=issue_date, file=path)
9696
yield from CsvImporter.find_csv_files(path, issue=(issue_date, epi.Week.fromdate(issue_date)), glob=glob)
9797
else:
9898
logger.warning(event='invalid issue directory day', detail=issue_date_value, file=path)

src/client/delphi_epidata.R

+1-1
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.1.3'
18+
client_version <- '0.1.4'
1919

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

src/client/delphi_epidata.js

+1-1
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.1.3";
25+
const client_version = "0.1.4";
2626

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

src/client/packaging/npm/package.json

+1-1
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.1.3",
5+
"version": "0.1.4",
66
"license": "MIT",
77
"homepage": "https://github.com/cmu-delphi/delphi-epidata",
88
"bugs": {
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.1.3'
4+
__version__ = '0.1.4'

src/client/packaging/pypi/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

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

src/server/_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
load_dotenv()
77

8-
VERSION = "0.1.3"
8+
VERSION = "0.1.4"
99

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

tests/acquisition/covidcast/test_csv_importer.py

+33-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# standard library
44
import unittest
55
from unittest.mock import MagicMock
6+
from unittest.mock import patch
67
from datetime import date
78
import math
89
import numpy as np
10+
import os
911

1012
# third party
1113
import pandas
@@ -42,6 +44,36 @@ def test_is_sane_week(self):
4244
self.assertFalse(CsvImporter.is_sane_week(202054))
4345
self.assertFalse(CsvImporter.is_sane_week(20200418))
4446

47+
@patch("os.path.isdir")
48+
def test_find_issue_specific_csv_files(self,os_isdir_mock):
49+
"""Recursively explore and find issue specific CSV files."""
50+
# check valid path
51+
path_prefix='prefix/to/the/data/issue_20200408'
52+
os_isdir_mock.return_value=True
53+
issue_path=path_prefix+'ght/20200408_state_rawsearch.csv'
54+
55+
mock_glob = MagicMock()
56+
mock_glob.glob.side_effect = ([path_prefix], [issue_path])
57+
58+
#check if the day is a valid day.
59+
issuedir_match= CsvImporter.PATTERN_ISSUE_DIR.match(path_prefix.lower())
60+
issue_date_value = int(issuedir_match.group(2))
61+
self.assertTrue(CsvImporter.is_sane_day(issue_date_value))
62+
63+
found = set(CsvImporter.find_issue_specific_csv_files(path_prefix, glob=mock_glob))
64+
self.assertTrue(len(found)>0)
65+
66+
# check unvalid path:
67+
path_prefix_invalid='invalid/prefix/to/the/data/issue_20200408'
68+
os_isdir_mock.return_value=False
69+
issue_path_invalid=path_prefix_invalid+'ght/20200408_state_rawsearch.csv'
70+
mock_glob_invalid = MagicMock()
71+
mock_glob_invalid.glob.side_effect = ([path_prefix_invalid], [issue_path_invalid])
72+
73+
found = set(CsvImporter.find_issue_specific_csv_files(path_prefix_invalid, glob=mock_glob_invalid))
74+
self.assertFalse(len(found)>0)
75+
76+
4577
def test_find_csv_files(self):
4678
"""Recursively explore and find CSV files."""
4779

@@ -306,4 +338,4 @@ def test_load_csv_with_valid_header(self):
306338
self.assertEqual(rows[2].missing_stderr, Nans.NOT_MISSING)
307339
self.assertEqual(rows[2].missing_sample_size, Nans.REGION_EXCEPTION)
308340

309-
self.assertIsNone(rows[3])
341+
self.assertIsNone(rows[3])

0 commit comments

Comments
 (0)