File size: 1,774 Bytes
fd4a87f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

def render(tab, disp_sim_df, multi_model_bills):
    dispdfs_col1, dispdfs_col2 = tab.columns([1.5, 1])
    dispdfs_col1.subheader('Models & similar bills')
    dispdfs_col1.text(
        'Note 1: currently the progress columns appear to have same length, '
        'but in reality the number of versions are different per bill. '
        'I have not figured out how to make them different in Streamlit yet, if even possible.'
    )
    dispdfs_col1.text(
        'Note 2: Select one of the bill-model pair and switch to "Inspect" tab to view sentences.'
    )
    dispdfs_col1.dataframe(
        data=disp_sim_df,
        column_config={
            'source_sections': st.column_config.ListColumn(
                "model sections",
                width="medium",
            ),
            "progress_pct_src_sim": st.column_config.AreaChartColumn(
                "progess", 
                y_min=0, y_max=100
            ),
            "url": st.column_config.LinkColumn(display_text = '[Legiscan]'),
        },
        column_order=[
            'model',
            'bill',
            'version',
            '% similar',
            '# sentences',
            'progress_pct_src_sim',
            'source_sections',
            'url',
        ],
        selection_mode='single-row-required',
        key='bill_model_pair',
        on_select="rerun",
    )
    dispdfs_col2.subheader('Bills similar to more than 1 model')
    dispdfs_col2.dataframe(
        data=multi_model_bills,
        column_config={
            'model_pct_sim': st.column_config.ListColumn(
                'models & % similarity',
                width="medium",
            ),
            "url": st.column_config.LinkColumn(display_text = '[Legiscan]'),
        },
    )