SIENTIAPDE-1222

SIENTIAPDE-1214: Enhance MLFlow and tests with datetime index handling and logging improvements

- Added a new method in MLFlow to detect and parse datetime indices in DataFrames, ensuring proper format and raising errors for invalid types.
- Updated prediction workflows to utilize the new datetime index handling, improving data integrity during transformations.
- Enhanced logging in model_repository to include detailed data outputs for better traceability.
- Adjusted timeout settings in prediction workflows for improved execution time management.
- Updated tests.ipynb to include additional checks for index types and outputs for better validation of functionality.
This commit is contained in:
vitor-aignosi
2025-09-15 14:47:24 -03:00
parent caca923717
commit 934298b3c3
9 changed files with 144 additions and 829 deletions

View File

@@ -404,6 +404,60 @@
"print(len(b))\n",
"print(b.size)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3374174",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'str'>\n",
"All elements in index are of the same type\n"
]
}
],
"source": [
"from pandas import DataFrame\n",
"\n",
"data = DataFrame({\n",
" \"a\": {\"2025-01-01\": 1, \"2025-01-02\": 2, \"2025-01-03\": 3},\n",
" \"b\": {\"2025-01-01\": 4, \"2025-01-02\": 5, \"2025-01-03\": 6},\n",
"})\n",
"\n",
"index = data.index\n",
"\n",
"# Get type of first element of index\n",
"index_type = type(index[0])\n",
"\n",
"print(index_type)\n",
"\n",
"# Check if all in index are of the same type\n",
"if all(isinstance(i, index_type) for i in index):\n",
" print(\"All elements in index are of the same type\")\n",
"else:\n",
" print(\"Elements in index are of different types\")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "40e72c60",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "1fbb3788",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {