import streamlit as st from app_config import AppConfig # Import the configurations class from data_processor import DataProcessor # Import the data analysis class from visualization import Visualization # Import the data viz class from ai_analysis import AIAnalysis # Import the ai analysis class from sidebar import Sidebar # Import the Sidebar class def main(): # Initialize the app configuration app_config = AppConfig() # Initialize the sidebar sidebar = Sidebar() sidebar.display() # Initialize the data processor data_processor = DataProcessor() # Initialize the visualization handler visualization = Visualization() # Initialize the AI analysis handler ai_analysis = AIAnalysis(data_processor.client) st.title("Intervention Program Analysis") # File uploader uploaded_file = st.file_uploader("Upload your Excel file", type=["xlsx"]) if uploaded_file is not None: try: # Read the Excel file into a DataFrame df = data_processor.read_excel(uploaded_file) # Format the session data df = data_processor.format_session_data(df) # Replace student names with initials df = data_processor.replace_student_names_with_initials(df) st.subheader("Uploaded Data") st.write(df) # Ensure expected column is available if DataProcessor.INTERVENTION_COLUMN not in df.columns: st.error(f"Expected column '{DataProcessor.INTERVENTION_COLUMN}' not found.") return # Compute Intervention Session Statistics intervention_stats = data_processor.compute_intervention_statistics(df) st.subheader("Intervention Session Statistics") st.write(intervention_stats) # Plot and download intervention statistics # intervention_fig = visualization.plot_intervention_statistics(intervention_stats) # visualization.download_chart(intervention_fig, "intervention_statistics_chart.png") # Plot and download intervention statistics: Two-column layout for the visualization and intervention frequency col1, col2 = st.columns([3, 1]) # Set the column width ratio with col1: intervention_fig = visualization.plot_intervention_statistics(intervention_stats) with col2: intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0] # Display the "Intervention Frequency (%)" text st.markdown("