schollz / find

High-precision indoor positioning framework for most wifi-enabled devices.
https://www.internalpositioning.com/
GNU Affero General Public License v3.0
5.04k stars 369 forks source link

[Enhancement] REST API to get all configured locations? #147

Open kiwiandroiddev opened 7 years ago

kiwiandroiddev commented 7 years ago

Hi,

I wondered if there could be a new API for retrieving the list of all configured locations for a group on a server?

Something like GET /locations?group=my_group that returns:

{
   "message":"Correctly found locations.",
   "success":true,
   "locations":["bed bath", "bedroom", "car", "dining"]
}

It seems that this data can be obtained by appropriating the existing /location call for some known user, but not without getting a lot of extra irrelevant data too (signal strengths) which isn't ideal for mobile clients.

schollz commented 7 years ago

Your right, I avoided this since I figured folks would do as you suggest. I can certainly add, it's easy. Ill put it up later this week!

TilBlechschmidt commented 7 years ago

It would also be great if the location array could contain some metadata like the amount of stored fingerprints for each location.

schollz commented 7 years ago

@TheMegaTB @kiwiandroiddev

I've added it now, see if this will work for you: https://www.internalpositioning.com/api/#get-locations

It's live now, but I can still make modifications.

TilBlechschmidt commented 7 years ago

Just out of curiosity, how is the accuracy calculated? (I want to display some kind of progress bar for learning and am searching for the best way to do it)

TilBlechschmidt commented 7 years ago

@schollz thanks for the quick implementation of that feature! One more thing that prevents it from being used though is the missing Cross-Origin resource sharing header. Please have a look at #148 for the details.

schollz commented 7 years ago

@TheMegaTB The accuracy is calculated for the Naive Bayes implementation - it uses cross validation against a sequestered test set against the set used for learning. Its useful for figuring out which places aren't learned well.

TilBlechschmidt commented 7 years ago

It should be noted that newly learned locations are not returned by /locations right after learning and instead it requires a call to the /calculate endpoint for the location to show up.

schollz commented 7 years ago

Thanks, I updated the docs with that note