import re


def create_target_population(cov_pop_burden_df, param_df, index):
    """Adds a new column to cov_pop_burden_df which is the target population
       Inputs:
           cov_pop_burden_df - a df which must contain 'incidence_number' and 
               'pop_0-0' columns
           param_df - a df of parameters which must contain the column 'intervention_type'
               where all of the values are 'Therapeutic', 'Diagnostic' or 'Vaccine'
           index - a string that is one of the indexes of param_df
       Returns:
           a cov_pop_burden_df with target_pop column added
    """
    intervention_type = param_df.loc[index, 'intervention_type'] 
    # Select incidence as the target population if it is a therapeutic or diagnostic   
    if re.search('Therapeutic', intervention_type):
        cov_pop_burden_df['target_pop'] = cov_pop_burden_df['incidence_number']
    elif intervention_type in ['Device', 'Rapid diagnostic test']:
        cov_pop_burden_df['target_pop'] = cov_pop_burden_df['incidence_number']
    # Select population column if it is a vaccine 
    #~ This assumes it is an infant vaccination
    elif param_df.loc[index, 'intervention_type'] == 'Vaccine':
        cov_pop_burden_df['target_pop'] = cov_pop_burden_df['pop_0-0']
    else:
        raise ValueError('The value of intervention_type for is not valid')
    return cov_pop_burden_df