class_docstr: Defines the top-level Model Analysis API.
  Use RAIInsights to analyze errors, explain the most important
  features, compute counterfactuals and run causal analysis in a
  single API.
class_docstr_tok: ["Defines","the","top-level","Model","Analysis","API",".","Use","RAIInsights","to","analyze","errors",",","explain","the","most","important","features",",","compute","counterfactuals","and","run","causal","analysis","in","a","single","API","."]
docstr: Ensure that a time column is available from metadata or model.
  
  Some models have the time column name stored as an attribute
  in which case we can extract it directly without requiring users
  to explicitly specify the time column.
  
  :param feature_metadata: the feature metadata object
  :type feature_metadata: FeatureMetadata
  :param feature_names: the names of all features of the dataset
  :type feature_names: List[str]
  :param model: the model
  :type model: object
docstr_tok: ["Ensure","that","a","time","column","is","available","from","metadata","or","model",".","Some","models","have","the","time","column","name","stored","as","an","attribute","in","which","case","we","can","extract","it","directly","without","requiring","users","to","explicitly","specify","the","time","column",".",":","param","feature_metadata",":","the","feature","metadata","object",":","type","feature_metadata",":","FeatureMetadata",":","param","feature_names",":","the","names","of","all","features","of","the","dataset",":","type","feature_names",":","List","[","str","]",":","param","model",":","the","model",":","type","model",":","object"]
code: def _ensure_time_column_available(
      self,
      feature_metadata: FeatureMetadata,
      feature_names: List[str],
      model: Optional[Any],
  ):
      """Ensure that a time column is available from metadata or model.
  
      Some models have the time column name stored as an attribute
      in which case we can extract it directly without requiring users
      to explicitly specify the time column.
  
      :param feature_metadata: the feature metadata object
      :type feature_metadata: FeatureMetadata
      :param feature_names: the names of all features of the dataset
      :type feature_names: List[str]
      :param model: the model
      :type model: object
      """
      fm_time_columns = feature_metadata.datetime_features
      model_time_column = getattr(model, "time_column_name", None)
  
      # goal: set time column in feature metadata
      if model_time_column is None:
          if fm_time_columns is not None:
              return
          else:
              raise UserConfigValidationException(
                  "There was no time column name in feature metadata. "
                  "A time column is required for forecasting."
              )
      else:
          if fm_time_columns is None:
              if model_time_column in feature_names:
                  feature_metadata.datetime_features = [
                      model_time_column
                  ]
                  self._feature_metadata = feature_metadata
                  return
              else:
                  raise UserConfigValidationException(
                      "The provided model expects a time column named "
                      f"{model_time_column} that is not present in the "
                      "provided dataset."
                  )
          else:
              # both time columns were provided, ensure that they match
              if model_time_column not in fm_time_columns:
                  raise UserConfigValidationException(
                      f"The provided datetime features {fm_time_columns} "
                      "do not include the model's expected time column "
                      f"name {model_time_column}."
                  )
  
imports: import json
  import pickle
  import warnings
  from enum import Enum
  from pathlib import Path
  from typing import Any, List, Optional, Union
  import numpy
  import pandas
  from erroranalysis._internal.cohort_filter import FilterDataWithCohortFilters
  from erroranalysis._internal.process_categoricals import process_categoricals
  from raiutils.data_processing import convert_to_list
  from raiutils.exceptions import SystemErrorException, UserConfigValidationException
  from raiutils.models import Forecasting, ModelTask, SKLearn
  from responsibleai._interfaces import Dataset, RAIInsightsData, TabularDatasetMetadata
  from responsibleai._internal._forecasting_wrappers import _wrap_model
  from responsibleai._internal.constants import FileFormats, ManagerNames, Metadata, SerializationAttributes
  from responsibleai.feature_metadata import FeatureMetadata
  from responsibleai.managers.causal_manager import CausalManager
  from responsibleai.managers.counterfactual_manager import CounterfactualManager
  from responsibleai.managers.data_balance_manager import DataBalanceManager
  from responsibleai.managers.error_analysis_manager import ErrorAnalysisManager
  from responsibleai.managers.explainer_manager import ExplainerManager
  from responsibleai.rai_insights.rai_base_insights import RAIBaseInsights
label_desc: Use image node_id 15 for calling the RAIInsights obj's underlying member method code with example usage: obj._ensure_time_column_available(feature_metadata, feature_names, model) without return types