Business Requirement
Sunbird provides the capability to generate various datasets for reporting purposes. Some of these can be downloaded by users via the UI (the Course progress exhaust, for example), whereas others are used by the Sunbird portal to generate reports and charts, which can then be viewed by users.
There is a requirement for making all such datasets that are generated by SB to be made accessible via APIs. This will permit these datasets to be pulled via APIs, for usage in whatever additional manner they see fit - and enable them to create custom reports/ visualizations of their own.
Currently, following are the list of Datasets supported within SB:
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.
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.Other custom data files such as Consent files and master data files (geo data, for example).
Dataset download considerations:
Sunbird should provide an ability to provision for data security and allow access to datasets based on the nature of the data they contain. Consequently, a dataset that is not considered sensitive may be made available for public access, whereas any sensitive data may require to be protected.
In order to enable different types of access, SB will support configurations that can make the datasets ‘PUBLIC’ or ‘PRIVATE’. The type of access will determine whether a dataset can be accessed publicly using the API without any additional authorization, or whether it needs additional approval from admins for access.
Current Implementation
Currently, Sunbird Obsrv supports Reports Service API to list and access all published reports. However, only metadata of a report is accessible through the Report Service API. The data files and associated data are not currently accessible through the Report Service API.
The Sunbird portal allows access to the configured datasets using the Sunbird portal backend APIs. However, the APIs make use of the authorization through the Sunbird portal’s session logins with the access controls that are controlled by different roles in the Sunbird portal such as REPORT_ADMIN, REPORT_VIEWER and ORG_ADMIN.
Data isolation is supported by performing a slug or org based validation so that the access to a specific tenant’s data is controlled using the user’s login context.
The Sunbird user’s login context is used for parameterized reports where the parameters are injected from the user’s login context. The list of supported parameters are:
$slug
$channel
$state
$board
Below diagram explains the high level working flow on how the reports are rendered on the Portal Admin Dashboard.
Roles which are supported in Admin Dashboard workflow
Report_Admin
Report_viewer
Super_Admin - REPORT_ADMIN
Org_admin
Pages | REPORT_ADMIN <SUPER_ADMIN> | State REPORT_ADMIN | REPORT_VIEWER |
---|---|---|---|
List Page |
|
|
|
Report Detail Page |
|
|
|
Current Report Config
New Column Additions
visibility
type - varchar(10)
enum - [public, private, protected]
Details - Link
accessPath
type - jsonb
Details - Link
showOnDashboard
type- boolean
Description - Whether to show/hide the report on admin dashboard.
Current API Structure
Datasource Schema
interface IDatasource { id: 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 Metadata + 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
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. Default can be users belonging to the same organisation or tenant etc. |
private | Similar to “protected” - accessible only to a limited set of users defined by the “access path” attribute. |
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.
interface IAccessPath { organisation: Array<string> | string; role: Array<string> | string; tenant: 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 }
API to get list of Reports
This API is associated with Searching Reports on the Sunbird Platform.
METHOD - POST
URL - /report/list