|
7 | 7 | import { apiKey, formSelections } from '../../../store'; |
8 | 8 |
|
9 | 9 | export let id: string; |
10 | | - let data_source = $formSelections.covidcast.dataSource; |
11 | | - let signal = $formSelections.covidcast.signal; |
12 | | - let geo_type = $formSelections.covidcast.geoType; |
13 | | - let geo_value = $formSelections.covidcast.geoValue; |
14 | 10 | let valid_key = true; |
15 | 11 |
|
16 | 12 | let dataSources: (LabelValue & { signals: string[] })[] = []; |
17 | 13 | let geoTypes: string[] = []; |
18 | 14 |
|
19 | | - $: dataSignals = (dataSources.find((d) => d.value === data_source) || { signals: [] }).signals; |
| 15 | + $: dataSignals = (dataSources.find((d) => d.value === $formSelections.covidcast.dataSource) || { signals: [] }) |
| 16 | + .signals; |
20 | 17 |
|
21 | 18 | $: { |
22 | 19 | if ($formSelections.covidcast.dataSource) { |
|
68 | 65 |
|
69 | 66 | export function importDataSet() { |
70 | 67 | return fetchCOVIDcastMeta($apiKey).then((res) => { |
71 | | - const meta = res.filter((row) => row.data_source === data_source && row.signal === signal); |
| 68 | + const meta = res.filter( |
| 69 | + (row) => |
| 70 | + row.data_source === $formSelections.covidcast.dataSource && row.signal === $formSelections.covidcast.signal, |
| 71 | + ); |
72 | 72 | const time_type = meta[0].time_type; |
73 | | - return importCOVIDcast({ data_source, signal, geo_type, geo_value, time_type, api_key: $apiKey }); |
| 73 | + return importCOVIDcast({ |
| 74 | + data_source: $formSelections.covidcast.dataSource, |
| 75 | + geo_type: $formSelections.covidcast.geoType, |
| 76 | + geo_value: $formSelections.covidcast.geoValue, |
| 77 | + signal: $formSelections.covidcast.signal, |
| 78 | + time_type, |
| 79 | + api_key: $apiKey, |
| 80 | + }); |
74 | 81 | }); |
75 | 82 | } |
76 | 83 | </script> |
|
0 commit comments