rscloud icon indicating copy to clipboard operation
rscloud copied to clipboard

Additional filters for 'space_member_usage'.

Open kputschko opened this issue 3 years ago • 6 comments

In the help page for the space_member_usage function, I see there is a filters argument that makes use of both groupby and from. I'm wondering if there are any more parameters that could be passed into this filter argument?

kputschko avatar Oct 25 '21 21:10 kputschko

In addition, are there any additional ways to specify the from argument? The help page shows from = "90d", but I'm curious how to further specify a date range of interest.

These work: space_member_usage(space, filters = list(groupby = "user_id", from = "30d")) space_member_usage(space, filters = list(groupby = "user_id", from = "123456789")) (I assume it's milliseconds from 1970-01-01)

But these don't work: space_member_usage(space, filters = list(groupby = "user_id", from = "2021-10-20")) space_member_usage(space, filters = list(groupby = "user_id", from = "1y")) space_member_usage(space, filters = list(groupby = "user_id", from = "1m")) space_member_usage(space, filters = list(groupby = "user_id", from = "1 week"))

And this is the error that is returned:

Error: Request to endpoint `spaces/***/usage` failed with
  Status: 400
  Response: Invalid argument from: is not an ISO datetime type or is not a unix epoch timestamp or is not an ISO date or is not a valid relative date

kputschko avatar Oct 25 '21 21:10 kputschko

I'm running into another issues as of today. This code ran successfully last week.

space_member_usage(space, filters = list(groupby = "user_id", from = "90d"))

But now it is returning this error:

Error: Problem with `mutate()` column `last_activity`.
i `last_activity = as.POSIXct(.data$last_activity/1000, origin = "1970-01-01")`.
x Column `last_activity` not found in `.data`

Interestingly, I can use from = 30, but not from = 35.

# Success
space_member_usage(space, filters = list(groupby = "user_id", from = "30d"))

# Failure
space_member_usage(space, filters = list(groupby = "user_id", from = "35d"))

kputschko avatar Dec 20 '21 14:12 kputschko

@kputschko There was an update in the last week in the API to limit last_activity to 30 days. I'm working on updating the function to reflect this change so the function works for any time period but reports last_activity only up to 30 days and for time periods longer than that it doesn't report it.

mine-cetinkaya-rundel avatar Dec 20 '21 17:12 mine-cetinkaya-rundel

Thanks for the response. To clarify, going forward it will only be possible to look back at time frames within the last 30 days?

kputschko avatar Dec 20 '21 20:12 kputschko

Yes, for the last_active field it will only be possible to look back within the last 30 days. For other fields there won't be such time limit.

mine-cetinkaya-rundel avatar Dec 20 '21 20:12 mine-cetinkaya-rundel

@kputschko The broken space_member_usage() call for longer time periods should now be fixed with #50. Leaving the issue open to remind of the original request re: better documentation of possible filters.

mine-cetinkaya-rundel avatar Dec 31 '21 02:12 mine-cetinkaya-rundel