-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add feature to filter by date in users analysis table #1010
Conversation
Regarding clearing up the confusion on S3 summary files and our backend methods: S3 currently stores 4 different types of files:
So, I think the somewhat significant downfall is that our only useful day-grouped data is in the Monthly Usage file. Consequently, regardless of our use case, if we want to get user-specific, day-grouped data we must parse through the massive monthly usage files (12 if we want past year). However, it seems we haven't reached too big of a user base, so the fetching of the file from S3 still contributes more to the processing time than the backend parsing (but not by much, both are nontrivial). Definitely something to look into regardless, maybe different formatting of our summary files to have more versatility and efficiency. Specifically, maybe we can look at a |
6271a94
to
0e2f67e
Compare
@benzuzu thanks for the detailed comments. I agree doing |
this.filterToggled = value; | ||
} | ||
|
||
@computed get calculateData(): UserOverviewUsage[] | UsageRecord[] { |
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.
I would rather for you to calculate the data separately and render two tables so the code looks more organized. Attache a key
to differentiate. Any performance concern here?
if (this.timeTypeToggleValue === ToggleValue.RESULTS_BY_MONTH) { | ||
this.props.data.forEach((userOverviewUsage: UserOverviewUsage) => { | ||
for (const curMonth in userOverviewUsage.monthUsage) { | ||
if (Object.prototype.hasOwnProperty.call(userOverviewUsage.monthUsage, curMonth)) { |
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.
I'm confused by the usage of the condition here. Could you elaborate?
Header: usageHeader, | ||
accessor: 'totalUsage', | ||
Cell(props: { original: UserOverviewUsage }) { | ||
return <UsageText usage={props.original.totalUsage ? props.original.totalUsage : 0} />; |
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.
I think as a primitive data type, they all have default values. Why we are checking here?
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.
- The icon under
Details
is not clickable except for userpublic_website@localhost
. But it should be enabled for all. - Can calendar tooltip be closed if use clicks anywhere on the page?
- Could you add a link on the email to user page? It should apply to both Users tab and resource page Example : oncokb.org/admin/usage-analysis/resources/!api!v1!annotate!mutations!byProteinChange
Thanks for the review @zhx828. Regarding the first item, I'm pretty sure this is just because we are using the fake data to run locally. The backend searches the database for userid since we do not store in s3. Should be all good in production. I'll work on the two frontend components you had comments on now. |
d5478e5
to
87f25c7
Compare
Some logic was wrong in the default sorting rules. Also, the day and month usage hashmap does not have userId stored, so this fix adds an optional property that can be used for the info icon link.
Render two table instead of one based on data type (date grouping)
87f25c7
to
dec2980
Compare
@benzuzu for the same user on the same day, why there are two entries? |
@@ -104,7 +104,7 @@ export const SHORTEN_TEXT_FROM_LIST_THRESHOLD = 5; | |||
export const TOKEN_ABOUT_2_EXPIRE_NOTICE_IN_DAYS = 14; | |||
export const USAGE_TOP_USERS_LIMIT = 10000; | |||
export const USAGE_ALL_TIME_KEY = 'All'; | |||
export const USAGE_ALL_TIME_VALUE = 'This year'; | |||
export const USAGE_ALL_TIME_VALUE = 'Past Year'; |
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.
When I see Past Year
, I think about 2023. But the stats is for 2024. Or am I using Past Year
wrong?
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.
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.
@benzuzu oh I see. Last 12 Months
is definitely better.
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.
@zhx828 Should we also change By Year
tab on the top to
All Time (Last 12 Months)
Last 12 Months
All (Last 12 Months)
All Time
or does By Year
make sense? I think one of the first 3 makes more sense
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.
@benzuzu I'm a bit confused. Looking at the stats for the user, it's past 12 month. But for resource, it's from the starting of the year to current?
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.
@zhx828 ah, sorry. I was wrong - it's been a bit since I wrote the logic. Both the user and resource stats are beginning of year to current (not last 12 months). This is because we store the analysis in yearly files, not constantly updating to last 12 months. If I remember correctly, we decided to change backed logic in userOverviewUsageGet
specifically so that we could view specific user usage for the past year (not just year to date). I've changed the tab now below:


I can change the backend logic for resourceUsageGet
as well to add all 12 months, but I'm not sure if it is worth the trouble.
@benzuzu looks good. Let me know once this is ready to be merged. |
We can now select time range in the users tab of the usage analysis page. Most importantly, this allows us to see recent usage, rather than just cumulative.
This was done by fetching dayUsage and monthUsage from the backend. It does take a bit longer, but the difference is not actually too significant. The longest part is actually fetching the files themselves from S3, not parsing through. Some JHipster analysis may be good.
this fixes https://github.com/oncokb/oncokb-pipeline/issues/169
Some other small changes:
Some ideas for future: