From b279244160fbd15bda2b3e592312b29295b9805c Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Wed, 17 Sep 2025 11:15:05 -0300 Subject: [PATCH] SIENTIAPDE-1222 Enhance MLFlow data handling by adding timestamp column and improving debug logging - Added a 'timestamp' column to the input data, converting the index to a datetime format for better tracking of predictions. - Improved debug logging to provide clearer context by including the input data preview in the log output. --- laborious/activities/mlflow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/laborious/activities/mlflow.py b/laborious/activities/mlflow.py index b96cc60..bd06283 100644 --- a/laborious/activities/mlflow.py +++ b/laborious/activities/mlflow.py @@ -169,11 +169,15 @@ class MLFlow(BaseActivity): model_name = input_data['model_name'] model_config = input_data.get('model_config', {}) - self.debug(data.head(5).to_string(), metadata) + self.debug(f"Input data for: \n {data.head(5).to_string()}", metadata) # Convert numpy.nan to None for model compatibility data.replace(np.nan, None, inplace=True) + data['timestamp'] = data.index + data['timestamp'] = to_datetime( + data['timestamp'], format=DATETIME_FORMAT_WITH_TZ).dt.strftime(DATETIME_FORMAT) + # Request prediction from MLFlow model response_data = self.model_monitoring_repository.predict( model_name, data, model_config, metadata