from typing import OrderedDict


def regional_timeseries_analysis(df, region):
    """
    regional time series analysis of ISM table
    Parameters
    ----------
    df: pandas.DataFrame
        Pandas dataframe containing ISM column
    region: str
        region of interest, corresponding to the 'country/region' column in ISM table
    Returns
    -------
    dict_freq: dictionary
        ISM frequency of a region of interest over time
    """
    df_tmp = df[df['country/region'] == region]
    total = df_tmp.sum()['count']
    ISM_list = list(df_tmp['ISM'].values)
    dict_freq = OrderedDict() 
    for ISM in ISM_list:
        freq = df_tmp[df_tmp['ISM'] == ISM]['count'].values[0]
        dict_freq[ISM] = str(freq)
    return dict_freq