Skip to content

Release Delphi Epidata 0.4.5 #1070

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

Merged
merged 26 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9e3ad67
1. add contidional time_values=* handler in parse_timer_mairs in covi…
LeonLu2 Dec 2, 2022
d08c011
Merge branch 'dev' into leonlu2/time_values_and_issues
LeonLu2 Dec 2, 2022
9b50619
Merge branch 'dev' into leonlu2/time_values_and_issues
LeonLu2 Dec 14, 2022
1a0563b
Merge pull request #1057 from cmu-delphi/bot/sync-main-dev
krivard Dec 14, 2022
44ff896
API server code health pass - misc. refactors (#1059)
rzats Dec 22, 2022
2d1ad93
Merge branch 'dev' into leonlu2/time_values_and_issues
LeonLu2 Jan 3, 2023
5d3bce6
Fix problem with covid_hosp skipping state revisions.
krivard Jan 12, 2023
94ec8e9
Server: fix unbound exception variable (#1051)
dshemetov Jan 14, 2023
7774f96
API server code health pass - rename *Pair classes to *Set (#1060)
rzats Jan 16, 2023
9b1eaeb
1. add issues=* handler to apply_issues_filter
LeonLu2 Jan 17, 2023
2a13311
1. Merge branch 'dev' into current branch
LeonLu2 Jan 17, 2023
335f037
mark inactive indicators on api documentation
minhkhul Jan 17, 2023
f4bdbeb
changes to quidel
minhkhul Jan 17, 2023
6cbb9e1
tested change to quidel
minhkhul Jan 17, 2023
9f4b5fa
s/Safegraph/Quidel on quidel.md
krivard Jan 17, 2023
9755ad2
Merge pull request #1066 from cmu-delphi/add-inactive-indicators
krivard Jan 17, 2023
4a6f0ae
Move parse methods from covidcast (#1062)
rzats Jan 18, 2023
7643299
Fix missing imports (#1067)
rzats Jan 18, 2023
247a1e3
[covid_hosp] add new column instead of repurpose old column
krivard Jan 18, 2023
3f2bacb
1. Merge branch 'dev' into leonlu2/time_values_and_issues
LeonLu2 Jan 18, 2023
269b294
1. Merge dev to current branch
LeonLu2 Jan 18, 2023
517df70
Merge pull request #1064 from cmu-delphi/krivard/covid_hosp_datechecks
krivard Jan 19, 2023
79e32dc
Update src/server/_params.py
LeonLu2 Jan 19, 2023
c53c15a
Update integrations/server/test_covidcast.py
LeonLu2 Jan 19, 2023
04ed491
Merge pull request #1065 from cmu-delphi/leonlu2/time_values_and_issues
krivard Jan 19, 2023
319e95f
chore: release delphi-epidata 0.4.5
krivard Jan 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.4
current_version = 0.4.5
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion dev/local/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = Delphi Development
version = 0.4.4
version = 0.4.5

[options]
packages =
Expand Down
2 changes: 1 addition & 1 deletion docs/api/covidcast-signals/covid-act-now.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: COVID Act Now
parent: Data Sources and Signals
parent: Inactive Signals
grand_parent: COVIDcast Main Endpoint
---

Expand Down
52 changes: 52 additions & 0 deletions docs/api/covidcast-signals/quidel-inactive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Quidel
parent: Inactive Signals
grand_parent: COVIDcast Main Endpoint
---

# Quidel
{: .no_toc}

* **Source name:** `quidel`

## Table of Contents
{: .no_toc .text-delta}

1. TOC
{:toc}


## COVID-19 Tests
These signals are still active. Documentation is available on the [Quidel page](quidel.md).

## Flu Tests

* **Earliest issue available:** April 29, 2020
* **Last issued:** May 19, 2020
* **Number of data revisions since May 19, 2020:** 0
* **Date of last change:** Never
* **Available for:** msa, state (see [geography coding docs](../covidcast_geography.md))
* **Time type:** day (see [date format docs](../covidcast_times.md))

Data source based on flu lab tests, provided to us by Quidel, Inc. When a
patient (whether at a doctor’s office, clinic, or hospital) has COVID-like
symptoms, doctors may perform a flu test to rule out seasonal flu (influenza),
because these two diseases have similar symptoms. Using this lab test data, we
estimate the total number of flu tests per medical device (a measure of testing
frequency), and the percentage of flu tests that are *negative* (since ruling
out flu leaves open another cause---possibly covid---for the patient's
symptoms), in a given location, on a given day.

The number of flu tests conducted in individual counties can be quite small, so
we do not report these signals at the county level.

The flu test data is no longer updated as of May 19, 2020, as the number of flu
tests conducted during the summer (outside of the normal flu season) is quite
small. The data may be updated again when the Winter 2020 flu season begins.

| Signal | Description |
| --- | --- |
| `raw_pct_negative` | The percentage of flu tests that are negative, suggesting the patient's illness has another cause, possibly COVID-19 <br/> **Earliest date available:** 2020-01-31 |
| `smoothed_pct_negative` | Same as above, but smoothed in time <br/> **Earliest date available:** 2020-01-31 |
| `raw_tests_per_device` | The average number of flu tests conducted by each testing device; measures volume of testing <br/> **Earliest date available:** 2020-01-31 |
| `smoothed_tests_per_device` | Same as above, but smoothed in time <br/> **Earliest date available:** 2020-01-31 |
33 changes: 2 additions & 31 deletions docs/api/covidcast-signals/quidel.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,34 +157,5 @@ not enough samples can be filled in from the parent state for smoothed signals s
no data is reported for that area on that day; an API query for all reported geographic areas on
that day will not include it.

## Flu Tests

* **Earliest issue available:** April 29, 2020
* **Last issued:** May 19, 2020
* **Number of data revisions since May 19, 2020:** 0
* **Date of last change:** Never
* **Available for:** msa, state (see [geography coding docs](../covidcast_geography.md))
* **Time type:** day (see [date format docs](../covidcast_times.md))

Data source based on flu lab tests, provided to us by Quidel, Inc. When a
patient (whether at a doctor’s office, clinic, or hospital) has COVID-like
symptoms, doctors may perform a flu test to rule out seasonal flu (influenza),
because these two diseases have similar symptoms. Using this lab test data, we
estimate the total number of flu tests per medical device (a measure of testing
frequency), and the percentage of flu tests that are *negative* (since ruling
out flu leaves open another cause---possibly covid---for the patient's
symptoms), in a given location, on a given day.

The number of flu tests conducted in individual counties can be quite small, so
we do not report these signals at the county level.

The flu test data is no longer updated as of May 19, 2020, as the number of flu
tests conducted during the summer (outside of the normal flu season) is quite
small. The data may be updated again when the Winter 2020 flu season begins.

| Signal | Description |
| --- | --- |
| `raw_pct_negative` | The percentage of flu tests that are negative, suggesting the patient's illness has another cause, possibly COVID-19 <br/> **Earliest date available:** 2020-01-31 |
| `smoothed_pct_negative` | Same as above, but smoothed in time <br/> **Earliest date available:** 2020-01-31 |
| `raw_tests_per_device` | The average number of flu tests conducted by each testing device; measures volume of testing <br/> **Earliest date available:** 2020-01-31 |
| `smoothed_tests_per_device` | Same as above, but smoothed in time <br/> **Earliest date available:** 2020-01-31 |
## Flu Tests (inactive)
These signals were updated until May 19, 2020. Documentation is still available on the [inactive Quidel page](quidel-inactive.md).
87 changes: 0 additions & 87 deletions docs/api/covidcast-signals/safegraph.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/api/covidcast-signals/usa-facts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: USAFacts Cases and Deaths
parent: Data Sources and Signals
parent: Inactive Signals
grand_parent: COVIDcast Main Endpoint
---

Expand Down
52 changes: 52 additions & 0 deletions integrations/server/test_covidcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def _insert_placeholder_set_four(self):
for i in [4, 5, 6]
]
self._insert_rows(rows)
return rows

def _insert_placeholder_set_five(self):
rows = [
self._make_placeholder_row(time_value=2000_01_01, value=i*1., stderr=i*10., sample_size=i*100., issue=2000_01_03+i)[0]
for i in [1, 2, 3]
] + [
# different time_values, same issues
self._make_placeholder_row(time_value=2000_01_01+i-3, value=i*1., stderr=i*10., sample_size=i*100., issue=2000_01_03+i-3)[0]
for i in [4, 5, 6]
]
self._insert_rows(rows)
return rows

def test_round_trip(self):
Expand Down Expand Up @@ -237,6 +249,46 @@ def test_location_wildcard(self):
'message': 'success',
})

def test_time_values_wildcard(self):
"""Select all time_values with a wildcard query."""

# insert placeholder data
rows = self._insert_placeholder_set_three()
expected_time_values = [
self.expected_from_row(r) for r in rows[:3]
]

# make the request
response, _ = self.request_based_on_row(rows[0], time_values="*")

self.maxDiff = None
# assert that the right data came back
self.assertEqual(response, {
'result': 1,
'epidata': expected_time_values,
'message': 'success',
})

def test_issues_wildcard(self):
"""Select all issues with a wildcard query."""

# insert placeholder data
rows = self._insert_placeholder_set_five()
expected_issues = [
self.expected_from_row(r) for r in rows[:3]
]

# make the request
response, _ = self.request_based_on_row(rows[0], issues="*")

self.maxDiff = None
# assert that the right data came back
self.assertEqual(response, {
'result': 1,
'epidata': expected_issues,
'message': 'success',
})

def test_signal_wildcard(self):
"""Select all signals with a wildcard query."""

Expand Down
15 changes: 10 additions & 5 deletions src/acquisition/covid_hosp/common/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Database:
def __init__(self,
connection,
table_name=None,
hhs_dataset_id=None,
columns_and_types=None,
key_columns=None,
additional_fields=None):
Expand All @@ -30,6 +31,8 @@ def __init__(self,
An open connection to a database.
table_name : str
The name of the table which holds the dataset.
hhs_dataset_id : str
The 9-character healthdata.gov identifier for this dataset.
columns_and_types : tuple[str, str, Callable]
List of 3-tuples of (CSV header name, SQL column name, data type) for
all the columns in the CSV file.
Expand All @@ -40,6 +43,7 @@ def __init__(self,

self.connection = connection
self.table_name = table_name
self.hhs_dataset_id = hhs_dataset_id
self.publication_col_name = "issue" if table_name == 'covid_hosp_state_timeseries' else \
'publication_date'
self.columns_and_types = {
Expand Down Expand Up @@ -115,8 +119,8 @@ def contains_revision(self, revision):
FROM
`covid_hosp_meta`
WHERE
`dataset_name` = %s AND `revision_timestamp` = %s
''', (self.table_name, revision))
`hhs_dataset_id` = %s AND `revision_timestamp` = %s
''', (self.hhs_dataset_id, revision))
for (result,) in cursor:
return bool(result)

Expand All @@ -138,14 +142,15 @@ def insert_metadata(self, publication_date, revision, meta_json):
INSERT INTO
`covid_hosp_meta` (
`dataset_name`,
`hhs_dataset_id`,
`publication_date`,
`revision_timestamp`,
`metadata_json`,
`acquisition_datetime`
)
VALUES
(%s, %s, %s, %s, NOW())
''', (self.table_name, publication_date, revision, meta_json))
(%s, %s, %s, %s, %s, NOW())
''', (self.table_name, self.hhs_dataset_id, publication_date, revision, meta_json))

def insert_dataset(self, publication_date, dataframe):
"""Add a dataset to the database.
Expand Down Expand Up @@ -232,7 +237,7 @@ def get_max_issue(self):
from
`covid_hosp_meta`
WHERE
dataset_name = "{self.table_name}"
hhs_dataset_id = "{self.hhs_dataset_id}"
''')
for (result,) in cursor:
if result is not None:
Expand Down
15 changes: 8 additions & 7 deletions src/acquisition/covid_hosp/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,20 @@ def update_dataset(database, network, newer_than=None, older_than=None):
# download the dataset and add it to the database
dataset = Utils.merge_by_key_cols([network.fetch_dataset(url) for url, _ in revisions],
db.KEY_COLS)
# add metadata to the database using the last revision seen.
last_url, last_index = revisions[-1]
metadata_json = metadata.loc[last_index].reset_index().to_json()
# add metadata to the database
all_metadata = []
for url, index in revisions:
all_metadata.append((url, metadata.loc[index].reset_index().to_json()))
datasets.append((
issue_int,
dataset,
last_url,
metadata_json
all_metadata
))
with database.connect() as db:
for issue_int, dataset, last_url, metadata_json in datasets:
for issue_int, dataset, all_metadata in datasets:
db.insert_dataset(issue_int, dataset)
db.insert_metadata(issue_int, last_url, metadata_json)
for url, metadata_json in all_metadata:
db.insert_metadata(issue_int, url, metadata_json)
print(f'successfully acquired {len(dataset)} rows')

# note that the transaction is committed by exiting the `with` block
Expand Down
2 changes: 2 additions & 0 deletions src/acquisition/covid_hosp/facility/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from delphi.epidata.acquisition.covid_hosp.common.database import Database as BaseDatabase
from delphi.epidata.acquisition.covid_hosp.common.database import Columndef
from delphi.epidata.acquisition.covid_hosp.common.utils import Utils
from delphi.epidata.acquisition.covid_hosp.facility.network import Network


class Database(BaseDatabase):
Expand Down Expand Up @@ -213,5 +214,6 @@ def __init__(self, *args, **kwargs):
*args,
**kwargs,
table_name=Database.TABLE_NAME,
hhs_dataset_id=Network.DATASET_ID,
key_columns=Database.KEY_COLS,
columns_and_types=Database.ORDERED_CSV_COLUMNS)
2 changes: 2 additions & 0 deletions src/acquisition/covid_hosp/state_daily/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from delphi.epidata.acquisition.covid_hosp.common.database import Database as BaseDatabase
from delphi.epidata.acquisition.covid_hosp.common.database import Columndef
from delphi.epidata.acquisition.covid_hosp.common.utils import Utils
from delphi.epidata.acquisition.covid_hosp.state_daily.network import Network


class Database(BaseDatabase):
Expand Down Expand Up @@ -223,6 +224,7 @@ def __init__(self, *args, **kwargs):
*args,
**kwargs,
table_name=Database.TABLE_NAME,
hhs_dataset_id=Network.DATASET_ID,
columns_and_types=Database.ORDERED_CSV_COLUMNS,
key_columns=Database.KEY_COLS,
additional_fields=[Columndef('D', 'record_type', None)])
Loading