mirror of
https://github.com/andwati/student-retention.git
synced 2026-10-18 00:42:53 +00:00
yolo
This commit is contained in:
@@ -51,10 +51,10 @@ def collect_user_input():
|
||||
academic_bg = render_academic_background_section(preset, feature_maps)
|
||||
|
||||
# Family background
|
||||
family_bg = render_family_background_section(feature_maps)
|
||||
family_bg = render_family_background_section(preset, feature_maps)
|
||||
|
||||
# Financial and social factors
|
||||
financial_social = render_financial_social_section()
|
||||
financial_social = render_financial_social_section(preset)
|
||||
|
||||
# Academic performance
|
||||
academic_performance = render_academic_performance_section(preset)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -58,7 +58,8 @@ def render_personal_info_section(preset: str, feature_maps: Dict) -> Dict[str, A
|
||||
|
||||
nationality = st.selectbox(
|
||||
"Nationality",
|
||||
[1, 2, 6, 11, 13, 14, 17, 21, 22, 24, 25, 26, 32, 41, 62, 100, 101, 103, 105, 108, 109],
|
||||
options=list(feature_maps['nationality'].keys()),
|
||||
format_func=lambda x: feature_maps['nationality'][x],
|
||||
index=0
|
||||
)
|
||||
|
||||
@@ -143,34 +144,40 @@ def render_academic_background_section(preset: str, feature_maps: Dict) -> Dict[
|
||||
}
|
||||
|
||||
|
||||
def render_family_background_section(feature_maps: Dict) -> Dict[str, Any]:
|
||||
def render_family_background_section(preset: str, feature_maps: Dict) -> Dict[str, Any]:
|
||||
"""Render family background input section"""
|
||||
st.markdown('<div class="section-divider"></div>', unsafe_allow_html=True)
|
||||
st.markdown("### 👨👩👧👦 Family Background")
|
||||
st.markdown('<div class="info-box">Parent education and occupation information</div>', unsafe_allow_html=True)
|
||||
|
||||
defaults = PRESET_CONFIGURATIONS[preset]
|
||||
|
||||
mothers_qualification = st.selectbox(
|
||||
"Mother's Qualification",
|
||||
options=list(feature_maps['qualification'].keys()),
|
||||
format_func=lambda x: feature_maps['qualification'].get(x, f"Qualification {x}")
|
||||
format_func=lambda x: feature_maps['qualification'].get(x, f"Qualification {x}"),
|
||||
index=list(feature_maps['qualification'].keys()).index(defaults["mothers_qualification"]) if defaults["mothers_qualification"] in feature_maps['qualification'] else 0
|
||||
)
|
||||
|
||||
fathers_qualification = st.selectbox(
|
||||
"Father's Qualification",
|
||||
options=list(feature_maps['qualification'].keys()),
|
||||
format_func=lambda x: feature_maps['qualification'].get(x, f"Qualification {x}")
|
||||
format_func=lambda x: feature_maps['qualification'].get(x, f"Qualification {x}"),
|
||||
index=list(feature_maps['qualification'].keys()).index(defaults["fathers_qualification"]) if defaults["fathers_qualification"] in feature_maps['qualification'] else 0
|
||||
)
|
||||
|
||||
mothers_occupation = st.selectbox(
|
||||
"Mother's Occupation",
|
||||
options=list(feature_maps['occupation'].keys()),
|
||||
format_func=lambda x: feature_maps['occupation'].get(x, f"Occupation {x}")
|
||||
format_func=lambda x: feature_maps['occupation'].get(x, f"Occupation {x}"),
|
||||
index=list(feature_maps['occupation'].keys()).index(defaults["mothers_occupation"]) if defaults["mothers_occupation"] in feature_maps['occupation'] else 0
|
||||
)
|
||||
|
||||
fathers_occupation = st.selectbox(
|
||||
"Father's Occupation",
|
||||
options=list(feature_maps['occupation'].keys()),
|
||||
format_func=lambda x: feature_maps['occupation'].get(x, f"Occupation {x}")
|
||||
format_func=lambda x: feature_maps['occupation'].get(x, f"Occupation {x}"),
|
||||
index=list(feature_maps['occupation'].keys()).index(defaults["fathers_occupation"]) if defaults["fathers_occupation"] in feature_maps['occupation'] else 0
|
||||
)
|
||||
|
||||
return {
|
||||
@@ -181,31 +188,36 @@ def render_family_background_section(feature_maps: Dict) -> Dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
def render_financial_social_section() -> Dict[str, Any]:
|
||||
def render_financial_social_section(preset: str) -> Dict[str, Any]:
|
||||
"""Render financial and social factors input section"""
|
||||
st.markdown('<div class="section-divider"></div>', unsafe_allow_html=True)
|
||||
st.markdown("### 💰 Financial & Social")
|
||||
st.markdown('<div class="info-box">Student financial status and special circumstances</div>',
|
||||
unsafe_allow_html=True)
|
||||
|
||||
defaults = PRESET_CONFIGURATIONS[preset]
|
||||
|
||||
col1, col2 = st.columns(2)
|
||||
with col1:
|
||||
displaced = st.radio(
|
||||
"Displaced Student",
|
||||
[0, 1],
|
||||
format_func=lambda x: "No" if x == 0 else "Yes",
|
||||
index=defaults["displaced"],
|
||||
horizontal=True
|
||||
)
|
||||
educational_special_needs = st.radio(
|
||||
"Educational Special Needs",
|
||||
[0, 1],
|
||||
format_func=lambda x: "No" if x == 0 else "Yes",
|
||||
index=defaults["educational_special_needs"],
|
||||
horizontal=True
|
||||
)
|
||||
debtor = st.radio(
|
||||
"Has Outstanding Debts",
|
||||
[0, 1],
|
||||
format_func=lambda x: "No" if x == 0 else "Yes",
|
||||
index=defaults["debtor"],
|
||||
horizontal=True
|
||||
)
|
||||
with col2:
|
||||
@@ -213,18 +225,21 @@ def render_financial_social_section() -> Dict[str, Any]:
|
||||
"Tuition Fees Up to Date",
|
||||
[0, 1],
|
||||
format_func=lambda x: "No" if x == 0 else "Yes",
|
||||
index=defaults["tuition_fees_up_to_date"],
|
||||
horizontal=True
|
||||
)
|
||||
scholarship_holder = st.radio(
|
||||
"Scholarship Holder",
|
||||
[0, 1],
|
||||
format_func=lambda x: "No" if x == 0 else "Yes",
|
||||
index=defaults["scholarship_holder"],
|
||||
horizontal=True
|
||||
)
|
||||
international = st.radio(
|
||||
"International Student",
|
||||
[0, 1],
|
||||
format_func=lambda x: "No" if x == 0 else "Yes",
|
||||
index=defaults["international"],
|
||||
horizontal=True
|
||||
)
|
||||
|
||||
|
||||
+96
-22
@@ -17,19 +17,19 @@ def create_feature_mappings():
|
||||
6: "Legally Separated",
|
||||
}
|
||||
|
||||
# Application mode mapping
|
||||
# Application mode mapping (from data dictionary)
|
||||
application_mode_map = {
|
||||
1: "1st Phase - General Contingent",
|
||||
1: "1st phase - general contingent",
|
||||
2: "Ordinance No. 612/93",
|
||||
5: "1st Phase - Special Contingent (Azores)",
|
||||
7: "Holders of Other Higher Courses",
|
||||
5: "1st phase - special contingent (Azores Island)",
|
||||
7: "Holders of other higher courses",
|
||||
10: "Ordinance No. 854-B/99",
|
||||
15: "International Student (Bachelor)",
|
||||
16: "1st Phase - Special Contingent (Madeira)",
|
||||
17: "2nd Phase - General Contingent",
|
||||
18: "3rd Phase - General Contingent",
|
||||
26: "Ordinance No. 533-A/99, item b2",
|
||||
27: "Ordinance No. 533-A/99, item b3",
|
||||
15: "International student (bachelor)",
|
||||
16: "1st phase - special contingent (Madeira Island)",
|
||||
17: "2nd phase - general contingent",
|
||||
18: "3rd phase - general contingent",
|
||||
26: "Ordinance No. 533-A/99, item b2 (Different Plan)",
|
||||
27: "Ordinance No. 533-A/99, item b3 (Other Institution)",
|
||||
39: "Over 23 years old",
|
||||
42: "Transfer",
|
||||
43: "Change of course",
|
||||
@@ -60,7 +60,7 @@ def create_feature_mappings():
|
||||
9991: "Management (evening attendance)",
|
||||
}
|
||||
|
||||
# Previous qualification mapping
|
||||
# Previous qualification mapping (from data dictionary)
|
||||
qualification_map = {
|
||||
1: "Secondary education",
|
||||
2: "Higher education - bachelor's degree",
|
||||
@@ -77,7 +77,7 @@ def create_feature_mappings():
|
||||
38: "Basic education 2nd cycle (6th/7th/8th year) or equiv.",
|
||||
39: "Technological specialization course",
|
||||
40: "Higher education - degree (1st cycle)",
|
||||
42: "Professional course",
|
||||
42: "Professional higher technical course",
|
||||
43: "Higher education - master (2nd cycle)",
|
||||
}
|
||||
|
||||
@@ -117,12 +117,38 @@ def create_feature_mappings():
|
||||
194: "Meal preparation assistants",
|
||||
}
|
||||
|
||||
# Nationality mapping (from data dictionary)
|
||||
nationality_map = {
|
||||
1: "Portuguese",
|
||||
2: "German",
|
||||
6: "Spanish",
|
||||
11: "Italian",
|
||||
13: "Dutch",
|
||||
14: "English",
|
||||
17: "Lithuanian",
|
||||
21: "Angolan",
|
||||
22: "Cape Verdean",
|
||||
24: "Guinean",
|
||||
25: "Mozambican",
|
||||
26: "Santomean",
|
||||
32: "Turkish",
|
||||
41: "Brazilian",
|
||||
62: "Romanian",
|
||||
100: "Moldova (Republic of)",
|
||||
101: "Mexican",
|
||||
103: "Ukrainian",
|
||||
105: "Russian",
|
||||
108: "Cuban",
|
||||
109: "Colombian",
|
||||
}
|
||||
|
||||
return {
|
||||
"marital_status": marital_status_map,
|
||||
"application_mode": application_mode_map,
|
||||
"course": course_map,
|
||||
"qualification": qualification_map,
|
||||
"occupation": occupation_map,
|
||||
"nationality": nationality_map,
|
||||
}
|
||||
|
||||
|
||||
@@ -136,15 +162,39 @@ PRESET_CONFIGURATIONS = {
|
||||
"course": 9254,
|
||||
"prev_grade": 120,
|
||||
"adm_grade": 120,
|
||||
# Family background
|
||||
"mothers_qualification": 1, # Secondary education
|
||||
"fathers_qualification": 1, # Secondary education
|
||||
"mothers_occupation": 4, # Administrative staff
|
||||
"fathers_occupation": 7, # Skilled workers
|
||||
# Financial & social
|
||||
"displaced": 0,
|
||||
"educational_special_needs": 0,
|
||||
"debtor": 0,
|
||||
"tuition_fees_up_to_date": 1,
|
||||
"scholarship_holder": 0,
|
||||
"international": 0,
|
||||
},
|
||||
"Typical Graduate Student": {
|
||||
"age": 19,
|
||||
"gender": 1,
|
||||
"marital": 1,
|
||||
"app_mode": 15,
|
||||
"course": 9254,
|
||||
"prev_grade": 160,
|
||||
"adm_grade": 142,
|
||||
"age": 18, # Slightly younger, traditional student age
|
||||
"gender": 0, # Female students often have slightly higher graduation rates
|
||||
"marital": 1, # Single
|
||||
"app_mode": 1, # 1st phase general contingent (most competitive)
|
||||
"course": 9500, # Nursing (typically high graduation rate)
|
||||
"prev_grade": 170, # Higher previous qualification grade
|
||||
"adm_grade": 150, # Higher admission grade
|
||||
# Family background
|
||||
"mothers_qualification": 2, # Higher education - bachelor's degree
|
||||
"fathers_qualification": 2, # Higher education - bachelor's degree
|
||||
"mothers_occupation": 2, # Specialists in intellectual activities
|
||||
"fathers_occupation": 2, # Specialists in intellectual activities
|
||||
# Financial & social
|
||||
"displaced": 0,
|
||||
"educational_special_needs": 0,
|
||||
"debtor": 0,
|
||||
"tuition_fees_up_to_date": 1,
|
||||
"scholarship_holder": 1, # Has scholarship (positive factor)
|
||||
"international": 0,
|
||||
},
|
||||
"At-Risk Student": {
|
||||
"age": 22,
|
||||
@@ -154,15 +204,39 @@ PRESET_CONFIGURATIONS = {
|
||||
"course": 171,
|
||||
"prev_grade": 100,
|
||||
"adm_grade": 110,
|
||||
# Family background
|
||||
"mothers_qualification": 19, # Basic education 3rd cycle
|
||||
"fathers_qualification": 19, # Basic education 3rd cycle
|
||||
"mothers_occupation": 9, # Unskilled workers
|
||||
"fathers_occupation": 9, # Unskilled workers
|
||||
# Financial & social
|
||||
"displaced": 0,
|
||||
"educational_special_needs": 0,
|
||||
"debtor": 1, # Has debts (risk factor)
|
||||
"tuition_fees_up_to_date": 0, # Behind on tuition
|
||||
"scholarship_holder": 0,
|
||||
"international": 0,
|
||||
},
|
||||
"International Student": {
|
||||
"age": 21,
|
||||
"gender": 0,
|
||||
"marital": 1,
|
||||
"app_mode": 1,
|
||||
"app_mode": 15, # International student (bachelor)
|
||||
"course": 9238,
|
||||
"prev_grade": 135,
|
||||
"adm_grade": 130,
|
||||
# Family background
|
||||
"mothers_qualification": 2, # Higher education - bachelor's degree
|
||||
"fathers_qualification": 2, # Higher education - bachelor's degree
|
||||
"mothers_occupation": 2, # Specialists in intellectual activities
|
||||
"fathers_occupation": 2, # Specialists in intellectual activities
|
||||
# Financial & social
|
||||
"displaced": 0,
|
||||
"educational_special_needs": 0,
|
||||
"debtor": 0,
|
||||
"tuition_fees_up_to_date": 1,
|
||||
"scholarship_holder": 0,
|
||||
"international": 1, # Is international student
|
||||
},
|
||||
}
|
||||
|
||||
@@ -190,7 +264,7 @@ ACADEMIC_DEFAULTS = {
|
||||
"1st_sem": {
|
||||
"enrolled": 6,
|
||||
"approved": 6,
|
||||
"grade": 14,
|
||||
"grade": 16, # Higher grade (closer to maximum of 20)
|
||||
"credited": 0,
|
||||
"evaluations": 6,
|
||||
"without": 0,
|
||||
@@ -198,7 +272,7 @@ ACADEMIC_DEFAULTS = {
|
||||
"2nd_sem": {
|
||||
"enrolled": 6,
|
||||
"approved": 6,
|
||||
"grade": 14,
|
||||
"grade": 16, # Higher grade (closer to maximum of 20)
|
||||
"credited": 0,
|
||||
"evaluations": 6,
|
||||
"without": 0,
|
||||
|
||||
Reference in New Issue
Block a user