@@ -64,9 +64,11 @@ function loadEpidata(
6464 name : string ,
6565 epidata : Record < string , unknown > [ ] ,
6666 columns : string [ ] ,
67+ columnNames : Record < string , string > ,
6768 params : Record < string , unknown > ,
6869) : DataGroup {
6970 const datasets : DataSet [ ] = [ ] ;
71+ const colNames = new Map ( Object . entries ( columnNames ) ) ;
7072
7173 for ( const col of columns ) {
7274 const points : EpiPoint [ ] = [ ] ;
@@ -91,7 +93,9 @@ function loadEpidata(
9193 }
9294 points . push ( new EpiPoint ( date , row [ col ] as number ) ) ;
9395 }
94- datasets . push ( new DataSet ( points , col , params ) ) ;
96+ // overwrite default column name if there's an overwrite in columnNames
97+ const title = colNames . has ( col ) ? colNames . get ( col ) : col ;
98+ datasets . push ( new DataSet ( points , title , params ) ) ;
9599 }
96100 return new DataGroup ( name , datasets ) ;
97101}
@@ -112,6 +116,7 @@ export function loadDataSet(
112116 fixedParams : Record < string , unknown > ,
113117 userParams : Record < string , unknown > ,
114118 columns : string [ ] ,
119+ columnNames : Record < string , string > = { } ,
115120) : Promise < DataGroup | null > {
116121 const duplicates = get ( expandedDataGroups ) . filter ( ( d ) => d . title == title ) ;
117122 if ( duplicates . length > 0 ) {
@@ -135,7 +140,7 @@ export function loadDataSet(
135140 url . searchParams . set ( 'format' , 'json' ) ;
136141 return fetchImpl < Record < string , unknown > [ ] > ( url )
137142 . then ( ( res ) => {
138- return loadEpidata ( title , res , columns , { _endpoint : endpoint , ...params } ) ;
143+ return loadEpidata ( title , res , columns , columnNames , { _endpoint : endpoint , ...params } ) ;
139144 } )
140145 . catch ( ( error ) => {
141146 console . warn ( 'failed fetching data' , error ) ;
@@ -318,7 +323,7 @@ export function importFluView({
318323 auth ?: string ;
319324} ) : Promise < DataGroup | null > {
320325 const regionLabel = fluViewRegions . find ( ( d ) => d . value === regions ) ?. label ?? '?' ;
321- const title = appendIssueToTitle ( `[API] FluView: ${ regionLabel } ` , { issues, lag } ) ;
326+ const title = appendIssueToTitle ( `[API] ILINet (aka FluView) : ${ regionLabel } ` , { issues, lag } ) ;
322327 return loadDataSet (
323328 title ,
324329 'fluview' ,
@@ -339,6 +344,10 @@ export function importFluView({
339344 'num_age_4' ,
340345 'num_age_5' ,
341346 ] ,
347+ {
348+ wili : '%wILI' ,
349+ ili : '%ILI' ,
350+ } ,
342351 ) ;
343352}
344353
0 commit comments