ObjAITime Module DocumentationThis document provides documentation for the ObjAITime module, which serves as a base class for time-series AI forecasting within the Axion project.
ObjAIQuery ClassThis is the primary class in the module, inheriting from ObjApi. It provides a framework for executing time-series analysis and forecasting tasks.
| Member | Type | Description |
|---|---|---|
_Modelname |
str |
The name of the AI model being used (e.g., "prophet"). |
_Timebasetable |
str |
The database table containing the source time-series data. |
_Timebasedate |
str |
The column in _Timebasetable that represents the date/time (ds). |
_Timebasevalue |
str |
The column in _Timebasetable that represents the value to be forecasted (y). |
_Localaidocuments |
str |
The local directory path for saving generated report images and plots. |
_Timepredictwindow |
int |
The number of future periods to predict. Default is 30. |
read(self, ai_code: str, package: str) -> NoneReads the AI time-series configuration from the def_aitime database table based on the provided ai_code and package. This method populates the class members (_Timebasetable, _Timebasedate, etc.) with the configuration from the database.
get_date_range(self) -> tupleRetrieves the minimum and maximum dates from the source data table. It returns a tuple containing the start_date (datetime.date), end_date (datetime.date), and time_difference (datetime.timedelta).
insert_prediction_rows(self, start_date: datetime.date, time_difference: datetime.timedelta) -> NoneInserts placeholder rows into the prediction table for the future date range. To improve performance, it batches the INSERT statements into blocks of 1000.
get_training_dataframe(self, end_date: datetime.date) -> pd.DataFrameConstructs and executes a SQL query to retrieve the training data. It returns a Pandas DataFrame formatted for use in time-series modeling libraries like Prophet.
query(self)This is the main orchestration method. It executes the full time-series analysis workflow:
read() to load the configuration.get_date_range() to determine the time period.insert_prediction_rows() to prepare for future predictions.get_training_dataframe() to prepare the data for the model.cythonize -3 -a -i ObjAITime.py
Compiling /home/axion/projects/axion/factory.ai/package.time/ObjAITime.py because it changed..[1/1] Cythonizing /home/axion/projects/axion/factory.ai/package.time/ObjAITime.py
Updated : 2025-06-08