-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.ts
25 lines (19 loc) · 938 Bytes
/
app.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
import { extractDistricts } from './extracts/district.ts';
import { extractYear } from './extracts/year.ts';
import { loadMapsToJsonFiles, loadReportSuiteToJsonFiles, loadDistrictsToJsonFiles } from './loads/json.ts';
import { transformMaps } from './transforms/map.ts';
import { transformReports } from './transforms/report.ts';
import { Config } from './config.ts';
const config = new Config('./config.json');
const years = await Promise.all(
Object.entries(config.summaryDataSheets)
.map(([no, url]) => {
return extractYear(url, Number(no));
})
);
const { districts, all, districtAreas } = await extractDistricts(config.districtSheet);
const suite = transformReports(years, districts, all, districtAreas);
const maps = transformMaps(years, districts);
await loadReportSuiteToJsonFiles(suite, './result');
await loadMapsToJsonFiles(maps, './result');
await loadDistrictsToJsonFiles(districts, './result');