Spaces:
Sleeping
Sleeping
fixed path bug
Browse files
src/dashboard/pages/2_Ripeness_Classifier.py
CHANGED
|
@@ -220,11 +220,20 @@ with tab2:
|
|
| 220 |
today = date.today()
|
| 221 |
filed_date = today - timedelta(days=case_age)
|
| 222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
test_case = Case(
|
| 224 |
case_id=case_id,
|
| 225 |
case_type=case_type,
|
| 226 |
filed_date=filed_date,
|
| 227 |
-
current_stage=
|
| 228 |
status=CaseStatus.PENDING,
|
| 229 |
)
|
| 230 |
|
|
@@ -247,6 +256,36 @@ with tab2:
|
|
| 247 |
st.markdown(f":{color}[**{status.value}**]")
|
| 248 |
st.caption(reason)
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
with tab3:
|
| 251 |
st.markdown("### Batch Classification Analysis")
|
| 252 |
|
|
|
|
| 220 |
today = date.today()
|
| 221 |
filed_date = today - timedelta(days=case_age)
|
| 222 |
|
| 223 |
+
# Map UI-friendly stage labels to classifier's internal stage names
|
| 224 |
+
stage_map = {
|
| 225 |
+
"PRE-TRIAL": "ADMISSION", # early-stage administrative
|
| 226 |
+
"TRIAL": "EVIDENCE", # substantive stage
|
| 227 |
+
"POST-TRIAL": "ORDERS / JUDGMENT", # arguments/orders phase
|
| 228 |
+
"FINAL DISPOSAL": "FINAL DISPOSAL",
|
| 229 |
+
}
|
| 230 |
+
classifier_stage = stage_map.get(case_stage, case_stage)
|
| 231 |
+
|
| 232 |
test_case = Case(
|
| 233 |
case_id=case_id,
|
| 234 |
case_type=case_type,
|
| 235 |
filed_date=filed_date,
|
| 236 |
+
current_stage=classifier_stage,
|
| 237 |
status=CaseStatus.PENDING,
|
| 238 |
)
|
| 239 |
|
|
|
|
| 256 |
st.markdown(f":{color}[**{status.value}**]")
|
| 257 |
st.caption(reason)
|
| 258 |
|
| 259 |
+
# Debug details to explain classification
|
| 260 |
+
with st.expander("Why this classification? (debug)"):
|
| 261 |
+
thresholds = RipenessClassifier.get_current_thresholds()
|
| 262 |
+
service_ok = service_hearings_count >= thresholds[
|
| 263 |
+
"MIN_SERVICE_HEARINGS"
|
| 264 |
+
] or bool(test_case.last_hearing_purpose)
|
| 265 |
+
compliance_ok = (
|
| 266 |
+
classifier_stage not in RipenessClassifier.UNRIPE_STAGES
|
| 267 |
+
or days_in_stage >= thresholds["MIN_STAGE_DAYS"]
|
| 268 |
+
)
|
| 269 |
+
age_ok = case_age >= thresholds["MIN_CASE_AGE_DAYS"]
|
| 270 |
+
|
| 271 |
+
st.write(
|
| 272 |
+
{
|
| 273 |
+
"ui_stage": case_stage,
|
| 274 |
+
"classifier_stage": classifier_stage,
|
| 275 |
+
"hearing_count": service_hearings_count,
|
| 276 |
+
"days_in_stage": int(days_in_stage),
|
| 277 |
+
"age_days": int(case_age),
|
| 278 |
+
"last_hearing_purpose": test_case.last_hearing_purpose,
|
| 279 |
+
"evidence": {
|
| 280 |
+
"service_ok": service_ok,
|
| 281 |
+
"compliance_ok": compliance_ok,
|
| 282 |
+
"age_ok": age_ok,
|
| 283 |
+
"all_ok": service_ok and compliance_ok and age_ok,
|
| 284 |
+
},
|
| 285 |
+
"thresholds": thresholds,
|
| 286 |
+
}
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
with tab3:
|
| 290 |
st.markdown("### Batch Classification Analysis")
|
| 291 |
|
src/dashboard/pages/3_Simulation_Workflow.py
CHANGED
|
@@ -16,9 +16,9 @@ import pandas as pd
|
|
| 16 |
import plotly.express as px
|
| 17 |
import streamlit as st
|
| 18 |
|
| 19 |
-
from cli import __version__ as CLI_VERSION
|
| 20 |
from src.output.cause_list import CauseListGenerator
|
| 21 |
|
|
|
|
| 22 |
# Page configuration
|
| 23 |
st.set_page_config(
|
| 24 |
page_title="Simulation Workflow",
|
|
|
|
| 16 |
import plotly.express as px
|
| 17 |
import streamlit as st
|
| 18 |
|
|
|
|
| 19 |
from src.output.cause_list import CauseListGenerator
|
| 20 |
|
| 21 |
+
CLI_VERSION = "1.0.0"
|
| 22 |
# Page configuration
|
| 23 |
st.set_page_config(
|
| 24 |
page_title="Simulation Workflow",
|