from typing import Any, Dict, List import pandas as pd import streamlit as st def create_layout( result_df: pd.DataFrame, dsps: List[str], acquisition_channels: Dict[str, str] ) -> Any: """ Function to create fields and collect input from the Streamlit app :param result_df: Pandas dataframe containing related territory, label, atist and mailing list values :param dsps: list of hardcoded DSP values used for user input :param acquisition_channels: dictionary of acqusition channels and respective target> email, phone :return: Values from user input """ # upload_name = st.text_input(label="Upload name", key="upload_name") file_source_description = st.text_input( label="File Source Description", key="file_source_description" ) territory_values = result_df["TERRITORY_C"].unique() select_territory = st.selectbox( label="Territory", options=territory_values, index=None, key="territory", ) label_values = result_df[result_df["TERRITORY_C"] == select_territory][ "LABEL_NAME" ].unique() select_label = st.selectbox( label="Label", options=label_values, index=None, key="label", ) artist_values = result_df[ (result_df["TERRITORY_C"] == select_territory) & (result_df["LABEL_NAME"] == select_label) ]["ARTIST_C"].unique() select_artist = st.selectbox( label="Artist", options=artist_values, index=None, key="artist", ) mailing_list_values = result_df[ (result_df["TERRITORY_C"] == select_territory) & (result_df["LABEL_NAME"] == select_label) & (result_df["ARTIST_C"] == select_artist) ][["MAILING_LIST_NAME_C", "TLA_ID"]].drop_duplicates() select_mailing_list = st.selectbox( label="Mailing list", options=mailing_list_values["MAILING_LIST_NAME_C"].unique(), index=None, key="mailint_list", ) tla_id_value = mailing_list_values["TLA_ID"].unique() select_dsp = st.selectbox( label="DSP", options=dsps, index=None, key="dsp", ) is_crm_generated = ["No", "Yes"] select_is_crm_generated = st.selectbox( label="Is CRM generated", options=is_crm_generated, index=None, key="crm_generated", ) select_acquisition_channels = st.selectbox( label="Acquisition Channel", options=list(acquisition_channels.keys()), index=None, key="acquisition_channels", ) select_overwrite_fan_data = st.checkbox("Overwrite Fan Data") return ( file_source_description, select_acquisition_channels, select_is_crm_generated, select_dsp, select_mailing_list, select_label, select_artist, select_territory, select_overwrite_fan_data, tla_id_value, )