"""Main entry point for the Artist Roster Streamlit app - redirects to Roster View.""" import os import streamlit as st # Page config st.set_page_config( page_title="Artist Roster Management", page_icon="đŸŽĩ", layout="wide", initial_sidebar_state="expanded", ) # Auto-redirect to Roster View on first visit if "visited_main" not in st.session_state: st.session_state.visited_main = True st.switch_page("pages/roster_view.py") # If user explicitly navigated to main page, show Info & Help st.title("â„šī¸ Info & Help") st.write("Artist Roster Management - User Guide") # Environment indicator env = os.getenv("TARGET_ENV", "prod") if env == "qa": st.warning("âš ī¸ This is the QA/DEVELOPMENT version of the tool") else: st.info("â„šī¸ This is the PRODUCTION version of the tool") st.divider() # Welcome message st.markdown( """ ## Welcome to the Artist Roster Management App This application allows you to **view**, **add**, and **delete** artists from vendor rosters in Snowflake. ### Features 📋 **View Rosters** - Search across all roster tables (MAIN_REP, LOCAL_REP, ARTIST_ROSTER) - Filter by vendor ID/name, artist UUID/name, and subaccount - Pagination for large result sets - Compact table view with action buttons ➕ **Add Artists** - Add artists to appropriate roster tables - Automatic brand detection (SME vs non-SME) - Country search by name with validation (ISO 2-letter codes) - Duplicate prevention using MERGE queries - Support for MAIN_REP, LOCAL_REP, and ARTIST_ROSTER tables đŸ—‘ī¸ **Delete Artists** - Remove artists from roster tables - For MAIN_REP and ARTIST_ROSTER: single delete button - For LOCAL_REP with multiple countries: - Delete all countries at once - Or select specific country to delete - Confirmation dialog before deletion - Works with transaction safety ### Roster Tables **ARTIST_ROSTER_MAIN_REP** (SME brands) - Main representative assignments - Includes STATUS and IS_ARTIST_TEAM fields - Unique key: (Vendor, Artist, Subaccount) **ARTIST_ROSTER_LOCAL_REP** (SME brands) - Territory-specific representatives - Requires COUNTRY_CODE (ISO 2-letter) - Unique key: (Vendor, Artist, Subaccount, Country) - Multiple countries per artist supported **ARTIST_ROSTER** (Non-SME brands) - For vendors without Sony Music brand classification - Unique key: (Vendor, Artist, Subaccount) ### Brand Classification The app automatically detects brand type by checking vendor's brand association: - **SME (Sony Music Entertainment)**: Vendors with "Sony Music" brand - Can use MAIN_REP or LOCAL_REP tables - Main rep = primary global representative - Local rep = territory-specific representative - **Non-SME**: All other vendors - Can only use ARTIST_ROSTER table - Simpler structure without rep types Brand rules are strictly enforced to maintain data consistency. ### Data Sources - **Roster Tables**: `fansifter_app_reporting.{qa|prod}.ARTIST_ROSTER_*` - **Vendor Lookup**: `orchard_app_reporting.delphi_prod.VENDOR` - **Artist Lookup**: `orchard_app_reporting.delphi_prod.GLOBAL_PARTICIPANT` - **Brand Lookup**: `orchard_app_reporting.delphi_prod.COMPANY_BRAND` ### Getting Started Use the sidebar navigation to: 1. **📋 Roster View** - Search, view, and delete roster entries (default page) 2. **➕ Add Artist** - Add new artists to roster tables ### Safety Features - **QA Schema by default**: All writes go to QA unless explicitly configured for PROD - **PROD writes blocked**: Extra safety layer requires environment variable to enable PROD writes - **Duplicate prevention**: MERGE queries prevent accidental duplicates - **Confirmation dialogs**: All delete operations require user confirmation - **Session state persistence**: Form fields preserved during navigation ### Support For questions or issues, contact the Fansifter engineering team. """ )