Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert and deprecate async_epidata (+ Remove usage of PHP alias in the Python client) #1295

Merged

Conversation

melange396
Copy link
Collaborator

whoops, i wasnt paying attention on the command line and my commit message got slightly mangled, it should read:
"revert async_epidata() to previous behavior, and mark deprecated (filterwarnings() not fully tested)"

to be added to #1288

i did not do much testing around the warnings.filterwarnings() call, but it is intended to print the deprecation warning for the method only once (on its first use), no matter how async_epidata() is called.

@melange396
Copy link
Collaborator Author

@rzats can you make this failing test work? I think it might be pretty easily fixable if you use src/common/covidcast_row.py:as_api_compatibility_row_*() in or around the .assertEqual() call.

Copy link
Contributor

@dshemetov dshemetov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested filterwarnings in a separate python file and it only printed the warning once 👍

responses = [i[0]["epidata"] for i in test_output]
# check response is same as standard covidcast call (minus fields omitted by the api.php endpoint),
# using 24 calls to test batch sizing
ignore_fields = ["source", "time_type", "geo_type"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of re-defining, use existing list:

Suggested change
ignore_fields = ["source", "time_type", "geo_type"]
ignore_fields = CovidcastTestRow._api_row_compatibility_ignore_fields

Comment on lines 349 to 350
[{k: v for k, v in row.items() if k not in ignore_fields} for row in Epidata.covidcast(**self.params_from_row(rows[0]))["epidata"]],
[{k: v for k, v in row.items() if k not in ignore_fields} for row in Epidata.covidcast(**self.params_from_row(rows[1]))["epidata"]],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is slightly more concise...

Suggested change
[{k: v for k, v in row.items() if k not in ignore_fields} for row in Epidata.covidcast(**self.params_from_row(rows[0]))["epidata"]],
[{k: v for k, v in row.items() if k not in ignore_fields} for row in Epidata.covidcast(**self.params_from_row(rows[1]))["epidata"]],
[{k: row[k] for k in row.keys() - ignore_fields} for row in Epidata.covidcast(**self.params_from_row(rows[0]))["epidata"]],
[{k: row[k] for k in row.keys() - ignore_fields} for row in Epidata.covidcast(**self.params_from_row(rows[1]))["epidata"]],

@sonarcloud
Copy link

sonarcloud bot commented Oct 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@melange396
Copy link
Collaborator Author

Tested filterwarnings in a separate python file and it only printed the warning once 👍

awesome!!! thank you @dshemetov !

@melange396 melange396 merged commit 1f9bf19 into rzatserkovnyi/api-php-refactor Oct 4, 2023
5 checks passed
@melange396 melange396 deleted the revert_deprecate_async_epidata branch October 4, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants