code: def generate_html_detail_cat(
      feature_dict: dict, compare_dict: dict, dataframe_report
  ):
      template = jinja2_env.get_template("feature_detail_cat.html")
  
      # Set some parameters for detail breakdown
      # ------------------------------------------
      # Vertical
      spacing = config["Layout"].getint("cat_detail_col_spacing")
      cols = dict()
      detail_layout = dict()
      detail_layout["graph_y"] = config["Layout"].getint(
          "cat_detail_graph_y"
      )
      detail_layout["breakdown_y"] = (
          detail_layout["graph_y"]
          + feature_dict["detail_graphs"][0].size_in_inches[1] * 100
          + config["Layout"].getint("cat_detail_breakdown_y_offset")
      )
      detail_layout["breakdown_height"] = (
          910 - detail_layout["breakdown_y"]
      )
  
      if dataframe_report.get_target_type() == FeatureType.TYPE_NUM:
          # Need 2 lines for the breakdown header area
          detail_layout[
              "breakdown_header_class"
          ] = "breakdown-row-header-2-lines"
          detail_layout["breakdown_hr_class"] = "breakdown-hr-2-lines"
      else:
          detail_layout[
              "breakdown_header_class"
          ] = "breakdown-row-header"
          detail_layout["breakdown_hr_class"] = "breakdown-hr"
  
      # Column Layout
      # ------------------------
      # Find name width
      count_row_data = feature_dict["detail"]["full_count"]
      longest_cat = max(
          map(lambda row: len(str(row["name"])), count_row_data)
      )
      longest_width = longest_cat * config["Layout"].getint(
          "character_width_estimate"
      )
      # Set columns
      # cur_x = config["Layout"].getint("cat_detail_col_1_x")
      # 230px->48 = 4.8
      # 37px->6 = 6.2
      # 216px->44 = 4.9
      cur_x = longest_width + config["Layout"].getint(
          "cat_detail_col_x_padding_after_name"
      )
      cur_x = min(
          cur_x, config["Layout"].getint("cat_detail_col_1_max_x")
      )
  
      cols["name_max_len"] = cur_x
      cols["source"] = cur_x
      cur_x = cur_x + spacing
      if compare_dict is not None:
          cols["compare"] = cur_x
          cur_x = cur_x + spacing
      if dataframe_report.get_target_type() is not None:
          cur_x = cur_x + config["Layout"].getint(
              "cat_detail_col_target_extra_spacing"
          )
          cols["source_target"] = cur_x
          cur_x = cur_x + spacing
          if "compare" in dataframe_report._target:
              cols["compare_target"] = cur_x
              cur_x = cur_x + spacing
  
      max_rows = config["Detail_Stats"].getint(
          "max_num_breakdown_categories"
      )
      feature_dict["detail"]["detail_count"] = feature_dict["detail"][
          "full_count"
      ][:max_rows]
  
      # Set up ASSOCIATION data
      # ------------------------------------
      feature_name = feature_dict["name"]
      if dataframe_report._associations is not None:
          # Filter by datatype CATEGORICAL
          influencing = dataframe_report._associations[feature_name]
          influencing = {
              k: v
              for k, v in influencing.items()
              if (
                  dataframe_report.get_type(k) == FeatureType.TYPE_BOOL
                  or dataframe_report.get_type(k)
                  == FeatureType.TYPE_CAT
              )
              and k != feature_name
          }
  
          # Filter by datatype CATEGORICAL
          influenced = dataframe_report.get_what_influences_me(
              feature_name
          )
          influenced = {
              k: v
              for k, v in influenced.items()
              if (
                  dataframe_report.get_type(k) == FeatureType.TYPE_BOOL
                  or dataframe_report.get_type(k)
                  == FeatureType.TYPE_CAT
              )
              and k != feature_name
          }
  
          # NUM-CAT
          corr_ratio = dataframe_report._associations[feature_name]
          corr_ratio = {
              k: v
              for k, v in corr_ratio.items()
              if dataframe_report.get_type(k) == FeatureType.TYPE_NUM
              and k != feature_name
          }
  
          # Sort & get top
          max_num = config["Detail_Stats"].getint(
              "max_num_top_associations"
          )
          influencing = sorted(
              influencing.items(), key=itemgetter(1), reverse=True
          )[:max_num]
          influenced = sorted(
              influenced.items(), key=itemgetter(1), reverse=True
          )[:max_num]
          corr_ratio = sorted(
              corr_ratio.items(), key=itemgetter(1), reverse=True
          )[:max_num]
  
          # Set who's the target, for highlighting
          if dataframe_report._target is not None:
              influencing = add_is_target_or_not(
                  influencing, dataframe_report._target["name"]
              )
              influenced = add_is_target_or_not(
                  influenced, dataframe_report._target["name"]
              )
              corr_ratio = add_is_target_or_not(
                  corr_ratio, dataframe_report._target["name"]
              )
      else:
          influencing = None
          influenced = None
          corr_ratio = None
      output = template.render(
          feature_dict=feature_dict,
          compare_dict=compare_dict,
          dataframe=dataframe_report,
          cols=cols,
          detail_layout=detail_layout,
          influencing=influencing,
          influenced=influenced,
          corr_ratio=corr_ratio,
      )
      return output
  
imports: import numpy
  import html
  from operator import itemgetter
  from jinja2 import Environment, PackageLoader
  import sweetviz.sv_html_formatters
  from sweetviz.config import config
  from sweetviz.sv_types import NumWithPercent, FeatureType, OTHERS_GROUPED
  from sweetviz.graph_associations import CORRELATION_ERROR
  from sweetviz.graph_associations import CORRELATION_IDENTICAL
  from functools import cmp_to_key
label_desc: Use image node_id 16 for calling a global function with example usage: generate_html_detail_cat(feature_dict, compare_dict, dataframe_report) and returns: output