Skip to content

Releases: cmu-delphi/delphi-epidata

PyPI version 0.0.12

08 Jun 14:46
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

This version includes a minor change to the default async settings to reduce timeout errors.

It can be installed like this:

pip install delphi-epidata

Sample usage:

# import
from delphi_epidata import Epidata
from datetime import datetime, timedelta

start = datetime(2020, 9, 8)
dates = [(start + timedelta(days=i)) for i in range(60)]
params = [
    {
        'endpoint': 'covidcast',
        'data_source': 'fb-survey',
        'signals': 'smoothed_wearing_mask',
        'time_type': 'day',
        'geo_type': 'county',
        'geo_value': '*',
        'time_values': d.strftime("%Y%m%d")
    } for d in dates
]

output = Epidata.async_epidata(params, batch_size=10)

Sample output:

[
  (
    {
      "result": 1,
      "epidata": [
        {
          "geo_value": "01000",
          "signal": "smoothed_wearing_mask",
          "time_value": 20200908,
          "direction": null,
          "issue": 20201209,
          "lag": 92,
          "value": 87.8745134,
          "stderr": 1.7062192,
          "sample_size": 366.0096
        },
        ...],
      "message": "success"
    },
    {
      "endpoint": "covidcast",
      "data_source": "fb-survey",
      "signals": "smoothed_wearing_mask",
      "time_type": "day",
      "geo_type": "county",
      "geo_value": "*",
      "time_values": "20200908"
    }
  ),
  (
    {
      "result": 1,
      "epidata": [
        {
          "geo_value": "01000",
          "signal": "smoothed_wearing_mask",
          "time_value": 20200909,
          "direction": null,
          "issue": 20201209,
          "lag": 91,
          "value": 84.1639592,
          "stderr": 1.2342333,
          "sample_size": 874.9399
        },
        ...],
      "message": "success"
    },
    {
      "endpoint": "covidcast",
      "data_source": "fb-survey",
      "signals": "smoothed_wearing_mask",
      "time_type": "day",
      "geo_type": "county",
      "geo_value": "*",
      "time_values": "20200909"
    }
  ),
  ...
]

PyPI version 0.0.11

12 Feb 23:02
9496806
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

This version supports submitting many queries simultaneously using aiohttp.

It can be installed like this:

pip install delphi-epidata

Sample usage:

# import
from delphi_epidata import Epidata
from datetime import datetime, timedelta

start = datetime(2020, 9, 8)
dates = [(start + timedelta(days=i)) for i in range(60)]
params = [
    {
        'endpoint': 'covidcast',
        'data_source': 'fb-survey',
        'signals': 'smoothed_wearing_mask',
        'time_type': 'day',
        'geo_type': 'county',
        'geo_value': '*',
        'time_values': d.strftime("%Y%m%d")
    } for d in dates
]

output = Epidata.async_epidata(params, batch_size=10)

Sample output:

[
  (
    {
      "result": 1,
      "epidata": [
        {
          "geo_value": "01000",
          "signal": "smoothed_wearing_mask",
          "time_value": 20200908,
          "direction": null,
          "issue": 20201209,
          "lag": 92,
          "value": 87.8745134,
          "stderr": 1.7062192,
          "sample_size": 366.0096
        },
        ...],
      "message": "success"
    },
    {
      "endpoint": "covidcast",
      "data_source": "fb-survey",
      "signals": "smoothed_wearing_mask",
      "time_type": "day",
      "geo_type": "county",
      "geo_value": "*",
      "time_values": "20200908"
    }
  ),
  (
    {
      "result": 1,
      "epidata": [
        {
          "geo_value": "01000",
          "signal": "smoothed_wearing_mask",
          "time_value": 20200909,
          "direction": null,
          "issue": 20201209,
          "lag": 91,
          "value": 84.1639592,
          "stderr": 1.2342333,
          "sample_size": 874.9399
        },
        ...],
      "message": "success"
    },
    {
      "endpoint": "covidcast",
      "data_source": "fb-survey",
      "signals": "smoothed_wearing_mask",
      "time_type": "day",
      "geo_type": "county",
      "geo_value": "*",
      "time_values": "20200909"
    }
  ),
  ...
]

PyPI version 0.0.9

22 Dec 16:53
64f96f8
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

It can be installed like this:

pip install delphi-epidata

Sample usage:

# import
from delphi_epidata import Epidata
import json

# query
print(json.dumps(Epidata.covid_hosp_facility_lookup(city='scranton'), indent=2))

Sample output:

{
  "result": 1,
  "epidata": [
    {
      "hospital_pk": "390001",
      "state": "PA",
      "ccn": "390001",
      "hospital_name": "GEISINGER-COMMUNITY MEDICAL CENTER",
      "address": "1822 MULBERRY STREET",
      "city": "SCRANTON",
      "zip": "18510",
      "hospital_subtype": "Short Term",
      "fips_code": "42069",
      "is_metro_micro": 1
    },
    {
      "hospital_pk": "390119",
      "state": "PA",
      "ccn": "390119",
      "hospital_name": "MOSES TAYLOR HOSPITAL",
      "address": "700 QUINCY AVENUE",
      "city": "SCRANTON",
      "zip": "18510",
      "hospital_subtype": "Short Term",
      "fips_code": "42069",
      "is_metro_micro": 1
    },
    {
      "hospital_pk": "390237",
      "state": "PA",
      "ccn": "390237",
      "hospital_name": "REGIONAL HOSPITAL OF SCRANTON",
      "address": "746 JEFFERSON AVENUE",
      "city": "SCRANTON",
      "zip": "18501",
      "hospital_subtype": "Short Term",
      "fips_code": "42069",
      "is_metro_micro": 1
    }
  ],
  "message": "success"
}

PyPI version 0.0.8

20 Nov 22:16
7cd9cb9
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

It can be installed like this:

pip install delphi-epidata

It can be used like this:

# import
from delphi_epidata import Epidata
import json

# query
print(json.dumps(Epidata.covid_hosp("pa", 20201101), indent=2))
{
  "result": 1,
  "epidata": [
    {
      "state": "PA",
      "issue": 20201118,
      "date": 20201101,
      "hospital_onset_covid": 39,
      "hospital_onset_covid_coverage": 217,
[...]
      "adult_icu_bed_covid_utilization": 0.11014884979702,
      "adult_icu_bed_utilization": 0.75111812680873
    }
  ],
  "message": "success"
}

PyPI version 0.0.7

26 Jul 02:23
fd2af0c
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

It can be installed like this:

pip install delphi-epidata

It can be used like this:

# import
from delphi_epidata import Epidata

# query
print(Epidata.fluview('nat', 202016))

PyPI version 0.0.6

18 Jun 22:17
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

It can be installed like this:

pip install delphi-epidata

It can be used like this:

# import
from delphi_epidata import Epidata

# query
print(Epidata.fluview('nat', 202016))

PyPI version 0.0.5

30 Apr 22:56
92d1ba2
Compare
Choose a tag to compare

This is an update to the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

It can be installed like this:

pip install delphi-epidata

It can be used like this:

# import
from delphi_epidata import Epidata

# query
print(Epidata.fluview('nat', 202016))

PyPI version 0.0.4

05 Oct 18:02
Compare
Choose a tag to compare

This is the first release of the PyPI package delphi-epidata, which can be found at https://pypi.org/project/delphi-epidata/.

It can be installed like this:
pip install delphi-epidata (or even better: pipenv install delphi-epidata)

Then you can use it in your python code like this:

# import
from delphi_epidata import Epidata

# query
print(Epidata.fluview('nat', 201830))