covid19

Crates.iocovid19
lib.rscovid19
version0.3.0
sourcesrc
created_at2020-04-16 12:42:39.149469
updated_at2020-05-08 12:34:08.136399
descriptionWrapper for cv19api https://lbandc.github.io/2020/04/14/project-cv19api.html
homepagehttps://github.com/biomunky/cv19api
repository
max_upload_size
id230763
size854,571
BioMunky (biomunky)

documentation

README

A Quick and Dirty Rust wrapper for cv19api and coviddata

Why?

Why not? It's fun to learn new things.

cv19api

Handles the following endpoints and returns an Ok(Response) for each. Each Endpoint has its own response type rather than making the trust and region fields optional.

    /deaths

    {
        "data": [
            {
                "date": "2020-04-14",
                "deaths": 113
            },
        ...
        ]
        ,
        "metaData": {
            "recordedOnTo": "2020-04-15",
            "from": "2020-03-16",
            "to": "2020-04-15",
            "recordedOnFrom": "2020-01-01"
        }
    }
    /deaths/trusts

        {
        "data": [
            {
                "date": "2020-04-14",
                "trust": "AIREDALE NHS FOUNDATION TRUST",
                "deaths": 0
            },
        ...
        ]
        ,
        "metaData": {
            "recordedOnTo": "2020-04-15",
            "from": "2020-03-16",
            "to": "2020-04-15",
            "recordedOnFrom": "2020-01-01"
        }
    }
    /deaths/regions

        {
        "data": [
            {
                "date": "2020-04-14",
                "region": "EAST_OF_ENGLAND",
                "deaths": 41
            },
        ...
        ]
        ,
        "metaData": {
            "recordedOnTo": "2020-04-15",
            "from": "2020-03-16",
            "to": "2020-04-15",
            "recordedOnFrom": "2020-01-01"
        }
    }

coviddata

    v1/countries/stats.json

    [
        {
            "country": {
                "key": "united-states",
                "name": "United States"
            },
            "dates": {
                "2020-01-22": {
                    "new": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    },
                    "cumulative": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    }
                },
                "2020-01-23": {
                    "new": {
                        "cases": 0,
                        "deaths": 0,
                        "recoveries": 0
                    },
                    "cumulative": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    }
                }
            }
        }
    ]
    v1/regions/stats.json

    [
        {
            "region": {
                "key": "new-york-united-states",
                "name": "New York",
                "full_name": "New York, United States",
                "country": {
                    "location_type": "country",
                    "key": "united-states",
                    "name": "United States"
                }
            },
            "dates": {
                "2020-03-01": {
                    "new": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    },
                    "cumulative": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    }
                },
                "2020-03-02": {
                    "new": {
                        "cases": 0,
                        "deaths": 0,
                        "recoveries": 0
                    },
                    "cumulative": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    }
                }
            }
        }
    ]
    v1/places/stats.json
    [
        {
            "place": {
                "key": "new-york-city-new-york-united-states",
                "name": "New York City",
                "full_name": "New York City, New York, United States",
                "country": {
                    "location_type": "country",
                    "key": "united-states",
                    "name": "United States"
                },
                "region": {
                    "location_type": "region",
                    "key": "new-york-united-states",
                    "name": "New York",
                    "full_name": "New York, United States",
                    "country": {
                        "location_type": "country",
                        "key": "united-states",
                        "name": "United States"
                    }
                }
            },
            "dates": {
                "2020-03-01": {
                    "new": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    },
                    "cumulative": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    }
                },
                "2020-03-02": {
                    "new": {
                        "cases": 0,
                        "deaths": 0,
                        "recoveries": 0
                    },
                    "cumulative": {
                        "cases": 1,
                        "deaths": 0,
                        "recoveries": 0
                    }
                }
            }
        }
    ]

Examples

Quick and dirty usage

cargo run --example cv19api_deaths_by_region
cargo run --example cv19api_deaths_by_trust
cargo run --example cv19api_deaths
cargo run --example coviddata_countries
Commit count: 0

cargo fmt