class_docstr: The module AlertsSummary combines the alerts-summaries of all individual features
  
  It combines the alerts-summaries of all individual features into an artificial feature "_AGGREGATE_".
code: def transform(self, data: dict) -> dict | None:
      # determine all possible features, used for the comparison below
      features = self.get_features(list(data.keys()))
      if len(features) == 0:
          return None
  
      self.logger.info(
          f'Combining alerts into artificial variable "{self.combined_variable}"'
      )
  
      # STEP 1: loop over features where alerts exist
      df_list = []
      for feature in features:
          # basic checks if feature object is filled correctly
          df = (
              self.get_datastore_object(
                  data, feature, dtype=pd.DataFrame
              )
          ).copy(deep=False)
          df.columns = [f"{feature}_{c}" for c in df.columns]
          df_list.append(df)
  
      # the different features could technically have different indices.
      # will only merge alerts if all indices are the same
      if len(df_list) >= 2:
          for df in df_list[1:]:
              if not np.array_equal(df_list[0].index, df.index):
                  self.logger.warning(
                      "indices of features are different. no alerts summary generated."
                  )
                  return None
  
      # STEP 2: Concatenate the dataframes, there was one for each original feature.
      tlv = pd.concat(df_list, axis=1)
      dfc = pd.DataFrame(index=tlv.index)
  
      # colors of traffic lights
      for color in ["green", "yellow", "red"]:
          cols = fnmatch.filter(tlv.columns, f"*_n_{color}")
          dfc[f"n_{color}"] = (
              tlv[cols].values.sum(axis=1) if len(cols) else 0
          )
  
      # store combination of traffic alerts
      data[self.combined_variable] = dfc
      return data
  
file_path: popmon/popmon/alerting/alerts_summary.py
imports: from __future__ import annotations
  import fnmatch
  import numpy
  import pandas
  from popmon.base import Module
label_desc: Use image node_id 2 for calling the AlertsSummary obj's underlying member method code with example usage: obj.transform(data) and returns: data, None, None