Describe the problem
Geolocation extraction is a great feature, but it consumes a high amount of resources. In this issue, we will optimize the extraction of locations on the GBFS feeds. As it has not been proven that the proposed solution will increase performance until it is implemented and tested, as part of this issue, we are adding the ability to "configure" the extraction strategy. This will keep the code intact, and we will be able to conduct live tests to gather more accurate data for comparison.
Proposed solution
Currently, we query the database once per geographic point. For GBFS, many geographic points are "clustered". This is primarily true in the case of vehicle positions as they tend to be clustered across regions in the same city. In many cities, the scooters/bikes/etc are only allowed to be parked in certain areas, which increases the points per cluster. This is empirical information.
Tasks:
- Adjust the code to allow multiple location extraction strategies by using a cloud function parameter or a pub/sub event parameter. Consider adding a default in case no strategy is passed.
- Having the list of points to extract the geolocation, implement the following strategy:
- Query the DB for one point
- Get the list of OSM IDs
- From the OSM IDs, select the one with the highest level and retrieve the polygon associated
- Iterate over the list and remove from the list all the points that are in the retrieved polygon
- Go to step 1 until the list is completed
- Test the strategy with a few feeds and adjust it if needed. Consider twinking the comparison of the polygon by comparing all OSM polygons
- Consider adjusting the CPU and memory function if needed, as the local processing will demand more resources.
Alternatives you've considered
No response
Additional context
No response
Describe the problem
Geolocation extraction is a great feature, but it consumes a high amount of resources. In this issue, we will optimize the extraction of locations on the GBFS feeds. As it has not been proven that the proposed solution will increase performance until it is implemented and tested, as part of this issue, we are adding the ability to "configure" the extraction strategy. This will keep the code intact, and we will be able to conduct live tests to gather more accurate data for comparison.
Proposed solution
Currently, we query the database once per geographic point. For GBFS, many geographic points are "clustered". This is primarily true in the case of vehicle positions as they tend to be clustered across regions in the same city. In many cities, the scooters/bikes/etc are only allowed to be parked in certain areas, which increases the points per cluster. This is empirical information.
Tasks:
Alternatives you've considered
No response
Additional context
No response