code: def structural_analysis_set_up(
      train_data: InputData,
      test_data: InputData,
      task: TaskTypesEnum = TaskTypesEnum.classification,
      metric: QualityMetricsEnum = ClassificationMetricsEnum.ROCAUC,
      primary_operations: List[str] = None,
      secondary_operations: List[str] = None,
  ) -> Tuple[PipelineOptNodeFactory, SAObjective, SAObjective]:
      """Build initial infrastructure for performing SA: node factory, objectives.
      Can be reused for other SA applications, appropriate parameters must be specified then.
      """
  
      def _construct_objective(
          data: InputData, metric: QualityMetricsEnum
      ) -> SAObjective:
          """Build objective function with fit and predict functions inside."""
          metric_func = MetricsRepository.get_metric(metric)
          get_value = partial(metric_func, reference_data=data)
          metrics_ = {metric: metric_func}
  
          data_producer = DataSourceSplitter().build(data=data)
          objective_function = PipelineObjectiveEvaluate(
              objective=Objective(quality_metrics=get_value),
              data_producer=data_producer,
          )
          objective = SAObjective(
              objective=objective_function, quality_metrics=metrics_
          )
          return objective
  
      task = Task(task)
      advisor = PipelineChangeAdvisor(task)
      primary_operations = primary_operations or [
          "rf",
          "pca",
          "normalization",
          "scaling",
      ]
      secondary_operations = secondary_operations or [
          "dt",
          "logit",
          "rf",
          "knn",
      ]
      requirements = PipelineComposerRequirements(
          primary=primary_operations, secondary=secondary_operations
      )
      node_factory = PipelineOptNodeFactory(
          requirements=requirements, advisor=advisor
      )
  
      # build objective function with fit and predict functions inside
      optimization_metric = metric
      train_objective = _construct_objective(
          data=train_data, metric=optimization_metric
      )
      test_objective = _construct_objective(
          data=test_data, metric=optimization_metric
      )
      return node_factory, train_objective, test_objective
  
imports: import os
  from copy import deepcopy
  from functools import partial
  from typing import Callable, Dict, List, Optional, Tuple
  from golem.core.dag.graph_verifier import GraphVerifier
  from golem.core.dag.verification_rules import has_no_cycle, has_no_isolated_components, has_no_isolated_nodes, has_no_self_cycled_nodes, has_one_root
  from golem.core.optimisers.graph import OptGraph
  from golem.core.optimisers.objective import Objective
  from golem.structural_analysis.graph_sa.graph_structural_analysis import GraphStructuralAnalysis
  from golem.structural_analysis.graph_sa.sa_requirements import StructuralAnalysisRequirements
  from examples.advanced.structural_analysis.dataset_access import get_scoring_data
  from examples.advanced.structural_analysis.pipelines_access import get_three_depth_manual_class_pipeline
  from fedot.core.data.data import InputData
  from fedot.core.optimisers.objective import PipelineObjectiveEvaluate
  from fedot.core.optimisers.objective.data_source_splitter import DataSourceSplitter
  from fedot.core.pipelines.adapters import PipelineAdapter
  from fedot.core.pipelines.pipeline_advisor import PipelineChangeAdvisor
  from fedot.core.pipelines.pipeline_composer_requirements import PipelineComposerRequirements
  from fedot.core.pipelines.pipeline_node_factory import PipelineOptNodeFactory
  from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, ComplexityMetricCallable, ComplexityMetricsEnum, MetricsRepository, QualityMetricCallable, QualityMetricsEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum
  from fedot.utilities.project_import_export import DEFAULT_PATH
label_desc: Use image node_id 1 for calling a global function with example usage: structural_analysis_set_up(train_data, test_data, task, metric, primary_operations, secondary_operations) and returns: node_factory,  train_objective,  test_objective, objective