Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skills data modelling #9

Closed
Mir-SA opened this issue Sep 9, 2022 · 11 comments
Closed

Skills data modelling #9

Mir-SA opened this issue Sep 9, 2022 · 11 comments
Assignees

Comments

@Mir-SA
Copy link
Contributor

Mir-SA commented Sep 9, 2022

Data Models:

  • Model =
     	Tags: {
     		id: String,
                    type: String,
     		name: String,
     		createdBy: String,
     		reason: String,
     		date: Timestamp,
     	}
     	UserTags: {
     		userid: String,
     		tagid: String,
     	}
    
  • UserID & TagID will be used as FK to create a link between Tag Model & User Model
  • Each document in UserTags will contain the skills of users by a reference to their TagID & UserID
  • This collection UserTags can also be used to store user contextual data.

Requirements

  1. Create Skill Data
  2. Fetch all skills in the collection
  3. Fetch users with a certain skill
  4. Fetch skills of a certain user
@rajakvk
Copy link
Contributor

rajakvk commented Sep 9, 2022

@Mir-SA Please tag 'feature owner' and 'Application owner' so that they will share their opinion.

@pallabez
Copy link
Member

What is

 		tag1id: String,
 		tag2id: String,
 		date: Timestamp,

@pallabez
Copy link
Member

Can we have this issue ticket synced with the PR?

@Mir-SA
Copy link
Contributor Author

Mir-SA commented Sep 25, 2022

What is

 		tag1id: String,
 		tag2id: String,
 		date: Timestamp,

i'm thinking of using that model to store IDs of all usertags(skills)

@pallabez
Copy link
Member

Shouldn't it be an array then?

tag: [tag1, tag2, ...];

@Mir-SA
Copy link
Contributor Author

Mir-SA commented Sep 25, 2022

Shouldn't it be an array then?

tag: [tag1, tag2, ...];

it can be but document size is limited to 1MB so if array grows quickly next write to doc will fail
initially i had taken that approach but ankush said not to

@pallabez
Copy link
Member

pallabez commented Sep 26, 2022

It shouldn't unless you have 13k tag for that user only considering it takes 80bytes for the tagID.

Also, making

tag1id: String,
tag2id: String,

won't make it any difference as the space consumption is same.

But yeah, having object is prefered over array. I would suggest

{
  userId: String,
  tags: {
    tag1id: Boolean,
    tag2id: Boolean, 
    ...
  } 
}

Mainly, cause querying would look something like .where(tags.xyzabc, '==', true) instead of where(xyzabc, '==', true) where xyzabc is tagId

@Mir-SA
Copy link
Contributor Author

Mir-SA commented Sep 26, 2022

It shouldn't unless you have 13k tag for that user only considering it takes 80bytes for the tagID.

agree. i had pointed that out in previous pr #7 (comment) and had some array-based & collection based approach but we eliminated all array appraoches. check previous edit in doc #9 (comment)

But yeah, having object is prefered over array. I would suggest

maps are just as inefficient with space as array :/
point is to make data as granular as possible

@vinayak-trivedi
Copy link
Member

  1. How are we storing the levels of a particular skill that a user has? My suggestion is to add the levels in the doc in the userSKill collection. so it will be something like this:
{
  userId: <userId>
  tagId: <tagId>
  tagLevel: <anything between 1-5>
}

then we can update the level of that particular tag here only and we do need to create multiple tags for different skill levels

  1. How are we storing how many tasks a user has completed of a particular skill, which would be required to update a particular skill

@Mir-SA
Copy link
Contributor Author

Mir-SA commented Oct 7, 2022

  1. How are we storing the levels of a particular skill that a user has? My suggestion is to add the levels in the doc in the userSKill collection. so it will be something like this:
{
  userId: <userId>
  tagId: <tagId>
  tagLevel: <anything between 1-5>
}

then we can update the level of that particular tag here only and we do need to create multiple tags for different skill levels

  1. How are we storing how many tasks a user has completed of a particular skill, which would be required to update a particular skill

I think it would be better to store Skill Level, Tasks completed & any metadata about Skills in Tags collection since it particularly for diff type of Tags whereas UserTags is for tags related to user & it is only there to create link between user & their Tags

@prakashchoudhary07
Copy link
Contributor

Closing this in favor of the skill-tree feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants