Hi there,
I was wondering if I could implement / customize this repo to have it in my own country and deploy it to a github page or a domain?
My approach would be a bit different though, instead of manually (? that's actually an assumption, that you manually update now the data) updating the vaccination data, I want to create a github action, that would run every day to get the covid data from an external service, and populate it to data.json
, somehow similarly:
const request = require('request');
const Papa = require('papaparse');
const fs = require('fs');
const HUN_POPULATION = 9772756
request.get('https://covid.ourworldindata.org/data/owid-covid-data.csv', function (error, response, body) {
if (!error && response.statusCode == 200) {
const hunOwidData = Papa.parse(body, {
header: true,
})
.data.filter(data => data.iso_code === 'HUN');
const hunData = {
lastUpdate: '2021-04-09',
history: hunOwidData.map(owid => ({
statusDate: owid.date,
vaccinationRate: (+owid.total_vaccinations / HUN_POPULATION) * 100,
vaccinatedPersons: +owid.new_vaccinations,
administeredVaccineDoses: +owid.total_vaccinations,
})).slice(Math.max(hunOwidData.length - 15, 1)),
};
fs.writeFileSync('data.json', JSON.stringify(hunData, null, 2))
console.log('data written');
}
});
I could also introduce this at this repo, so no manual (again, just an assumption) updates would be necessary.
Edit: the code example above is just a sketch to demonstrate how I would update the data.