Background:
Presently Sunbird uses hardcoded of BMGS.If User wants to use this application for hospital or different organisations, Then we have to remove hardcode of BMGS and make it as dynamicBMGS is hardcoded for Framework request. If we want to change this label as category1, category2, category3 and category4 then we have to change the framework request.
Jira ticket: https://project-sunbird.atlassian.net/jira/software/c/projects/ED/issues/ED-1957?filter=myopenissues
Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
Problem Statement :
How to start to remove BMGS and from which page, we have to start remove hardcoded from any subtask or we have to start from onboarding steps.
Key Design Problem:
Framework-Details Api’s
Update framework api request as category[i] and we have to change the framework details response categories 1.What is the new API request for getFrameworkDetails? (We invoke the getFrameworkDetails api with default framework(BMGS) to get the framework categories as BMGS but to get categorie for multiple framework what API should call?
1.How to handle different categories for multiple frameworks(framework1-board, medium, grade, subject. framework2-department, block)?
2. Suppose default framework is framework1. so, it’s showing board, medium and grade label in onboarding page. now we select framework2. Then BMG label will change to department, block or what happen??
3. If user change framework on profile edit page then BMGS label should change?
Key Design Problem:
Create a form
Store multiple frameworks keys as category1, category2
Check the label is updating or not for selected framework
Design :
Framework-Details Api’s
Update framework api request as category[i] and we have to change the framework details response categories code also in sunbird SDK.
...
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = {
from: CachedItemRequestSourceFrom.SERVER,
language: this.translate.currentLang,
requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES
};
this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise() |
6. relevent-content.page.ts:
a) Remove BMGS hardcoded and use category1 for board, category2 for medium, category3 for grade and category4 for subject TS file
b. Update framework API’s request with category[i].
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = {
from: CachedItemRequestSourceFrom.CACHE,
language: this.translate.currentLang,
requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES
};
try {
const list = await this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise(); |
7.search :
a) Remove BMGS hardcoded and use category1 for board, category2 for medium, category3 for grade and category4 for subject TS file
b. Update framework API’s request with category[i].
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4.
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = {
language: this.translate.currentLang,
requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES
};
// Auto update the profile if that board/framework is listed in custodian framework list.
this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise() |
8. Update User Profile (update-profile.service.ts):
a) Remove BMGS hardcoded and use category1 for board, category2 for medium, category3 for grade and category4 for subject TS file
b. Update framework API’s request with category[i].
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4.
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = {
language: this.translate.currentLang,
requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES
};
// Auto update the profile if that board/framework is listed in custodian framework list.
this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise() |
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4.
Code Block |
---|
const frameworkDetailsRequest: FrameworkDetailsRequest = {
frameworkId: element.identifier,
requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES
};
this.frameworkService.getFrameworkDetails(frameworkDetailsRequest).toPromise() |
Search API’s: Search Api’s are using BMGS as Api’s request for searching, filtering and sorting. so removed BMGS and use category1 for board, category2 for medium, category3 for gradeLevel and category4 for subject.
Code Block |
---|
export interface ContentRequest {
uid?: string | string[];
primaryCategories: string[];
audience?: string[];
pragma?: string[];
exclPragma?: string[];
attachFeedback?: boolean;
attachContentAccess?: boolean;
attachContentMarker?: boolean;
sortCriteria?: ContentSortCriteria[];
recentlyViewed?: boolean;
localOnly?: boolean;
resourcesOnly?: boolean;
limit?: number;
board?: string[];
medium?: string[];
grade?: string[];
dialcodes?: string[];
childNodes?: string[]; |
convert BMGS to category[i] for content aggregator.
Code Block |
---|
this.contentService.getContents({ primaryCategories: (searchCriteria.primaryCategories && searchCriteria.primaryCategories.length getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = { &&from: searchCriteria.primaryCategories) ||CachedItemRequestSourceFrom.SERVER, (searchRequest.filters && searchRequest.filters.primaryCategory) || language: this.translate.currentLang, requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES }; [], this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise() |
6. relevent-content.page.ts:
a) Remove BMGS hardcoded and use category1 for board, category2 for medium, category3 for grade and category4 for subject TS file
b. Update framework API’s request with category[i].
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = { boardfrom: searchCriteriaCachedItemRequestSourceFrom.board, CACHE, language: this.translate.currentLang, mediumrequiredCategories: searchCriteria.medium,FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES }; try { const list = grade: searchCriteria.grade |
Remove BMGS from get content handler and search content handler in SDK.
Change BMGS to category1-4 for content properties in client service.
Update the below request BMGS to category1…category4 in mobile and we have to change the request as category1….category4 for search filter and help section in mobile.
Code Block |
---|
userPreferences: { await this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise(); |
7.search :
a) Remove BMGS hardcoded and use category1 for board, category2 for medium, category3 for grade and category4 for subject TS file
b. Update framework API’s request with category[i].
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4.
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = { language: this.translate.currentLang, boardrequiredCategories: this.profile.board, FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES }; // Auto update the profile if that board/framework is listed in custodian framework list. medium: this.profile.medium, gradeLevel: this.profile.grade, this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise() |
8. Update User Profile (update-profile.service.ts):
a) Remove BMGS hardcoded and use category1 for board, category2 for medium, category3 for grade and category4 for subject TS file
b. Update framework API’s request with category[i].
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4.
Code Block |
---|
const getSuggestedFrameworksRequest: GetSuggestedFrameworksRequest = { subjectlanguage: this.profiletranslate.subject, currentLang, } |
Update Profile:
a) Server Profile:
Now we can use category1, category2, category3 and category4 as update user profile request instead of BMGS.
Example of update profile request.
Code Block |
---|
"request": "request": { "userId": "155ce3c5-713e-4749-bc1c-95d09c640914", "framework": { requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES "id": [ }; "framework1" ], // Auto update "category1": [ "Category1 Term1" the profile if that board/framework is listed in custodian framework list. ], "category2": [ this.frameworkUtilService.getActiveChannelSuggestedFrameworkList(getSuggestedFrameworksRequest).toPromise() |
DEFAULT_FRAMEWORK_CATEGORIES
should be category1, category2, category3 and category4.
Code Block |
---|
const frameworkDetailsRequest: FrameworkDetailsRequest = "Category2{ Term1" ], "category3": [ "Category3 Term1" ] } } |
Update Profile for Logged In user:
Update profile request BMGS to category1, category2, category3 and category4
Code Block |
---|
this.profileService.updateServerProfile(req).toPromise() |
b) Local profile DB :
Update local profile DB keys BMGS to category1, category2, category3 and category4
Code Block |
---|
export interface Profile { frameworkId: element.identifier, uid: string; handle: string; createdAt?: number; medium?: string[];requiredCategories: FrameworkCategoryCodesGroup.DEFAULT_FRAMEWORK_CATEGORIES board?: string[]; subject?: string[]; profileType: ProfileType; grade?: string[] }; syllabus?: string[]; source: ProfileSource; gradeValue?: { [key: string]: any }; serverProfile?: ServerProfile; } this.frameworkService.getFrameworkDetails(frameworkDetailsRequest).toPromise() |