mjkalas's picture
Rename app (1).py to app.py
82346ea verified
Raw History Blame Contribute Delete
22.5 kB
import streamlit as st
# ── Ole Miss brand colors ──────────────────────────────────────────────────────
st.set_page_config(page_title="Ole Miss Degree Planner", page_icon="πŸŽ“", layout="wide")
st.markdown("""
<style>
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Source+Sans+3:wght@300;400;600&display=swap');
:root {
--navy: #002147;
--red: #CE1126;
--gold: #C8A84B;
--light: #F4F6F9;
--card: #FFFFFF;
--border: #D8DDE6;
--text: #1A1A2E;
--muted: #6B7280;
}
html, body, [class*="css"] {
font-family: 'Source Sans 3', sans-serif;
background-color: var(--light);
color: var(--text);
}
/* Header */
.hero {
background: linear-gradient(135deg, var(--navy) 0%, #003366 100%);
border-bottom: 4px solid var(--red);
padding: 2rem 2.5rem 1.5rem;
border-radius: 12px;
margin-bottom: 1.5rem;
color: white;
}
.hero h1 {
font-family: 'Playfair Display', serif;
font-size: 2.4rem;
font-weight: 900;
margin: 0 0 0.25rem 0;
letter-spacing: -0.5px;
}
.hero p {
font-size: 1rem;
color: rgba(255,255,255,0.75);
margin: 0;
font-weight: 300;
}
.accent { color: var(--gold); }
/* Cards */
.card {
background: var(--card);
border: 1px solid var(--border);
border-radius: 10px;
padding: 1.25rem 1.5rem;
margin-bottom: 1rem;
box-shadow: 0 2px 8px rgba(0,33,71,0.07);
}
.card-header {
font-family: 'Playfair Display', serif;
font-size: 1.1rem;
font-weight: 700;
color: var(--navy);
border-bottom: 2px solid var(--red);
padding-bottom: 0.4rem;
margin-bottom: 0.75rem;
}
/* Remaining course pill */
.course-pill {
display: inline-block;
background: #EEF2FF;
border: 1px solid #BDC9E8;
border-left: 4px solid var(--navy);
color: var(--navy);
font-size: 0.85rem;
font-weight: 600;
padding: 0.3rem 0.75rem;
border-radius: 6px;
margin: 0.2rem 0.2rem 0.2rem 0;
}
.course-pill.done {
background: #F0FDF4;
border-left-color: #16A34A;
color: #15803D;
text-decoration: line-through;
opacity: 0.65;
}
/* GPA badge */
.gpa-badge {
background: linear-gradient(135deg, var(--navy), #003366);
color: white;
border-radius: 12px;
padding: 1.5rem;
text-align: center;
border: 3px solid var(--gold);
}
.gpa-number {
font-family: 'Playfair Display', serif;
font-size: 3.5rem;
font-weight: 900;
color: var(--gold);
line-height: 1;
}
.gpa-label {
font-size: 0.85rem;
color: rgba(255,255,255,0.7);
margin-top: 0.25rem;
text-transform: uppercase;
letter-spacing: 1px;
}
/* Stat boxes */
.stat-box {
background: var(--navy);
color: white;
border-radius: 8px;
padding: 0.9rem 1rem;
text-align: center;
}
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--gold); }
.stat-lbl { font-size: 0.75rem; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.5px; }
/* Tab styling */
div[data-testid="stTabs"] button {
font-family: 'Source Sans 3', sans-serif !important;
font-weight: 600 !important;
color: var(--navy) !important;
}
div[data-testid="stTabs"] button[aria-selected="true"] {
color: var(--red) !important;
border-bottom-color: var(--red) !important;
}
/* Selectbox / dropdown */
div[data-testid="stSelectbox"] label, div[data-testid="stMultiSelect"] label {
font-weight: 600;
color: var(--navy);
}
/* Checkbox label */
.stCheckbox label { font-size: 0.9rem; }
/* Red badge for remaining */
.badge-remaining {
display: inline-block;
background: var(--red);
color: white;
font-size: 0.7rem;
font-weight: 700;
padding: 0.1rem 0.5rem;
border-radius: 99px;
vertical-align: middle;
margin-left: 0.4rem;
}
.badge-done {
display: inline-block;
background: #16A34A;
color: white;
font-size: 0.7rem;
font-weight: 700;
padding: 0.1rem 0.5rem;
border-radius: 99px;
vertical-align: middle;
margin-left: 0.4rem;
}
/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
</style>
""", unsafe_allow_html=True)
# ── Course Data ────────────────────────────────────────────────────────────────
GRADE_MAP = {"A": 4.0, "B": 3.0, "C": 2.0, "D": 1.0, "F": 0.0, "W": None, "In Progress": None}
MAJORS = {
"Accountancy (B.Accy.)": {
"General Education / Core": [
"WRIT 100/101 – First Year Writing I",
"WRIT/LIBA 102 – First Year Writing II",
"Natural Science with Lab I",
"Natural Science with Lab II",
"MATH 167 – Business Mathematics",
"MATH 267 – Business Calculus I",
"ECON 202 – Principles of Microeconomics",
"Humanities (3 hrs)",
"Fine Arts (3 hrs)",
"Humanities or Fine Arts – Additional (3 hrs)",
],
"Additional Core Requirements": [
"ACCY 201 – Principles of Accounting I",
"ACCY 202 – Principles of Accounting II",
"ECON 203 – Principles of Macroeconomics",
"BUS 250 – Legal Environment of Business",
"BUS 271 / SPCH 102 / SPCH 105 – Business Communication or Speech",
"BUS 230 / ECON 230 – Economic Statistics I",
"ACCY 302 – Fundamentals of Data Analytics",
],
"Major Course Requirements": [
"ACCY 303 – Financial Accounting I",
"ACCY 304 – Financial Accounting II",
"ACCY 309 – Cost Accounting",
"ACCY 310 – Systems",
"ACCY 401 – Auditing",
"ACCY 402 – Advanced Accounting",
"ACCY 405 – Income Tax",
"ACCY 407 – Governmental Accounting",
"ACCY 411 – Business Law",
],
"Business Core & Other Requirements": [
"ACCY 520 – Internship OR MGMT 493 – Strategic Planning",
"MKTG 351 – Marketing Principles",
"BUS/ECON 302 – Economic Statistics II",
"FIN 331 – Business Finance I",
"MKTG 372 – Intro to Operations & Supply Chain Management",
"MGMT 371 – Principles of Management",
"MIS 309 – Management Information Systems",
"WRIT 440 – Writing for Accountancy",
],
"Minor Requirements": [
"Minor Course 1 (3 hrs)",
"Minor Course 2 (3 hrs)",
"Minor Course 3 (3 hrs)",
],
},
"Banking and Finance (B.B.A.)": {
"General Education Requirements": [
"WRIT 100/101 – First Year Writing I",
"WRIT/LIBA 102 – First Year Writing II",
"Humanities I (3 hrs)",
"Humanities II (3 hrs)",
"Fine Arts (3 hrs)",
"Natural Science with Lab I",
"Natural Science with Lab II",
"MATH 167 – Business Mathematics",
"MATH 267 – Business Calculus I",
"ECON 202 – Principles of Microeconomics",
"ECON 203 – Principles of Macroeconomics",
],
"B.B.A. Core Requirements": [
"ACCY 201 – Accounting I",
"ACCY 202 – Accounting II",
"BUS 250 – Legal Environment of Business",
"BUS 271 – Business Communication",
"BUS/ECON 230 – Economic Statistics I",
"MKTG 351 – Principles of Marketing",
"FIN 331 – Principles of Finance",
"MGMT 371 – Principles of Management",
"ECON/BUS 302 – Economic Statistics II",
"MKTG 372 – Intro to Operations and Supply Chain Management",
"BAIS 309 – Business Analytics and Information Systems",
"MGMT 493 – Management of Strategic Planning",
"MKTG 354 – Professional Selling and Relationship Marketing",
"300+ Elective (3 hrs)",
"300+ Business Elective (3 hrs)",
],
"Major Requirements": [
"ECON/FIN 303 – Money and Banking OR FIN 333 – Financial Markets & Institutions",
"FIN 334 – Investments",
"FIN 338 – Intermediate Finance Management",
"FIN 537 – Banking and Finance I",
"FIN 538 – Banking and Finance II",
"Finance Major Elective I (3 hrs)",
"Finance Major Elective II (3 hrs)",
"Finance Major Elective III (3 hrs)",
],
},
"Business Analytics & Information Systems (B.B.A.)": {
"General Education Requirements": [
"WRIT 100/101 – First Year Writing I",
"WRIT/LIBA 102 – First Year Writing II",
"Humanities I (3 hrs)",
"Humanities II (3 hrs)",
"Fine Arts (3 hrs)",
"Natural Science with Lab I",
"Natural Science with Lab II",
"MATH 167 – Business Mathematics",
"MATH 267 – Business Calculus I",
"ECON 202 – Principles of Microeconomics",
"ECON 203 – Principles of Macroeconomics",
],
"B.B.A. Core Requirements": [
"ACCY 201 – Accounting I",
"ACCY 202 – Accounting II",
"BUS 250 – Legal Environment of Business",
"BUS 271 – Business Communication",
"BUS/ECON 230 – Economic Statistics I",
"MKTG 351 – Principles of Marketing",
"FIN 331 – Principles of Finance",
"MGMT 371 – Principles of Management",
"ECON/BUS 302 – Economic Statistics II",
"MKTG 372 – Intro to Operations and Supply Chain Management",
"BAIS 309 – Business Analytics and Information Systems",
"MGMT 493 – Management of Strategic Planning",
"300+ Elective (3 hrs)",
"300+ Business Elective I (3 hrs)",
"300+ Business Elective II (3 hrs)",
],
"Major Requirements": [
"BAIS Major Elective I (3 hrs)",
"BAIS Major Elective II (3 hrs)",
"BAIS Major Elective III (3 hrs)",
"BAIS Major Elective IV (3 hrs)",
"BAIS Major Elective V (3 hrs)",
"BAIS Major Elective VI (3 hrs)",
"BAIS Major Elective VII (3 hrs)",
"BAIS Major Elective VIII (3 hrs)",
],
},
}
# ── Session state init ─────────────────────────────────────────────────────────
if "selected_major" not in st.session_state:
st.session_state.selected_major = None
if "completed" not in st.session_state:
st.session_state.completed = {}
if "grades" not in st.session_state:
st.session_state.grades = {}
# ── Header ─────────────────────────────────────────────────────────────────────
st.markdown("""
<div class="hero">
<h1>πŸŽ“ Ole Miss <span class="accent">Degree Planner</span></h1>
<p>University of Mississippi Β· School of Business Β· Track your progress toward graduation</p>
</div>
""", unsafe_allow_html=True)
# ── Major Selection ────────────────────────────────────────────────────────────
col_sel, col_info = st.columns([2, 1])
with col_sel:
major_choice = st.selectbox(
"Select Your Major",
options=["β€” Choose a major β€”"] + list(MAJORS.keys()),
key="major_dropdown"
)
if major_choice == "β€” Choose a major β€”":
st.info("πŸ‘† Select your major above to get started.")
st.stop()
# Reset completed/grades when major changes
if st.session_state.selected_major != major_choice:
st.session_state.selected_major = major_choice
st.session_state.completed = {}
st.session_state.grades = {}
major_data = MAJORS[major_choice]
all_courses = [c for cats in major_data.values() for c in cats]
# Quick stats
total_courses = len(all_courses)
completed_keys = [k for k, v in st.session_state.completed.items() if v]
num_done = len(completed_keys)
num_remaining = total_courses - num_done
hrs_done = num_done * 3
hrs_remaining = num_remaining * 3
with col_info:
st.markdown(f"""
<div class="stat-box" style="margin-top:1.6rem;">
<div class="stat-num">{num_done}/{total_courses}</div>
<div class="stat-lbl">Courses Completed</div>
</div>
""", unsafe_allow_html=True)
# ── Tabs ───────────────────────────────────────────────────────────────────────
tab1, tab2, tab3 = st.tabs(["πŸ“‹ Course Checklist", "πŸ“Œ Remaining Courses", "πŸ“Š GPA Calculator"])
# ══════════════════════════════════════════════════════════════════════════════
# TAB 1 – CHECKLIST
# ══════════════════════════════════════════════════════════════════════════════
with tab1:
st.markdown("**Check off every course you have already completed. Then enter your grade.**")
st.markdown('<hr class="divider">', unsafe_allow_html=True)
for category, courses in major_data.items():
cat_done = sum(1 for c in courses if st.session_state.completed.get(c, False))
cat_total = len(courses)
st.markdown(f"""
<div class="card-header">
{category}
<span class="badge-done">{cat_done} done</span>
<span class="badge-remaining">{cat_total - cat_done} left</span>
</div>
""", unsafe_allow_html=True)
for course in courses:
c1, c2 = st.columns([3, 1])
with c1:
checked = st.checkbox(
course,
key=f"chk_{course}",
value=st.session_state.completed.get(course, False)
)
st.session_state.completed[course] = checked
with c2:
if checked:
grade = st.selectbox(
"Grade",
options=list(GRADE_MAP.keys()),
key=f"grade_{course}",
index=list(GRADE_MAP.keys()).index(
st.session_state.grades.get(course, "A")
),
label_visibility="collapsed"
)
st.session_state.grades[course] = grade
st.markdown("<br>", unsafe_allow_html=True)
# ══════════════════════════════════════════════════════════════════════════════
# TAB 2 – REMAINING COURSES
# ══════════════════════════════════════════════════════════════════════════════
with tab2:
remaining_by_cat = {}
done_by_cat = {}
for category, courses in major_data.items():
rem = [c for c in courses if not st.session_state.completed.get(c, False)]
done = [c for c in courses if st.session_state.completed.get(c, False)]
remaining_by_cat[category] = rem
done_by_cat[category] = done
total_rem = sum(len(v) for v in remaining_by_cat.values())
if total_rem == 0:
st.success("πŸŽ‰ Congratulations! You've completed all course requirements for this major!")
else:
st.markdown(f"You have **{total_rem} courses** ({total_rem * 3} credit hours) remaining.")
st.markdown('<hr class="divider">', unsafe_allow_html=True)
for category, rem_courses in remaining_by_cat.items():
done_courses = done_by_cat[category]
if not rem_courses and not done_courses:
continue
st.markdown(f"""
<div class="card-header">
{category}
<span class="badge-remaining">{len(rem_courses)} remaining</span>
</div>
""", unsafe_allow_html=True)
pills_html = ""
for c in rem_courses:
pills_html += f'<span class="course-pill">{c}</span>'
for c in done_courses:
pills_html += f'<span class="course-pill done">βœ“ {c}</span>'
st.markdown(pills_html, unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
# Summary stats row
c1, c2, c3 = st.columns(3)
c1.markdown(f'<div class="stat-box"><div class="stat-num">{num_done}</div><div class="stat-lbl">Completed</div></div>', unsafe_allow_html=True)
c2.markdown(f'<div class="stat-box"><div class="stat-num">{total_rem}</div><div class="stat-lbl">Remaining</div></div>', unsafe_allow_html=True)
c3.markdown(f'<div class="stat-box"><div class="stat-num">{total_rem * 3}</div><div class="stat-lbl">Hours Left</div></div>', unsafe_allow_html=True)
# ══════════════════════════════════════════════════════════════════════════════
# TAB 3 – GPA CALCULATOR
# ══════════════════════════════════════════════════════════════════════════════
with tab3:
graded_courses = [
c for c in completed_keys
if st.session_state.grades.get(c) in GRADE_MAP
and GRADE_MAP[st.session_state.grades.get(c)] is not None
]
if not graded_courses:
st.info("✏️ Complete courses and enter grades in the **Course Checklist** tab to see your GPA here.")
else:
total_points = sum(GRADE_MAP[st.session_state.grades[c]] for c in graded_courses)
gpa = total_points / len(graded_courses)
# GPA color
if gpa >= 3.5:
gpa_status = "Dean's List πŸ†"
elif gpa >= 3.0:
gpa_status = "Good Standing πŸ‘"
elif gpa >= 2.0:
gpa_status = "Satisfactory βœ“"
else:
gpa_status = "Below Minimum ⚠️"
col_gpa, col_breakdown = st.columns([1, 2])
with col_gpa:
st.markdown(f"""
<div class="gpa-badge">
<div class="gpa-number">{gpa:.2f}</div>
<div class="gpa-label">Cumulative GPA</div>
<div style="color:var(--gold); font-size:0.9rem; margin-top:0.5rem; font-weight:600;">{gpa_status}</div>
<div style="color:rgba(255,255,255,0.6); font-size:0.75rem; margin-top:0.3rem;">Based on {len(graded_courses)} graded course(s)</div>
</div>
""", unsafe_allow_html=True)
with col_breakdown:
st.markdown('<div class="card-header">Grade Breakdown</div>', unsafe_allow_html=True)
grade_counts = {}
for c in graded_courses:
g = st.session_state.grades[c]
grade_counts[g] = grade_counts.get(g, 0) + 1
for grade, count in sorted(grade_counts.items()):
pct = count / len(graded_courses)
bar_color = {"A": "#16A34A", "B": "#2563EB", "C": "#D97706", "D": "#EA580C", "F": "#DC2626"}.get(grade, "#6B7280")
st.markdown(f"""
<div style="display:flex; align-items:center; gap:0.75rem; margin-bottom:0.5rem;">
<span style="width:1.5rem; font-weight:700; color:var(--navy);">{grade}</span>
<div style="flex:1; background:#E5E7EB; border-radius:99px; height:12px; overflow:hidden;">
<div style="width:{pct*100:.0f}%; background:{bar_color}; height:100%; border-radius:99px;"></div>
</div>
<span style="font-size:0.85rem; color:var(--muted);">{count} course(s)</span>
</div>
""", unsafe_allow_html=True)
st.markdown('<hr class="divider">', unsafe_allow_html=True)
st.markdown("**Course-by-Course Detail**")
for c in graded_courses:
g = st.session_state.grades[c]
pts = GRADE_MAP[g]
st.markdown(f"""
<div style="display:flex; justify-content:space-between; padding:0.25rem 0; border-bottom:1px solid var(--border); font-size:0.85rem;">
<span style="color:var(--text);">{c}</span>
<span style="font-weight:700; color:var(--navy);">{g} ({pts:.1f})</span>
</div>
""", unsafe_allow_html=True)
st.markdown("<br>", unsafe_allow_html=True)
st.markdown("""
<div style="background:#FEF3C7; border:1px solid #F59E0B; border-radius:8px; padding:0.75rem 1rem; font-size:0.82rem; color:#92400E;">
⚠️ <strong>Note:</strong> A minimum 2.0 GPA is required for graduation. All 300+ level courses must be taken in residence at UM.
</div>
""", unsafe_allow_html=True)
# ── Footer ─────────────────────────────────────────────────────────────────────
st.markdown('<hr class="divider">', unsafe_allow_html=True)
st.markdown("""
<div style="text-align:center; color:#9CA3AF; font-size:0.78rem; padding:0.5rem 0;">
University of Mississippi Β· School of Business Administration Β· Degree requirements effective Fall 2025 – Summer 2026<br>
Always verify requirements with your academic advisor.
</div>
""", unsafe_allow_html=True)