Sphurthy - fix: Added analytics features#1917
Conversation
VijayAnirudh
left a comment
There was a problem hiding this comment.
Hello!
- "Get overview: GET /api/analytics/overview with Authorization.
Get student metrics: GET /api/analytics/student/{studentId} with Authorization.
Force refresh: GET /api/analytics/student/{studentId}?force=true with Authorization."
These APIs are working fine!
-
I couldn't understand what it meant to do: "Insert a FormResponse for a test student if needed." That you want me to add a student to metrics via POST? If so, please mention related API endpoint.
-
As per "Check MongoDB for studentMetrics collection and verify metrics are updated," you did not mention how to update metrics. I can't verify the metrics without updating them. Please provide an API endpoint to update metrics.
There was a problem hiding this comment.
Hi Spurthy, I ran the current branch locally.
I can verify the following API response works:
Issues:
-
Could you clarify why the two APIs:
/api/analytics/student/{studentId}and/api/analytics/student/{studentId}?force=trueadd to the student metric collections in MongoDB? Aren’t these GET requests, not POST requests? -
Also I wasn't sure what 5. Insert a FormResponse for a test student if needed, meant. Could you clarify and give the associated api call for that.
…docs Addresses PR review: GET /api/analytics/student/:studentId was growing the studentMetrics collection on each call. Without a unique index the findOneAndUpdate upsert could insert duplicate documents for the same student. A unique index guarantees exactly one metrics doc per student, so repeated GET requests update in place instead of adding rows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tics-integration-backend # Conflicts: # package-lock.json # src/startup/routes.js
|
HemanthNidamanuru
left a comment
There was a problem hiding this comment.
Hi Sphurthy,
I tested the analytics APIs locally.
The following APIs are working fine:
GET /api/analytics/overview
GET /api/analytics/student/{studentId}
GET /api/analytics/student/{studentId}?force=true
I was not clear about the step “Insert a FormResponse for a test student if needed.” If this needs to be done through an API, please provide the related endpoint and sample payload.
Also, for MongoDB verification, please mention how the metrics should be updated and which fields need to be checked in the studentMetrics collection.
|
Thanks for testing @DeepighaJ (and @HemanthNidamanuru / @kzou55 / @VijayAnirudh, same answer for all of you 🙏). Clarifying the two confusing steps:
db.formresponses.insertOne({ To verify: Insert one or more FormResponse docs for test-student-1 (use the same value in {studentId} below). |












Description
Related PRS (if any):
Frontend: OneCommunityGlobal/HighestGoodNetworkApp#4482
Main changes explained:
How to test:
Screenshots or videos of changes: