Skip to content

Commit

Permalink
New stats
Browse files Browse the repository at this point in the history
  • Loading branch information
pietervdvn committed Jul 29, 2022
1 parent 1ff03d9 commit 20292c9
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions Docs/Tools/GenerateSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,23 @@ class StatsDownloader {
if (year === currentYear && month === currentMonth && day === today.getDate() ) {
break;
}
const path = `${this._targetDirectory}/stats.${year}-${month}-${(day < 10 ? "0" : "") + day}.json`
const path = `${this._targetDirectory}/stats.${year}-${month}-${(day < 10 ? "0" : "") + day}.json`
if(existsSync(path)){
console.log("Skipping ", path,": already exists")
continue
}
try{

await this.DownloadStatsForDay(year, month, day, path)
}catch(e){
console.error(e)
console.error("Could not download "+year+"-"+month+"-"+day+"... Trying again")
try{
await this.DownloadStatsForDay(year, month, day, path)
}catch(e){
console.error("Could not download "+year+"-"+month+"-"+day+", skipping for now")
}
}
}
}
}
Expand Down Expand Up @@ -828,17 +840,21 @@ async function main(): Promise<void> {
if (process.argv.indexOf("--no-graphs") >= 0) {
return
}
await createMiscGraphs(allFeatures, emptyCS)

const grbOnly = allFeatures.filter(f => f.properties.metadata.theme === "grb")
allFeatures = allFeatures.filter(f => f.properties.metadata.theme !== "grb")
await createGraphs(allFeatures, "")
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2020")), " in 2020")
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2021")), " in 2021")
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2022")), " in 2022")
await createGraphs(allFeatures.filter(f => f.properties.metadata.theme === "toerisme_vlaanderen"), " met pin je punt", 0)
await createGraphs(grbOnly, " with the GRB import tool", 0)

const allFiles = readdirSync("Docs/Tools/stats").filter(p => p.endsWith(".json"))
writeFileSync("Docs/Tools/stats/file-overview.json", JSON.stringify(allFiles))

/*
await createMiscGraphs(allFeatures, emptyCS)
const grbOnly = allFeatures.filter(f => f.properties.metadata.theme === "grb")
allFeatures = allFeatures.filter(f => f.properties.metadata.theme !== "grb")
await createGraphs(allFeatures, "")
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2020")), " in 2020")
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2021")), " in 2021")
await createGraphs(allFeatures.filter(f => f.properties.date.startsWith("2022")), " in 2022")
await createGraphs(allFeatures.filter(f => f.properties.metadata.theme === "toerisme_vlaanderen"), " met pin je punt", 0)
await createGraphs(grbOnly, " with the GRB import tool", 0)
*/
}

main().then(_ => console.log("All done!"))
Expand Down

0 comments on commit 20292c9

Please sign in to comment.