From 732e48bd1e5b540beb2c53971d53d5306df3810a Mon Sep 17 00:00:00 2001 From: Pratham Soni Date: Mon, 1 Jul 2024 10:16:04 -0500 Subject: [PATCH] Changed hard coding for selectbox to mapping in dictionary --- streamlit/interface_2.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/streamlit/interface_2.py b/streamlit/interface_2.py index e11ceec..a81cbaa 100644 --- a/streamlit/interface_2.py +++ b/streamlit/interface_2.py @@ -195,6 +195,35 @@ if client: cur.execute(query) df2 = pd.DataFrame.from_records(iter(cur), columns=[x[0] for x in cur.description]) + + # Changed To Dictionary Mapping for Faster Runtime (Replace with above code when using more fields) + + # Define the mapping + # field_group_mapping = { + # 'Unique Key': ('A', None, None), + # 'Contract Related': ('C', None, None), + # 'Pricing Before Carveouts - I': ('B', 2, 0), + # 'Pricing Before Carveouts - II': ('B', 2, 1), + # 'Carveout Indicator, Code Type and Code #s - I': ('F', 3, 0), + # 'Carveout Indicator, Code Type and Code #s - II': ('F', 3, 1), + # 'Carveout Indicator, Code Type and Code #s - III': ('F', 3, 2), + # 'Carveout Methodology - I': ('G', 4, 0), + # 'Carveout Methodology - II': ('G', 4, 1), + # 'Carveout Method - III': ('G', 4, 2), + # 'Carveout Method - IV': ('G', 4, 3), + # 'Provider': ('D', None, None), + # 'Timeline': ('E', None, None) + # } + + # # Get the mapping for the current field group + # priority, split, index = field_group_mapping.get(field_group, (None, None, None)) + + # if priority: + # fields = fields[fields['PRIORITY'] == priority] + # if split is not None and index is not None: + # fields = np.array_split(fields, split)[index] + + button_cols = st.columns([1,2,6]) with button_cols[0]: if st.button("Show PDF"):