Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions src/api/EpiData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,35 @@ export function importFluView({
});
}

export function importFluViewClinical({
regions,
issues,
lag,
}: {
regions: string;
issues?: number | null;
lag?: number | null;
}): Promise<DataGroup | null> {
const regionLabel = fluViewRegions.find((d) => d.value === regions)?.label ?? '?';
const title = appendIssueToTitle(`[API] FluView Clinical: ${regionLabel}`, { issues, lag });
return loadDataSet(
title,
'fluview_clinical',
{
epiweeks: epiRange(firstEpiWeek.fluview, currentEpiWeek),
},
{ regions, issues, lag },
['total_specimens', 'total_a', 'total_b', 'percent_positive', 'percent_a', 'percent_b'],
).then((ds) => {
// get inside the Promise and make sure its not null,
// then enable display of 'percent_positive' data
if (ds instanceof DataGroup) {
ds.defaultEnabled = ['percent_positive'];
}
return ds;
});
}

export function importGFT({ locations }: { locations: string }): Promise<DataGroup | null> {
const regionLabel = gftLocations.find((d) => d.value === locations)?.label ?? '?';
const title = `[API] GFT: ${regionLabel}`;
Expand Down
14 changes: 14 additions & 0 deletions src/components/dialogs/ImportAPIDialog.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import FluSurv from './dataSources/FluSurv.svelte';
import FluView from './dataSources/FluView.svelte';
import FluViewClinical from './dataSources/FluViewClinical.svelte';

import { createEventDispatcher } from 'svelte';

Expand Down Expand Up @@ -81,6 +82,17 @@
>cmu-delphi.github.io</a
>)</label
>
<label
><input
class="uk-radio"
type="radio"
name="dataSource"
bind:group={$formSelections.dataSource}
value="fluview_clinical"
/>
FluView Clinical (source:
<a target="_blank" href="https://gis.cdc.gov/grasp/fluview/fluportaldashboard.html">cdc.gov</a>)
</label>
<label
><input
class="uk-radio"
Expand Down Expand Up @@ -200,6 +212,8 @@

{#if $formSelections.dataSource === 'fluview'}
<FluView {id} bind:this={handler} />
{:else if $formSelections.dataSource === 'fluview_clinical'}
<FluViewClinical {id} bind:this={handler} />
{:else if $formSelections.dataSource === 'flusurv'}
<FluSurv {id} bind:this={handler} />
{:else if $formSelections.dataSource === 'gft'}
Expand Down
24 changes: 24 additions & 0 deletions src/components/dialogs/dataSources/FluViewClinical.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import { importFluViewClinical } from '../../../api/EpiData';
import { fluViewRegions } from '../../../data/data';
import SelectField from '../inputs/SelectField.svelte';
import SelectIssue from '../inputs/SelectIssue.svelte';
import { formSelections } from '../../../store';

export let id: string;

export function importDataSet() {
return importFluViewClinical({
regions: $formSelections.fluViewClinical.locations,
...$formSelections.fluViewClinical.issue,
});
}
</script>

<SelectField
id="{id}-r"
label="Region"
bind:value={$formSelections.fluViewClinical.locations}
options={fluViewRegions}
/>
<SelectIssue {id} bind:value={$formSelections.fluViewClinical.issue} />
7 changes: 7 additions & 0 deletions src/components/dialogs/formSelections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export class FluViewSelections {
issue = DEFAULT_ISSUE;
}

export class FluViewClinicalSelections {
locations = fluViewRegions[0].value;
issue = DEFAULT_ISSUE;
}

export class GftSelections {
locations = gftLocations[0].value;
}
Expand Down Expand Up @@ -93,6 +98,7 @@ export class WikiSelections {
export default class FormSelections {
dataSource:
| 'fluview'
| 'fluview_clinical'
| 'flusurv'
| 'gft'
| 'ght'
Expand All @@ -111,6 +117,7 @@ export default class FormSelections {
covidHosp = new CovidHospSelections();
fluSurv = new FluSurvSelections();
fluView = new FluViewSelections();
fluViewClinical = new FluViewClinicalSelections();
gft = new GftSelections();
ght = new GhtSelections();
nidssDengue = new NidssDengueSelections();
Expand Down
3 changes: 3 additions & 0 deletions src/deriveLinkDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
importCOVIDcast,
importFluSurv,
importFluView,
importFluViewClinical,
importGFT,
importGHT,
importNIDSSDengue,
Expand Down Expand Up @@ -54,6 +55,7 @@ const lookups = {
covidcast: importCOVIDcast,
flusurv: importFluSurv,
fluview: importFluView,
fluview_clinical: importFluViewClinical,
gft: importGFT,
ght: importGHT,
nidss_dengue: importNIDSSDengue,
Expand All @@ -73,6 +75,7 @@ const argOrders: Record<string, string[]> = {
covid_hosp: ['states', 'issues'],
flusurv: ['locations', 'issues', 'lag'],
fluview: ['regions', 'issues', 'lag', 'auth'],
fluview_clinical: ['regions', 'issues', 'lag'],
gft: ['locations'],
ght: ['auth', 'locations', 'query'],
nidss_dengue: ['locations'],
Expand Down