Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NYT Source Coordinates are NULL #303

Open
Sajantoor opened this issue Apr 26, 2020 · 2 comments
Open

[BUG] NYT Source Coordinates are NULL #303

Sajantoor opened this issue Apr 26, 2020 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed source: nyt New York Times

Comments

@Sajantoor
Copy link

Sajantoor commented Apr 26, 2020

For the NYT source the coordinates are NULL for all data objects.
(https://coronavirus-tracker-api.herokuapp.com/v2/locations?source=nyt&country_code=US&province=Washington&county=Snohomish)

λ http GET https://coronavirus-tracker-api.herokuapp.com/v2/locations source==nyt country_code==US province=="Washington" county=="Snohomish" -v
GET /v2/locations?source=nyt&country_code=US&province=Washington&county=Snohomish HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: coronavirus-tracker-api.herokuapp.com
User-Agent: HTTPie/2.0.0



HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 339
Content-Type: application/json
Date: Sun, 26 Apr 2020 00:25:45 GMT
Server: uvicorn
Via: 1.1 vegur
{
    "latest": {
        "confirmed": 2267,
        "deaths": 102,
        "recovered": 0
    },
    "locations": [
        {
            "coordinates": {
                "latitude": null,
                "longitude": null
            },
            "country": "US",
            "country_code": "US",
            "country_population": 327167434,
            "county": "Snohomish",
            "id": 0,
            "last_updated": "2020-04-25T23:56:30.904937Z",
            "latest": {
                "confirmed": 2267,
                "deaths": 102,
                "recovered": 0
            },
            "province": "Washington"
        }
    ]
}
@Sajantoor Sajantoor added the bug Something isn't working label Apr 26, 2020
@Kilo59 Kilo59 added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Apr 26, 2020
@Kilo59
Copy link
Collaborator

Kilo59 commented Apr 26, 2020

Thanks for the report, and the example.
The NYT data-set was only recently added. They do not provide coordinates like our other sources.

Solutions to the problem were discussed by @nischalshankar but have yet to be implemented.
#259 (comment)

@Sajantoor
Any input or assistance would be welcomed.
Also I've edited your example so that it can be reproduced and compared to any future solution.

@xiaoxianma
Copy link

xiaoxianma commented Jun 13, 2020

@Kilo59 Hi, inspired by @nischalshankar, NYT data-set provides county, state, and fips code where county and fips code are one-to-one mapping, so knowing county and state may be good enough to locate coordinates. We can leverage a library called geopy to achieve it. geopy seems reliable as I haven't seen an edge case yet.

>>> from geopy.geocoders import Nominatim
>>> geolocator = Nominatim(user_agent="api")
>>> geolocator.geocode('Fort Bend,Texas')
Location(Fort Bend County, Texas, United States of America, (29.511218, -95.7807348, 0.0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed source: nyt New York Times
Projects
None yet
Development

No branches or pull requests

3 participants