Skip to content

Instantly share code, notes, and snippets.

@ceeK
Last active August 29, 2015 14:19
Show Gist options
  • Save ceeK/918414dd24bc1769331c to your computer and use it in GitHub Desktop.
Save ceeK/918414dd24bc1769331c to your computer and use it in GitHub Desktop.

OrganisationVenue response

The current implementation has us requesting OrganisationVenue's based on the events they run on a day-to-day basis. This means on a Monday, only OrganisationVenue's that have events running that day should be shown.

A typical request is only for one single day, as each day is loaded independently. Parameters:

  • lat
  • lon
  • radius
  • start_time
  • end_time
  • activity_type

An expected response would be along the lines of:

[
 { "organisation" : {...},
   "venue" : {...},
   "event_min_price : ...,
   "event_count" : ...
  },
  { "organisation" : {...},
   "venue" : {...},
   "event_min_price : ...,
   "event_count" : ...
  },
]

Each of these OrganisationVenue's should only be relevant for the date and activity_type supplied.

On my end, given that I no longer have access to the Event's, I would attach a dictionary onto the OrganisationVenue linking activity_types to the day they run. I can obtain this information from the request I make. Moreover, I would need to link event countandevent_min_price` to specific dates too.

Therefore, when loading from cache, I can safely query the dictionary for the activity_type and see what if any of the dates match the current query. If they do, I can show that organisation venue.

@nickcharlton
Copy link

Okay. I'll need to give this a bunch of thought as it's going to either break the current implementation or need more.

Filtering across so much (and then returning just the orgs/venues isn't so easy given where the data is.

E.g.: acitivity_type is in events, so we'd need to go through OrganisationEvents to filter by that.

Can you think of something which avoids doing that?

@ceeK
Copy link
Author

ceeK commented Apr 14, 2015

For that part I was thinking of tagging OrganisationVenues with the types of activity they do so this can be easily retrieved.

This may have some side effects though but it may be worth it for the speed.

Maybe it'd be worthwhile to add the activity_type -> date dictionary on your end within the background job? Then the actual request just needs to query a pre-computed dictionary on the OrganisationVenue.

@nickcharlton
Copy link

Tagging could work, but it might be a bit messy. I'll see what I can pull off with what I've got.

We're certainly hitting the point where using a standalone search tool would help us massively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment