A personal memorial for lives lost due to covid-19
Computer programming, Data visualization
mport csv, json, urllib.request, datetime
from codecs import iterdecode
def main(latest):
url = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/'
+'master/csse_covid_19_data/csse_covid_19_daily_reports/'
+latest+'.csv'
try:
latest = urllib.request.urlopen(url)
return generatejson(latest)
except urllib.request.HTTPError:
print('url not found')
return False
def generatejson(csvfile):
data = {}
total = 0
csvReader = csv.DictReader(iterdecode(csvfile, 'utf-8'))
for row in csvReader:
name = row['Country_Region']
Deaths = int(row['Deaths'])
if name not in data:
data[name] = Deaths
else:
data[name] += Deaths
total += Deaths
data = {k: v for k, v in sorted(data.items(), key=lambda item: item[1],reverse=True)}
with open('data.json', 'w') as jsonfile:
jsonfile.write(json.dumps(data))
return total Islands of Maldives (aligning together)
Computer programming, Data visualization, Research
import processing.video.*;
MovieMaker mm;
....
float x = -7000 + float(pieces[6])*100;
float y = 715 + float(pieces[7])*-100;
scale(50);
String[] shapes = split(pieces[0], ',');
beginShape();
for (int nodes = 0; nodes < shapes.length; nodes = nodes+1) {
String[] xy = split(shapes[nodes]," ");
float x1 = -7000 + float(xy[0])*100 - x+6.4;
float y1 = 715 + float(xy[1])*-100 - y+4.0;
vertex(x1, y1);
}
endShape(CLOSE);