|
19 | 19 | import NowCast from './dataSources/Nowcast.svelte'; |
20 | 20 | import CovidHosp from './dataSources/COVIDHosp.svelte'; |
21 | 21 | import CoviDcast from './dataSources/COVIDcast.svelte'; |
22 | | - import { navMode } from '../../store'; |
| 22 | + import { navMode, storeApiKeys } from '../../store'; |
23 | 23 | import { NavMode } from '../chartUtils'; |
| 24 | + import { formSelections } from '../../store'; |
24 | 25 |
|
25 | 26 | const dispatch = createEventDispatcher(); |
26 | 27 |
|
27 | 28 | const id = randomId(); |
28 | 29 |
|
29 | | - let dataSource: |
30 | | - | 'fluview' |
31 | | - | 'flusurv' |
32 | | - | 'gft' |
33 | | - | 'ght' |
34 | | - | 'twitter' |
35 | | - | 'wiki' |
36 | | - | 'cdc' |
37 | | - | 'quidel' |
38 | | - | 'nidss_flu' |
39 | | - | 'nidss_dengue' |
40 | | - | 'sensors' |
41 | | - | 'nowcast' |
42 | | - | 'covidcast' |
43 | | - | 'covid_hosp' = 'fluview'; |
44 | | -
|
45 | 30 | let loading = false; |
46 | 31 | let handler: unknown = null; |
47 | 32 |
|
|
71 | 56 | <div class="uk-form-label">Data Source</div> |
72 | 57 | <div class="uk-form-controls uk-form-controls-text"> |
73 | 58 | <label |
74 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="fluview" /> |
| 59 | + ><input |
| 60 | + class="uk-radio" |
| 61 | + type="radio" |
| 62 | + name="dataSource" |
| 63 | + bind:group={$formSelections.dataSource} |
| 64 | + value="fluview" |
| 65 | + /> |
75 | 66 | ILINet (aka FluView) (source: |
76 | 67 | <a target="_blank" href="https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html">cdc.gov</a>) |
77 | 68 | </label> |
78 | 69 | <label |
79 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="flusurv" /> FluSurv |
80 | | - (source: <a target="_blank" href="https://gis.cdc.gov/GRASP/Fluview/FluHospRates.html">cdc.gov</a>)</label |
| 70 | + ><input |
| 71 | + class="uk-radio" |
| 72 | + type="radio" |
| 73 | + name="dataSource" |
| 74 | + bind:group={$formSelections.dataSource} |
| 75 | + value="flusurv" |
| 76 | + /> |
| 77 | + FluSurv (source: |
| 78 | + <a target="_blank" href="https://gis.cdc.gov/GRASP/Fluview/FluHospRates.html">cdc.gov</a>)</label |
81 | 79 | > |
82 | 80 | <label |
83 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="gft" /> Google Flu |
84 | | - Trends (source: <a target="_blank" href="https://www.google.org/flutrends/">google.com</a>)</label |
| 81 | + ><input class="uk-radio" type="radio" name="dataSource" bind:group={$formSelections.dataSource} value="gft" /> |
| 82 | + Google Flu Trends (source: <a target="_blank" href="https://www.google.org/flutrends/">google.com</a>)</label |
85 | 83 | > |
86 | 84 | <label |
87 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="ght" /> Google Health Trends |
88 | | - (source: private Google API)</label |
| 85 | + ><input class="uk-radio" type="radio" name="dataSource" bind:group={$formSelections.dataSource} value="ght" /> |
| 86 | + Google Health Trends (source: private Google API)</label |
89 | 87 | > |
90 | 88 | <label |
91 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="twitter" /> |
| 89 | + ><input |
| 90 | + class="uk-radio" |
| 91 | + type="radio" |
| 92 | + name="dataSource" |
| 93 | + bind:group={$formSelections.dataSource} |
| 94 | + value="twitter" |
| 95 | + /> |
92 | 96 | HealthTweets (source: <a target="_blank" href="http://www.healthtweets.org/">healthtweets.org</a>)</label |
93 | 97 | > |
94 | 98 | <label |
95 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="wiki" /> Wikipedia |
96 | | - Access (source: |
| 99 | + ><input |
| 100 | + class="uk-radio" |
| 101 | + type="radio" |
| 102 | + name="dataSource" |
| 103 | + bind:group={$formSelections.dataSource} |
| 104 | + value="wiki" |
| 105 | + /> |
| 106 | + Wikipedia Access (source: |
97 | 107 | <a target="_blank" href="https://dumps.wikimedia.org/other/pagecounts-raw/">dumps.wikimedia.org</a>)</label |
98 | 108 | > |
99 | 109 | <label |
100 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="cdc" /> CDC Page Hits (source: |
101 | | - private CDC dataset)</label |
| 110 | + ><input class="uk-radio" type="radio" name="dataSource" bind:group={$formSelections.dataSource} value="cdc" /> |
| 111 | + CDC Page Hits (source: private CDC dataset)</label |
102 | 112 | > |
103 | 113 | <label |
104 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="quidel" /> Quidel Data (source: |
105 | | - private Quidel dataset)</label |
| 114 | + ><input |
| 115 | + class="uk-radio" |
| 116 | + type="radio" |
| 117 | + name="dataSource" |
| 118 | + bind:group={$formSelections.dataSource} |
| 119 | + value="quidel" |
| 120 | + /> Quidel Data (source: private Quidel dataset)</label |
106 | 121 | > |
107 | 122 | <label |
108 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="nidss_flu" /> NIDSS - |
109 | | - Influenza (source: |
| 123 | + ><input |
| 124 | + class="uk-radio" |
| 125 | + type="radio" |
| 126 | + name="dataSource" |
| 127 | + bind:group={$formSelections.dataSource} |
| 128 | + value="nidss_flu" |
| 129 | + /> |
| 130 | + NIDSS - Influenza (source: |
110 | 131 | <a target="_blank" href="http://nidss.cdc.gov.tw/en/CDCWNH01.aspx?dc=wnh">nidss.cdc.gov.tw</a>)</label |
111 | 132 | > |
112 | 133 | <label |
113 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="nidss_dengue" /> NIDSS |
114 | | - - Dengue (source: |
| 134 | + ><input |
| 135 | + class="uk-radio" |
| 136 | + type="radio" |
| 137 | + name="dataSource" |
| 138 | + bind:group={$formSelections.dataSource} |
| 139 | + value="nidss_dengue" |
| 140 | + /> |
| 141 | + NIDSS - Dengue (source: |
115 | 142 | <a |
116 | 143 | target="_blank" |
117 | 144 | href="http://nidss.cdc.gov.tw/en/SingleDisease.aspx?dc=1&dt=4&disease=061&position=1" |
118 | 145 | >nidss.cdc.gov.tw</a |
119 | 146 | >)</label |
120 | 147 | > |
121 | 148 | <label |
122 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="sensors" /> Delphi |
123 | | - Sensors (source: <a target="_blank" href="https://delphi.cmu.edu/">delphi.cmu.edu</a>)</label |
| 149 | + ><input |
| 150 | + class="uk-radio" |
| 151 | + type="radio" |
| 152 | + name="dataSource" |
| 153 | + bind:group={$formSelections.dataSource} |
| 154 | + value="sensors" |
| 155 | + /> |
| 156 | + Delphi Sensors (source: <a target="_blank" href="https://delphi.cmu.edu/">delphi.cmu.edu</a>)</label |
124 | 157 | > |
125 | 158 | <label |
126 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="nowcast" /> Delphi |
127 | | - Nowcast (source: <a target="_blank" href="https://delphi.cmu.edu/">delphi.cmu.edu</a>)</label |
| 159 | + ><input |
| 160 | + class="uk-radio" |
| 161 | + type="radio" |
| 162 | + name="dataSource" |
| 163 | + bind:group={$formSelections.dataSource} |
| 164 | + value="nowcast" |
| 165 | + /> |
| 166 | + Delphi Nowcast (source: <a target="_blank" href="https://delphi.cmu.edu/">delphi.cmu.edu</a>)</label |
128 | 167 | > |
129 | 168 | <label |
130 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="covidcast" /> Delphi |
131 | | - COVIDcast (source: <a target="_blank" href="https://delphi.cmu.edu/">delphi.cmu.edu</a>)</label |
| 169 | + ><input |
| 170 | + class="uk-radio" |
| 171 | + type="radio" |
| 172 | + name="dataSource" |
| 173 | + bind:group={$formSelections.dataSource} |
| 174 | + value="covidcast" |
| 175 | + /> |
| 176 | + Delphi COVIDcast (source: <a target="_blank" href="https://delphi.cmu.edu/">delphi.cmu.edu</a>)</label |
132 | 177 | > |
133 | 178 | <label |
134 | | - ><input class="uk-radio" type="radio" name="dataSource" bind:group={dataSource} value="covid_hosp" /> COVID |
135 | | - Hospitalization (source: |
| 179 | + ><input |
| 180 | + class="uk-radio" |
| 181 | + type="radio" |
| 182 | + name="dataSource" |
| 183 | + bind:group={$formSelections.dataSource} |
| 184 | + value="covid_hosp" |
| 185 | + /> |
| 186 | + COVID Hospitalization (source: |
136 | 187 | <a |
137 | 188 | target="_blank" |
138 | 189 | href="https://healthdata.gov/dataset/covid-19-reported-patient-impact-and-hospital-capacity-state-timeseries" |
|
142 | 193 | </div> |
143 | 194 | </div> |
144 | 195 |
|
145 | | - {#if dataSource === 'fluview'} |
| 196 | + {#if $formSelections.dataSource === 'fluview'} |
146 | 197 | <FluView {id} bind:this={handler} /> |
147 | | - {:else if dataSource === 'flusurv'} |
| 198 | + {:else if $formSelections.dataSource === 'flusurv'} |
148 | 199 | <FluSurv {id} bind:this={handler} /> |
149 | | - {:else if dataSource === 'gft'} |
| 200 | + {:else if $formSelections.dataSource === 'gft'} |
150 | 201 | <Gft {id} bind:this={handler} /> |
151 | | - {:else if dataSource === 'ght'} |
| 202 | + {:else if $formSelections.dataSource === 'ght'} |
152 | 203 | <GHT {id} bind:this={handler} /> |
153 | | - {:else if dataSource === 'twitter'} |
| 204 | + {:else if $formSelections.dataSource === 'twitter'} |
154 | 205 | <Twitter {id} bind:this={handler} /> |
155 | | - {:else if dataSource === 'wiki'} |
| 206 | + {:else if $formSelections.dataSource === 'wiki'} |
156 | 207 | <Wiki {id} bind:this={handler} /> |
157 | | - {:else if dataSource === 'quidel'} |
| 208 | + {:else if $formSelections.dataSource === 'quidel'} |
158 | 209 | <Quidel {id} bind:this={handler} /> |
159 | | - {:else if dataSource === 'nidss_dengue'} |
| 210 | + {:else if $formSelections.dataSource === 'nidss_dengue'} |
160 | 211 | <NidssDengue {id} bind:this={handler} /> |
161 | | - {:else if dataSource === 'nidss_flu'} |
| 212 | + {:else if $formSelections.dataSource === 'nidss_flu'} |
162 | 213 | <NidssFlu {id} bind:this={handler} /> |
163 | | - {:else if dataSource === 'cdc'} |
| 214 | + {:else if $formSelections.dataSource === 'cdc'} |
164 | 215 | <Cdc {id} bind:this={handler} /> |
165 | | - {:else if dataSource === 'sensors'} |
| 216 | + {:else if $formSelections.dataSource === 'sensors'} |
166 | 217 | <Sensors {id} bind:this={handler} /> |
167 | | - {:else if dataSource === 'nowcast'} |
| 218 | + {:else if $formSelections.dataSource === 'nowcast'} |
168 | 219 | <NowCast {id} bind:this={handler} /> |
169 | | - {:else if dataSource === 'covid_hosp'} |
| 220 | + {:else if $formSelections.dataSource === 'covid_hosp'} |
170 | 221 | <CovidHosp {id} bind:this={handler} /> |
171 | | - {:else if dataSource === 'covidcast'} |
| 222 | + {:else if $formSelections.dataSource === 'covidcast'} |
172 | 223 | <CoviDcast {id} bind:this={handler} /> |
173 | 224 | {/if} |
174 | 225 | </form> |
175 | 226 |
|
176 | | - <button slot="footer" class="uk-button uk-button-primary" type="submit" form={id} disabled={loading}> |
177 | | - Fetch Data |
178 | | - {#if loading} |
179 | | - <div uk-spinner /> |
180 | | - {/if} |
181 | | - </button> |
| 227 | + <div slot="footer"> |
| 228 | + <div class="uk-form-controls uk-form-controls-text container"> |
| 229 | + <button class="uk-button uk-button-primary" type="submit" form={id} disabled={loading}> |
| 230 | + Fetch Data |
| 231 | + {#if loading} |
| 232 | + <div uk-spinner /> |
| 233 | + {/if} |
| 234 | + </button> |
| 235 | + <label |
| 236 | + ><input class="uk-checkbox" type="checkbox" bind:checked={$storeApiKeys} /> |
| 237 | + Save API key (auth token) between visits</label |
| 238 | + > |
| 239 | + </div> |
| 240 | + </div> |
182 | 241 | </Dialog> |
| 242 | + |
| 243 | +<style> |
| 244 | + .container { |
| 245 | + display: flex; |
| 246 | + align-items: center; |
| 247 | + column-gap: 2em; |
| 248 | + } |
| 249 | +</style> |
0 commit comments