def parse_family_data(controls):
    """ingest control data to return family_id_to_controls mapping and family_id_to_name mapping"""
    id_to_family = re.compile(r"(\w+)-.*")

    family_id_to_controls = {}  # family ID to control object
    family_id_to_name = {}
    for control in controls:
        if control["type"] != "course-of-action":
            # skip any object that if is not a mitigation
            continue
        # parse family ID from control external ID
        family_id = id_to_family.search(control["external_references"][0]["external_id"]).groups()[0]
        if family_id not in family_id_to_controls:
            family_id_to_controls[family_id] = [control]
        else:
            family_id_to_controls[family_id].append(control)
        # parse family name if possible, or just use family ID if not
        if "x_mitre_family" in control:
            family_id_to_name[family_id] = control["x_mitre_family"]
        else:
            family_id_to_name[family_id] = family_id

    return family_id_to_controls, family_id_to_name, id_to_family
ingest control data to return family_id_to_controls mapping and family_id_to_name mapping
src/mappings_to_heatmaps.py