doctorecord / src /ui /strategy_selector.py
levalencia's picture
feat: update unique indices combinator to return array of objects
f98e92f
"""Strategy selection UI components for Streamlit."""
import streamlit as st
from typing import Dict, Any, Tuple
def render_strategy_selector() -> Tuple[str, Dict[str, Any]]:
"""Render strategy selection UI and return selected strategy and parameters."""
strategy = st.radio(
"Select Extraction Strategy",
["Original Strategy", "Unique Indices Strategy"],
help="Choose how to extract information from the document"
)
params = {}
if strategy == "Original Strategy":
params["strategy"] = "original"
params["current_field"] = st.text_input(
"Field to Extract",
help="Enter the field name to extract from the document"
)
else:
params["strategy"] = "unique_indices"
# Get unique indices
indices_input = st.text_area(
"Unique Indices",
help="Enter comma-separated list of indices to look for (e.g., 'peptide, modification, timepoint')"
)
params["unique_indices"] = [idx.strip() for idx in indices_input.split(",") if idx.strip()]
# Get fields to extract
fields_input = st.text_area(
"Fields to Extract",
help="Enter comma-separated list of fields to extract for each combination"
)
params["fields_to_extract"] = [field.strip() for field in fields_input.split(",") if field.strip()]
return strategy, params