-
Notifications
You must be signed in to change notification settings - Fork 448
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
Feat: Add BIT personal background to MS schema #1092
base: bit
Are you sure you want to change the base?
Conversation
Add new migration script reformat to black linting
Codecov Report
@@ Coverage Diff @@
## bit #1092 +/- ##
==========================================
- Coverage 94.50% 94.24% -0.27%
==========================================
Files 39 40 +1
Lines 2677 2868 +191
==========================================
+ Hits 2530 2703 +173
- Misses 147 165 +18
|
@isabelcosta and @epicadk .The codecov %-tages are dropping since I didn't add a test_database_models for personal background. Do you want me to add the test on this PR or add later in a separate one? |
@@ -0,0 +1,146 @@ | |||
from sqlalchemy import null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment here specifying that this is a BIT extension?
db.create_all() | ||
|
||
@application.shell_context_processor | ||
def make_shell_context(): | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app/utils/bitschema_utils.py
Outdated
@unique | ||
class SexualOrientation(Enum): | ||
HETEROSEXUAL = "Heterosexual/Straight" | ||
LGBTIA = "LGBTIA+" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot the Q LGBTQIA
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will make the change soon 😉
years_of_experience = db.Column(db.Enum(YearsOfExperience)) | ||
others = db.Column(JsonCustomType) | ||
is_public = db.Column(db.Boolean) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why exactly we would need such information. I'll leave that to @isabelcosta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epicadk , do you mean years of experience? First of all, I believe this is relevant to support one of BIT goals which is to improve equity in IT because many with no to limited years of experience in IT were left out from employment opportunity. We often see a position for entry level required more than 3 - 5 years of experience. Stating this years of experience encouraging industries to target people within the lower years of experience to be the mentee and people with the higher level of experience to be the mentor. Their willingness to go against the norm in employment market (aka to be more inclusive by targeting those within the minority groups, e.g. minimal years of experience) is going to be highlighted in the BIT Landing page as per the Mockup in my GSoC20 proposal.
|
||
@unique | ||
class YearsOfExperience(Enum): | ||
UNDER_ONE = "Less than a year" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to just store numbers (number of years of experience) in the database instead of storing strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epicadk , the reason I did it like this (in word instead of number) is because IMO it makes more sense when an organization open a mentoring program opportunity, they can state the target candidate based on a range of years of experience (e.g. between 3 to 5 years) instead of a distinct year 1,2,3, or 4 yr etc. This is also to make it easier for later when we make the logic which allows user to filter mentoring program based on certain categories (e.g. years of experience required "between 3 - 5 years" instead of selecting a particular number like 1,2,3 or 4 yr etc). This way it also limits the options to 5 only. Hope this makes sense 😉 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can still make the same query with databases ( possibly more optimized as well if we use indexing) further every year we could just ++ the count in the database rather than having to migrate the strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epicadk , what do you mean by
further every year we could just ++ the count in the database rather than having to migrate the strings.
Do you mean we need to make a scheduler to automatically add one year to the years of experience of each users who have this data instead of users manually updating their years of experience from their end? We could do that I suppose, but we're at disadvantage when the user is no longer in the industry but hasn't cancelled their membership/delete their account with us as that would be an inefficient use of overhead, plus we don't know how many of our users are in this category 🤔 .
Let's wait for @isabelcosta's opinion on this 😉 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtreacy002 code coverage is descreasing significantly. I think new test cases are also needed with changes.
Ok, will add the test for the database model then 👍 |
Hi @devkapilbansal & @epicadk , does any you have a suggestion on how to increase the test coverage? I really appreciate any input 😉 |
90 to 95% Coverage is fine as long as the tests cover all possible cases. |
user_id: An integer for storing the user's id. | ||
gender: A string for storing the user's gender. | ||
age: A string for storing the user's age. | ||
ethnicity: A string for storing the user's wthnicity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ethnicity: A string for storing the user's wthnicity. | |
ethnicity: A string for storing the user's ethnicity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mtreacy002 this is not resolved yet
background = PersonalBackgroundModel.query.filter_by( | ||
user_id=self.user2.id | ||
).first() | ||
self.assertTrue(background is not None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just as a fyi, you can do also assertIsNotNone()
I think it's like this 🤔
not that you need to change, just wanted to let you know ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot about that 🤣 . Thanks @isabelcosta for the reminder. I've fixed it now 😉 .
|
||
# default values | ||
self.others = None | ||
self.is_public = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should not be a boolean option.
I would say this could be an enum to represent different visibility levels. E.g.:
- Not visible to anyone
- Visible to BIT only
- Visible to Organizations only
- Visible to all users (probably no one will select this though 🤔 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will approve this, as this is AS IS from BIT backend code, but lets try to after this merge, address the 2 review comments we discussed in the Open Session:
- removing religious questions
- making personal background visibility an enum instead of a boolean
Noted. Thank you @isabelcosta . Will open the issues and work on these points once this pr is approved 😉 |
@isabelcosta , @vj-codes and @epicadk , can you please advise if there's anything else need to be done here? Thanks 😉 |
@mtreacy002 have you tested this and are you confident this is working ok? Since we are merging to BIT branch, I trust you on this. Happy to merge, just give me the green light 🤗 |
@isabelcosta , I'm pretty sure I've tested it locally though I haven't written the test report since I was hoping others could help with the testing part. But, I'll do it asap and will write the test summary soon 😉. |
@mtreacy002 I can also test this, all I need to do is pull it locally and run unittests right? |
That's right, @vj-codes . Thank you, that'll be great, please 😉 |
Description
Added BIT Personal Background to MS schema
Fixes #1091
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
Checklist:
Code/Quality Assurance Only