code: def get_highlevel_table(
      group_value_df,
      fairness_measures,
  ):
      supported_name = {
          "Statistical Parity": "[Equal Parity](#equal-parity)",
          "Impact Parity": "[Proportional Parity](#proportional-parity)",
          "TypeI Parity": "[False Positive Parity](#false-positive-parity)",
          "TypeII Parity": "[False Negative Parity](#false-negative-parity)",
      }
      supported_outcome = {
          "Statistical Parity": "Each group is represented equally.",
          "Impact Parity": "Each group is represented proportional to their representation in the overall population.",
          "TypeI Parity": "Each group has proportionally equal false positive errors made by the model.",
          "TypeII Parity": "Each group has proportionally equal false negative errors made by the model.",
      }
      supported_order = [
          "Statistical Parity",
          "Impact Parity",
          "TypeI Parity",
          "TypeII Parity",
      ]
      # once again this is hardcoded because it's easy now, in the future make it mapped automatically
  
      map_ref_groups = {
          "Statistical Parity": ["ppr_ref_group_value"],
          "Impact Parity": ["pprev_ref_group_value"],
          "TypeI Parity": [
              "fpr_ref_group_value",
              "fdr_ref_group_value",
          ],
          "TypeII Parity": [
              "fnr_ref_group_value",
              "for_ref_group_value",
          ],
      }
      key_columns = ["model_id", "score_threshold", "attribute_name"]
      fairness_measures_edited = []
      for meas in fairness_measures:
          if meas in ["FPR Parity", "FDR Parity"]:
              fairness_measures_edited.append("TypeI Parity")
          elif meas in ["FNR Parity", "FOR Parity"]:
              fairness_measures_edited.append("TypeII Parity")
          else:
              fairness_measures_edited.append(meas)
      fairness_measures_edited = set(fairness_measures_edited)
      raw = {
          "Fairness Criteria": [],
          "Desired Outcome": [],
          "Reference Groups Selected": [],
          "Unfairly Affected Groups": [],
      }
      for measure in supported_order:
          if measure in fairness_measures_edited:
              raw["Fairness Criteria"].append(supported_name[measure])
              raw["Desired Outcome"].append(supported_outcome[measure])
              false_df = group_value_df.loc[
                  group_value_df[measure] == False
              ]
              ref_dict = {}
              false_dict = {}
              for index, row in false_df.iterrows():
                  try:
                      false_dict[row["attribute_name"]].add(
                          "["
                          + row["attribute_value"]
                          + "]"
                          + supported_name[measure][
                              supported_name[measure].find("(") :
                          ]
                      )
                  except KeyError:
                      false_dict[row["attribute_name"]] = set()
                      false_dict[row["attribute_name"]].add(
                          "["
                          + row["attribute_value"]
                          + "]"
                          + supported_name[measure][
                              supported_name[measure].find("(") :
                          ]
                      )
              attr_order = []
              if len(false_dict) > 0:
                  cell = ""
                  attr_order = false_dict.keys()
                  for key in attr_order:
                      cell += "**{attribute_name}:**".format(
                          attribute_name=key
                      )
                      cell += "##br##&emsp;&emsp;&emsp;"
                      cell += (
                          "##br##&emsp;&emsp;&emsp;".join(
                              false_dict[key]
                          )
                          + " ##br##"
                      )
                  raw["Unfairly Affected Groups"].append(cell)
              else:
                  if group_value_df[measure].isnull().all():
                      raw["Unfairly Affected Groups"].append(
                          "Undefined"
                      )
                  else:
                      raw["Unfairly Affected Groups"].append(
                          "No Unfair Groups Found"
                      )
  
              for ref in map_ref_groups[measure]:
                  groupby_refs = group_value_df.groupby(
                      key_columns + [ref]
                  )
                  for group, values in groupby_refs:
                      try:
                          ref_dict[
                              group[key_columns.index("attribute_name")]
                          ].add(
                              "["
                              + group[-1]
                              + "]("
                              + "-".join(
                                  supported_name[measure]
                                  .lower()
                                  .split(" ")
                              )
                              + ")"
                          )
                      except KeyError:
                          ref_dict[
                              group[key_columns.index("attribute_name")]
                          ] = set()
                          ref_dict[
                              group[key_columns.index("attribute_name")]
                          ].add(
                              "["
                              + group[-1]
                              + "]("
                              + "-".join(
                                  supported_name[measure]
                                  .lower()
                                  .split(" ")
                              )
                              + ")"
                          )
              cellref = ""
              align_rows = True if attr_order else False
              refs_order = attr_order if attr_order else ref_dict.keys()
              newline = "##br##"
              idented = "&emsp;&emsp;&emsp;"
              for key in refs_order:
                  cellref += (
                      "**{attribute_name}:**".format(attribute_name=key)
                      + newline
                  )
                  cellref += (
                      idented + list(ref_dict[key])[0] + " ##br##"
                  )
                  if align_rows:
                      cellref += "".join(
                          [newline] * (len(false_dict[key]) - 1)
                      )  # this is the number of lines to skip in cell
                  else:
                      cellref += newline
              raw["Reference Groups Selected"].append(cellref)
  
      highlevel_table = "\n\n"
      if len(raw["Fairness Criteria"]) > 0:
          landf = pd.DataFrame(
              raw,
              columns=[
                  "Fairness Criteria",
                  "Desired Outcome",
                  "Reference Groups Selected",
                  "Unfairly Affected Groups",
              ],
          )
          # keep the same order!!
          # krrp
          highlevel_table = tabulate(
              landf[
                  [
                      "Fairness Criteria",
                      "Desired Outcome",
                      "Reference Groups Selected",
                      "Unfairly Affected Groups",
                  ]
              ],
              headers="keys",
              tablefmt="pipe",
              showindex="never",
              numalign="left",
          )
  
      return highlevel_table
  
imports: import datetime
  import logging
  import pandas
  from markdown2 import markdown
  from tabulate import tabulate
label_desc: Use image node_id 12 for calling a global function with example usage: get_highlevel_table(group_value_df, fairness_measures) and returns: highlevel_table