-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
146 lines (127 loc) · 4.74 KB
/
app.py
File metadata and controls
146 lines (127 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import streamlit as st
import time
from datetime import datetime, timedelta
import traceback
import sys
import os
# Set page config with white background
st.set_page_config(
page_title="College Result Manager",
page_icon="📊",
layout="wide",
initial_sidebar_state="expanded"
)
# Maintenance mode control - Set to False for live app
MAINTENANCE_MODE = False
# Initialize session state for data storage
if 'stored_data' not in st.session_state:
st.session_state.stored_data = {}
def save_data(path, info):
"""Save data to session state"""
st.session_state.stored_data[path] = info
def load_data(path):
"""Load data from session state"""
return st.session_state.stored_data.get(path, [])
def show_maintenance_page():
st.title("🔧 College Result Management System")
st.markdown("---")
# Maintenance message with styling
st.markdown(
"""
<div style='
background: linear-gradient(135deg, #ff6b6b, #feca57);
padding: 2rem;
border-radius: 10px;
text-align: center;
color: white;
margin: 2rem 0;
'>
<h1 style='color: white; margin-bottom: 1rem;'>🚧 Under Maintenance 🚧</h1>
<p style='font-size: 1.2rem;'>
Our application is currently undergoing maintenance to improve your experience.
</p>
<p style='font-size: 1.2rem;'>
Please check back later. We apologize for any inconvenience.
</p>
</div>
""",
unsafe_allow_html=True
)
# Set maintenance end time
maintenance_end = datetime.now() + timedelta(hours=2)
# Display static countdown
time_left = maintenance_end - datetime.now()
hours, remainder = divmod(time_left.seconds, 3600)
minutes, seconds = divmod(remainder, 60)
st.info(f"Estimated time until maintenance completes: {hours:02d}:{minutes:02d}:{seconds:02d}")
st.markdown("---")
st.markdown("""
<div style="text-align: center; color: #666; font-size: 0.9em;">
<p>Developed by Shreyash Patil | Analytics Dashboard</p>
</div>
""", unsafe_allow_html=True)
def show_main_app():
try:
# Try to import page modules
try:
# Add the pages directory to Python path
pages_dir = os.path.join(os.path.dirname(__file__), 'pages')
if pages_dir not in sys.path:
sys.path.append(pages_dir)
# Import all page modules
from pages import upload_pdf, dashboard, top_students, division_analysis, pass_fail_analysis, subject_analysis, student_search, excel_report
except ImportError as e:
st.error(f"Error importing page modules: {str(e)}")
st.info("Please make sure all page files exist in the 'pages' directory")
return
st.title("🎓 College Result Management System")
st.markdown("---")
st.sidebar.title("Navigation")
menu_options = [
"Upload PDF",
"Performance Dashboard",
"View Top Students",
"Division Analysis",
"Pass/Fail Analysis",
"Subject-wise Analysis",
"Student Search",
"Generate Excel Report"
]
choice = st.sidebar.selectbox("Select Option", menu_options)
# Route to the appropriate page with error handling
try:
if choice == "Upload PDF":
upload_pdf.show()
elif choice == "Performance Dashboard":
dashboard.show()
elif choice == "View Top Students":
top_students.show()
elif choice == "Division Analysis":
division_analysis.show()
elif choice == "Pass/Fail Analysis":
pass_fail_analysis.show()
elif choice == "Subject-wise Analysis":
subject_analysis.show()
elif choice == "Student Search":
student_search.show()
elif choice == "Generate Excel Report":
excel_report.show()
except Exception as e:
st.error(f"Error in {choice} page: {str(e)}")
st.code(traceback.format_exc())
st.markdown("---")
st.markdown("""
<div style="text-align: center; color: #666; font-size: 0.9em;">
<p>Developed by Shreyash Patil | Analytics Dashboard</p>
</div>
""", unsafe_allow_html=True)
except Exception as e:
st.error("A critical error occurred in the application")
st.code(traceback.format_exc())
def main():
if MAINTENANCE_MODE:
show_maintenance_page()
else:
show_main_app()
if __name__ == '__main__':
main()