Introduction:
This document describes the design approach of using the TPD framework in the portal.
Background:
Jira Issue: https://project-sunbird.atlassian.net/browse/SH-3
...
How custom tenant framework can be used for content/resources created for course.?
Key design problems:
The course-related content/resources should be attached to How to get a tenant specific framework(custom/default) TPD framework?
How to send Textbook/Course specific framework data(specified by the tenanttenant) in the editor config while create/edit of content/resources?
Existing workflow:
When a user tries to create any course from the workspace:
Since, SH-3, we have segregated the create workflow into two parts:
a. Textbook
b. Training.
Now, we need to change this workflow, as we have introduced custom framework for any tenant (as of now, CBSE has its custom framework called ‘cbse-tpd’ ) and we need to take that framework while creating content from the training sub-tab.
Solution 1:
We will make an API call (getformConfig) to get the custom framework while we start creating any course/resource from the training sub-tab.
...
** request body for the form read API:
...
Change request:
As part of https://project-sunbird.atlassian.net/browse/SH-3 we have split creation workflow into 2 parts(in Workspace => Create)
1. Textbook
2. Training
Any resource/content created in Textbook section should use ETB framework defined by the tenant
Any resource/content created in Trainings section should use TPD framework defined by the tenant
Solution 1:
Get all framework details in the channel read API call(all framework-types).
...
Channel read API should return the frameworks for this channel. Each framework will be having “frameworkType“ that will define where to use this framework.
Presently there are 2 frameworks types supported/defined in the platform
k_12 => Used for Library/Textbook workflows
TPD => Used for Tanning/Course workflows
Below example is for the channel which has not defined custom frameworks(channel should use default frameworks)
Code Block |
---|
{{host}}/api/channel/v1/read/013016492159606784174 |
Response:
Code Block | ||
---|---|---|
| ||
{
"id": "api.channel.read",
"ver": "1.0",
"ts": "2020-05-12T07:32:55.520Z",
"params": {
"resmsgid": "cbae0600-9422-11ea-921e-b5cf18189e8e",
"msgid": "59d4edd3-9ad3-f3e2-e9c0-1248c8add278",
"status": "successful",
"err": null,
"errmsg": null
},
"responseCode": "OK",
"result": {
"channel": {
"identifier": "013016492159606784174",
"lastStatusChangedOn": "2020-05-08T08:37:06.840+0000",
"code": "013016492159606784174",
"frameworks": [
{
"identifier": "NCF",
"default": true,
"name": "NCF",
"description": "ETB framework created for CBSE channel",
"frameworkType": "K-12",
"objectType": "Framework",
"relation": "hasSequenceMember",
"status": "Live"
},
{
"identifier": "TPD",
"name": "TPD",
"default": true,
"description": "TPD framework created for CBSE channel",
"frameworkType": "TPD",
"objectType": "Framework",
"relation": "hasSequenceMember",
"status": "Live"
}
],
"consumerId": "ed450daa-a5fd-4295-a346-35ae58c1a602",
"channel": "in.ekstep",
"languageCode": [],
"createdOn": "2020-05-08T08:37:06.840+0000",
"objectType": "Channel",
"versionKey": "1588927026840",
"appId": "local.sunbird.portal",
"name": "cbse",
"lastUpdatedOn": "2020-05-08T08:37:06.840+0000",
"status": "Live",
"defaultFramework": "NCF"
}
}
} |
Note: In the above response “defaultFramework” : “NCF“ is not required. Because now every tenant has min 2 frameworks. One for Textbook & another one for the Course.
The below table defines the different possibilities of channel defining default & custom frameworks for Library & Training.
Assuming the default framework for Library/Textbook=NCF & Training/Course=TPD
Defined custom | Defined custom | Result |
---|---|---|
No | No | Use the default frameworks Library/Textbook should use a custom framework => NCF ex: frameworks: [{NCF}, {TPD}] |
Yes | No | Library/Textbook should use a custom framework => rj_k12 ex: frameworks: [{rj_k12}, {TPD}] |
No | Yes | Library/Textbook should use the default framework => NCF ex: frameworks: [{NCF}, {rj_tpd}] |
Yes | Yes | Library/Textbook should use a custom framework => rj_k12 ex: frameworks: [{rj_k12}, {rj_tpd}] |
Pros:
Based on the framework type, consumption will decide which framework to use.
Will avoid form/read API call to get the TPD framework & also avoids defining forms for each tenant.
Cons:
The existing functionality of using the default framework has to change
Solution 2:
Use form read API call to get which framework to use for create conent/resources.
...
Request:
Code Block |
---|
{{host}}/api/data/v1/form/read request payload: { formType: 'framework', formAction: 'search/create', contentType: 'framework-code', rootOrgId: "013016492159606784174" } |
Response:
Code Block |
---|
{ "id": "api.form.read", "params": { "resmsgid": "812594ec-1ce0-46ed-8311-51225e05f3aa", "msgid": "aaddbe0a-e538-4dca-80d7-dde3be09eaf0", "status": "successful" }, "responseCode": "OK", "result": { "form": { "type": "framework", "subtype": "framework-code", "action": "search", "component": "*", "framework": "*", "data": { "templateName": "defaultTemplate", "action": "search", "fields": [ { "framework": "cbse-tpd" } ] }, "created_on": "2020-05-08T10:06:00.284Z", "last_modified_on": null, "rootOrgId": "013016492159606784174" } }, "ts": "2020-05-12T07:37:48.347Z", "ver": "1.0" } |
Note : Since we are making the same getFormConfig API call to get the custom framework what we are making in the “Trainings” “Training” page, then we can take the same from the cache.
...
So, When the user goes to the “Trainings” “Training” page, we won’t make the API call again.
Pros:
This is an existing workflow.
...
It will be easy to implement.
Cons:
...
Solution 2 :
To get a new API which will give a list of frameworks tagged with a tenant.
We, from the portal side, will call this API in the first place to get the list of frameworks and use these frameworks accordingly.
...
Pros: We will get the list of frameworks in the very first place.
Cons: Dependency on the back-end team to create this new API.
Solution 3:
...
The forms have to define for each tenant for search & create workflows
Multiple API calls to know which framework to use in search & create
Maintenance overhead.