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 dynamic.
Jira ticket: https://project-sunbird.atlassian.net/jira/software/c/projects/ED/issues/ED-1957?filter=myopenissues
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.Jira ticket:
Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
Problem Statement :
Key Design Problem:
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 = {
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
&& searchCriteria.primaryCategories) ||
(searchRequest.filters && searchRequest.filters.primaryCategory) ||
[],
board: searchCriteria.board,
medium: searchCriteria.medium,
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: { board: this.profile.board, medium: this.profile.medium, gradeLevel: this.profile.grade, 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() |