Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Overview

This document details the design options for introducing scores as part of group aggregate API and reports.

Design

Currently, only trackable collections and their progress are stored in user_activity_agg table.
Below is the flow used to show scores in group aggregates.

AssessmentAggregator job changes:

Create a new process function to compute the best attempted score and store it in user_activity_agg table in below format.

activity_type

activity_id

user_id

context_id

agg

agg_last_updated

Assessment

do_123(assessmentId)

user_123

cb:batch_123

{'score': <best attempted score>}

{'score': ‘timestamp’}

Group Aggregate API changes:

Create a new v2 endpoint and accept list of activityIds in the input and response is based on the activityId.
Each activity data for a group is cached with key groupId:activityId:activityType:activity-agg and TTL of 1hr.

Request:

POST: /v2/group/activity/agg

{
  "request": {
    "groupId": "groupId",
    "activityId": ["assessmentId_1","assessmentId_2"],
    "activityType": "Assessment"
  }
}

Response:

{
  "id": "api.group.activity.agg",
  "ver": "v2",
  "ts": "2021-04-07 05:53:32:742+0000",
  "params": {
    "resmsgid": null,
    "msgid": "62ae69c9-edf7-4486-bbfc-c84454add954",
    "err": null,
    "status": "success",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "activities": [
      {
        "activity": {
          "id": "assessmentId_1",
          "type": "Assessment",
          "agg": [
            {
              "metric": "score",
              "lastUpdatedOn": 1596647700613,
              "value": 1
            }
          ]
        },
        "groupId": "b0c4a645-807e-41c7-972e-5c48c5b5e5e7",
        "members": [
          {
            "agg": [
              {
                "metric": "score",
                "value": 20,
                "lastUpdatedOn": 1596647700613
              }
            ],
            "name": "Creation",
            "role": "admin",
            "status": "active",
            "createdBy": "874ed8a5-782e-4f6c-8f36-e0288455901e",
            "userId": "874ed8a5-782e-4f6c-8f36-e0288455901e"
          }
        ]
      },
      {
        "activity": {
          "id": "assessmentId_2",
          "type": "Assessment",
          "agg": [
            {
              "metric": "score",
              "lastUpdatedOn": 1596647700613,
              "value": 1
            }
          ]
        },
        "groupId": "b0c4a645-807e-41c7-972e-5c48c5b5e5e7",
        "members": [
          {
            "agg": [
              {
                "metric": "score",
                "value": 30,
                "lastUpdatedOn": 1596647700613
              }
            ],
            "name": "Creation",
            "role": "admin",
            "status": "active",
            "createdBy": "874ed8a5-782e-4f6c-8f36-e0288455901e",
            "userId": "874ed8a5-782e-4f6c-8f36-e0288455901e"
          }
        ]
      }
    ]
  }
}
  • No labels