Skip to content

Commit ad60298

Browse files
authored
Merge pull request #562 from cmu-delphi/sgratzl/bumpclientversions
unify client versions and bump them at once
2 parents 2e8aa8d + f7db427 commit ad60298

File tree

8 files changed

+53
-27
lines changed

8 files changed

+53
-27
lines changed

.bumpversion.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ commit = False
44
tag = False
55

66
[bumpversion:file:src/server/_config.py]
7+
8+
[bumpversion:file:src/client/delphi_epidata.js]
9+
10+
[bumpversion:file:src/client/delphi_epidata.R]
11+
12+
[bumpversion:file:src/client/packaging/npm/package.json]
13+
14+
[bumpversion:file:src/client/packaging/pypi/setup.py]
15+
16+
[bumpversion:file:src/client/packaging/pypi/delphi_epidata/__init__.py]

src/client/delphi_epidata.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Epidata <- (function() {
1515
# API base url
1616
BASE_URL <- 'https://delphi.cmu.edu/epidata/api.php'
1717

18+
client_version <- '0.1.0'
19+
1820
# Helper function to cast values and/or ranges to strings
1921
.listitem <- function(value) {
2022
if(is.list(value) && 'from' %in% names(value) && 'to' %in% names(value)) {
@@ -614,6 +616,7 @@ Epidata <- (function() {
614616
# Export the public methods
615617
return(list(
616618
range = range,
619+
client_version = client_version,
617620
fluview = fluview,
618621
fluview_meta = fluview_meta,
619622
fluview_clinical = fluview_clinical,

src/client/delphi_epidata.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ declare module 'delphi_epidata' {
1717
readonly BASE_URL: string;
1818
range(this: void, from: string | number, to: string | number): EpiRange;
1919
withURL(this: void, baseUrl?: string): EpidataFunctions;
20+
client_version: string;
21+
version(): Promise<{version: string, client_version: string}>;
2022

2123
afhsb(callback: EpiDataCallback, auth: string, locations: StringParam, epiweeks: EpiRangeParam, flu_types: StringParam): Promise<EpiDataResponse>;
2224
cdc(callback: EpiDataCallback, auth: string, epiweeks: EpiRangeParam, locations: StringParam): Promise<EpiDataResponse>;
@@ -56,6 +58,8 @@ declare module 'delphi_epidata' {
5658
readonly BASE_URL: string;
5759
range(this: void, from: string | number, to: string | number): EpiRange;
5860
withURL(this: void, baseUrl?: string): EpidataAsyncFunctions;
61+
client_version: string;
62+
version(): Promise<{ version: string, client_version: string }>;
5963

6064
afhsb(auth: string, locations: StringParam, epiweeks: EpiRangeParam, flu_types: StringParam): Promise<EpiDataResponse>;
6165
cdc(auth: string, epiweeks: EpiRangeParam, locations: StringParam): Promise<EpiDataResponse>;

src/client/delphi_epidata.js

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

2627
// Helper function to cast values and/or ranges to strings
2728
function _listitem(value) {
@@ -118,6 +119,10 @@
118119
BASE_URL: baseUrl || BASE_URL,
119120
withURL: createEpidataAsync,
120121
range,
122+
client_version,
123+
version: () => {
124+
return _request('version', {}).then((r) => Object.assign(r, {client_version}));
125+
},
121126
/**
122127
* Fetch AFHSB data (point data, no min/max)
123128
*/
@@ -552,9 +557,15 @@
552557
BASE_URL: api.BASE_URL,
553558
withURL: createEpidata,
554559
range,
560+
client_version,
561+
version: () => {
562+
return _request('version', {}).then((r) => Object.assign(r, { client_version }));
563+
},
555564
};
565+
const knownKeys = Object.keys(r);
556566
Object.keys(api).forEach((key) => {
557-
if (key === "BASE_URL" || key === "withURL" || key === 'range') {
567+
if (knownKeys.indexOf(key) >= 0) {
568+
// known key ignore
558569
return;
559570
}
560571
r[key] = function (callback) {

src/client/delphi_epidata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Epidata:
3535
# API base url
3636
BASE_URL = 'https://delphi.cmu.edu/epidata/api.php'
3737

38+
client_version = _version
39+
3840
# Helper function to cast values and/or ranges to strings
3941
@staticmethod
4042
def _listitem(value):

src/client/packaging/npm/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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": "1.0.0",
5+
"version": "0.1.0",
66
"main": "delphi_epidata.js",
77
"types": "delphi_epidata.d.ts",
88
"browser": "delphi_epidata.js",

src/client/packaging/pypi/setup.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
import setuptools
22

3-
with open('README.md', 'r') as f:
4-
long_description = f.read()
3+
with open("README.md", "r") as f:
4+
long_description = f.read()
55

66
setuptools.setup(
7-
name='delphi_epidata',
8-
version='0.0.12',
9-
author='David Farrow',
10-
author_email='[email protected]',
11-
description='A programmatic interface to Delphi\'s Epidata API.',
12-
long_description=long_description,
13-
long_description_content_type='text/markdown',
14-
url='https://github.com/cmu-delphi/delphi-epidata',
15-
packages=setuptools.find_packages(),
16-
install_requires=[
17-
'aiohttp',
18-
'requests>=2.7.0',
19-
'tenacity'
20-
],
21-
classifiers=[
22-
'Programming Language :: Python',
23-
'License :: OSI Approved :: MIT License',
24-
'Operating System :: OS Independent',
25-
'Intended Audience :: Science/Research',
26-
'Natural Language :: English',
27-
'Topic :: Scientific/Engineering :: Bio-Informatics',
28-
],
7+
name="delphi_epidata",
8+
version="0.1.0",
9+
author="David Farrow",
10+
author_email="[email protected]",
11+
description="A programmatic interface to Delphi's Epidata API.",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/cmu-delphi/delphi-epidata",
15+
packages=setuptools.find_packages(),
16+
install_requires=["aiohttp", "requests>=2.7.0", "tenacity"],
17+
classifiers=[
18+
"Programming Language :: Python",
19+
"License :: OSI Approved :: MIT License",
20+
"Operating System :: OS Independent",
21+
"Intended Audience :: Science/Research",
22+
"Natural Language :: English",
23+
"Topic :: Scientific/Engineering :: Bio-Informatics",
24+
],
2925
)

0 commit comments

Comments
 (0)