pomber / covid19

JSON time-series of coronavirus cases (confirmed, deaths and recovered) per country - updated daily
https://pomber.github.io/covid19/timeseries.json
1.23k stars 374 forks source link

v2 api structure #160

Closed adityasatalkar closed 4 years ago

adityasatalkar commented 4 years ago

I propose updating the JSON format to have a JSON array to make it simpler to parse it easily in a dynamic manner.

Current JSON format

{
    "Afghanistan": [{
            "date": "2020-1-22",
            "confirmed": 0,
            "deaths": 0,
            "recovered": 0
        },
        {
            "date": "2020-1-23",
            "confirmed": 0,
            "deaths": 0,
            "recovered": 0
        }
    ],
    "Albania": [{
            "date": "2020-1-22",
            "confirmed": 0,
            "deaths": 0,
            "recovered": 0
        },
        {
            "date": "2020-1-23",
            "confirmed": 0,
            "deaths": 0,
            "recovered": 0
        }
    ]
}

Proposed JSON format

{
    "countryWise": [
        {
            "country": "Afghanistan",
            "timeSeries": [
                {
                    "date": "2020-4-16",
                    "confirmed": 840,
                    "deaths": 30,
                    "recovered": 54
                },
                {
                    "date": "2020-4-16",
                    "confirmed": 840,
                    "deaths": 30,
                    "recovered": 54
                }
            ]
        },
        {
            "country": "Albania",
            "timeSeries": [
                {
                    "date": "2020-4-16",
                    "confirmed": 840,
                    "deaths": 30,
                    "recovered": 54
                },
                {
                    "date": "2020-4-16",
                    "confirmed": 840,
                    "deaths": 30,
                    "recovered": 54
                }
            ]
        },
        {
            "country": "Unknown",
            "timeSeries": [
                {
                    "date": "2020-4-16",
                    "confirmed": 840,
                    "deaths": 30,
                    "recovered": 54
                }
            ]
        }
    ]
}
pomber commented 4 years ago

Hi, I don't think that's worth a new major version. It may be simpler for some use cases but it's harder for others.

Feel free to fork the repo if you really need the JSON with that structure.