Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Druid based Datasets/Reports (created via HE/APIs)

  2. Custom datasets created as data products and configured manually

    1. Ex: VDN reports, WFS, Collection Summary dataset

  3. On-Demand Datasets

Expand
titleExpand for more details
  1. Sunbird Obsrv’s Data Service allows creation of reusable custom datasets and an ability to submit requests for generation of such reports. The datasets that are currently configured are course progress exhausts, the user information exhausts and the assessment response exhaust reports. These reports are are run on preset frequency or on-demand basis.

  2. Sunbird Obsrv’s Report Service allows creation of datasets that can be published as reports and charts that can be viewed from Sunbird Portal’s Admin Dashboard web UI. These reports are generated based on the frequency configured while publishing the report.

  3. Other custom data files such as Consent files and master data files (geo data, for example).

Image Modified

Dataset download considerations:

...

  • visibility

    • type - varchar(10)

    • enum - [public, private, protected]

    • Details - Link

  • accessPath

    • type - jsonb

    • Details - Link

  • visibilityFlags

    • type- jsonb

    • Description - Whether to show/hide the report on specific pages.

Current API Structure

...

titleGET- /report/get/:reportId

This API is associated with viewing and reading out the specific report on the Sunbird Platform. It returns only the metadata information for the report.

Response

...

languagejson

...

Access Control Spec

  • Controls who can access a report based on certain rules.

  • This can be achieved using two attributes visibility and accessPath.

Visibility

It can be defined both at the report level or it's children (i.e table, chart, map etc ) within a report.

Visibility

Access

public (default)

Accessible by all users. Anyone can discover and consume these Reports.

protected

Accessible only to a limited set of users based on a criteria defined by the access path attribute.

Default can be user with REPORT_VIEWER role belonging to the same channel or tenant.

private

Similar to “protected” - accessible only the creator of the report.

AccessPath

This attribute is applicable for Reports with “protected” or “private” visibility only. This attribute can be used to restrict the access based on or more of the following criteria: organisation, role, group, user id, and location.

AccessPath interface is as follows :-
**Note - All keys are optional. Also very fine grained accessPath may not be required in this case. Replicating the actual schema defined for ActionSets as is and to be re-used for datasets as well.

Code Block
languagejson
interface IAccessPath {
  organisation: Array<string> | string;
  role: Array<string> | string;
  channel: Array<string> | string;
  group: Array<string> | string;
  userType: Array<string> | string;
  framework: Array<string> | string;
  isSuperAdmin: Array<string> | string;
  board: Array<string> | string;
  userId: Array<string> | string;
  userLocation: {
    state: Array<string> | string;
    district: Array<string> | string;
    block: Array<string> | string;
  };
  ...anyOtherAttribute: any
}

...

Current API Structure

Expand
titleGET- /report/get/:reportId

This API is associated with viewing and reading out the specific report on the Sunbird Platform. It returns only the metadata information for the report.

Response

Code Block
languagejson
{
  "id": "string",
        "type"ver": "string",
  "params": {
    "reportaccessurlresmsgid": "string",

       "createdonmsgid": "string",
    "status": "success",
    "updatedonerr": "string",
    "errmsg": "string"
  },
  "createdbyresponseCode": "stringOK",
  "result": {
    "reportconfigreports": [
  {    {
        "idreportid": "string",
          "labeltitle": "string",

         "tabledescription": ["string",
        "authorizedroles": [
          "string"
  {      ],
        "namestatus": "string",
  
           "valuesExprtype": "string",
    
         "columnsExprreportaccessurl": "string",
        "createdon": "string",
    "config": {}   "updatedon": "string",
        }
"createdby": "string",
         ],"reportconfig": {
          "titleid": "string",
          "chartslabel": ["string",
          "table": [
{            {
  "colors": [                 {
   "name": "string",
              "borderColorvaluesExpr": "string",
  
               "backgroundColorcolumnsExpr": "string",
              "config": {}
    }        }
      ],    ],
          "optionstitle": {"string",
          "charts": [
    "title": {       {
           "text":   "stringcolors",: [
                 "display": true,{
                   "fontSizeborderColor": 16"string",
                },    "backgroundColor": "string"
            "legend": {      }
            "display": false ],
               },"options": {
                "scalestitle": {
                  "xAxestext": ["string",
                  "display": true,
{                  "fontSize": 16
   "scaleLabel": {                         "display": true,
     },
                  "labelStringlegend": "string"{
                      }
  "display": false
                 },
                  ],"scales": {
                  "yAxesxAxes": [
                    {
                      "scaleLabel": {
                        "display": true,
                        "labelString": "string"
                      }
                    }
                  ],
                  },
"yAxes": [
               "tooltips": {    {
              "mode": "string",            "scaleLabel": {
      "intersect": false,                   "bodySpacingdisplay": 5true,
                  "titleSpacing": 5     "labelString": "string"
          },            }
    "responsive": true               },
               "datasets": [  ]
              {  },
                "labeltooltips": "string",{
                  "dataExprmode": "string"
,
               }   "intersect": false,
          ],          "bodySpacing": 5,
    "chartType": "string",               "labelsExprtitleSpacing": 5
"string",               "dataSource": { },
                "idsresponsive": [ true
              },
              "parameterizedPathdatasets": [
                {
 ],                 "commonDimensionlabel": "string",
              }    "dataExpr": "string"
       }         }
 ],           "dataSource": [ ],
           {
              "idchartType": "parameterizedPathstring",
              "pathlabelsExpr": "/reports/$state/abc.json"string",
            },  "dataSource": {
         {       "ids": [
    "id": "nonParameterizedPath",             "path": "/reports/tn/abc.json"
parameterizedPath"
           }     ],
     ],           "descriptioncommonDimension": "string",
          "downloadUrl": "string"   }
     },       }
 "slug": "string",        ],
"reportgenerateddate": "string",         "reportdurationdataSource": [
    {        {
  "enddate": "string",           "startdateid": "stringparameterizedPath"
,
       },         "tagspath": ["/reports/$state/abc.json"
          "string"  },
      ],      {
  "updatefrequency": "string",         "parametersid": "nonParameterizedPath",
[            "stringpath": "/reports/tn/abc.json"
       ],     }
   "report_type": "string"      ],
}     ],     "countdescription": "string",
 1   } }

Datasource Schema

Code Block
languagejson
interface
 
IDatasource
 
{
   
id
"downloadUrl": "string"
     
path:
  
string }

id: Job id for the dataset

path: Endpoint for downloading the dataset file(s) - the path can be both parameterized and non parameterized . Portal backend populates the parameters using logged in user context details and downloads the respective file.

Proposed Solution

API to get materialized data Files

There is a need to create API in report service that will provide access to the meta data as well as the report data files that are used to generate the reports in the 'Admin dashboards' page on the Sunbird portal with certain access controls.

Proposed API Structure to get the metadata + datasets.

METHOD - GET

URL: /report/datasets/get/:reportId?from=<>&to=<>&since=<>

Expand
titleAPI to get materialized data from the dataset
Proposed response structure - to get meta + datasets.
Success Scenario - Status Code 200
Code Block
languagejson
{
    "id": "api.report.read",
    "ver": "string",
    "ts": "timestamp",
    "params": {
      "resmsgid": "string",
      "msgid": "string",
      "status": "success",
      "err },
        "slug": "string",
        "reportgenerateddate": "string",
        "reportduration": {
          "enddate": "string",
          "errmsgstartdate": "string"
        },
        "responseCodetags": "OK", [
          "result": {string"
        ],
    "metadata": {... similar to above API}"updatefrequency": "string",
        "datasetsparameters": [
          "string"
 {        ],
        "datasetreport_idtype": "dataset_id_1string"
      }
     ],
    "isParameterizedcount": true,1
  }
}

Datasource Schema

Code Block
languagejson
interface IDatasource {
  id: string
  path: 
"parameters": ["$state"], "data": { "rj": { "signedUrl": "url" }, "tn": { "signedUrl": "url" },
string
}

id: Job id for the dataset

path: Endpoint for downloading the dataset file(s) - the path can be both parameterized and non parameterized . Portal backend populates the parameters using logged in user context details and downloads the respective file.

...

Proposed Solution

API to get materialized data Files

There is a need to create API in report service that will provide access to the meta data as well as the report data files that are used to generate the reports in the 'Admin dashboards' page on the Sunbird portal with certain access controls.

Proposed API Structure to get the metadata + datasets.

METHOD - GET

URL: /report/datasets/get/:reportId?from=<>&to=<>&since=<>

Expand
titleAPI to get materialized data from the dataset

Proposed response structure - to get meta + datasets.

Success Scenario - Status Code 200

Code Block
languagejson
{
    "id": "api.report.read",
    "ver": "string",
    "ts": "timestamp",
    "params": {
       "...otherParametersresmsgid": {"string",
      "msgid": "string",
        "status": "success",
       "signedUrlerr": "urlstring",
      "errmsg": "string"
    },
    "responseCode": "OK",
   } "result": {
        "metadata": {... similar to above  API},
            },"datasets": [
            {
                "dataset_id": "dataset_id_21"
                "isParameterized": falsetrue,
                "parameters": null["$state"],
                "data": {
                    "defaultrj": {
                        "signedUrl": "url"
                    },
                    "tn": {
                        "signedUrl": "url"
       }             },
        ]     }
}

Explanation -

  • If the report dataset file path is parameterized then

    • isParameterized - true

    • parameters - parameter attribute

    • data object will contain all resolved parameter values along with the signed url to download the file

  • Else

    • data object will have default key with the signed url to download the file.

Error Response
Unauthorized Access - Status Code 401
Code Block
languagejson
{       "id": "api..report.read",otherParameters": {
                        "versignedUrl": "v1",
 url"
                    }
  "ts": "timestamp",     "params": {       }
 "resmsgid": null,         "msgid": "string", },
         "err": "UNAUTHORIZED_USER",  {
      "status": "UNAUTHORIZED_USER",         "errmsgdataset_id": "You are not authorized.""dataset_id_2"
           },     "responseCodeisParameterized": "UNAUTHORIZED"false,
     "result": {}
}
Internal Server Error - Status Code - 500
Code Block
languagejson
{          "idparameters": "api.report.read",null,
        "ver": "v1",   "ts": "timestamp",   "paramsdata": {
           "resmsgid": null,         "msgiddefault": "string",{
     "err": "string",     "status": "SERVER_ERROR",     "errmsg": "string"   },   "responseCodesignedUrl": "SERVER_ERRORurl",
  "result": {} }
Invalid Report Id - Status Code 404
Code Block
languagejson
{   "id": "api.report.read",   "ver": "1.0.0",   "params": {     "resmsgid": "string",}
     "msgid": null,     "status": "failed",    }
"err": null,     "errmsg": "no report found"   },
       "responseCode": "string", ]
  "result": {}
}

Access Control Spec

  • Controls who can access a report based on certain rules.

  • This can be achieved using two attributes visibility and accessPath.

Visibility

It can be defined both at the report level or it's children (i.e table, chart, map etc ) within a report.

...

Visibility

...

Access

...

public (default)

...

Accessible by all users. Anyone can discover and consume these Reports.

...

protected

...

Accessible only to a limited set of users based on a criteria defined by the access path attribute.

Default can be user with REPORT_VIEWER role belonging to the same channel or tenant.

...

private

...

Similar to “protected” - accessible only the creator of the report.

AccessPath

...

Code Block
languagejson
interface IAccessPath {
  organisation: Array<string> | string;
  role: Array<string> | string;
  channel: Array<string> | string;
  group: Array<string> | string;
  userType: Array<string> | string;
  framework: Array<string> | string;
  isSuperAdmin: Array<string> | string;
  board: Array<string> | string;
  userId: Array<string> | string;
  userLocation: {
    state: Array<string> | string;
    district: Array<string> | string;
    block: Array<string> | string;
  };
  ...anyOtherAttribute: any
}

...

 }
}

Explanation -

  • If the report dataset file path is parameterized then

    • isParameterized - true

    • parameters - parameter attribute

    • data object will contain all resolved parameter values along with the signed url to download the file

  • Else

    • data object will have default key with the signed url to download the file.


Error Response

Unauthorized Access - Status Code 401

Code Block
languagejson
{
    "id": "api.report.read",
    "ver": "v1",
    "ts": "timestamp",
    "params": {
        "resmsgid": null,
        "msgid": "string",
        "err": "UNAUTHORIZED_USER",
        "status": "UNAUTHORIZED_USER",
        "errmsg": "You are not authorized."
    },
    "responseCode": "UNAUTHORIZED",
    "result": {}
}


Internal Server Error - Status Code - 500

Code Block
languagejson
{
  "id": "api.report.read",
  "ver": "v1",
  "ts": "timestamp",
  "params": {
    "resmsgid": null,
    "msgid": "string",
    "err": "string",
    "status": "SERVER_ERROR",
    "errmsg": "string"
  },
  "responseCode": "SERVER_ERROR",
  "result": {}
}


Invalid Report Id - Status Code 404

Code Block
languagejson
{
  "id": "api.report.read",
  "ver": "1.0.0",
  "params": {
    "resmsgid": "string",
    "msgid": null,
    "status": "failed",
    "err": null,
    "errmsg": "no report found"
  },
  "responseCode": "string",
  "result": {}
}

...

Search Report API

This API is associated with Searching Reports on the Sunbird Platform.

...