code: def _load_csv_files(manual_dir, dictionary_of_csv_files):
      """Load the ground-truth data from the given dictionary of CSV files.
  
      Args:
        manual_dir: Path of the directory containing the images.
        dictionary_of_csv_files: Dictionary containing the key and filepath of each
          CSV file to load.
  
      Returns:
        A dictionary containing the ground-truth loaded from the CSV files.
      """
      # Data maps patients -> examples -> list of abnormalities
      data = {}
      for csv_key, csv_path in sorted(dictionary_of_csv_files.items()):
          with tf.io.gfile.GFile(csv_path, "r") as f:
              csv_reader = csv.DictReader(f)
              for i, row in enumerate(csv_reader, 2):
                  row = {
                      k: v.strip() for k, v in row.items()
                  }  # Strip all cells.
                  # Construct example ID from the study and series IDs.
                  example_id = _DCIM_REGEX.sub(
                      r"\g<study>/\g<series>", row["image file path"]
                  )
                  # Get path to the
                  for key in [
                      "image file path",
                      "ROI mask file path",
                      "cropped image file path",
                  ]:
                      row[key] = row[key].replace(".dcm", ".png")
                      row[key] = os.path.join(
                          manual_dir, *row[key].split("/")
                      )
                      if not tf.io.gfile.exists(row[key]):
                          raise ValueError(
                              "Error processing line %d from csv file %s: "
                              "Image %r does not exist!"
                              % (i, csv_path, row[key])
                          )
  
                  mask_file_path = row["ROI mask file path"]
                  crop_file_path = row["cropped image file path"]
                  full_image = _read_image(row["image file path"])
                  mask_image = _read_image(mask_file_path)
                  crop_image = _read_image(crop_file_path)
                  if full_image.shape == crop_image.shape:
                      # TODO(jpuigcerver): THIS ASSUMES THAT THE CROP/MASK COLUMNS ARE JUST
                      # REVERSED. I've checked that this is the case for a couple of rows,
                      # but this issue happens a lot across all CSV files. Contact the
                      # owners of the dataset to ask about this problem.
                      mask_file_path, crop_file_path = (
                          crop_file_path,
                          mask_file_path,
                      )
                  elif full_image.shape != mask_image.shape:
                      # TODO(jpuigcerver): Contact the owners of the dataset to ask about
                      # this problem.
                      logging.error(
                          (
                              "Error processing line %d from csv file %s: No suitable mask"
                              " for the given image (expected size: %r, candidate sizes:"
                              " %r). This abnormality will NOT be included in the dataset."
                          ),
                          i,
                          csv_path,
                          full_image.shape,
                          [mask_image.shape, crop_image.shape],
                      )
                      continue
  
                  abnormality = {
                      "id": int(row["abnormality id"]),
                      "mask": mask_file_path,
                      "assessment": row["assessment"],
                      "pathology": row["pathology"],
                      "subtlety": row["subtlety"],
                  }
                  if "calc type" in row and "calc distribution" in row:
                      abnormality["type"] = "calc"
                      abnormality["calc_type"] = row["calc type"]
                      abnormality["calc_distribution"] = row[
                          "calc distribution"
                      ]
                  elif "mass shape" in row and "mass margins" in row:
                      abnormality["type"] = "mass"
                      abnormality["mass_shape"] = row["mass shape"]
                      abnormality["mass_margins"] = row["mass margins"]
                  else:
                      raise ValueError(
                          "CSV file is missing required columns."
                      )
  
                  example = {
                      "id": example_id,
                      "breast": row["left or right breast"],
                      "patient": row["patient_id"],
                      "image": row["image file path"],
                      "view": row["image view"],
                      "abnormalities": [abnormality],
                      # Note: Useful to know whether the example is from train or test.
                      "csv_key": csv_key,
                  }
                  _append_example_to_data(data, example)
  
      return data
  
imports: import csv
  import os
  import re
  from absl import logging
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 1 for calling a global function with example usage: _load_csv_files(manual_dir, dictionary_of_csv_files) and returns: data