import pandas as pd
import numpy as np
from ParaUtils import parse_WPS_rankings
from ParaUtils.Standards import LA2028_Events

from pathlib import Path
module_dir = Path(__file__).parent

def set_AWR(DF):
    CAN = DF[DF.NPC == 'CAN']
    NR4 = DF[(DF.NPC_Rank > 3) & ~DF.index.isin(CAN.index)]
    pool = DF[~(DF.index.isin(CAN.index) | DF.index.isin(NR4.index))]
    pool = pool.assign(AWR=pool.Seconds.apply(lambda S: 1+len(pool[pool.Seconds < S])))
    return (
        pd.concat([
            CAN.assign(AWR='CAN'),
            NR4.assign(AWR='NR > 3'),
            pool
        ])
        .sort_values('Seconds AWR'.split())
    )

Current_AWR = (
    pd.read_excel(module_dir / '2025 Fall Performance AWR - 2025-10-07.xlsx')
)