Changed hard coding for selectbox to mapping in dictionary

This commit is contained in:
Pratham Soni
2024-07-01 10:16:04 -05:00
committed by Michael McGuinness
parent d8aa2c8354
commit 732e48bd1e
+29
View File
@@ -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"):