import re


def get_pheno_fields(participant, fields: list) -> list:
    """get a list of phenotype field names for phenotypes of interest

    Parameters
    ----------
    participant : UKB spark df
        participant df
    fields : list
        list of phenotypes of interest, numbered as in showcase

    Returns
    -------
    list
        list of field names
    """
    phenos = "|".join(fields)

    pheno_fields = list(
        participant.find_fields(lambda f: bool(re.match(f"^p({phenos})\D", f.name)))
    )

    return [f.name for f in pheno_fields]