Skip to content

Commit f544328

Browse files
committed
Merge branch 'ndefries/flusurv-new-columns' into ndefries/flusurv-new-endpoint
2 parents 81e5f42 + cd9a46b commit f544328

File tree

5 files changed

+127
-73
lines changed

5 files changed

+127
-73
lines changed

docs/api/flusurv.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,45 @@ If neither is specified, the current issues are used.
5454

5555
## Response
5656

57-
| Field | Description | Type |
58-
|--------------------------|-----------------------------------------------------------------|------------------|
59-
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
60-
| `epidata` | list of results | array of objects |
61-
| `epidata[].release_date` | | string |
62-
| `epidata[].location` | | string |
63-
| `epidata[].issue` | | integer |
64-
| `epidata[].epiweek` | | integer |
65-
| `epidata[].lag` | | integer |
66-
| `epidata[].rate_age_0` | | float |
67-
| `epidata[].rate_age_1` | | float |
68-
| `epidata[].rate_age_2` | | float |
69-
| `epidata[].rate_age_3` | | float |
70-
| `epidata[].rate_age_4` | | float |
71-
| `epidata[].rate_overall` | | float |
72-
| `message` | `success` or error message | string |
57+
| Field | Description | Type |
58+
|---|---|---|
59+
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
60+
| `epidata` | list of results | array of objects |
61+
| `epidata[].release_date` | the date when this record was first received by Delphi | string |
62+
| `epidata[].location` | the name of the catchment (e.g. 'network_all', 'CA', 'NY_albany' | string |
63+
| `epidata[].issue` | the epiweek of receipt by Delphi (e.g. issue 201453 includes epiweeks up to and including 2014w53, but not 2015w01 or following) | integer |
64+
| `epidata[].epiweek` | the epiweek during which the data was collected | integer |
65+
| `epidata[].lag` | number of weeks between `epiweek` and `issue` | integer |
66+
| `epidata[].rate_age_0` | hospitalization rate for ages 0-4 | float |
67+
| `epidata[].rate_age_1` | hospitalization rate for ages 5-17 | float |
68+
| `epidata[].rate_age_2` | hospitalization rate for ages 18-49 | float |
69+
| `epidata[].rate_age_3` | hospitalization rate for ages 50-64 | float |
70+
| `epidata[].rate_age_4` | hospitalization rate for ages 65+ | float |
71+
| `epidata[].rate_overall` | overall hospitalization rate | float |
72+
| `epidata[].rate_age_5` | hospitalization rate for ages 65-74 | float |
73+
| `epidata[].rate_age_6` | hospitalization rate for ages 75-84 | float |
74+
| `epidata[].rate_age_7` | hospitalization rate for ages 85+ | float |
75+
| `epidata[].rate_age_18t29` | hospitalization rate for ages 18 to 29 | float |
76+
| `epidata[].rate_age_30t39` | hospitalization rate for ages 30 to 39 | float |
77+
| `epidata[].rate_age_40t49` | hospitalization rate for ages 40 to 49 | float |
78+
| `epidata[].rate_age_5t11` | hospitalization rate for ages 5 to 11 | float |
79+
| `epidata[].rate_age_12t17` | hospitalization rate for ages 12 to 17 | float |
80+
| `epidata[].rate_age_lt18` | hospitalization rate for ages <18 | float |
81+
| `epidata[].rate_age_gte18` | hospitalization rate for ages >=18 | float |
82+
| `epidata[].rate_age_0tlt1` | hospitalization rate for ages 0-1 | float |
83+
| `epidata[].rate_age_1t4` | hospitalization rate for ages 1-4 | float |
84+
| `epidata[].rate_age_gte75` | hospitalization rate for ages >=75 | float |
85+
| `epidata[].rate_race_white` | hospitalization rate for white people | float |
86+
| `epidata[].rate_race_black` | hospitalization rate for black people | float |
87+
| `epidata[].rate_race_hisp` | hospitalization rate for Hispanic/Latino people | float |
88+
| `epidata[].rate_race_asian` | hospitalization rate for Asian people | float |
89+
| `epidata[].rate_race_natamer` | hospitalization rate for American Indian/Alaskan Native people | float |
90+
| `epidata[].rate_sex_male` | hospitalization rate for males | float |
91+
| `epidata[].rate_sex_female` | hospitalization rate for females | float |
92+
| `epidata[].rate_flu_a` | hospitalization rate for inflenza A | float |
93+
| `epidata[].rate_flu_b` | hospitalization rate for inflenza B | float |
94+
| `epidata[].season` | indicates the start and end years of the winter flu season in the format YYYY-YY (e.g. 2022-23 indicates the flu season running late 2022 through early 2023) | string |
95+
| `message` | `success` or error message | string |
7396

7497
Notes:
7598
* The `flusurv` age groups are, in general, not the same as the ILINet

src/acquisition/flusurv/flusurv_update.py

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,9 @@
1919
=== Data Dictionary ===
2020
=======================
2121
22-
`flusurv` is the table where US flu hospitalization rates are stored.
23-
+--------------+-------------+------+-----+---------+----------------+
24-
| Field | Type | Null | Key | Default | Extra |
25-
+--------------+-------------+------+-----+---------+----------------+
26-
| id | int(11) | NO | PRI | NULL | auto_increment |
27-
| release_date | date | NO | MUL | NULL | |
28-
| issue | int(11) | NO | MUL | NULL | |
29-
| epiweek | int(11) | NO | MUL | NULL | |
30-
| location | varchar(32) | NO | MUL | NULL | |
31-
| lag | int(11) | NO | MUL | NULL | |
32-
| rate_age_0 | double | YES | | NULL | |
33-
| rate_age_1 | double | YES | | NULL | |
34-
| rate_age_2 | double | YES | | NULL | |
35-
| rate_age_3 | double | YES | | NULL | |
36-
| rate_age_4 | double | YES | | NULL | |
37-
| rate_overall | double | YES | | NULL | |
38-
| rate_age_5 | double | YES | | NULL | |
39-
| rate_age_6 | double | YES | | NULL | |
40-
| rate_age_7 | double | YES | | NULL | |
41-
+--------------+-------------+------+-----+---------+----------------+
42-
id: unique identifier for each record
43-
release_date: the date when this record was first received by Delphi
44-
issue: the epiweek of receipt by Delphi (e.g. issue 201453 includes epiweeks up to
45-
and including 2014w53, but not 2015w01 or following)
46-
epiweek: the epiweek during which the data was collected
47-
location: the name of the catchment (e.g. 'network_all', 'CA', 'NY_albany')
48-
lag: number of weeks between `epiweek` and `issue`
49-
rate_age_0: hospitalization rate for ages 0-4
50-
rate_age_1: hospitalization rate for ages 5-17
51-
rate_age_2: hospitalization rate for ages 18-49
52-
rate_age_3: hospitalization rate for ages 50-64
53-
rate_age_4: hospitalization rate for ages 65+
54-
rate_overall: overall hospitalization rate
55-
rate_age_5: hospitalization rate for ages 65-74
56-
rate_age_6: hospitalization rate for ages 75-84
57-
rate_age_7: hospitalization rate for ages 85+
22+
US flu hospitalization rates are stored in the `flusurv` table. See
23+
`strc/ddl/fluview.sql` for the `flusurv` schema. See `docs/api/flusurv.md` for
24+
field descriptions.
5825
5926
=================
6027
=== Changelog ===
@@ -168,8 +135,13 @@ def update(fetcher, location, test_mode=False):
168135
del data[epiweek][key]
169136

170137
args_meta = {
138+
# the date when this record was first received by Delphi
171139
"release_date": release_date,
140+
# the epiweek of receipt by Delphi (e.g. issue 201453 includes
141+
# epiweeks up to and including 2014w53, but not 2015w01 or
142+
# following)
172143
"issue": fetcher.metadata.issue,
144+
# the epiweek during which the data was collected
173145
"epiweek": epiweek,
174146
"location": location,
175147
"lag": lag

src/ddl/fluview.sql

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ CREATE TABLE `fluview_public` (
329329
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
330330

331331
/*
332-
`flusurv` stores FluSurv-NET data (flu hospitaliation rates) as published by
332+
`flusurv` stores FluSurv-NET data (flu hospitalization rates) as published by
333333
CDC.
334334
335335
Data is public.
@@ -345,25 +345,58 @@ Note that the flusurv age groups are, in general, not the same as the ILINet
345345
particular "catchment" (e.g. 'network_all', 'CA', 'NY_albany') rather than by
346346
regions and states in general.
347347
348-
+--------------+-------------+------+-----+---------+----------------+
349-
| Field | Type | Null | Key | Default | Extra |
350-
+--------------+-------------+------+-----+---------+----------------+
351-
| id | int(11) | NO | PRI | NULL | auto_increment |
352-
| release_date | date | NO | MUL | NULL | |
353-
| issue | int(11) | NO | MUL | NULL | |
354-
| epiweek | int(11) | NO | MUL | NULL | |
355-
| location | varchar(32) | NO | MUL | NULL | |
356-
| lag | int(11) | NO | MUL | NULL | |
357-
| rate_age_0 | double | YES | | NULL | |
358-
| rate_age_1 | double | YES | | NULL | |
359-
| rate_age_2 | double | YES | | NULL | |
360-
| rate_age_3 | double | YES | | NULL | |
361-
| rate_age_4 | double | YES | | NULL | |
362-
| rate_overall | double | YES | | NULL | |
363-
| rate_age_5 | double | YES | | NULL | |
364-
| rate_age_6 | double | YES | | NULL | |
365-
| rate_age_7 | double | YES | | NULL | |
366-
+--------------+-------------+------+-----+---------+----------------+
348+
+-------------------+-------------+------+-----+---------+----------------+
349+
| Field | Type | Null | Key | Default | Extra |
350+
+-------------------+-------------+------+-----+---------+----------------+
351+
| id | int(11) | NO | PRI | NULL | auto_increment |
352+
| release_date | date | NO | MUL | NULL | |
353+
| issue | int(11) | NO | MUL | NULL | |
354+
| epiweek | int(11) | NO | MUL | NULL | |
355+
| location | varchar(32) | NO | MUL | NULL | |
356+
| lag | int(11) | NO | MUL | NULL | |
357+
| rate_age_0 | double | YES | | NULL | |
358+
| rate_age_1 | double | YES | | NULL | |
359+
| rate_age_2 | double | YES | | NULL | |
360+
| rate_age_3 | double | YES | | NULL | |
361+
| rate_age_4 | double | YES | | NULL | |
362+
| rate_overall | double | YES | | NULL | |
363+
| rate_age_5 | double | YES | | NULL | |
364+
| rate_age_6 | double | YES | | NULL | |
365+
| rate_age_7 | double | YES | | NULL | |
366+
| rate_age_18t29 | double | YES | | NULL | |
367+
| rate_age_30t39 | double | YES | | NULL | |
368+
| rate_age_40t49 | double | YES | | NULL | |
369+
| rate_age_5t11 | double | YES | | NULL | |
370+
| rate_age_12t17 | double | YES | | NULL | |
371+
| rate_age_lt18 | double | YES | | NULL | |
372+
| rate_age_gte18 | double | YES | | NULL | |
373+
| rate_race_white | double | YES | | NULL | |
374+
| rate_race_black | double | YES | | NULL | |
375+
| rate_race_hisp | double | YES | | NULL | |
376+
| rate_race_asian | double | YES | | NULL | |
377+
| rate_race_natamer | double | YES | | NULL | |
378+
| rate_sex_male | double | YES | | NULL | |
379+
| rate_sex_female | double | YES | | NULL | |
380+
| season | char(7) | YES | | NULL | |
381+
+-------------------+-------------+------+-----+---------+----------------+
382+
383+
id: unique identifier for each record
384+
release_date: the date when this record was first received by Delphi
385+
issue: the epiweek of receipt by Delphi (e.g. issue 201453 includes epiweeks up to
386+
and including 2014w53, but not 2015w01 or following)
387+
epiweek: the epiweek during which the data was collected
388+
location: the name of the catchment (e.g. 'network_all', 'CA', 'NY_albany')
389+
lag: number of weeks between `epiweek` and `issue`
390+
rate_age_0: hospitalization rate for ages 0-4
391+
rate_age_1: hospitalization rate for ages 5-17
392+
rate_age_2: hospitalization rate for ages 18-49
393+
rate_age_3: hospitalization rate for ages 50-64
394+
rate_age_4: hospitalization rate for ages 65+
395+
rate_overall: overall hospitalization rate
396+
rate_age_5: hospitalization rate for ages 65-74
397+
rate_age_6: hospitalization rate for ages 75-84
398+
rate_age_7: hospitalization rate for ages 85+
399+
367400
*/
368401

369402
CREATE TABLE `flusurv` (
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- Add new age, race, and sex strata, and season descriptor (YYYY-YY format)
2+
ALTER TABLE `flusurv` ADD (
3+
`rate_age_18t29` double DEFAULT NULL,
4+
`rate_age_30t39` double DEFAULT NULL,
5+
`rate_age_40t49` double DEFAULT NULL,
6+
`rate_age_5t11` double DEFAULT NULL,
7+
`rate_age_12t17` double DEFAULT NULL,
8+
`rate_age_lt18` double DEFAULT NULL,
9+
`rate_age_gte18` double DEFAULT NULL,
10+
`rate_race_white` double DEFAULT NULL,
11+
`rate_race_black` double DEFAULT NULL,
12+
`rate_race_hisp` double DEFAULT NULL,
13+
`rate_race_asian` double DEFAULT NULL,
14+
`rate_race_natamer` double DEFAULT NULL,
15+
`rate_sex_male` double DEFAULT NULL,
16+
`rate_sex_female` double DEFAULT NULL,
17+
`rate_age_0tlt1` double DEFAULT NULL,
18+
`rate_age_1t4` double DEFAULT NULL,
19+
`rate_age_gte75` double DEFAULT NULL,
20+
`rate_flu_a` double DEFAULT NULL,
21+
`rate_flu_b` double DEFAULT NULL,
22+
`season` char(7) DEFAULT NULL,
23+
);

src/server/endpoints/flusurv.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def handle():
1919
# basic query info
2020
q = QueryBuilder("flusurv", "fs")
2121

22-
fields_string = ["release_date", "location"]
22+
fields_string = ["release_date", "location", "season"]
2323
fields_int = ["issue", "epiweek", "lag"]
2424
fields_float = [
2525
"rate_age_0",
@@ -41,13 +41,16 @@ def handle():
4141
"rate_age_1t4",
4242
"rate_age_gte75",
4343
"rate_age_0tlt1",
44+
4445
"rate_race_white",
4546
"rate_race_black",
4647
"rate_race_hisp",
4748
"rate_race_asian",
4849
"rate_race_natamer",
50+
4951
"rate_sex_male",
5052
"rate_sex_female",
53+
5154
"rate_flu_a",
5255
"rate_flu_b"
5356
]

0 commit comments

Comments
 (0)