android-fhir
android-fhir copied to clipboard
Support location search
Is your feature request related to a problem? Please describe.
Currently we do not support search for locations
Describe the solution you'd like
Support search for location
Additional context
https://www.hl7.org/fhir/search.html#special
Would you like to work on the issue?
yes
An update here. I'm still trying to work out the math. There are a few methods to find the distance between two points on the earth however I am not sure how we can use indexes with them. All the methods I've come across would require a Full table scan.
@epicadk , have you been able to move ahead with this?
@epicadk , have you been able to move ahead with this?
Not really, I still can't figure out a way that provides high accuracy and would make use of the index. I will open a pr today with what I've tried so far
I tried adding the tests and realized what I'd done wasn't correct. I'll still try working on this but unassigning myself so that if someone has a better idea they can send a pr.
For this issue, I have come across this algorithm, a bounded search that will help in looking up the locations via an index in the database.
This is a combination of calculating boundaries and using the database to filter the results within the bounds. Implementing the search on co-ordinates using an R-Tree index is the most efficient implementation on spatial indexes, SQLITE looks to be supporting the R-Tree index