Files
hiffi-artist-intelligence/scripts/apply_catalog_intelligence_tiers.py
T

32 lines
917 B
Python
Raw Normal View History

import os
import pandas as pd
DATA_DIR = "data"
SALES_PATH = os.path.join(DATA_DIR, "master_sales_17k_verified.csv")
OUTPUT_PATH = os.path.join(DATA_DIR, "master_artists_intelligence_17k.csv")
df = pd.read_csv(SALES_PATH)
def assign_tier(row):
prov = str(row.get("provenance", ""))
units = row.get("audited_sales_units", 0)
if prov == "VERIFIED_CSPC":
return "TIER_1_GLOBAL_SUPERSTAR_CSPC"
elif prov == "VERIFIED_RIAA":
if pd.notna(units) and units >= 10_000_000:
return "TIER_2A_MAJOR_COMMERCIAL_CORE"
return "TIER_2B_CERTIFIED_CATALOG"
# Provenance UNVERIFIED_NO_RECORDS
return "TIER_3_UNAUDITED_DIGITAL_CATALOG"
df["catalog_intelligence_tier"] = df.apply(assign_tier, axis=1)
print("--- CATALOG INTELLIGENCE TIER DISTRIBUTION ---")
print(df["catalog_intelligence_tier"].value_counts())
df.to_csv(OUTPUT_PATH, index=False)
print(f"\nFinal catalog exported to: {OUTPUT_PATH}")