-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
42 lines (37 loc) · 1.13 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { groupBy } from "lodash-es";
import gpuData from "datasets/gpus.json";
import gpuBenchmarks from "datasets/gpu-benchmarks.json";
import ethPrices from "datasets/eth.json";
export const gpus = gpuData;
export interface GPUShareDatum {
date: string;
name: string;
percentage: number;
manufacturer: string;
}
const getGpuSharesData = async () => {
return (await import("datasets/gpu-shares.json")).default as GPUShareDatum[];
};
export const getGpuSharesByDateData = async () =>
groupBy(await getGpuSharesData(), (row) => {
return row.date;
});
export const getGpuSharesByNameData = async () =>
groupBy(await getGpuSharesData(), (row) => {
return row.name;
});
export interface GPUBenchmarkData {
[name: string]: number;
}
export const gpuBenchmarkData: GPUBenchmarkData = gpuBenchmarks;
export interface CovidCaseDatum {
date: string;
code: string;
name: string;
newCases: number;
}
export const getCovidCasesByCountryData = async () =>
(await import("datasets/covid-cases.json")).default as unknown as {
[name: string]: CovidCaseDatum[];
};
export const ethData = ethPrices as Record<string, number>;