import fs from 'fs/promises' import fg from 'fast-glob' import path from 'path' import StreamZip from 'node-stream-zip' import XLSX from 'xlsx' import Counties from './parser/counties.js' import OverallTesting from './parser/overall/testing.js' import OverallCases from './parser/overall/cases.js' import OverallHospitalizations from './parser/overall/hospitalizations.js' import OverallDeaths from './parser/overall/deaths.js' import OverallVaccinations from './parser/overall/vaccinations.js' import RiskAge from './parser/risk/age.js' import RiskHealthConditions from './parser/risk/health-conditions.js' import Summary from './parser/summary.js' async function main() { const sources = await fg(['./data/raw/dph-daily-report/*.zip']) sources.sort() const zips = sources.slice(-7).map(source => ({ date: path.basename(source, path.extname(source)), zip: new StreamZip.async({ file: source }) })) const vaccinations = await fg(['./data/raw/vaccinations/*.xlsx']) const vaccinationSheets = vaccinations.slice(-7).map(source => ({ date: path.basename(source, path.extname(source)), xlsx: XLSX.readFile(source) })) const counties = await Counties(zips) await OverallTesting(zips) await OverallCases(zips, counties) await OverallHospitalizations(zips, counties) await OverallDeaths(zips, counties) await OverallVaccinations(vaccinationSheets, counties) await RiskAge(zips) await RiskHealthConditions(zips) await Summary() } main()