File size: 1,454 Bytes
924cb7d
 
f98e92f
924cb7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""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