marleymarl / geotimeline-backend

0 stars 0 forks source link

Enrich footprint data with nearest city/state/country #2

Open marleymarl opened 4 years ago

marleymarl commented 4 years ago

Right now footprint data has only lat/lon whereas it would be useful for DataView if it had enriched that with city/state/country as users won't be able to decipher where a lat/lon represents by looking at it in table view. This could be done through geocoding or some other method and could be done on initial save_timeline API or done through scheduled enrichment e.g. using a Cloudwatch event that checked for any new entries in DB since last check and enriched them based on their lat/lon using geocoding.

heldersepu commented 4 years ago

This can get really expensive really quick, I did exactly that for a real estate company cleaning up the address that the realtors' input for the properties and it was pricey...

on this case it's only city/state/country not down to the address level, not sure if there is an API that might do just that for smaller fee, we will have to research and see

marleymarl commented 4 years ago

Good point. I had been looking at https://www.npmjs.com/package/all-the-cities as an option. It has lat/lon for each of those cities so I guess we'd need to find best way to structure the query to generate a matching city.

marleymarl commented 4 years ago

At a simple level it could grab the first city that is less than or equal to X distance from the 'bounding box' of the timeline but there might be a better way, especially using a graph db query.

heldersepu commented 4 years ago

... looking at https://www.npmjs.com/package/all-the-cities as an option. It has lat/lon for each of those cities ...

ye we can do an approx with that, the package is just giving us a point for the city easy pythagorean calculation to get the distance to patient location


grab the first city that is less than or equal to X distance from the 'bounding box' of the timeline

got lost on 2 counts:

rtf-const commented 4 years ago

As an another option we can use Openstreetmap geocoding https://nominatim.org/ It can be installed in our server, it has ready to use docker container for easy installation. It will provide us not just a city but the detailed address information for free (except for the server resources)

heldersepu commented 4 years ago

As an another option we can use Openstreetmap geocoding https://nominatim.org/ It can be installed in our server, ... detailed address information for free (except for the server resources)

Ye, the hardware requirements are quite high: https://nominatim.org/release-docs/latest/admin/Installation/#hardware

I think we should stick to the all-the-cities package for now