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

No data returned from nchs-mortality and can't use week as the time type #1904

Closed
IDPHChicago opened this issue Oct 17, 2023 · 7 comments
Closed
Assignees
Labels
data quality Missing data, weird data, broken data

Comments

@IDPHChicago
Copy link

Actual Behavior:

When I query the data of any signal from data source nchs-mortality, it returns NoDataWarning. The time type is day (datetime.date()). The geo type is state. The geo value is il.
When I set the time type as week by using epiweek.Week(), it can't return the correct time and raise "AttributeError: 'Week' object has no attribute 'strftime'".

Expected behavior

I have the API key and would like to use covidcast.signal to download the data of Illinois from data source nchs-mortality. The signals are: deaths_covid_incidence_num, deaths_covid_incidence_prop, deaths_pneumonia_notflu_incidence_num, deaths_pneumonia_notflu_incidence_prop, deaths_pneumonia_or_flu_or_covid_incidence_num, deaths_pneumonia_or_flu_or_covid_incidence_prop.

Context

I can create the pandas dateframes by using covidcast.signal to download data from other data sources.

@IDPHChicago IDPHChicago added the data quality Missing data, weird data, broken data label Oct 17, 2023
@nolangormley
Copy link
Contributor

Do you remember which day you were trying to grab data from that gave you a NoDataWarning?

@nolangormley
Copy link
Contributor

Also, correct me if I'm wrong @brookslogan but it seems like from the documentation that when using epiweeks we should use epiweek.Week.enddate()?

@IDPHChicago
Copy link
Author

IDPHChicago commented Oct 17, 2023 via email

@melange396
Copy link
Contributor

@IDPHChicago: nchs-mortality data is collated weekly. Try this to get the data you are looking for, and note the time_type and time_values arguments that together specify the range of weeks 5 through 7 of 2021:

from delphi_epidata import Epidata
data = Epidata.covidcast("nchs-mortality", "deaths_covid_incidence_num", time_type="week", geo_type="state", time_values="202105:202107", geo_value="il")

@IDPHChicago
Copy link
Author

IDPHChicago commented Oct 18, 2023 via email

@melange396
Copy link
Contributor

Thank you for bringing this to our attention! We recently (accidentally) introduced a bug in processing "week" dates on our server, and you helped us identify it.

Now that it has been fixed, you should be able to use the covidcast client successfully... However, its start_day and end_day arguments must be of type datetime.date, even if the signal is "weekly". Either the .startdate() or .enddate() methods of epiweek.Week objects can be used to convert (and both should net the same results for weekly signals). Be sure you also specify time_type="week"! Here is a modified version of your sample code from above that should work properly:

data = covidcast.signal("nchs-mortality", "deaths_covid_incidence_num", Week(2021, 5).startdate(), Week(2021, 7).enddate(), "state", "il", time_type="week")

@IDPHChicago
Copy link
Author

IDPHChicago commented Oct 18, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data quality Missing data, weird data, broken data
Projects
None yet
Development

No branches or pull requests

3 participants