code4moldova / covid19md-info

Portal de informare despre noul tip de coronavirus in Moldova cu scopul de oferi suport informațional populației rapid și corect prin infografice, date statistice.
https://info.c19.md
3 stars 0 forks source link

make api for stats using google sheets #48

Open Junumboxo opened 4 years ago

Junumboxo commented 4 years ago

@alexkingdom o sa faca un rest api si o sa puna in public. Datele o sa fie luate de la gis. Dupa detalii la mine @grigore-fiodorov sau la @alexkingdom

vmelnic commented 4 years ago

Suggestion. In order to send the data from gsheet (or any other supported source) to info.c19.md you can also use Zapier for free https://zapier.com/home and only handle the request from Zapier webhook in your app, instead of integrating google api/sdk and so.

johnsmithm commented 4 years ago
data = jsonFromAPI get request
cols = max([int(i['gs$cell']['col']) for i in data['feed']['entry']])
rows = max([int(i['gs$cell']['row']) for i in data['feed']['entry']])
df = [['' for i in range(cols)] for j in range(rows)]
for i in data['feed']['entry']:
    col = int(i['gs$cell']['col'])
    row = int(i['gs$cell']['row'])
    #print(i['gs$cell'])
    df[row-1][col-1] = i['gs$cell']['inputValue']