-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added filtering by date support for persons API #13120
Conversation
I don't think this will close the issue you linked, since that is about exposing this in the UI as well. Feedback on the PR: I think these parameters should be a part of the filter, rather than becoming an extra parameter to I'm guessing you decided to put this here because it won't be used anywhere but for persons filtering? I think it makes sense for this to be in the filter, so in the future someone can also filter insights based on this person property. Also see https://github.com/PostHog/posthog/blob/master/posthog/models/filters/mixins/common.py#L354 for helper function for parsing dates |
Yeah changed to "related"
Here I actually started with the filter using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good, though I do agree with Neil it might make sense to make this a part of filters. I requested @mariusandra's review, as he's working on a new querying API scheme which will include a PersonsNode
, so this seems of interest.
Definitely don't re-use |
Which is perfectly fine, because all insights can filter on persons as well, without calling the Persons endpoint directly. |
Another option might be to fold it under property filters, and special case that everywhere since it's not a regular property, but that's a much bigger chunk of work, although it makes a bit more conceptual sense |
We should fold this under property filters. Here's my main motivation. This is an event that's sent back to us: Currently you can't filter the fields "id", "distinct_id", "timestamp" or "event" in the interface. You can here: but what if you want The solution is to add a new pill to the filter called "event fields", with fields "event name", "timestamp", "distinct id" and perhaps something else. Similar to the "elements" tab we now have. A similar category can be created for person properties, and perhaps recordings. The API does return a few things: |
@mariusandra - I'm worried this could lead to greater confusion... How do I filter differently between If we had a separate tab of "person_fields", what would be there other than Happy to put this in property filters but feels like I might need some guidance of how we want to do that in a manageable way... |
In the hypothetical case, when you have a custom person property I'd put the "person properties" as the first pill in the filters (you usually want a property), and then "person metadata" as the second pill. It'll look good enough. |
I think that makes sense. Implementation wise, this should be a different so we can distinguish these everywhere; and then wherever a property filter is used, it always calls this function: https://github.com/PostHog/posthog/blob/master/posthog/models/property/util.py#L201 , so we'd need to add code here for handling the new The same is true for event metadata, where people want to filter on distinct IDs / created_at / etc. etc. Relevant: #7810 and #8250 (wow, I didn't realise we've had this convo before!) |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
I'm happy to take this over and own it, as it's very much connected to my work this sprint. |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant. |
Problem
Related to #12962
Customer requested the ability to filter persons based on the creation date via the API. We support for our other
primitives so why not here.
Changes
created_at_from
andcreated_at_to
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
Tests