Skip to content

Commit 9de7d64

Browse files
authored
Update flusurv schema and docs with new age, sex, and race groups (#1287)
* add new columns to flusurv endpoint spec * add new age, sex, race strata, and season to schema * list new signals in documentation * move new season column to end of table * add migration script to add new fields to flusurv table * add field descriptions; reformat table so don't need to match line lengths * point from acquisition script to docs and schema def to deduplicate
1 parent 5248a97 commit 9de7d64

File tree

5 files changed

+127
-73
lines changed

5 files changed

+127
-73
lines changed

Diff for: docs/api/flusurv.md

+34-16
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,40 @@ If neither is specified, the current issues are used.
5252

5353
## Response
5454

55-
| Field | Description | Type |
56-
|--------------------------|-----------------------------------------------------------------|------------------|
57-
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
58-
| `epidata` | list of results | array of objects |
59-
| `epidata[].release_date` | | string |
60-
| `epidata[].location` | | string |
61-
| `epidata[].issue` | | integer |
62-
| `epidata[].epiweek` | | integer |
63-
| `epidata[].lag` | | integer |
64-
| `epidata[].rate_age_0` | | float |
65-
| `epidata[].rate_age_1` | | float |
66-
| `epidata[].rate_age_2` | | float |
67-
| `epidata[].rate_age_3` | | float |
68-
| `epidata[].rate_age_4` | | float |
69-
| `epidata[].rate_overall` | | float |
70-
| `message` | `success` or error message | string |
55+
| Field | Description | Type |
56+
|---|---|---|
57+
| `result` | result code: 1 = success, 2 = too many results, -2 = no results | integer |
58+
| `epidata` | list of results | array of objects |
59+
| `epidata[].release_date` | the date when this record was first published by the CDC | string |
60+
| `epidata[].location` | the name of the catchment (e.g. 'network_all', 'CA', 'NY_albany' | string |
61+
| `epidata[].issue` | the epiweek of publication (e.g. issue 201453 includes epiweeks up to and including 2014w53, but not 2015w01 or following) | integer |
62+
| `epidata[].epiweek` | the epiweek during which the data was collected | integer |
63+
| `epidata[].lag` | number of weeks between `epiweek` and `issue` | integer |
64+
| `epidata[].rate_age_0` | hospitalization rate for ages 0-4 | float |
65+
| `epidata[].rate_age_1` | hospitalization rate for ages 5-17 | float |
66+
| `epidata[].rate_age_2` | hospitalization rate for ages 18-49 | float |
67+
| `epidata[].rate_age_3` | hospitalization rate for ages 50-64 | float |
68+
| `epidata[].rate_age_4` | hospitalization rate for ages 65+ | float |
69+
| `epidata[].rate_overall` | overall hospitalization rate | float |
70+
| `epidata[].rate_age_5` | hospitalization rate for ages 65-74 | float |
71+
| `epidata[].rate_age_6` | hospitalization rate for ages 75-84 | float |
72+
| `epidata[].rate_age_7` | hospitalization rate for ages 85+ | float |
73+
| `epidata[].rate_age_18t29` | hospitalization rate for ages 18 to 29 | float |
74+
| `epidata[].rate_age_30t39` | hospitalization rate for ages 30 to 39 | float |
75+
| `epidata[].rate_age_40t49` | hospitalization rate for ages 40 to 49 | float |
76+
| `epidata[].rate_age_5t11` | hospitalization rate for ages 5 to 11 | float |
77+
| `epidata[].rate_age_12t17` | hospitalization rate for ages 12 to 17 | float |
78+
| `epidata[].rate_age_lt18` | hospitalization rate for ages <18 | float |
79+
| `epidata[].rate_age_gte18` | hospitalization rate for ages >=18 | float |
80+
| `epidata[].rate_race_white` | hospitalization rate for white people | float |
81+
| `epidata[].rate_race_black` | hospitalization rate for black people | float |
82+
| `epidata[].rate_race_hisp` | hospitalization rate for Hispanic/Latino people | float |
83+
| `epidata[].rate_race_asian` | hospitalization rate for Asian people | float |
84+
| `epidata[].rate_race_natamer` | hospitalization rate for American Indian/Alaskan Native people | float |
85+
| `epidata[].rate_sex_male` | hospitalization rate for males | float |
86+
| `epidata[].rate_sex_female` | hospitalization rate for females | float |
87+
| `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 |
88+
| `message` | `success` or error message | string |
7189

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

Diff for: src/acquisition/flusurv/flusurv_update.py

+3-36
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 published by the CDC
44-
issue: the epiweek of publication (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+
`flusurv` is the table where US flu hospitalization rates are stored. See
23+
`strc/ddl/fluview.sql` for the `flusurv` schema. See `docs/api/flusurv.md` for
24+
field descriptions.
5825
5926
=================
6027
=== Changelog ===

Diff for: src/ddl/fluview.sql

+50-20
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,40 @@ 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+
+-------------------+-------------+------+-----+---------+----------------+
367382
*/
368383

369384
CREATE TABLE `flusurv` (
@@ -382,6 +397,21 @@ CREATE TABLE `flusurv` (
382397
`rate_age_5` double DEFAULT NULL,
383398
`rate_age_6` double DEFAULT NULL,
384399
`rate_age_7` double DEFAULT NULL,
400+
`rate_age_18t29` double DEFAULT NULL,
401+
`rate_age_30t39` double DEFAULT NULL,
402+
`rate_age_40t49` double DEFAULT NULL,
403+
`rate_age_5t11` double DEFAULT NULL,
404+
`rate_age_12t17` double DEFAULT NULL,
405+
`rate_age_lt18` double DEFAULT NULL,
406+
`rate_age_gte18` double DEFAULT NULL,
407+
`rate_race_white` double DEFAULT NULL,
408+
`rate_race_black` double DEFAULT NULL,
409+
`rate_race_hisp` double DEFAULT NULL,
410+
`rate_race_asian` double DEFAULT NULL,
411+
`rate_race_natamer` double DEFAULT NULL,
412+
`rate_sex_male` double DEFAULT NULL,
413+
`rate_sex_female` double DEFAULT NULL,
414+
`season` char(7) DEFAULT NULL,
385415
PRIMARY KEY (`id`),
386416
UNIQUE KEY `issue` (`issue`,`epiweek`,`location`),
387417
KEY `release_date` (`release_date`),

Diff for: src/ddl/migrations/flusurv_age_sex_race_strata.sql

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
`season` char(7) DEFAULT NULL,
18+
);

Diff for: src/server/endpoints/flusurv.py

+22-1
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",
@@ -28,6 +28,27 @@ def handle():
2828
"rate_age_3",
2929
"rate_age_4",
3030
"rate_overall",
31+
32+
"rate_age_5",
33+
"rate_age_6",
34+
"rate_age_7",
35+
36+
"rate_age_18t29",
37+
"rate_age_30t39",
38+
"rate_age_40t49",
39+
"rate_age_5t11",
40+
"rate_age_12t17",
41+
"rate_age_lt18",
42+
"rate_age_gte18",
43+
44+
"rate_race_white",
45+
"rate_race_black",
46+
"rate_race_hisp",
47+
"rate_race_asian",
48+
"rate_race_natamer",
49+
50+
"rate_sex_male",
51+
"rate_sex_female",
3152
]
3253
q.set_fields(fields_string, fields_int, fields_float)
3354
q.set_sort_order("epiweek", "location", "issue")

0 commit comments

Comments
 (0)