Skip to content

Adithya Enhanced popularity timeline Backend#1885

Merged
one-community merged 7 commits intodevelopmentfrom
adithya_impl_enhanced_role_analytics_backend
Dec 23, 2025
Merged

Adithya Enhanced popularity timeline Backend#1885
one-community merged 7 commits intodevelopmentfrom
adithya_impl_enhanced_role_analytics_backend

Conversation

@adithya-6101
Copy link
Copy Markdown
Contributor

@adithya-6101 adithya-6101 commented Nov 4, 2025

Description

[Backend PR: Follow-Up to PR #1704]

This PR implements the enhanced backend to support complex, role-based visualization on the frontend, specifically addressing the need for connected Hits/Applications pairs and optimized filtering.

The original /popularity endpoint logic has been replaced by the new /popularity-enhanced endpoints designed for flexibility, performance, and multi-role analysis.

Screenshot 2025-11-17 181919

Key Backend Enhancements

  • Role Pairing Data Structure: Introduced the /popularity-enhanced/role-pairs endpoint to return data grouped by Month, with nested Hits/Applications metrics per role.
  • Role-Based Aggregation (/timeline): The main /timeline endpoint is now purely role-focused. It consistently groups and returns all requested data by Role and Month, enabling us to plot multiple distinct timeline lines correctly.
  • "All Roles" Support: The /roles-enhanced endpoint now returns the aggregate summary for "All Roles," ensuring the multi-select filter works across the entire dataset

Related PRS (if any)

This backend PR is a follow-up enhancement to the original Popularity Timeline backend implementation, PR #1704.


Main changes explained

Backend (src/routes/popularityEnhancedRoutes.js):

  • Refactoring: Converted /popularity logic into the new /popularity-enhanced route.
  • New Endpoint: Added GET /popularity-enhanced/role-pairs to provide month-centric, paired data for visualization interactivity.
  • Enhanced Endpoint: Updated GET /popularity-enhanced/timeline to always return role-grouped data with detailed monthly summaries.
  • Role List Endpoint: Updated GET /popularity-enhanced/roles-enhanced to provide comprehensive role summaries, including an "All Roles" object, to populate the multi-select filter.
  • Filtering: Improved date and role filtering to handle comma-separated lists and partial name matches using regex.

How to test

1.  Checkout the current branch (adithya_impl_enhanced_role_analytics_backend).
2.  Run the backend server (npm start).
3.  Use Postman:

  • Test Role Filter Options: GET http://localhost:4500/api/popularity-enhanced/roles-enhanced (Check that the "All Roles" entry is present at the top.)
  • Test Multi-Role Timeline: GET http://localhost:4500/api/popularity-enhanced/timeline?roles=Frontend,Backend (Confirm you receive two separate role objects, each containing its 6 monthly data points.)
  • Test Pairing Structure: GET http://localhost:4500/api/popularity-enhanced/role-pairs?roles=Frontend,Backend (Verify the top-level array is grouped by month, and each month object contains the paired data for the two selected roles, identified by the pairId field.)

Screenshots or videos of changes

Postman Enhanced Roles Postman Specific Roles Postman Role Pairs

@adithya-6101 adithya-6101 added the Do Not Review Do not review or look at code without full context label Nov 4, 2025
@adithya-6101 adithya-6101 removed the Do Not Review Do not review or look at code without full context label Nov 17, 2025
@adithya-6101 adithya-6101 changed the title Enhanced popularity timeline Adithya Enhanced popularity timeline Backend Nov 17, 2025
@sanjeev29
Copy link
Copy Markdown

Tested the related frontend PR - 4416. The PR changes works as expected.

Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aditya,

I have reviewed your PR locally and the backend API responses work as per requirement across all roles.
Screenshot 2025-12-04 at 6 31 00 PM
Screenshot 2025-12-04 at 6 31 16 PM
Screenshot 2025-12-04 at 6 31 31 PM
Screenshot 2025-12-04 at 6 31 57 PM

Copy link
Copy Markdown
Contributor

@bhanuanishakkineni bhanuanishakkineni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Adithya,
I have reviewed and tested both frontend and backend of this PR. Please find the frontend comments at #4416.
I tested the API endpoints using postman.

  1. http://localhost:4500/api/popularity-enhanced/roles-enhanced
    This endpoint returned all roles aggregate and also comprehensive data for each individual role.
PR#1885 testing-1 2. http://localhost:4500/api/popularity-enhanced/timeline?roles= This API endpoint returned monthly data for each role provided as params separated by roles. PR#1885 testing-2 3. http://localhost:4500/api/popularity-enhanced/role-pairs?roles= The endpoint returned monthly data for each role separated by months. I have also tested this endpoint with more than two roles and it worked. PR#1885 testing-3 All the three endpoints worked as expected.

@SwathiAngadi
Copy link
Copy Markdown
Contributor

Hi Adithya,

Reviewed this PR. Everything looks good. Provided detail review in Front end PR.

OneCommunityGlobal/HighestGoodNetworkApp#4416 (comment)

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit cdb37cc into development Dec 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants