From 2d4ea6053e2c25535fb82beb35a79dd417ded29d Mon Sep 17 00:00:00 2001 From: george haff Date: Mon, 21 Apr 2025 16:37:15 -0400 Subject: [PATCH 1/3] add support for 'fluview_clinical' endpoint --- src/api/EpiData.ts | 36 +++++++++++++++++++ src/components/dialogs/ImportAPIDialog.svelte | 14 ++++++++ .../dataSources/FluViewClinical.svelte | 20 +++++++++++ src/components/dialogs/formSelections.ts | 7 ++++ src/deriveLinkDefaults.ts | 3 ++ 5 files changed, 80 insertions(+) create mode 100644 src/components/dialogs/dataSources/FluViewClinical.svelte diff --git a/src/api/EpiData.ts b/src/api/EpiData.ts index 71b44ef..a6362e0 100644 --- a/src/api/EpiData.ts +++ b/src/api/EpiData.ts @@ -437,6 +437,42 @@ export function importFluView({ }); } +export function importFluViewClinical({ + regions, + issues, + lag, +}: { + regions: string; + issues?: number | null; + lag?: number | null; +}): Promise { + 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 { const regionLabel = gftLocations.find((d) => d.value === locations)?.label ?? '?'; const title = `[API] GFT: ${regionLabel}`; diff --git a/src/components/dialogs/ImportAPIDialog.svelte b/src/components/dialogs/ImportAPIDialog.svelte index e15838f..302eb57 100644 --- a/src/components/dialogs/ImportAPIDialog.svelte +++ b/src/components/dialogs/ImportAPIDialog.svelte @@ -1,6 +1,7 @@ + + + diff --git a/src/components/dialogs/formSelections.ts b/src/components/dialogs/formSelections.ts index c030af9..019cdf5 100644 --- a/src/components/dialogs/formSelections.ts +++ b/src/components/dialogs/formSelections.ts @@ -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; } @@ -93,6 +98,7 @@ export class WikiSelections { export default class FormSelections { dataSource: | 'fluview' + | 'fluview_clinical' | 'flusurv' | 'gft' | 'ght' @@ -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(); diff --git a/src/deriveLinkDefaults.ts b/src/deriveLinkDefaults.ts index 23ea337..265f444 100644 --- a/src/deriveLinkDefaults.ts +++ b/src/deriveLinkDefaults.ts @@ -4,6 +4,7 @@ import { importCOVIDcast, importFluSurv, importFluView, + importFluViewClinical, importGFT, importGHT, importNIDSSDengue, @@ -54,6 +55,7 @@ const lookups = { covidcast: importCOVIDcast, flusurv: importFluSurv, fluview: importFluView, + fluview_clinical: importFluViewClinical, gft: importGFT, ght: importGHT, nidss_dengue: importNIDSSDengue, @@ -73,6 +75,7 @@ const argOrders: Record = { 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'], From 190e2d5a138f1c0263d117eb00969cbe6c258d48 Mon Sep 17 00:00:00 2001 From: george haff Date: Mon, 21 Apr 2025 16:40:03 -0400 Subject: [PATCH 2/3] remove unused import --- src/components/dialogs/dataSources/FluViewClinical.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/dialogs/dataSources/FluViewClinical.svelte b/src/components/dialogs/dataSources/FluViewClinical.svelte index 4c26301..e5070b9 100644 --- a/src/components/dialogs/dataSources/FluViewClinical.svelte +++ b/src/components/dialogs/dataSources/FluViewClinical.svelte @@ -3,7 +3,6 @@ import { fluViewRegions } from '../../../data/data'; import SelectField from '../inputs/SelectField.svelte'; import SelectIssue from '../inputs/SelectIssue.svelte'; - import TextField from '../inputs/TextField.svelte'; import { formSelections } from '../../../store'; export let id: string; From 9e5b3856174b487a87746e7b4f5d1c43f45ae760 Mon Sep 17 00:00:00 2001 From: george haff Date: Mon, 21 Apr 2025 16:43:50 -0400 Subject: [PATCH 3/3] formatting edits for linter --- src/api/EpiData.ts | 9 +-------- .../dialogs/dataSources/FluViewClinical.svelte | 7 ++++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/api/EpiData.ts b/src/api/EpiData.ts index a6362e0..782a534 100644 --- a/src/api/EpiData.ts +++ b/src/api/EpiData.ts @@ -455,14 +455,7 @@ export function importFluViewClinical({ epiweeks: epiRange(firstEpiWeek.fluview, currentEpiWeek), }, { regions, issues, lag }, - [ - 'total_specimens', - 'total_a', - 'total_b', - 'percent_positive', - 'percent_a', - 'percent_b', - ], + ['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 diff --git a/src/components/dialogs/dataSources/FluViewClinical.svelte b/src/components/dialogs/dataSources/FluViewClinical.svelte index e5070b9..fc3e54f 100644 --- a/src/components/dialogs/dataSources/FluViewClinical.svelte +++ b/src/components/dialogs/dataSources/FluViewClinical.svelte @@ -15,5 +15,10 @@ } - +