Spaces:
Sleeping
Sleeping
File size: 7,406 Bytes
cecefdc 7a39bba cecefdc db7ca89 cecefdc 6a28f91 cecefdc f6c65ef cecefdc f6c65ef 7a39bba cecefdc 7a39bba f6c65ef cecefdc f6c65ef cecefdc f6c65ef cecefdc f6c65ef 7a39bba cecefdc db7ca89 f6c65ef db7ca89 cecefdc f6c65ef cecefdc f6c65ef cecefdc f6c65ef cecefdc f6c65ef cecefdc f6c65ef cecefdc f6c65ef cecefdc f6c65ef cecefdc db7ca89 7a39bba f6c65ef db7ca89 f6c65ef 7a39bba f6c65ef 7a39bba f6c65ef 7a39bba f6c65ef 7a39bba f6c65ef 7a39bba f6c65ef 7a39bba f6c65ef db7ca89 f6c65ef 9eaac57 db7ca89 cecefdc f6c65ef 7a39bba f6c65ef cecefdc f6c65ef 7a39bba f6c65ef 7a39bba f6c65ef 9eaac57 f6c65ef 7a39bba cecefdc f6c65ef 7a39bba f6c65ef 7a39bba cecefdc f6c65ef 9eaac57 |
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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
"""Main dashboard application for Court Scheduling System.
This is the entry point for the Streamlit multi-page dashboard.
Launch with: uv run court-scheduler dashboard (or `streamlit run` directly)
"""
from __future__ import annotations
import streamlit as st
from src.dashboard.utils import get_data_status
# Page configuration
st.set_page_config(
page_title="Court Scheduling System Dashboard",
page_icon="scales",
layout="wide",
initial_sidebar_state="expanded",
)
# Main page content
st.title("Court Scheduling System Dashboard")
st.markdown(
"**Karnataka High Court - Algorithmic Decision Support for Fair Scheduling**"
)
st.markdown("---")
# Introduction
st.markdown(
"""
### Overview
This system provides data-driven scheduling recommendations while maintaining judicial control and autonomy.
**Key Capabilities:**
- Historical data analysis and pattern identification
- Case ripeness classification (identifying bottlenecks)
- Multi-courtroom scheduling simulation
- Algorithmic suggestions with full explainability
- Judge override and approval system
- Reinforcement learning optimization
Use the sidebar to navigate between sections.
"""
)
# System status
status_header_col1, status_header_col2 = st.columns([3, 1])
with status_header_col1:
st.markdown("### System Status")
with status_header_col2:
if st.button("Refresh Status", use_container_width=True):
st.rerun()
data_status = get_data_status()
col1, col2, col3 = st.columns(3)
with col1:
status = "Ready" if data_status["cleaned_data"] else "Missing"
color = "green" if data_status["cleaned_data"] else "red"
st.markdown(f":{color}[{status}] **Cleaned Data**")
if not data_status["cleaned_data"]:
st.caption("Run EDA pipeline to process raw data")
with col2:
status = "Ready" if data_status["parameters"] else "Missing"
color = "green" if data_status["parameters"] else "red"
st.markdown(f":{color}[{status}] **Parameters**")
if not data_status["parameters"]:
st.caption("Run EDA pipeline to extract parameters")
with col3:
status = "Ready" if data_status["eda_figures"] else "Missing"
color = "green" if data_status["eda_figures"] else "red"
st.markdown(f":{color}[{status}] **Analysis Figures**")
if not data_status["eda_figures"]:
st.caption("Run EDA pipeline to generate visualizations")
# Setup Controls
eda_ready = (
data_status["cleaned_data"]
and data_status["parameters"]
and data_status["eda_figures"]
)
if not eda_ready:
st.markdown("---")
st.markdown("### Initial Setup")
st.warning(
"Run the EDA pipeline to process historical data and extract parameters."
)
col1, col2 = st.columns([2, 1])
with col1:
st.markdown(
"""
The EDA pipeline:
- Loads and cleans historical court case data
- Extracts statistical parameters (distributions, transition probabilities)
- Generates analysis visualizations
This is required before using other dashboard features.
"""
)
with col2:
if st.button("Run EDA Pipeline", type="primary", use_container_width=True):
from eda.load_clean import run_load_and_clean
from eda.exploration import run_exploration
from eda.parameters import run_parameter_export
with st.spinner("Running EDA pipeline... This may take a few minutes."):
try:
# Step 1: Load & clean data
run_load_and_clean()
# Step 2: Generate visualizations
run_exploration()
# Step 3: Extract parameters
run_parameter_export()
st.success("EDA pipeline completed")
st.rerun()
except Exception as e:
st.error("Pipeline failed while running inside the dashboard.")
with st.expander("Show error details"):
st.exception(e)
with st.expander("Run manually via CLI"):
st.code("uv run court-scheduler eda", language="bash")
else:
st.success("System ready - all data processed")
# Allow user to override and re-run EDA even if it's already completed
st.markdown("\n")
if st.button("Re-run EDA Pipeline (override)", use_container_width=False):
from eda.load_clean import run_load_and_clean
from eda.exploration import run_exploration
from eda.parameters import run_parameter_export
with st.spinner("Re-running EDA pipeline... This may take a few minutes."):
try:
# Step 1: Load & clean data
run_load_and_clean()
# Step 2: Generate visualizations
run_exploration()
# Step 3: Extract parameters
run_parameter_export()
st.success("EDA pipeline re-run completed")
st.rerun()
except Exception as e:
st.error("Pipeline failed while re-running inside the dashboard.")
with st.expander("Show error details"):
st.exception(e)
st.markdown("---")
# Navigation Guide
st.markdown("### Dashboard Sections")
col1, col2 = st.columns(2)
with col1:
st.markdown(
"""
#### 1. Data & Insights
Explore historical case data, view analysis visualizations, and review extracted parameters.
#### 2. Ripeness Classifier
Test case ripeness classification with interactive threshold tuning and explainability.
#### 3. Simulation Workflow
Generate cases, configure simulation parameters, run scheduling simulations, and view results.
"""
)
with col2:
st.markdown(
"""
#### 4. Cause Lists & Overrides
View generated cause lists, make judge overrides, and track modification history.
#### 5. Scheduled Cases Explorer
Browse individual case, view status timelines, and understand scheduling decisions.
#### 6. Analytics & Reports
Compare simulation runs, analyze performance metrics, and export comprehensive reports.
"""
)
st.markdown("---")
# Typical Workflow
with st.expander("Typical Usage Workflow"):
st.markdown(
"""
**Step 1: Initial Setup**
- Run EDA pipeline to process historical data (one-time setup)
**Step 2: Understand the Data**
- Explore Data & Insights to understand case patterns
- Review extracted parameters and distributions
**Step 3: Test Ripeness Classifier**
- Adjust thresholds for your court's specific needs
- Test classification on sample cases
**Step 4: Run Simulation**
- Go to Simulation Workflow
- Generate or upload case dataset
- Configure simulation parameters
- Run simulation and review results
**Step 5: Review & Override**
- View generated cause lists in Cause Lists & Overrides
- Make judicial overrides as needed
- Approve final cause lists
**Step 6: Analyze Performance**
- Use Analytics & Reports to evaluate fairness and efficiency
- Compare different scheduling policies
- Identify bottlenecks and improvement opportunities
"""
)
# Footer
st.markdown("---")
st.caption("Court Scheduling System - Code4Change Hackathon - Karnataka High Court")
st.caption("Developed by Aalekh Roy")
|