-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes better region information available, for example ISO country codes, and allows the user to filter based on them. This addresses #43 Example: http://127.0.0.1:8000/v1/jh/daily-reports/?country_code_iso2=GB { "id": 100477, "country_region": "United Kingdom", "province_state": "Channel Islands", "fips": null, "admin2": null, "last_update": "2020-04-04T23:34:00", "confirmed": 262, "deaths": 5, "recovered": 13, "region_info": { "uid": 8261, "scope": "Province_State", "country_code_iso2": "GB", "country_code_iso3": "GBR", "country_region": "United Kingdom", "province_state": "Channel Islands", "fips": null, "admin2": null } } This example includes province/state level reports as well as country/region level. The scope parameter can be used to filter these out: http://127.0.0.1:8000/v1/jh/daily-reports/?country_code_iso2=GB&scope=Country_Region { "id": 100709, "country_region": "United Kingdom", "province_state": null, "fips": null, "admin2": null, "last_update": "2020-04-04T23:34:00", "confirmed": 41903, "deaths": 4313, "recovered": 135, "region_info": { "uid": 826, "scope": "Country_Region", "country_code_iso2": "GB", "country_code_iso3": "GBR", "country_region": "United Kingdom", "province_state": null, "fips": null, "admin2": null } }, The country_region, province_state, fips, admin2 fields duplicate the top level one, but I think we should include them for backwards compatability. Then if we create a V2 of the API we can drop the top level ones. The ones in region info are the cleaned versions - they ensure that the same region will always be presented the same way. The top level ones come from the reports themselves and are inconsistent from day to day.
- Loading branch information
Showing
5 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from enum import Enum | ||
|
||
class Scope(Enum): | ||
COUNTRY_REGION = 1 | ||
PROVINCE_STATE = 2 | ||
ADMIN2 = 3 | ||
COUNTRY_REGION = 'Country_Region' | ||
PROVINCE_STATE = 'Province_State' | ||
ADMIN2 = 'Admin2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters