instedd / mbuilder

Scalable SMS application builder
http://mbuilder.instedd.org/
6 stars 1 forks source link

Resourcemap Facilities cannot be filtered by Latitude #282

Closed mmuller closed 9 years ago

mmuller commented 9 years ago

Found in version 1.2-pre2

Resmap Version 2.14-pre7

Preconditions: The account 'Foo' has the collection 'Bar' in Resourcemap The Collection 'Bar' contains a Facility 'London' where '51.5072' is the Latitude of the Facility

Steps: Sign into mBuilder with the account 'Foo' Go to create a Message Trigger Fill the field 'When a message like this is received:' with '12.90' as pill and 'name' as text Add the collection 'Bar' from Resourcemap Filter the Collection by Latitude (dragging the pill into the column header) Add a new step 'Send SMS' where the Facility 'Name' is sent (dragging the pill 'Facility Name' into the message box) Send '51.5072 name' using the Sandbox

Obtained: The following error is thrown: 'Error: Missing 'lng' parameter - Check the API documentation: https://github.com/instedd/resourcemap/wiki/REST_API'

Expected: 'London' should be returned

screen shot 2015-03-02 at 4 20 29 pm

screen shot 2015-03-02 at 4 20 16 pm

vtiffenberg commented 9 years ago

This is because of how the resmap API works. Location search can be done in two ways: either pass 4 coordinates to form a rectangle and return sites within that, or pass lat+lng and a radius to define a circle which within to search. At this time, mBuilder isn't supporting either because filters can't be added manually, which means there's no "box" parameter or "radius" parameter. When inserting only the latitude, resmap responds that the lng and radius parameters are missing.

Should we invalidate search by location somehow or add a better failure response for this case or implement a way to make location searches work?

nditada commented 9 years ago

That makes sense, let's close this issue for now. Searching by coordinates is not a use case we have as part of the scope.

bcardiff commented 9 years ago

An alternative would be to add fictitious columns in the resmap tables for the radius. Or at least hardcode same fixed radius (if resmap sort the results by score).

Either way it is an old limitation if the reason is the resmap api.

There is no place in mbuilder to perform some validations of the flow.