Commit 87de0f2
authored
feat(dashboards): integrate snowflake analytics for board member metrics (#140)
* feat(dashboards): integrate snowflake analytics for board member metrics
- Add 5 new API endpoints for organization-level analytics data
- Integrate real Snowflake data into organization involvement metrics
- Refactor board member dashboard to use reactive form pattern
- Add support for projects participating, total commits, certified employees,
board meeting attendance, and event sponsorships metrics
- Update organization involvement component to display live analytics data
- Add multi-currency formatting for event sponsorships
- Create TypeScript interfaces in shared package for type safety
LFXV2-701
Signed-off-by: Asitha de Silva <asithade@gmail.com>
* refactor(dashboards): extract defaults and fix currency crash
- Extract hardcoded accountId, projectId, and segmentId to shared constants
- Create ANALYTICS_DEFAULTS constant in shared package for temporary values
- Replace 16 inline hardcoded values in analytics controller with constants
- Fix InvalidPipeArgument crash when Snowflake returns null/empty currency codes
- Add filtering in transformEventSponsorship to handle imperfect data gracefully
- Dashboard now resilient to legacy/draft sponsorship records with missing currency
LFXV2-701
Signed-off-by: Asitha de Silva <asithade@gmail.com>
* refactor(analytics): extract service layer from controller
Refactored analytics.controller.ts to follow the established Controller → Service → Data Source pattern used by other controllers in the codebase.
Changes:
- Moved 4 user analytics methods to UserService (active weeks streak, pull requests, code commits, projects)
- Moved 10 organization analytics methods to OrganizationService (maintainers, membership tier, contributors, events, technical committee, certifications, board meetings, sponsorships)
- Removed inline SQL queries and business logic from analytics.controller.ts
- Controller now only handles HTTP concerns (validation, logging, response)
- Reduced controller complexity from 930 lines to ~400 lines
- Removed all unused interface imports from controller
LFXV2-701
Generated with [Claude Code](https://claude.com/claude-code)
Signed-off-by: Asitha de Silva <asithade@gmail.com>
* refactor(analytics): consolidate endpoints and remove unused code
Consolidate 15 individual analytics endpoints into 4 optimized endpoints:
- getOrganizationContributionsOverview (maintainers + contributors + technical committee)
- getOrganizationSegmentOverview (projects participating + total commits)
- getBoardMemberDashboard (membership tier + certified employees + board attendance)
- getOrganizationEventsOverview (event attendance + event sponsorships)
Backend changes:
- Inline getEventAttendance and getEventSponsorships into getEventsOverview
- Remove 10 legacy endpoint handlers from analytics controller
- Rename private service methods for consistency (remove "Consolidated" suffix)
- Clean up JSDoc comments and simplify method documentation
Frontend changes:
- Remove 10 unused HTTP methods from analytics service
- Update organization-involvement component to use consolidated endpoints
Shared package changes:
- Remove 21 unused interfaces from analytics-data.interface.ts (~450 lines)
- Clean up legacy interfaces no longer used after consolidation
This refactor reduces codebase by ~602 lines while improving API efficiency
through consolidated database queries and parallel execution patterns.
Generated with [Claude Code](https://claude.ai/code)
Refs: LFXV2-701
Signed-off-by: Asitha de Silva <asithade@gmail.com>
* refactor(dashboards): fix partial data 404s and remove annual fee
LFXV2-701
- Refactor SQL queries to use CTE base with LEFT JOINs instead of anchoring on specific tables
- This fixes 404 errors when organizations have partial data (e.g., contributors but no maintainers)
- Remove MEMBERSHIP_PRICE/annual fee field from backend, shared interfaces, and frontend
- Update membership tier card layout to show three clear rows: Tier, Member Since, and Renewal Date
Signed-off-by: Asitha de Silva <asithade@gmail.com>
---------
Signed-off-by: Asitha de Silva <asithade@gmail.com>1 parent 41a38b5 commit 87de0f2
16 files changed
Lines changed: 1173 additions & 812 deletions
File tree
- apps/lfx-one/src
- app
- modules/dashboards
- board-member
- components/organization-involvement
- server
- controllers
- routes
- services
- utils
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
Lines changed: 14 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
28 | 30 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
49 | 46 | | |
50 | 47 | | |
51 | | - | |
52 | | - | |
| 48 | + | |
| 49 | + | |
53 | 50 | | |
54 | 51 | | |
55 | | - | |
| 52 | + | |
56 | 53 | | |
57 | 54 | | |
58 | 55 | | |
| |||
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
90 | | - | |
| 87 | + | |
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
| |||
0 commit comments