Skip to content

Commit 377fadd

Browse files
committed
Change columnNames to columnRenamings
1 parent 0ce4ef6 commit 377fadd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/api/EpiData.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ function loadEpidata(
6464
name: string,
6565
epidata: Record<string, unknown>[],
6666
columns: string[],
67-
columnNames: Record<string, string>,
67+
columnRenamings: Record<string, string>,
6868
params: Record<string, unknown>,
6969
): DataGroup {
7070
const datasets: DataSet[] = [];
71-
const colNames = new Map(Object.entries(columnNames));
71+
const colRenamings = new Map(Object.entries(columnRenamings));
7272

7373
for (const col of columns) {
7474
const points: EpiPoint[] = [];
@@ -93,8 +93,8 @@ function loadEpidata(
9393
}
9494
points.push(new EpiPoint(date, row[col] as number));
9595
}
96-
// overwrite default column name if there's an overwrite in columnNames
97-
const title = colNames.has(col) ? colNames.get(col) : col;
96+
// overwrite default column name if there's an overwrite in columnRenamings
97+
const title = colRenamings.has(col) ? colRenamings.get(col) : col;
9898
datasets.push(new DataSet(points, title, params));
9999
}
100100
return new DataGroup(name, datasets);
@@ -116,7 +116,7 @@ export function loadDataSet(
116116
fixedParams: Record<string, unknown>,
117117
userParams: Record<string, unknown>,
118118
columns: string[],
119-
columnNames: Record<string, string> = {},
119+
columnRenamings: Record<string, string> = {},
120120
): Promise<DataGroup | null> {
121121
const duplicates = get(expandedDataGroups).filter((d) => d.title == title);
122122
if (duplicates.length > 0) {
@@ -140,7 +140,7 @@ export function loadDataSet(
140140
url.searchParams.set('format', 'json');
141141
return fetchImpl<Record<string, unknown>[]>(url)
142142
.then((res) => {
143-
return loadEpidata(title, res, columns, columnNames, { _endpoint: endpoint, ...params });
143+
return loadEpidata(title, res, columns, columnRenamings, { _endpoint: endpoint, ...params });
144144
})
145145
.catch((error) => {
146146
console.warn('failed fetching data', error);

0 commit comments

Comments
 (0)