TrialPath / app /components /progress_tracker.py
yakilee's picture
style: apply ruff format to entire codebase
e46883d
"""Journey state progress indicator component."""
from __future__ import annotations
from app.services.state_manager import JOURNEY_STATES
_STEP_LABELS = {
"INGEST": "Upload Documents",
"PRESCREEN": "Review Profile",
"VALIDATE_TRIALS": "Trial Matching",
"GAP_FOLLOWUP": "Gap Analysis",
"SUMMARY": "Summary & Export",
}
def render_progress_tracker(current_state: str) -> dict:
"""Produce a render-spec dict for the journey progress indicator."""
current_idx = JOURNEY_STATES.index(current_state) if current_state in JOURNEY_STATES else 0
steps = []
for i, state in enumerate(JOURNEY_STATES):
if i < current_idx:
status = "completed"
elif i == current_idx:
status = "current"
else:
status = "upcoming"
steps.append(
{
"state": state,
"label": _STEP_LABELS[state],
"status": status,
}
)
return {
"steps": steps,
"current_index": current_idx,
}