Skip to content
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/backend/deep user based analytics #355

Merged
merged 30 commits into from
Sep 9, 2024

Conversation

waveyboym
Copy link
Member

@waveyboym waveyboym commented Sep 9, 2024

Description

This pr is a revamp and refactor is analytics based operations. We go from processing and crunching the data on the backend to doing the operations on the database, thereby hopefully introducing major performance improvements for big data computation. We use mongo db's aggregation functions for these operations.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests and coverage for all analytics
  • Unit test database functions which aggregate

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

… improved performance

Refactor Attendance struct field names for consistency
Refactor Attendance struct field names for consistency
Refactor ToggleOnsite function to use switch statement for clarity
Preallocate result slices in analytics functions
…alculating average in-office hours by weekday
… TestBusiestHoursByWeekday and update the function call in the test case
@waveyboym waveyboym added type: documentation Improvements or additions to documentation type: feature A new feature type: fix Introduces a fix for a previous issue type: testing This affects one or more tests labels Sep 9, 2024
@waveyboym waveyboym added For: api This is mainly for the api For: backend This is mainly for the backend code priority: medium This does/did not need to be addressed soon but should have plans in place to be addressed status: pending This is awaiting approval effort: 5 This may require/required hours of work For: deployment This will affect our deployed system labels Sep 9, 2024
@waveyboym waveyboym added this to the Week 3 Sprint 4 milestone Sep 9, 2024
@waveyboym waveyboym self-assigned this Sep 9, 2024
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 99.79036% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.01%. Comparing base (48362e4) to head (a9f051b).
Report is 31 commits behind head on develop.

Files with missing lines Patch % Lines
occupi-backend/pkg/database/database.go 93.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #355      +/-   ##
===========================================
+ Coverage    88.53%   94.01%   +5.48%     
===========================================
  Files           53       11      -42     
  Lines         3392     3006     -386     
  Branches        84        0      -84     
===========================================
- Hits          3003     2826     -177     
+ Misses         303      136     -167     
+ Partials        86       44      -42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@waveyboym waveyboym merged commit e7adad4 into develop Sep 9, 2024
8 checks passed
@waveyboym waveyboym deleted the feat/backend/deep-user-based-analytics branch September 9, 2024 09:48
@waveyboym waveyboym linked an issue Sep 15, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: 5 This may require/required hours of work For: api This is mainly for the api For: backend This is mainly for the backend code For: deployment This will affect our deployed system priority: medium This does/did not need to be addressed soon but should have plans in place to be addressed status: pending This is awaiting approval type: documentation Improvements or additions to documentation type: feature A new feature type: fix Introduces a fix for a previous issue type: testing This affects one or more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] Mongo-db operations for analytics group endpoints
1 participant