{"id":18295437,"url":"https://github.com/spiderpig86/coronavirus-us-api","last_synced_at":"2025-04-05T12:31:30.645Z","repository":{"id":49709875,"uuid":"254039018","full_name":"Spiderpig86/coronavirus-us-api","owner":"Spiderpig86","description":"🦠🇺🇸 A fast (\u003c 400ms) microservice for live statistics on Coronavirus/Covid-19/SARS-CoV-2 impact on the US.","archived":false,"fork":false,"pushed_at":"2024-03-27T04:16:10.000Z","size":713,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T04:01:48.152Z","etag":null,"topics":["api","coronavirus","coronavirus-real-time","coronavirus-tracking","county","covid-19","covid-19-us","fastapi","microservice","ncov","python","rest"],"latest_commit_sha":null,"homepage":"http://coronavirus-us-api.herokuapp.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Spiderpig86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["Spiderpig86"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=5JW89TNNHB4JL\u0026currency_code=USD\u0026source=url"]}},"created_at":"2020-04-08T09:10:55.000Z","updated_at":"2024-01-16T05:12:52.000Z","dependencies_parsed_at":"2024-11-05T14:43:37.140Z","dependency_job_id":"34f0feb6-d3ba-4743-b9ff-159337807037","html_url":"https://github.com/Spiderpig86/coronavirus-us-api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spiderpig86%2Fcoronavirus-us-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spiderpig86%2Fcoronavirus-us-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spiderpig86%2Fcoronavirus-us-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Spiderpig86%2Fcoronavirus-us-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Spiderpig86","download_url":"https://codeload.github.com/Spiderpig86/coronavirus-us-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247338804,"owners_count":20922997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","coronavirus","coronavirus-real-time","coronavirus-tracking","county","covid-19","covid-19-us","fastapi","microservice","ncov","python","rest"],"created_at":"2024-11-05T14:35:26.656Z","updated_at":"2025-04-05T12:31:25.633Z","avatar_url":"https://github.com/Spiderpig86.png","language":"Python","funding_links":["https://github.com/sponsors/Spiderpig86","https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=5JW89TNNHB4JL\u0026currency_code=USD\u0026source=url"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\u003cimg width=250 height=250 src=\"https://raw.githubusercontent.com/Spiderpig86/coronavirus-us-api/master/static/coronavirus-us-1024.png\" /\u003e\u003c/div\u003e\r\n\r\n\u003ch1 align=\"center\"\u003ecoronavirus-us-api\u003c/h1\u003e\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n\r\n  [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com)\r\n\r\n  \u003cbr /\u003e\r\n\r\n  [![CI](https://github.com/Spiderpig86/coronavirus-us-api/actions/workflows/ci.yml/badge.svg)](https://github.com/Spiderpig86/coronavirus-us-api/actions/workflows/ci.yml)\r\n  [![MIT License](https://img.shields.io/github/license/Spiderpig86/coronavirus-us-api.svg)](https://opensource.org/licenses/GPL-3)\r\n  [![codecov](https://codecov.io/gh/Spiderpig86/coronavirus-us-api/branch/master/graph/badge.svg?token=7KTLEKXSK5)](https://codecov.io/gh/Spiderpig86/coronavirus-us-api)\r\n  [![Code style: black](https://img.shields.io/badge/code%20style-black-222.svg)](https://github.com/psf/black)\r\n  [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)\r\n\r\n\u003c/div\u003e\r\n\r\n## What\r\n\r\nThis API is designed to serve up to date information on confirmed cases and deaths across the United States at a country, state, and county level.\r\n\r\n## Built With\r\n\r\n* :zap: [FastAPI](https://fastapi.tiangolo.com/) - a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.\r\n* :moneybag: [Redis](https://redis.io/) - in-memory data structure store/cache.\r\n* :ear_of_rice: [Swagger](https://swagger.io/) - open source documentation tools.\r\n\r\n## Documentation\r\n\r\nSince **coronavirus-us-api** is powered by FastAPI, the API specification strictly follows the [OpenAPI](https://swagger.io/docs/specification/about/) standard. The JSON file for this API can be found [here](https://coronavirus-us-api.herokuapp.com/openapi.json).\r\n\r\nThe API documentation comes in three flavors:\r\n\r\n- [Swagger](https://coronavirus-us-api.herokuapp.com/) - standard way to test out the endpoints.\r\n- [Redoc](https://coronavirus-us-api.herokuapp.com/docs) - mobile friendly documentation.\r\n- [RapidAPI](https://rapidapi.com/Spiderpig86/api/coronavirus-us-api) - documentation and testing managed by RapidAPI.\r\n\r\n## Data Sources\r\n\r\nThe data used by the API comes from two sources:\r\n\r\n- [New York Times](https://github.com/nytimes/covid-19-data)\r\n- [John Hopkins University](https://github.com/CSSEGISandData/COVID-19)\r\n\r\n## Endpoints\r\n\r\nBefore getting started, let's go over some of the common types you will see in the remainder of the documentation:\r\n\r\n**Timelines**\r\n\r\n| Key                               | Description                                                                                                                      | Type   | \r\n|-----------------------------------|----------------------------------------------------------------------------------------------------------------------------------|--------| \r\n| **timelines**                     | Object containing measured statistics and their historical values.                                                               | Object | \r\n| timelines.*statistic*             | Object that contains information for that statistic. For now, only `confirmed` and `deaths` are supported.                       | Object | \r\n| timelines.*statistic*.**history** | Object containing a list of key value pairs where the key is the date and the value is the number for that statistic for that date. | Object | \r\n| timelines.*statistic*.**latest** | Value of statistic at current date. | Object | \r\n\r\n**Properties**\r\n\r\n| Key                                  | Description                                                                                                    | Type    | \r\n|--------------------------------------|----------------------------------------------------------------------------------------------------------------|---------| \r\n| **properties**                       | Object containing information regarding naming, classification, coordinates, and population.                   | Object  | \r\n| propertes.**uid**                    | Unique ID used by JHU CSSE to identify different locations.                                                    | string  | \r\n| properties.**iso2**                  | Country code following [alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) ISO country name standards. | string  | \r\n| properties.**iso3**                  | Country code following [alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) ISO country name standards. | string  | \r\n| properties.**code3**                 | A three digit numerical country code identifier.                                                               | string  | \r\n| properties.**fips**                  | A five digit identifier for US county and county-equivalents.                                                  | string  | \r\n| properties.**county**                | Name of US county if applicable.                                                                               | string  | \r\n| properties.**state**                 | Name of US state if applicable.                                                                                | string  | \r\n| properties.**country**               | Code for country.                                                                                              | string  | \r\n| properties.**coordinates**           | Object containing coordinates for given location.                                                              | object  | \r\n| properties.coordinates.**latitude**  | Latitude of location.                                                                                          | string  | \r\n| properties.coordinates.**longitude** | Longitude of location.                                                                                         | string  | \r\n| properties.**combined_key**          | Unique key combining location names based on specificity of request result.                                    | string  | \r\n| properties.**population**            | Population of location.                                                                                        | number | \r\n\r\n\r\n### Location Data\r\n\r\nEndpoints for fetching information (confirmed, deaths, etc) at the country, state, or county level. By default, these endpoints will show the latest statistic. Other fields such as the timeline and properties for the location can be enabled via query parameters.\r\n\r\n#### Country\r\n\r\nRetrieve information on the country level.\r\n\r\n```http\r\nGET /api/country/all\r\n```\r\n\r\n**Query Parameters**\r\n\r\n| Parameter  | Description                                                                           | Type    |\r\n|------------|---------------------------------------------------------------------------------------|---------|\r\n| source     | The data source to fetch data from.\u003cbr\u003eOptions: [\"nyt\", \"jhu\"]\u003cbr\u003e**Default:** \"nyt\" | string  |\r\n| timelines  | Display timeline for daily statistics.\u003cbr\u003e**Default:** false                         | boolean |\r\n| properties | Display properties associated with a given location.\u003cbr\u003e**Default:** false           | boolean |\r\n\r\n**Sample Request**\r\n\r\n```http\r\nGET /api/country/all?timelines=true\u0026properties=true\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003cb\u003eSample Response\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"latest\": {\r\n    \"confirmed\": 3199715,\r\n    \"deaths\": 133901\r\n  },\r\n  \"locations\": [\r\n    {\r\n      \"id\": \"US\",\r\n      \"country\": \"US\",\r\n      \"state\": \"\",\r\n      \"county\": \"\",\r\n      \"fips\": \"\",\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"history\": {\r\n            \"2020-01-21\": 1,\r\n            \"2020-01-22\": 1,\r\n            \"2020-01-23\": 1,\r\n            ... \r\n          },\r\n          \"latest\": 3199715\r\n        },\r\n        \"deaths\": {\r\n          \"history\": {\r\n            \"2020-01-21\": 0,\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          },\r\n          \"latest\": 133901\r\n        }\r\n      },\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 3199715,\r\n        \"deaths\": 133901\r\n      },\r\n      \"properties\": {\r\n        \"uid\": \"840\",\r\n        \"iso2\": \"US\",\r\n        \"iso3\": \"USA\",\r\n        \"code3\": \"840\",\r\n        \"fips\": \"\",\r\n        \"county\": \"\",\r\n        \"state\": \"\",\r\n        \"country\": \"US\",\r\n        \"coordinates\": {\r\n          \"latitude\": \"37.0902\",\r\n          \"longitude\": \"-95.7129\"\r\n        },\r\n        \"combined_key\": \"United States\",\r\n        \"population\": 329466283\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n**Response**\r\n\r\n| Key                              | Description                                                     | Type           | \r\n|----------------------------------|-----------------------------------------------------------------|----------------| \r\n| **latest**                       | Object containing latest measurements for supported statistics. | object         | \r\n| latest.*statistic*               | Contains the value for statistic at current date.               | number         | \r\n| **locations**                    | List of `Location` matching given criteria if present.          | List\u003cLocation\u003e | \r\n| locations.location.**id**        | Unique ID for the country.                                      | string         | \r\n| locations.location.**country**   | Name of the country.                                            | string         | \r\n| locations.location.**state**     | State of the location if applicable.                            | string         | \r\n| locations.location.**county**    | County of the location if applicable.                           | string         | \r\n| locations.location.**fips**      | Fips code of location if applicable.                            | string         | \r\n| locations.location.**timelines** | Timeline for statistics in location.                            | Timeline       | \r\n| locations.location.**last_updated** | Date for when the data was updated.                          | string         | \r\n| locations.location.**latest**    | Latest values for supported statistics.                         | string         | \r\n| locations.location.**properties**| Properties for a given location.                                | Properties     | \r\n\r\n----\r\n\r\n#### State\r\n\r\nRetrieve information on the state level.\r\n\r\n```http\r\nGET /api/state/all\r\n```\r\n\r\n**Query Parameters**\r\n\r\n| Parameter  | Description                                                                           | Type    |\r\n|------------|---------------------------------------------------------------------------------------|---------|\r\n| source     | The data source to fetch data from.\u003cbr\u003eOptions: [\"nyt\", \"jhu\"]\u003cbr\u003e**Default:** \"nyt\" | string  |\r\n| timelines  | Display timeline for daily statistics.\u003cbr\u003e**Default:** false                         | boolean |\r\n| properties | Display properties associated with a given location.\u003cbr\u003e**Default:** false           | boolean |\r\n| fips       | Only show locations matching the fips code.                                           | number |\r\n| state      | Only show locations matching state name. The name can be the **full name** or a [2-letter ANSI code](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations).    | string |\r\n\r\n**Sample Request**\r\n\r\n```http\r\nGET /api/state/all?timelines=true\u0026properties=true\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003cb\u003eSample Response\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"latest\": {\r\n    \"confirmed\": 3199790,\r\n    \"deaths\": 133906\r\n  },\r\n  \"locations\": [\r\n    {\r\n      \"id\": \"US@Washington@53\",\r\n      \"country\": \"US\",\r\n      \"state\": \"Washington\",\r\n      \"county\": \"\",\r\n      \"fips\": \"53\",\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"history\": {\r\n            \"2020-01-21\": 1,\r\n            \"2020-01-22\": 1,\r\n            \"2020-01-23\": 1,\r\n            ...\r\n          },\r\n          \"latest\": 41090\r\n        },\r\n        \"deaths\": {\r\n          \"history\": {\r\n            \"2020-01-21\": 0,\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          },\r\n          \"latest\": 1426\r\n        }\r\n      },\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 41090,\r\n        \"deaths\": 1426\r\n      },\r\n      \"properties\": {\r\n        \"uid\": \"84000053\",\r\n        \"iso2\": \"US\",\r\n        \"iso3\": \"USA\",\r\n        \"code3\": \"840\",\r\n        \"fips\": \"53\",\r\n        \"county\": \"\",\r\n        \"state\": \"Washington\",\r\n        \"country\": \"US\",\r\n        \"coordinates\": {\r\n          \"latitude\": \"47.4009\",\r\n          \"longitude\": \"-121.4905\"\r\n        },\r\n        \"combined_key\": \"Washington, US\",\r\n        \"population\": 7614893\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n**Response**\r\n\r\n| Key                              | Description                                                     | Type           | \r\n|----------------------------------|-----------------------------------------------------------------|----------------| \r\n| **latest**                       | Object containing latest measurements for supported statistics. | object         | \r\n| latest.*statistic*               | Contains the value for statistic at current date.               | number         | \r\n| **locations**                    | List of `Location` matching given criteria if present.          | List\u003cLocation\u003e | \r\n| locations.location.**id**        | Unique ID for the country.                                      | string         | \r\n| locations.location.**country**   | Name of the country.                                            | string         | \r\n| locations.location.**state**     | State of the location if applicable.                            | string         | \r\n| locations.location.**county**    | County of the location if applicable.                           | string         | \r\n| locations.location.**fips**      | Fips code of location if applicable.                            | string         | \r\n| locations.location.**uid**       | (Optional depends on source) Unique identifier for location.    | string         | \r\n| locations.location.**iso2**      | (Optional depends on source) Country code following [alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) ISO country name standards.   | string         | \r\n| locations.location.**iso3**      | (Optional depends on source) Country code following [alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) ISO country name standards.   | string         | \r\n| locations.location.**code3**     | (Optional depends on source) A three digit numerical country code identifier.  | string         | \r\n| locations.location.**latitude**  | (Optional depends on source) Latitude of location               | string         | \r\n| locations.location.**longitude** | (Optional depends on source) Longitude of location.             | string         | \r\n| locations.location.**timelines** | Timeline for statistics in location.                            | Timeline       | \r\n| locations.location.**last_updated** | Date for when the data was updated.                          | string         | \r\n| locations.location.**latest**    | Latest values for supported statistics.                         | string         | \r\n| locations.location.**properties**| Properties for a given location.                                | Properties     | \r\n\r\n**Sample Request with Parameter**\r\n\r\n```http\r\nGET /api/state/all?state=WA\r\n```\r\n\r\n```json\r\n{\r\n  \"latest\": {\r\n    \"confirmed\": 39218,\r\n    \"deaths\": 1424\r\n  },\r\n  \"locations\": [\r\n    {\r\n      \"id\": \"US@Washington\",\r\n      \"country\": \"US\",\r\n      \"state\": \"Washington\",\r\n      \"county\": \"\",\r\n      \"fips\": \"53\",\r\n      \"uid\": \"84000053\",\r\n      \"iso2\": \"US\",\r\n      \"iso3\": \"USA\",\r\n      \"code3\": \"840\",\r\n      \"latitude\": \"47.4009\",\r\n      \"longitude\": \"-121.4905\",\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 39218,\r\n        \"deaths\": 1424\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n----\r\n\r\n#### County\r\n\r\nRetrieve information on the county level.\r\n\r\n```http\r\nGET /api/county/all\r\n```\r\n\r\n**Query Parameters**\r\n\r\n| Parameter  | Description                                                                           | Type    |\r\n|------------|---------------------------------------------------------------------------------------|---------|\r\n| source     | The data source to fetch data from.\u003cbr\u003eOptions: [\"nyt\", \"jhu\"]\u003cbr\u003e**Default:** \"nyt\" | string  |\r\n| timelines  | Display timeline for daily statistics.\u003cbr\u003e**Default:** false                         | boolean |\r\n| properties | Display properties associated with a given location.\u003cbr\u003e**Default:** false           | boolean |\r\n| fips       | Only show locations matching the fips code.                                           | number |\r\n| state      | Only show locations matching state name. The name can be the **full name** or a [2-letter ANSI code](https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations).           | string |\r\n| county     | Only show locations matching county name.                                            | string |\r\n\r\n**Sample Request**\r\n\r\n```http\r\nGET /api/county/all?source=jhu\u0026timelines=true\u0026properties=true\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003cb\u003eSample Response\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"latest\": {\r\n    \"confirmed\": 11568,\r\n    \"deaths\": 633\r\n  },\r\n  \"locations\": [\r\n    {\r\n      \"id\": \"US@Texas@King\",\r\n      \"country\": \"US\",\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 0,\r\n        \"deaths\": 0\r\n      },\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"latest\": 0,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        },\r\n        \"deaths\": {\r\n          \"latest\": 0,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        }\r\n      },\r\n      \"properties\": {\r\n        \"uid\": \"84048269\",\r\n        \"iso2\": \"US\",\r\n        \"iso3\": \"USA\",\r\n        \"code3\": \"840\",\r\n        \"fips\": \"48269\",\r\n        \"county\": \"King\",\r\n        \"state\": \"Texas\",\r\n        \"country\": \"US\",\r\n        \"coordinates\": {\r\n          \"latitude\": \"33.61643847\",\r\n          \"longitude\": \"-100.2558057\"\r\n        },\r\n        \"combined_key\": \"King, Texas, US\",\r\n        \"population\": 272\r\n      },\r\n      \"uid\": \"84048269\",\r\n      \"iso2\": \"US\",\r\n      \"iso3\": \"USA\",\r\n      \"code3\": \"840\",\r\n      \"state\": \"Texas\",\r\n      \"county\": \"King\",\r\n      \"fips\": \"48269.0\",\r\n      \"latitude\": \"33.61643847\",\r\n      \"longitude\": \"-100.2558057\"\r\n    },\r\n    {\r\n      \"id\": \"US@Washington@King\",\r\n      \"country\": \"US\",\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 11568,\r\n        \"deaths\": 633\r\n      },\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"latest\": 11568,\r\n          \"history\": {\r\n            \"2020-01-22\": 1,\r\n            \"2020-01-23\": 1,\r\n            ...\r\n          }\r\n        },\r\n        \"deaths\": {\r\n          \"latest\": 633,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        }\r\n      },\r\n      \"properties\": {\r\n        \"uid\": \"84053033\",\r\n        \"iso2\": \"US\",\r\n        \"iso3\": \"USA\",\r\n        \"code3\": \"840\",\r\n        \"fips\": \"53033\",\r\n        \"county\": \"King\",\r\n        \"state\": \"Washington\",\r\n        \"country\": \"US\",\r\n        \"coordinates\": {\r\n          \"latitude\": \"47.49137892\",\r\n          \"longitude\": \"-121.8346131\"\r\n        },\r\n        \"combined_key\": \"King, Washington, US\",\r\n        \"population\": 2252782\r\n      },\r\n      \"uid\": \"84053033\",\r\n      \"iso2\": \"US\",\r\n      \"iso3\": \"USA\",\r\n      \"code3\": \"840\",\r\n      \"state\": \"Washington\",\r\n      \"county\": \"King\",\r\n      \"fips\": \"53033.0\",\r\n      \"latitude\": \"47.49137892\",\r\n      \"longitude\": \"-121.8346131\"\r\n    },\r\n    ...\r\n  ]\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n**Response**\r\n\r\n| Key                              | Description                                                     | Type           | \r\n|----------------------------------|-----------------------------------------------------------------|----------------| \r\n| **latest**                       | Object containing latest measurements for supported statistics. | object         | \r\n| latest.*statistic*               | Contains the value for statistic at current date.               | number         | \r\n| **locations**                    | List of `Location` matching given criteria if present.          | List\u003cLocation\u003e | \r\n| locations.location.**id**        | Unique ID for the country.                                      | string         | \r\n| locations.location.**country**   | Name of the country.                                            | string         | \r\n| locations.location.**state**     | State of the location if applicable.                            | string         | \r\n| locations.location.**county**    | County of the location if applicable.                           | string         | \r\n| locations.location.**fips**      | Fips code of location if applicable.                            | string         | \r\n| locations.location.**uid**       | (Optional depends on source) Unique identifier for location.    | string         | \r\n| locations.location.**iso2**      | (Optional depends on source) Country code following [alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) ISO country name standards.   | string         | \r\n| locations.location.**iso3**      | (Optional depends on source) Country code following [alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) ISO country name standards.   | string         | \r\n| locations.location.**code3**     | (Optional depends on source) A three digit numerical country code identifier.  | string         | \r\n| locations.location.**latitude**  | (Optional depends on source) Latitude of location               | string         | \r\n| locations.location.**longitude** | (Optional depends on source) Longitude of location.             | string         | \r\n| locations.location.**timelines** | Timeline for statistics in location.                            | Timeline       | \r\n| locations.location.**last_updated** | Date for when the data was updated.                          | string         | \r\n| locations.location.**latest**    | Latest values for supported statistics.                         | string         | \r\n| locations.location.**properties**| Properties for a given location.                                | Properties     | \r\n\r\n**Sample Request with Parameter**\r\n\r\n```http\r\nGET /api/state/all?source=jhu\u0026county=King\r\n```\r\n\r\n```json{\r\n  \"latest\": {\r\n    \"confirmed\": 0,\r\n    \"deaths\": 0\r\n  },\r\n  \"locations\": [\r\n    {\r\n      \"id\": \"US@New York@Queens\",\r\n      \"country\": \"US\",\r\n      \"last_updated\": \"2020-07-12\",\r\n      \"latest\": {\r\n        \"confirmed\": 0,\r\n        \"deaths\": 0\r\n      },\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"latest\": 0,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        },\r\n        \"deaths\": {\r\n          \"latest\": 0,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        }\r\n      },\r\n      \"uid\": \"84036081\",\r\n      \"iso2\": \"US\",\r\n      \"iso3\": \"USA\",\r\n      \"code3\": \"840\",\r\n      \"state\": \"New York\",\r\n      \"county\": \"Queens\",\r\n      \"fips\": \"36081.0\",\r\n      \"latitude\": \"40.71088124\",\r\n      \"longitude\": \"-73.81684712\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n- **Note:** Multiple locations that share the same county name or share the same state will also be shown. The value you see for `latest` is the aggregate for all matching results.\r\n\r\n```http\r\nGET /api/county/all?source=jhu\u0026county=king\u0026timelines=true\u0026properties=true\r\n```\r\n\r\n```json\r\n{\r\n  \"latest\": {\r\n    \"confirmed\": 11568,\r\n    \"deaths\": 633\r\n  },\r\n  \"locations\": [\r\n    {\r\n      \"id\": \"US@Texas@King\",\r\n      \"country\": \"US\",\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 0,\r\n        \"deaths\": 0\r\n      },\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"latest\": 0,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        },\r\n        \"deaths\": {\r\n          \"latest\": 0,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        }\r\n      },\r\n      \"properties\": {\r\n        \"uid\": \"84048269\",\r\n        \"iso2\": \"US\",\r\n        \"iso3\": \"USA\",\r\n        \"code3\": \"840\",\r\n        \"fips\": \"48269\",\r\n        \"county\": \"King\",\r\n        \"state\": \"Texas\",\r\n        \"country\": \"US\",\r\n        \"coordinates\": {\r\n          \"latitude\": \"33.61643847\",\r\n          \"longitude\": \"-100.2558057\"\r\n        },\r\n        \"combined_key\": \"King, Texas, US\",\r\n        \"population\": 272\r\n      },\r\n      \"uid\": \"84048269\",\r\n      \"iso2\": \"US\",\r\n      \"iso3\": \"USA\",\r\n      \"code3\": \"840\",\r\n      \"state\": \"Texas\",\r\n      \"county\": \"King\",\r\n      \"fips\": \"48269.0\",\r\n      \"latitude\": \"33.61643847\",\r\n      \"longitude\": \"-100.2558057\"\r\n    },\r\n    {\r\n      \"id\": \"US@Washington@King\",\r\n      \"country\": \"US\",\r\n      \"last_updated\": \"2020-07-11\",\r\n      \"latest\": {\r\n        \"confirmed\": 11568,\r\n        \"deaths\": 633\r\n      },\r\n      \"timelines\": {\r\n        \"confirmed\": {\r\n          \"latest\": 11568,\r\n          \"history\": {\r\n            \"2020-01-22\": 1,\r\n            \"2020-01-23\": 1,\r\n            ...\r\n          }\r\n        },\r\n        \"deaths\": {\r\n          \"latest\": 633,\r\n          \"history\": {\r\n            \"2020-01-22\": 0,\r\n            \"2020-01-23\": 0,\r\n            ...\r\n          }\r\n        }\r\n      },\r\n      \"properties\": {\r\n        \"uid\": \"84053033\",\r\n        \"iso2\": \"US\",\r\n        \"iso3\": \"USA\",\r\n        \"code3\": \"840\",\r\n        \"fips\": \"53033\",\r\n        \"county\": \"King\",\r\n        \"state\": \"Washington\",\r\n        \"country\": \"US\",\r\n        \"coordinates\": {\r\n          \"latitude\": \"47.49137892\",\r\n          \"longitude\": \"-121.8346131\"\r\n        },\r\n        \"combined_key\": \"King, Washington, US\",\r\n        \"population\": 2252782\r\n      },\r\n      \"uid\": \"84053033\",\r\n      \"iso2\": \"US\",\r\n      \"iso3\": \"USA\",\r\n      \"code3\": \"840\",\r\n      \"state\": \"Washington\",\r\n      \"county\": \"King\",\r\n      \"fips\": \"53033.0\",\r\n      \"latitude\": \"47.49137892\",\r\n      \"longitude\": \"-121.8346131\"\r\n    },\r\n    ...\r\n  ]\r\n}\r\n```\r\n\r\n## Latest\r\n\r\nRetrieve the latest statistics for the entire country.\r\n\r\n```http\r\nGET /api/country/latest\r\n```\r\n\r\n**Query Parameters**\r\n\r\n| Parameter  | Description                                                                           | Type    |\r\n|------------|---------------------------------------------------------------------------------------|---------|\r\n| source     | The data source to fetch data from.\u003cbr\u003eOptions: [\"nyt\", \"jhu\"]\u003cbr\u003e**Default:** \"nyt\" | string  |\r\n\r\n**Sample Request**\r\n\r\n```http\r\nGET /api/county/latest?source=jhu\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003cb\u003eSample Response\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"latest\": {\r\n    \"confirmed\": 3184573,\r\n    \"deaths\": 134092\r\n  },\r\n  \"last_updated\": \"2020-07-12\"\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n## Sources\r\n\r\nRetrieve the list of sources that the API supports.\r\n\r\n```http\r\nGET /api/data/sources\r\n```\r\n\r\n**Sample Request**\r\n\r\n```http\r\nGET /api/data/sources\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003cb\u003eSample Response\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"sources\": [\r\n    \"nyt\",\r\n    \"jhu\"\r\n  ]\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n## Heartbeat\r\n\r\nEndpoint to test service health.\r\n\r\n```http\r\nGET /api/health/heartbeat\r\n```\r\n\r\n**Sample Request**\r\n\r\n```http\r\nGET /api/health/heartbeat\r\n```\r\n\r\n\u003cdetails\u003e\r\n\u003csummary\u003e\u003cb\u003eSample Response\u003c/b\u003e\u003c/summary\u003e\r\n\r\n```json\r\n{\r\n  \"is_alive\": true\r\n}\r\n```\r\n\u003c/details\u003e\r\n\r\n## Development\r\n\r\nBelow are some of the dependencies you will need:\r\n\r\n- [Python 3.7+](https://www.python.org/downloads/)\r\n- [Pipenv](https://pypi.org/project/pipenv/)\r\n\r\nThen, clone the repository and create a Pipenv environment.\r\n\r\n```sh\r\n$ git clone git@github.com:Spiderpig86/coronavirus-us-api.git\r\n$ cd ./coronavirus-us-api\r\n```\r\n\r\n[Install Pipenv](https://pipenv.pypa.io/en/latest/install/#installing-pipenv) and set up your virtual environment with the needed dependencies.\r\n\r\n```sh\r\n$ pip install --user pipenv\r\n$ pipenv sync --dev\r\n$ pipenv shell\r\n```\r\n\r\nNow that this is all setup, you can run the commands to run, test, and format the project. The project will start at `localhost:8000` by default (configurable in `backend/core/config/config.yml`):\r\n\r\n**Debugging/Live Reloading**\r\n\r\n```sh\r\n$ pipenv run dev\r\n```\r\n\r\n**Running**\r\n\r\n```sh\r\n$ pipenv run start\r\n```\r\n\r\n**Formatting**\r\n\r\n```sh\r\n$ invoke black\r\n```\r\n\r\n**Sort Imports**\r\n\r\n```sh\r\n$ invoke sort\r\n```\r\n\r\n**Linting**\r\n\r\n```sh\r\n$ invoke check\r\n```\r\n\r\n**Unit Testing**\r\n\r\n```sh\r\n$ invoke test\r\n```\r\n\r\n**End to End Tests**\r\n\r\n```sh\r\n$ invoke e2e\r\n```\r\n\r\n**Generate Test Coverage**\r\n\r\n```sh\r\n$ invoke coverage\r\n```\r\n\r\n### Docker\r\n\r\nSetting up Docker is quite straight forward -- unless you are using Windows 10 Home (more on this later).\r\n\r\nRun these commands.\r\n\r\n```sh\r\ndocker-compose build\r\ndocker-compose up\r\n```\r\n\r\nIf you are using a non-supported OS for Docker, you would need to use Docker Toolkit. Once you have it set up, if you are not able to access the container itself, allow port `8080` in your VM. [Reference](https://stackoverflow.com/questions/42866013/docker-toolbox-localhost-not-working)\r\n\r\n## Projects Using This API\r\n\r\nLet me know if you are using the API! It means a great deal.\r\n\r\n- [CovidPovertyLink](https://github.com/christorepl/CovidPovertyLink)\r\n\r\n## License\r\n\r\nSee [LICENSE.md](https://github.com/Spiderpig86/coronavirus-us-api/blob/master/LICENSE) for information regarding usage and attribution.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspiderpig86%2Fcoronavirus-us-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspiderpig86%2Fcoronavirus-us-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspiderpig86%2Fcoronavirus-us-api/lists"}