Skip to content

Instantly share code, notes, and snippets.

@darrenmothersele
Created March 30, 2020 13:11
Show Gist options
  • Save darrenmothersele/a032f351eb99fcf9318f358a24c2b76d to your computer and use it in GitHub Desktop.
Save darrenmothersele/a032f351eb99fcf9318f358a24c2b76d to your computer and use it in GitHub Desktop.
{
"title": "Coronavirus Dashboard",
"blocks": [
{
"type": "multi",
"batches": [
{
"blocks": [
{
"type": "init"
},
{
"type": "http",
"method": "get",
"endpoint": "https://covid19.mathdro.id/api"
},
{
"type": "mapping",
"mapping": "[{ label: 'Confirmed', value: data.confirmed.value},{ label: 'Recovered', value: data.recovered.value},{ label: 'Deaths', value: data.deaths.value}]"
},
{
"type": "batch",
"flex": true,
"blocks": [
{
"type": "card",
"blocks": [
{
"type": "message",
"title": "{{ value }}",
"message": "{{ label }}"
}
]
}
]
}
]
},
{
"blocks": [
{
"type": "init"
},
{
"type": "http",
"method": "get",
"endpoint": "https://covid19.mathdro.id/api/daily"
},
{
"type": "multi",
"batches": [
{
"blocks": [
{
"type": "mapping",
"mapping": "{ data: data[*].{ value: confirmed.total, label: reportDate }, label: 'confirmed' }"
}
]
},
{
"blocks": [
{
"type": "mapping",
"mapping": "{ data: data[*].{ value: deaths.total, label: reportDate }, label: 'deaths' }"
}
]
}
]
},
{
"type": "chart",
"chartType": "line",
"multi": true
}
]
},
{
"blocks": [
{
"type": "init"
},
{
"type": "http",
"method": "get",
"endpoint": "https://covid19.mathdro.id/api/daily"
},
{
"type": "mapping",
"mapping": "[{ data: pairwise(data[-30:])[?next!=`null`].{ label: next.reportDate, value: percentChange(current.totalConfirmed, next.totalConfirmed) }, label: 'percentage change' }]"
},
{
"type": "chart",
"chartType": "line",
"multi": true
}
]
},
{
"blocks": [
{
"type": "init"
},
{
"type": "message",
"title": "COVID-19 Recoveries",
"message": "Locations with more than 20 recoveries"
},
{
"type": "http",
"method": "get",
"endpoint": "https://covid19.mathdro.id/api/recovered"
},
{
"type": "mapping",
"mapping": "data[?recovered > `20`].{ lat: lat, long: long, label: join(' ', [to_string(recovered), 'recovered in', combinedKey][? @ != null]) }"
},
{
"type": "map",
"height": 500,
"zoom": 2
}
]
}
]
}
],
"id": "covidDashboard",
"adapterName": "kendraio"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment