Skip to content

Latest commit

 

History

History
16 lines (7 loc) · 9.33 KB

File metadata and controls

16 lines (7 loc) · 9.33 KB

Caching and Denormalising User Metadata

Various data products in sunbird depends on the user metadata which are generated on joining different tables from core cassandra and LP cassandra. The logic for joining the table and fetching the information per user type is complex.

Solution :

Fetch the information from cassandra table, compute all the required fields in the flink job (user-cache-updater job) and update all the fields to the redis cache.

Design for the fields to be fetched:

Field NameTypeTable NameDescription
1User-IDStringUserIt indicates user unique Identifier
2Mobile NumberStringUserUser phone number in an encrypted format
3Email IDStringUserUser mail id in an encrypted format
4IDStringUserUser unique identifier
5First NameStringUserUser first name
6Last NameStringUserUser Last Name
7Phone VerifiedStringUserIt indicates whether user is verified the phone number or not
8Email VerifiedStringUserIt indicates whether user is verified the email or not
9Flags ValueIntUser
10FrameworkMap[String, List[String]]UserUser framework
11RootorgidStringUserUser root org id (can be used to differentiate between custodian and state user)
12CreatedByStringUserUser created By
13SubjectList[String]UserUser subjects
14LanguageList[String]UserUser Language
15GradeList[String]UserUser grades
16RolesList[String]UserUser roles
17StatusIntUserUser status
18WebpagesList[Map[String, String]]User
19CreateddateStringUserUser created date
20EmailverifiedBooleanUserUser email is verified or not
21IsdeletedBooleanUserUser is deleted or not
22LocationidsList[Strings]User
  1. If the user is Self Signed Up (custodian) user: USER.locationids
  2. If the user is tenant user: ORGANISATION.locationids
23UpdateddateStringUserUser last updated date
24ProfilevisibilityStringUserUser profile visibility
25LoginidStringUserUser login id
26UsernameStringUserIt’s a combination of user first name and last name columns
27External-IDStringUser_external_identity
  1. If the user is a self signed up user in the custodian org then the user’s self declared ID will be the value to the field.

    1. Filter the User_external_identity.idtype='declared-ext-id'
    2. Join with ORG table with condition User_external_identity.provider=ORG.channel and fetch User_external_identity.userid , User_external_identity.externalID
  2. If the user is a state user then the tenant provided External ID will be the value to the field.

    1. Join USER and User_external_identity table with User_external_identity.idType =User.channel and User_external_identity.provider=User.channel and fetch User_external_identity.userid , User_external_identity.externalID
28School NameStringCustodian User: User_external_identity
State User: Organisation
  1. If the user is Self Signed Up (custodian) user then user’s self declared sub org Information code will be the value to the field.

    1. User_external_identity.idtype='declared-school-name' anf fetch User_external_identity.externalid,userid
  2. If the user is state user then tenant provided sub org Information will be the values.

    1. Join on User.userId = User_org.userId and then on get User_org.orgId and then join with Organisation.id where isRootOrg = false and fetch the Organisation.orgcode and ORG.orgname as school_name
29School UDISE CodeStringCustodian User: User_external_identity
State User: Organisation
  1. If the user is Self Signed Up (custodian) user then user’s self declared sub org Information code will be the value to the field.

    1. User_external_identity.idtype='declared-school-udise-code' and fetch User_external_identity.externalid,userid
  2. If the user is tenant user then tenant provided sub org Information will be the values.

    1. Join on User.userId = User_org.userId and then on get User_org.orgId and then join with ORGANISATION.id where isRootOrg = false and fetch the ORGANISATION.orgcode and ORG.orgname as school_name
30State NameStringLocation
  1. If the user is Self Signed Up (custodian) user then user’s self declared location will be the value to the field

    1. USER.locationids=LOCATION.id and LOCATION.type='state/' and fetch the name as LOCATION.{state_name},USER.userid
  2. If the user is tenant user then tenant location will be selected

    1. Join ORGANISATION and location table having condition:
      ORG.locationids=Location.id && Location.type='state and fetch the Location.name, ORG.id
    2. Join the Dataframe given in (i) and user table with condition:
      ORG.id = USER.rootorgid && ORG.isrootorg=true and get the USER.userid, Location.name
31District NameStringLocation
  1. If the user is Self Signed Up (custodian) user then user’s self declared location will be the value to the field

    1. USER.locationids=LOCATION.id and LOCATION.type='district' and fetch the name as LOCATION.{district_name},USER.userid
  2. If the user is tenant user then then tenant location will be selected

    1. Join ORGANISATION and location table having condition:
      ORG.locationids=Location.id && Location.type='district and fetch the Location.name, ORG.id
    2. Join the Dataframe given in (i) and user table with condition:
      ORG.id = USER.rootorgid && ORG.isrootorg=true and get the USER.userid, Location.name
32Block NameStringLocation
  1. If the user is Self Signed Up (custodian) user then user’s self declared location will be the value to the field

    1. USER.locationids=LOCATION.id and LOCATION.type='block' and fetch the name as LOCATION.{block_name},USER.userid
  2. If the user is tenant user then tenant location will be the value to the field

    1. Join ORGANISATION and location table having condition:
      ORG.locationids=Location.id && Location.type='block' and fetch the Location.name, ORG.id
    2. Join the Dataframe given in (i) and user table with condition:
      ORG.id = USER.rootorgid && ORG.isrootorg=true and get the USER.userid, Location.name