Skip to content

Instantly share code, notes, and snippets.

@darrenmothersele
Last active March 26, 2020 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenmothersele/52a4eb9e601e32a0b3bcb859472c6d00 to your computer and use it in GitHub Desktop.
Save darrenmothersele/52a4eb9e601e32a0b3bcb859472c6d00 to your computer and use it in GitHub Desktop.
Coronavirus Dashboard Config
{
"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' }"
}
]
},
{
"blocks": [
{
"type": "init"
},
{
"type": "http",
"method": "get",
"endpoint": "https://corona.lmao.ninja/historical"
},
{
"type": "mapping",
"mapping": "{ label: 'recoveries', data: toPairs(groupByKeys(data[*].timeline.recovered))[*].{ label: @[0].split(@, '/').join('', ['2020-0', @[0], '-', @[1].padStart(@, `2`, '0')]), value: @[1].map(&to_number(@), @).sum(@)}}"
}
]
}
]
},
{
"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 100 recoveries"
},
{
"type": "http",
"method": "get",
"endpoint": "https://covid19.mathdro.id/api/recovered"
},
{
"type": "mapping",
"mapping": "data[?recovered > `10`].{ 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