codeforamerica / fast_pass

Las Vegas Development Opportunity Finder
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

Create a Matching Parcel Endpoint #9

Closed lovehandle closed 10 years ago

lovehandle commented 11 years ago

Create a matching parcel endpoint that returns a JSON array of all parcels within a bounding box and their likelihood to be a positive match for the intended use.

Request:

curl http://localhost:3000/parcels/match?session_id=1&bounding_box=12.74,12.57,13.74,13.75

Response:

[{ "id": 1234, "score": 10.4 }, { "id": 5678, "score": 3.2 } ]

It would probably be good to include some descriptive metadata as to why each parcel has the score it does. Let's push that off until the next milestone, though.

louh commented 11 years ago

I think this endpoint is intended to be retrieved for this page, am I right? http://lv-dof-staging.herokuapp.com/#/section/45

We should know something more about zones on this response, so that the information on the left side could be populated. Is that a secondary endpoint or can this information be passed through this one?

e.g.

[{ "id": 1234, "score": 10.4, "zone": "DCP-0" }, { "id": 5678, "score": 3.2, "zone_id": "C-1" } ]

What is "id" in this case? Parcel #?

lovehandle commented 11 years ago

@louh exactly. Conceptually I think I was splitting the two parcel requests into separate API calls. My hunch is that the actual calculation of the scores is going to be pretty expensive, but I'm honestly not sure what would be most performant.

What do you think about rendering in several steps:

  1. Make an API request for all zones within bounding box.
  2. Display zones within bounding box.
  3. Display loading/thinking symbol.
  4. Make an API request for all parcels that are likely matches.
  5. Display parcels that are likely matches.

Do we even need to display the unlikely parcels? If the click on another spot we could do a single calculation as to the likelihood of it being a match.

louh commented 11 years ago

I think all of this sounds like a good plan. We'll leave unlikely parcels blank on the map, but let the user proceed if they insist on selecting something there.

lovehandle commented 11 years ago

@louh +1 I'll amend the other issue to reference a Zone endpoint.

louh commented 11 years ago

Anthony also turned me on to this one: http://clvplaces.appspot.com/maptools/rest/services/directory/agsquery.htm

Give it a lat/lng (so either through the address geocode, or by clicking a map), and it will find the parcel and return data:

That sounds pretty good, I might try to start populating the application with this, pending server side endpoint! Thoughts, @rclosner ?

louh commented 11 years ago

Also, just wanted to add that Anthony is going to work on getting geometry for us. He's going to try to expose a GeoJSON object through this endpoint too.

lovehandle commented 11 years ago

@louh good find! I think there are something like 200,000 parcels (if I remember correctly). It might take a while to get all of the data out of that, but it may make sense to use it for now. :)

louh commented 11 years ago

The parcel endpoint described on http://clvplaces.appspot.com/maptools/rest/services/directory/agsquery.htm is now working on the front-end.