android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Support location search

Open epicadk opened this issue 3 years ago • 5 comments

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

epicadk avatar May 16 '21 05:05 epicadk

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 avatar May 19 '21 04:05 epicadk

@epicadk , have you been able to move ahead with this?

Tarun-Bhardwaj avatar May 26 '21 10:05 Tarun-Bhardwaj

@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

epicadk avatar May 26 '21 11:05 epicadk

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.

epicadk avatar May 26 '21 19:05 epicadk

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

rkodev avatar Jul 08 '21 07:07 rkodev