code: def get_missing_metrics(
      data: Data, optimization_config: OptimizationConfig
  ) -> MissingMetrics:
      """Return all arm_name, trial_index pairs, for which some of the
      observatins of optimization config metrics are missing.
  
      Args:
          data: Data to search.
          optimization_config: provides metric_names to search for.
  
      Returns:
          A NamedTuple(missing_objective, Dict[str, missing_outcome_constraint])
      """
      objective = optimization_config.objective
      if isinstance(objective, MultiObjective):
          objective_metric_names = [m.name for m in objective.metrics]
      else:
          objective_metric_names = [
              optimization_config.objective.metric.name
          ]
  
      outcome_constraints_metric_names = [
          outcome_constraint.metric.name
          for outcome_constraint in optimization_config.outcome_constraints
      ]
      missing_objectives = {
          objective_metric_name: _get_missing_arm_trial_pairs(
              data, objective_metric_name
          )
          for objective_metric_name in objective_metric_names
      }
      missing_outcome_constraints = get_missing_metrics_by_name(
          data, outcome_constraints_metric_names
      )
      all_metric_names = set(data.df["metric_name"])
      optimization_config_metric_names = set(
          missing_objectives.keys()
      ).union(outcome_constraints_metric_names)
      missing_tracking_metric_names = all_metric_names.difference(
          optimization_config_metric_names
      )
      missing_tracking_metrics = get_missing_metrics_by_name(
          data=data, metric_names=missing_tracking_metric_names
      )
      return MissingMetrics(
          objective={
              k: v for k, v in missing_objectives.items() if len(v) > 0
          },
          outcome_constraints={
              k: v
              for k, v in missing_outcome_constraints.items()
              if len(v) > 0
          },
          tracking_metrics={
              k: v
              for k, v in missing_tracking_metrics.items()
              if len(v) > 0
          },
      )
  
imports: from collections import defaultdict
  from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Tuple
  import numpy
  from ax.core.arm import Arm
  from ax.core.base_trial import BaseTrial, TrialStatus
  from ax.core.batch_trial import BatchTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun
  from ax.core.objective import MultiObjective
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.trial import Trial
  from ax.core.types import ComparisonOp
  from ax.utils.common.typeutils import not_none
  from pyre_extensions import none_throws
label_desc: Use image node_id 1 for calling a global function with example usage: get_missing_metrics(data, optimization_config) and returns: MissingMetrics