https://github.com/willfantom/lu-covid-api
API access to the Lancaster University Covid19 statistics 🦠 (Also, some basic CLI graphs)
https://github.com/willfantom/lu-covid-api
covid-19 university unofficial
Last synced: 6 months ago
JSON representation
API access to the Lancaster University Covid19 statistics 🦠 (Also, some basic CLI graphs)
- Host: GitHub
- URL: https://github.com/willfantom/lu-covid-api
- Owner: WillFantom
- License: gpl-3.0
- Created: 2020-10-10T21:24:44.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-17T16:07:06.000Z (over 5 years ago)
- Last Synced: 2024-06-21T02:18:06.849Z (about 2 years ago)
- Topics: covid-19, university, unofficial
- Language: Go
- Homepage: https://lucovid.willfantom.dev
- Size: 331 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# COVID Statistics API for LU
> Very unofficial, but uses the data provided by the university publicly
To see the statistics, see [here](https://portal.lancaster.ac.uk/intranet/cms/coronavirus/covid-19-statistics). The API is currently hosted at `https://lucovid.willfantom.dev`. The data can also be found through the telegram bot `@LU_Covid19_bot`.
This API exists only to allow for easier manipulation of the data.
## Examples
- Get graph of all cases since 01/Oct/2020 (with `lolcat` for colors):
```bash
$ curl "https://lucovid.willfantom.dev/graphs/total" | lolcat
```

- Get average daily cases for the past week as JSON (with `jq` for formatting):
```bash
$ curl "https://lucovid.willfantom.dev/api/v1/average?days=7" | jq
{
"average cases": 22,
"ending date": "Thu, 15 Oct 2020 00:00:00 UTC",
"starting date": "Thu, 08 Oct 2020 00:00:00 UTC"
}
```
### ⚠️ Warning
If you can't reach `portal.lancaster.ac.uk`, you can't host the API. This might be because you are using CloudFlare DNS.
### Graphs
This simply returns some poorly formatted ascii graphs for now...
- **Total Cases**
`/graphs/total`
Shows increase in total cases across all available data.
- **Student Cases**
`/graphs/students`
Shows increase in total student cases (campus and city) across all available data points.
- **Staff Cases**
`/graphs/staff`
Shows increase in total staff cases across all available data points.
### API
- **Cases Today** [get]
`/api/v1/today`
Telegram bot function: `/today`
Will return:
- `204` if today's data has not yet been published (or scraped)
- `500` if this crappy code messed up
- `200` with a json summary of the cases today if successful
- **Most Recent Daily Numbers** [get]
`/api/v1/recent`
Telegram bot function: `/recent`
Will return:
- `204` if data has not yet been published (or scraped)
- `500` if this crappy code messed up
- `200` with a json summary of the cases for that day if successful, e.g.
```json
{"Date":"2020-10-02T00:00:00Z","Campus":4,"City":2,"Staff":0}
```
- **Cases for Given Day** [get]
`/api/v1/day`
Required Parameters:
- `day`: e.g. `02`
- `month`: e.g. `Oct`
- `year`: e.g. `2020`
> (example builds `October 2nd 2020`)
Will return:
- `204` if data has not yet been published (or scraped)
- `500` if this crappy code messed up
- `200` with a json summary of the cases for that day if successful, e.g.
```json
{"Date":"2020-10-02T00:00:00Z","Campus":4,"City":2,"Staff":0}
```
- **Total Cases** [get]
`/api/v1/totals`
Will return:
- `204` if data has not yet been published (or scraped)
- `500` if this crappy code messed up
- `200` with a json summary of the total cases if successful, e.g.
```json
{
"starting date": "Thu, 01 Oct 2020 00:00:00 UTC",
"ending date": "Thu, 08 Oct 2020 00:00:00 UTC",
"staff total": 5,
"student total": 117,
"total cases": 122
}
```
- **Average Daily Cases** [get]
`/api/v1/average`
Optional Parameters:
- `days`: e.g. `7` | if not provided, will average across the whole dataset
> (example returns average over the 7 most recently provided daily data)
Will return:
- `204` if data has not yet been published (or scraped)
- `500` if this crappy code messed up
- `200` with a json summary of the total cases if successful, e.g.
```json
{
"average cases": 23,
"ending date": "Sun, 11 Oct 2020 00:00:00 UTC",
"starting date": "Sun, 04 Oct 2020 00:00:00 UTC"
}
```
- **Complete Raw** [get]
`/api/v1/raw`
Will return:
- `204` if data has not yet been published (or scraped)
- `500` if this crappy code messed up
- `200` with a json summary of the total cases as given in the table if successful, e.g.
```json
[ {"Date":"2020-10-01T00:00:00Z","Campus":1,"City":2,"Staff":0},
{"Date":"2020-10-02T00:00:00Z","Campus":4,"City":2,"Staff":0},
{"Date":"2020-10-03T00:00:00Z","Campus":3,"City":1,"Staff":0},
{"Date":"2020-10-04T00:00:00Z","Campus":4,"City":4,"Staff":0} ]
```