FlowKit icon indicating copy to clipboard operation
FlowKit copied to clipboard

Add visited on most days query

Open greenape opened this issue 4 years ago • 6 comments

Another type of reference location which localises subscribers to the location they visited on most days from a span of days, and breaks ties according to the number of events they had at each location.

greenape avatar Aug 24 '21 15:08 greenape

Just confirming here: we can't have subscriber-level queries so this query is not supposed to take a subscriber ID as an input and spit out the location they visited on most days. Instead it would calculate the location visited on most days for all subscribers, map it back to the aggregation unit and give an aggregate of how many subscribers visited each aggregation unit the most. Right?

flowstef avatar Oct 19 '21 10:10 flowstef

We can have subscriber-level queries in flowmachine, but don't want to directly expose them through the API. So e.g. an API user wouldn't be able to get the result of a VisitedOnMostDays query, but could get the result of a SpatialAggregate query that has a VisitedOnMostDays sub-query.

jc-harrison avatar Oct 19 '21 10:10 jc-harrison

Thanks for clarifying. If that's the case here I need to look at other examples of subqueries that aren't exposed but used in aggregates.

flowstef avatar Oct 19 '21 15:10 flowstef

For the exposing-through-API side of things, see e.g. ReferenceLocationSchema, which defines the allowed reference location types (currently daily location, modal location, most frequent location) as parameters for queries such as SpatialAggregate. Query schemas that are not included in FlowmachineQuerySchema will not be directly exposed as top-level queries through the API.

jc-harrison avatar Oct 19 '21 16:10 jc-harrison

Right I think I've got something but still struggling with the test dataset and hardcoded values in unit tests. If somebody had time to review it with me at some point that'd be fab!

flowstef avatar Oct 25 '21 15:10 flowstef

Reopening this because #4463 doesn't include a flowclient function.

greenape avatar Nov 02 '21 16:11 greenape