def schedule_composition(row):
    """Takes in a series with $id and \*_ScheduleDay_Name values and return an
    array of dict of the form {'$ref': ref}

    Args:
        row (pandas.Series): a row

    Returns:
        list: list of dicts
    """
    # Assumes 7 days
    day_schedules = []
    days = [
        "Monday_ScheduleDay_Name",
        "Tuesday_ScheduleDay_Name",
        "Wednesday_ScheduleDay_Name",
        "Thursday_ScheduleDay_Name",
        "Friday_ScheduleDay_Name",
        "Saturday_ScheduleDay_Name",
        "Sunday_ScheduleDay_Name",
    ]  # With weekends last (as defined in
    # umi-template)
    # Let's start with the `Outside_Layer`
    for day in days:
        try:
            ref = row["$id", day]
        except:
            pass
        else:
            day_schedules.append({"$ref": str(int(ref))})
    return day_schedules