"""Main entry point for the Artist Roster Streamlit app. Local Development Note: - Local runs are QA-only for safety (target=qa is default in Makefile) - PROD environment is accessible ONLY via Snowflake deployment """ import streamlit as st from common.environment import IS_QA # Page config st.set_page_config( page_title="Fansifter Roster Management", page_icon="đŸŽĩ", layout="wide", initial_sidebar_state="expanded", ) def info_page() -> None: """Info & Help page content.""" st.title("â„šī¸ Info & Help") st.write("Artist Roster Management - User Guide") # Environment indicator if IS_QA: st.warning("âš ī¸ NB! This is QA/DEVELOPMENT version of this tool.") else: st.caption("â„šī¸ NB! This is PROD version of this tool.") st.divider() # Welcome message st.markdown( """ ## Welcome to the Artist Roster Management App This application allows you to manage artist rosters and virtual participants in Snowflake. ### Pages 📋 **Roster View** - 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 (100 rows per page) - Delete artists with confirmation (single or per-country for LOCAL_REP) ➕ **Add Artist** - Add a single artist to the appropriate roster table - Automatic brand detection (SME → MAIN_REP/LOCAL_REP, non-SME → ARTIST_ROSTER) - Conditional fields: STATUS and IS_ARTIST_TEAM (MAIN_REP), COUNTRY_CODE (LOCAL_REP) - Duplicate prevention using MERGE queries 📤 **Bulk Add Artists** - Upload a CSV file to add multiple artists at once (max 250) - Batch validation with detailed error reporting - Progress tracking during upload - Skipped/duplicate artist tracking 👤 **Add Virtual Participant** - Create virtual participants (pending artists or custom lists) - Link virtual participants with custom lists - Supports PENDING_ARTIST and CUSTOM_LIST types âŦ†ī¸ **Upgrade Pending Artist** - Add or update a Spotify ID on a pending artist record - Spotify ID validation (URL, URI, or plain 22-char ID) - Duplicate Spotify ID prevention ### Brand Classification - **SME** (Sony Music): vendors with "Sony Music" in COMPANY_BRAND → MAIN_REP or LOCAL_REP only - **Non-SME**: all other vendors → ARTIST_ROSTER only ### Safety - Local development always targets **QA**; PROD is only accessible via Snowflake deployment - PROD writes are blocked with explicit checks - All write operations require user confirmation """ ) # Navigation pg = st.navigation( [ st.Page("pages/roster_view.py", title="Roster View", icon="📋", default=True), st.Page("pages/add_artist.py", title="Add Artist", icon="➕"), st.Page("pages/bulk_add_artist.py", title="Bulk Add Artists", icon="📤"), st.Page( "pages/add_virtual_participant.py", title="Add Virtual Participant", icon="👤", ), st.Page( "pages/upgrade_pending_artist.py", title="Upgrade Pending Artist", icon="âŦ†ī¸", ), st.Page(info_page, title="Info & Help", icon="â„šī¸"), ] ) pg.run()