wheresrhys / keen-query

Terse, cypher-esque querying for keen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"per user" queries

adgad opened this issue · comments

A frequent query we run for our dashboards is to get things as a % of users, to balance out the fact that we have different numbers of users each day, or slight differences between number of users on control/variant.

e.g.

  • CTR - % of users clicking on something
  • Clicks per user (as opposed to total clicks)

this is now addressed by kq '@ratio(cta->count()!/cta->count(user.uuid))->interval(d)'

... if I understand correctly that is

$ node ./bin/keen-query.js '@ratio(cta->count()!/cta->count(user.uuid))->interval(d)'
@ratio(cta->count()!/cta->count(user.uuid))->interval(d)->print(ascii)
cta->count()->interval(d)->print(json,ISO)
this_14_days
cta->count(user.uuid)->interval(d)->print(json,ISO)
this_14_days
..................
 .---------------------------------.
|   cta->count(): this_14_days    |
|---------------------------------|
| timeframe  |       values       |
|------------|--------------------|
| 2015-12-25 | 5.0420188360299445 |
| 2015-12-26 |   5.04783914952623 |
| 2015-12-27 |  5.955564532417694 |
| 2015-12-28 |  6.050989166274141 |
| 2015-12-29 |  6.139826327215315 |
| 2015-12-30 |  5.905625606207566 |
| 2015-12-31 | 5.4853772425657406 |
| 2016-01-01 |  5.893449937533465 |
| 2016-01-02 |  5.966434988981184 |
| 2016-01-03 |  5.682004555808656 |
| 2016-01-04 |  6.554981277358789 |
| 2016-01-05 | 6.1811015176704025 |
| 2016-01-06 |  6.149214377959535 |
| 2016-01-07 | 5.7853478586662055 |
'---------------------------------'

or maybe '@reduce(cta->count()->interval(d)->group(user.uuid),median)', though I may need to define '@rowReduce(cta->count()->interval(d)->group(user.uuid),median)' to get median per day rather than median per user

Needs @filter(q, >12)

... although there are so many uuids that keen can't handle queries grouped by user.uuid in general. Probably better to redshift this sort of thing

Yup good point, the dashboards we have at the moment for them tend to be
very slow.

On 8 January 2016 at 11:45, Rhys Evans notifications@github.com wrote:

... although there are so many uuids that keen can't handle queries
grouped by user.uuid in general. Probably better to redshift this sort of
thing


Reply to this email directly or view it on GitHub
#7 (comment)
.


This email was sent by a company owned by Financial Times Group Limited
("FT Group http://aboutus.ft.com/corporate-information/#axzz3rajCSIAt"),
registered office at Number One Southwark Bridge, London SE1 9HL.
Registered in England and Wales with company number 879531. This e-mail may
contain confidential information. If you are not the intended recipient,
please notify the sender immediately, delete all copies and do not
distribute it further. It could also contain personal views which are not
necessarily those of the FT Group. We may monitor outgoing or
incoming emails as permitted by law.

Maybe the spreadsheet aliases should be able to refer to redshift queries
as well as keen?

On 8 January 2016 at 11:48, Arjun Gadhia arjun.gadhia@ft.com wrote:

Yup good point, the dashboards we have at the moment for them tend to be
very slow.

On 8 January 2016 at 11:45, Rhys Evans notifications@github.com wrote:

... although there are so many uuids that keen can't handle queries
grouped by user.uuid in general. Probably better to redshift this sort of
thing


Reply to this email directly or view it on GitHub
#7 (comment)
.


This email was sent by a company owned by Financial Times Group Limited
("FT Group http://aboutus.ft.com/corporate-information/#axzz3rajCSIAt"),
registered office at Number One Southwark Bridge, London SE1 9HL.
Registered in England and Wales with company number 879531. This e-mail may
contain confidential information. If you are not the intended recipient,
please notify the sender immediately, delete all copies and do not
distribute it further. It could also contain personal views which are not
necessarily those of the FT Group. We may monitor outgoing or
incoming emails as permitted by law.

Excellent idea!