{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Versuch Konstruktion Zeitachse im Datensatz\n",
    "\n",
    "- einzigartige ObjektIDs\n",
    "    - Einzigartigkeit verifizieren mittels HObjektText\n",
    "- je ObjektID Identifikation von Störungen\n",
    "- Analyse ähnlicher Störbilder\n",
    "- Nutzung:\n",
    "    - VorgangsTypName \n",
    "    - VorgangsBeschreibung\n",
    "    - VorgangsArtText\n",
    "    - evtl. concat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
      "  _torch_pytree._register_pytree_node(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:ihm_analyse.helpers:Loaded TOML config file successfully.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pandas import DataFrame, Series\n",
    "import spacy\n",
    "from spacy.lang.de import German as GermanSpacyModel\n",
    "import sentence_transformers\n",
    "from sentence_transformers import SentenceTransformer\n",
    "from collections import Counter\n",
    "from itertools import combinations\n",
    "from dateutil.parser import parse\n",
    "import re\n",
    "\n",
    "\n",
    "import logging\n",
    "import sys\n",
    "import pickle\n",
    "import os\n",
    "from pathlib import Path\n",
    "\n",
    "from lang_main import (\n",
    "    save_pickle,\n",
    "    load_pickle,\n",
    "    SAVE_PATH_FOLDER,\n",
    ")\n",
    "\n",
    "LOGGING_LEVEL = 'INFO'\n",
    "logging.basicConfig(level=LOGGING_LEVEL, stream=sys.stdout)\n",
    "logger = logging.getLogger('base')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:sentence_transformers.SentenceTransformer:Load pretrained SentenceTransformer: sentence-transformers/all-mpnet-base-v2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
      "  warnings.warn(\n",
      "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
      "  _torch_pytree._register_pytree_node(\n",
      "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\transformers\\utils\\generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
      "  _torch_pytree._register_pytree_node(\n",
      "A:\\Arbeitsaufgaben\\lang-main\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
      "  warnings.warn(\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:sentence_transformers.SentenceTransformer:Use pytorch device_name: cpu\n"
     ]
    }
   ],
   "source": [
    "model_stfr = SentenceTransformer('sentence-transformers/all-mpnet-base-v2')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "WindowsPath('A:/Arbeitsaufgaben/lang-main/test-notebooks/results/test_new2')"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p = Path(os.getcwd()) / SAVE_PATH_FOLDER\n",
    "p"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[WindowsPath('A:/Arbeitsaufgaben/lang-main/test-notebooks/results/test_new2/Pipe-TargetFeature_Step-3_remove_NA.pickle')]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "folder = list(p.glob(r'*'))\n",
    "folder"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:ihm_analyse.helpers:Loaded file successfully.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "123457"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ret = load_pickle(folder[0])\n",
    "data = ret[0]\n",
    "len(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 123457 entries, 0 to 123456\n",
      "Data columns (total 20 columns):\n",
      " #   Column                   Non-Null Count   Dtype         \n",
      "---  ------                   --------------   -----         \n",
      " 0   VorgangsID               123457 non-null  int64         \n",
      " 1   ObjektID                 123457 non-null  int64         \n",
      " 2   HObjektText              123442 non-null  object        \n",
      " 3   ObjektArtID              123457 non-null  int64         \n",
      " 4   ObjektArtText            122880 non-null  object        \n",
      " 5   VorgangsTypID            123457 non-null  int64         \n",
      " 6   VorgangsTypName          123457 non-null  object        \n",
      " 7   VorgangsDatum            123457 non-null  datetime64[ns]\n",
      " 8   VorgangsStatusId         123457 non-null  int64         \n",
      " 9   VorgangsPrioritaet       123457 non-null  int64         \n",
      " 10  VorgangsBeschreibung     123457 non-null  object        \n",
      " 11  VorgangsOrt              490 non-null     object        \n",
      " 12  VorgangsArtText          123457 non-null  object        \n",
      " 13  ErledigungsDatum         123457 non-null  datetime64[ns]\n",
      " 14  ErledigungsArtText       122953 non-null  object        \n",
      " 15  ErledigungsBeschreibung  115978 non-null  object        \n",
      " 16  MPMelderArbeitsplatz     6137 non-null    object        \n",
      " 17  MPAbteilungBezeichnung   6137 non-null    object        \n",
      " 18  Arbeitsbeginn            119897 non-null  datetime64[ns]\n",
      " 19  ErstellungsDatum         123457 non-null  datetime64[ns]\n",
      "dtypes: datetime64[ns](4), int64(6), object(10)\n",
      "memory usage: 18.8+ MB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# Gather timeline candidates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "from lang_main.analysis.timeline import (\n",
    "    non_relevant_obj_ids,\n",
    "    remove_non_relevant_obj_ids,\n",
    "    filter_activities_per_obj_id,\n",
    "    generate_model_input,\n",
    "    get_timeline_candidates_index,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:ihm_analyse.helpers:Loaded file successfully.\n",
      "len(data)=123457\n",
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 122958 entries, 0 to 123456\n",
      "Data columns (total 20 columns):\n",
      " #   Column                   Non-Null Count   Dtype         \n",
      "---  ------                   --------------   -----         \n",
      " 0   VorgangsID               122958 non-null  int64         \n",
      " 1   ObjektID                 122958 non-null  int64         \n",
      " 2   HObjektText              122953 non-null  object        \n",
      " 3   ObjektArtID              122958 non-null  int64         \n",
      " 4   ObjektArtText            122880 non-null  object        \n",
      " 5   VorgangsTypID            122958 non-null  int64         \n",
      " 6   VorgangsTypName          122958 non-null  object        \n",
      " 7   VorgangsDatum            122958 non-null  datetime64[ns]\n",
      " 8   VorgangsStatusId         122958 non-null  int64         \n",
      " 9   VorgangsPrioritaet       122958 non-null  int64         \n",
      " 10  VorgangsBeschreibung     122958 non-null  object        \n",
      " 11  VorgangsOrt              0 non-null       object        \n",
      " 12  VorgangsArtText          122958 non-null  object        \n",
      " 13  ErledigungsDatum         122958 non-null  datetime64[ns]\n",
      " 14  ErledigungsArtText       122465 non-null  object        \n",
      " 15  ErledigungsBeschreibung  115562 non-null  object        \n",
      " 16  MPMelderArbeitsplatz     5709 non-null    object        \n",
      " 17  MPAbteilungBezeichnung   5709 non-null    object        \n",
      " 18  Arbeitsbeginn            119459 non-null  datetime64[ns]\n",
      " 19  ErstellungsDatum         122958 non-null  datetime64[ns]\n",
      "dtypes: datetime64[ns](4), int64(6), object(10)\n",
      "memory usage: 19.7+ MB\n"
     ]
    }
   ],
   "source": [
    "ret = load_pickle(folder[0])\n",
    "data = ret[0]\n",
    "print(f\"{len(data)=}\")\n",
    "data = remove_non_relevant_obj_ids(data, thresh_unique_feat_per_id=4)\n",
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Reparaturauftrag (Portal)', 'Wartung', 'Störungsmeldung'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['VorgangsTypName'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ObjektID\n",
       "1       283\n",
       "1654    243\n",
       "7       223\n",
       "151     189\n",
       "140     140\n",
       "       ... \n",
       "1698      2\n",
       "683       2\n",
       "1135      2\n",
       "2170      2\n",
       "297       2\n",
       "Name: count, Length: 366, dtype: int64"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "activity_types = [\n",
    "    'Reparaturauftrag (Portal)',\n",
    "    'Störungsmeldung',\n",
    "]\n",
    "\n",
    "(data, num_activities_per_obj_id) =\\\n",
    "filter_activities_per_obj_id(data, relevant_activity_types=activity_types)\n",
    "num_activities_per_obj_id"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 6104 entries, 0 to 123456\n",
      "Data columns (total 20 columns):\n",
      " #   Column                   Non-Null Count  Dtype         \n",
      "---  ------                   --------------  -----         \n",
      " 0   VorgangsID               6104 non-null   int64         \n",
      " 1   ObjektID                 6104 non-null   int64         \n",
      " 2   HObjektText              6103 non-null   object        \n",
      " 3   ObjektArtID              6104 non-null   int64         \n",
      " 4   ObjektArtText            6087 non-null   object        \n",
      " 5   VorgangsTypID            6104 non-null   int64         \n",
      " 6   VorgangsTypName          6104 non-null   object        \n",
      " 7   VorgangsDatum            6104 non-null   datetime64[ns]\n",
      " 8   VorgangsStatusId         6104 non-null   int64         \n",
      " 9   VorgangsPrioritaet       6104 non-null   int64         \n",
      " 10  VorgangsBeschreibung     6104 non-null   object        \n",
      " 11  VorgangsOrt              0 non-null      object        \n",
      " 12  VorgangsArtText          6104 non-null   object        \n",
      " 13  ErledigungsDatum         6104 non-null   datetime64[ns]\n",
      " 14  ErledigungsArtText       6079 non-null   object        \n",
      " 15  ErledigungsBeschreibung  5812 non-null   object        \n",
      " 16  MPMelderArbeitsplatz     5672 non-null   object        \n",
      " 17  MPAbteilungBezeichnung   5672 non-null   object        \n",
      " 18  Arbeitsbeginn            5915 non-null   datetime64[ns]\n",
      " 19  ErstellungsDatum         6104 non-null   datetime64[ns]\n",
      "dtypes: datetime64[ns](4), int64(6), object(10)\n",
      "memory usage: 1001.4+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "# VorgangsTypName, VorgangsArtText, VorgangsBeschreibung\n",
    "prop_interest = ['VorgangsTypName', 'VorgangsArtText', 'VorgangsBeschreibung']\n",
    "prop_interest = ['VorgangsArtText', 'VorgangsBeschreibung']\n",
    "prop_interest = ['VorgangsBeschreibung']\n",
    "\n",
    "target_feature_name = 'nlp_model_input'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "anlys_data = generate_model_input(data, target_feature_name, model_input_features=prop_interest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 6104 entries, 0 to 123456\n",
      "Data columns (total 21 columns):\n",
      " #   Column                   Non-Null Count  Dtype         \n",
      "---  ------                   --------------  -----         \n",
      " 0   VorgangsID               6104 non-null   int64         \n",
      " 1   ObjektID                 6104 non-null   int64         \n",
      " 2   HObjektText              6103 non-null   object        \n",
      " 3   ObjektArtID              6104 non-null   int64         \n",
      " 4   ObjektArtText            6087 non-null   object        \n",
      " 5   VorgangsTypID            6104 non-null   int64         \n",
      " 6   VorgangsTypName          6104 non-null   object        \n",
      " 7   VorgangsDatum            6104 non-null   datetime64[ns]\n",
      " 8   VorgangsStatusId         6104 non-null   int64         \n",
      " 9   VorgangsPrioritaet       6104 non-null   int64         \n",
      " 10  VorgangsBeschreibung     6104 non-null   object        \n",
      " 11  VorgangsOrt              0 non-null      object        \n",
      " 12  VorgangsArtText          6104 non-null   object        \n",
      " 13  ErledigungsDatum         6104 non-null   datetime64[ns]\n",
      " 14  ErledigungsArtText       6079 non-null   object        \n",
      " 15  ErledigungsBeschreibung  5812 non-null   object        \n",
      " 16  MPMelderArbeitsplatz     5672 non-null   object        \n",
      " 17  MPAbteilungBezeichnung   5672 non-null   object        \n",
      " 18  Arbeitsbeginn            5915 non-null   datetime64[ns]\n",
      " 19  ErstellungsDatum         6104 non-null   datetime64[ns]\n",
      " 20  nlp_model_input          6104 non-null   object        \n",
      "dtypes: datetime64[ns](4), int64(6), object(11)\n",
      "memory usage: 1.0+ MB\n"
     ]
    }
   ],
   "source": [
    "anlys_data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>VorgangsID</th>\n",
       "      <th>ObjektID</th>\n",
       "      <th>HObjektText</th>\n",
       "      <th>ObjektArtID</th>\n",
       "      <th>ObjektArtText</th>\n",
       "      <th>VorgangsTypID</th>\n",
       "      <th>VorgangsTypName</th>\n",
       "      <th>VorgangsDatum</th>\n",
       "      <th>VorgangsStatusId</th>\n",
       "      <th>VorgangsPrioritaet</th>\n",
       "      <th>...</th>\n",
       "      <th>VorgangsOrt</th>\n",
       "      <th>VorgangsArtText</th>\n",
       "      <th>ErledigungsDatum</th>\n",
       "      <th>ErledigungsArtText</th>\n",
       "      <th>ErledigungsBeschreibung</th>\n",
       "      <th>MPMelderArbeitsplatz</th>\n",
       "      <th>MPAbteilungBezeichnung</th>\n",
       "      <th>Arbeitsbeginn</th>\n",
       "      <th>ErstellungsDatum</th>\n",
       "      <th>nlp_model_input</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>52136</th>\n",
       "      <td>262888</td>\n",
       "      <td>315</td>\n",
       "      <td>NaN</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-07-11</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-07-12</td>\n",
       "      <td>Intern UTT - Wartung</td>\n",
       "      <td>Räder gereinigt</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-07-12</td>\n",
       "      <td>2022-07-11</td>\n",
       "      <td>Laufrollen verstopft (Garn)</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       VorgangsID  ObjektID HObjektText  ObjektArtID  \\\n",
       "52136      262888       315         NaN           32   \n",
       "\n",
       "                                     ObjektArtText  VorgangsTypID  \\\n",
       "52136  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "\n",
       "                 VorgangsTypName VorgangsDatum  VorgangsStatusId  \\\n",
       "52136  Reparaturauftrag (Portal)    2022-07-11                 5   \n",
       "\n",
       "       VorgangsPrioritaet  ... VorgangsOrt VorgangsArtText ErledigungsDatum  \\\n",
       "52136                   0  ...         NaN  Flurförderzeug       2022-07-12   \n",
       "\n",
       "         ErledigungsArtText ErledigungsBeschreibung MPMelderArbeitsplatz  \\\n",
       "52136  Intern UTT - Wartung         Räder gereinigt              Versand   \n",
       "\n",
       "      MPAbteilungBezeichnung Arbeitsbeginn ErstellungsDatum  \\\n",
       "52136                Versand    2022-07-12       2022-07-11   \n",
       "\n",
       "                   nlp_model_input  \n",
       "52136  Laufrollen verstopft (Garn)  \n",
       "\n",
       "[1 rows x 21 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "anlys_data.loc[anlys_data['HObjektText'].isna()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>VorgangsID</th>\n",
       "      <th>ObjektID</th>\n",
       "      <th>HObjektText</th>\n",
       "      <th>ObjektArtID</th>\n",
       "      <th>ObjektArtText</th>\n",
       "      <th>VorgangsTypID</th>\n",
       "      <th>VorgangsTypName</th>\n",
       "      <th>VorgangsDatum</th>\n",
       "      <th>VorgangsStatusId</th>\n",
       "      <th>VorgangsPrioritaet</th>\n",
       "      <th>...</th>\n",
       "      <th>VorgangsOrt</th>\n",
       "      <th>VorgangsArtText</th>\n",
       "      <th>ErledigungsDatum</th>\n",
       "      <th>ErledigungsArtText</th>\n",
       "      <th>ErledigungsBeschreibung</th>\n",
       "      <th>MPMelderArbeitsplatz</th>\n",
       "      <th>MPAbteilungBezeichnung</th>\n",
       "      <th>Arbeitsbeginn</th>\n",
       "      <th>ErstellungsDatum</th>\n",
       "      <th>nlp_model_input</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1082</th>\n",
       "      <td>201309</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-02-21</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-02-22</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Laufrollen gesäubert und teilweise ausgewechselt.</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-02-22</td>\n",
       "      <td>2022-02-21</td>\n",
       "      <td>Laufrollen vorne tauschen/säubern</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1710</th>\n",
       "      <td>65146</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-11-12</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-11-12</td>\n",
       "      <td>Intern UTT - Reinigung</td>\n",
       "      <td>Räder von Fäden befreit.</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2020-11-12</td>\n",
       "      <td>2020-11-12</td>\n",
       "      <td>Laufrollen vorne bedingt einsatzfähig</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3525</th>\n",
       "      <td>146538</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-12-16</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-12-16</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Stützrad  beide erneuert\\n</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2021-12-16</td>\n",
       "      <td>2021-12-16</td>\n",
       "      <td>Stützrad defekt</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3786</th>\n",
       "      <td>260011</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-06-01</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-06-02</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Laufrollen gereinigt</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-06-02</td>\n",
       "      <td>2022-06-01</td>\n",
       "      <td>Laufrollen reinigen (Garnfäden)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11101</th>\n",
       "      <td>520758</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2023-04-05</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2023-04-21</td>\n",
       "      <td>Extern - Reparatur</td>\n",
       "      <td>Fahrzeug verliert öl, Monteur muss verständigt...</td>\n",
       "      <td>Vorwerk</td>\n",
       "      <td>Vorwerk</td>\n",
       "      <td>2023-04-06</td>\n",
       "      <td>2023-04-05</td>\n",
       "      <td>Verliert Öl.\\nWenn Fz. länger steht bildet sic...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13645</th>\n",
       "      <td>139405</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>2</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>2021-09-16</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-09-16</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Räder gesäubert</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2021-09-16</td>\n",
       "      <td>2021-09-16</td>\n",
       "      <td>Räder Sauber machen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14105</th>\n",
       "      <td>62552</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-10-23</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-10-22</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Laufrollen gesäubert</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2020-10-22</td>\n",
       "      <td>2020-10-23</td>\n",
       "      <td>Laufrollen säubern</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22686</th>\n",
       "      <td>61759</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-09-23</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-09-24</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Bügel ausgerichtet und Räder von Fäden befreit.</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2020-09-24</td>\n",
       "      <td>2020-09-23</td>\n",
       "      <td>Schutzbügel defekt verbogen bitte richten und ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24898</th>\n",
       "      <td>51614</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-08-05</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-08-05</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Bügel erneuert. Da ausrichten nicht möglich war</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2020-08-05</td>\n",
       "      <td>2020-08-05</td>\n",
       "      <td>Bügel verbogen bitte ausrichten</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25405</th>\n",
       "      <td>65283</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-11-16</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-11-19</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Bügel und Stützräder getauscht</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2020-11-19</td>\n",
       "      <td>2020-11-16</td>\n",
       "      <td>Schutzbügel defekt &gt;reparatur reicht am 17.11....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26160</th>\n",
       "      <td>48299</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-06-29</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Allgemeine Reparaturarbeiten</td>\n",
       "      <td>2020-06-30</td>\n",
       "      <td>Intern UTT - Prüfung</td>\n",
       "      <td>Ladegerät wurde geprüft gemäß DIN VDE 0701/0702.</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2020-06-30</td>\n",
       "      <td>2020-06-29</td>\n",
       "      <td>Ladestation nicht geprüft.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32457</th>\n",
       "      <td>11022</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2019-09-16</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2019-09-17</td>\n",
       "      <td>Externe Reparatur</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>NaT</td>\n",
       "      <td>2019-09-16</td>\n",
       "      <td>Schutzbügel verbogen bitte  richten</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36300</th>\n",
       "      <td>133603</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-07-12</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-07-12</td>\n",
       "      <td>Extern - Reparatur</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2021-07-12</td>\n",
       "      <td>2021-07-12</td>\n",
       "      <td>Räder bitte sauber machen und das defekte Rad ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39483</th>\n",
       "      <td>570650</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2023-05-24</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2023-05-25</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Laufrollen sauber gemacht von Fäden befreit</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2023-05-25</td>\n",
       "      <td>2023-05-24</td>\n",
       "      <td>Laufrollen wechseln/sauber machen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46099</th>\n",
       "      <td>70283</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-12-16</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-12-16</td>\n",
       "      <td>Extern - Reparatur</td>\n",
       "      <td>Fädengezogen</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2020-12-16</td>\n",
       "      <td>2020-12-16</td>\n",
       "      <td>Rollen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47628</th>\n",
       "      <td>116364</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>\\nwird bei folgendem Tk gemacht\\nsiehe TK \\n11...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>Nachtrag zur vorangehenden Meldung: Antriebsra...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47634</th>\n",
       "      <td>116362</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>vordere Gabelrolle rechts Laufbelag runter\\n\\n...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>2021-04-08</td>\n",
       "      <td>Rad defekt\\n\\nNachtrag zur vorangehenden Meldu...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52136</th>\n",
       "      <td>262888</td>\n",
       "      <td>315</td>\n",
       "      <td>NaN</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-07-11</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-07-12</td>\n",
       "      <td>Intern UTT - Wartung</td>\n",
       "      <td>Räder gereinigt</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-07-12</td>\n",
       "      <td>2022-07-11</td>\n",
       "      <td>Laufrollen verstopft (Garn)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57067</th>\n",
       "      <td>106178</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-03-01</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-03-02</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Antriebrad Stützräder und vordere Räder von Sc...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2021-03-02</td>\n",
       "      <td>2021-03-01</td>\n",
       "      <td>Rad defekt</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60040</th>\n",
       "      <td>102674</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-02-09</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-02-10</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Räder säubern\\n\\nSchutzbügel austauschen \\n</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2021-02-10</td>\n",
       "      <td>2021-02-09</td>\n",
       "      <td>Räder säubern\\n\\nSchutzbügel austauschen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62125</th>\n",
       "      <td>25451</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2019-12-18</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2019-12-18</td>\n",
       "      <td>Reparatur UTT</td>\n",
       "      <td>Bügel gerade gebogen.</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2019-12-18</td>\n",
       "      <td>2019-12-18</td>\n",
       "      <td>Schutzbügel verbogen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66746</th>\n",
       "      <td>30355</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-01-11</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-01-13</td>\n",
       "      <td>Reparatur UTT</td>\n",
       "      <td>fäden von rollen entfernt</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2020-01-13</td>\n",
       "      <td>2020-01-11</td>\n",
       "      <td>Bitte Räder reinigen sauber machen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>79821</th>\n",
       "      <td>272506</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-08-19</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-08-22</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>alle Räder gereinigt und gelenke abgeschmiert.</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-08-22</td>\n",
       "      <td>2022-08-19</td>\n",
       "      <td>Räder säubern</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>107351</th>\n",
       "      <td>495093</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-11-16</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-11-17</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>erledigt</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-11-16</td>\n",
       "      <td>2022-11-16</td>\n",
       "      <td>Laufrollen bitte säubern.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>121822</th>\n",
       "      <td>496095</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2022-12-13</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2022-12-13</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Räder gesäubert.\\nschraube musste ausgebohrt w...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2022-12-13</td>\n",
       "      <td>2022-12-13</td>\n",
       "      <td>Laufrollen säubern</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122399</th>\n",
       "      <td>513437</td>\n",
       "      <td>315</td>\n",
       "      <td>B15, Niederhubwagen,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2023-02-14</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2023-02-14</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>erledigt</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2023-02-14</td>\n",
       "      <td>2023-02-14</td>\n",
       "      <td>Bitte Räder von Fadenresten   sauber machen</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>26 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        VorgangsID  ObjektID            HObjektText  ObjektArtID  \\\n",
       "1082        201309       315  B15, Niederhubwagen,            32   \n",
       "1710         65146       315  B15, Niederhubwagen,            32   \n",
       "3525        146538       315  B15, Niederhubwagen,            32   \n",
       "3786        260011       315  B15, Niederhubwagen,            32   \n",
       "11101       520758       315  B15, Niederhubwagen,            32   \n",
       "13645       139405       315  B15, Niederhubwagen,            32   \n",
       "14105        62552       315  B15, Niederhubwagen,            32   \n",
       "22686        61759       315  B15, Niederhubwagen,            32   \n",
       "24898        51614       315  B15, Niederhubwagen,            32   \n",
       "25405        65283       315  B15, Niederhubwagen,            32   \n",
       "26160        48299       315  B15, Niederhubwagen,            32   \n",
       "32457        11022       315  B15, Niederhubwagen,            32   \n",
       "36300       133603       315  B15, Niederhubwagen,            32   \n",
       "39483       570650       315  B15, Niederhubwagen,            32   \n",
       "46099        70283       315  B15, Niederhubwagen,            32   \n",
       "47628       116364       315  B15, Niederhubwagen,            32   \n",
       "47634       116362       315  B15, Niederhubwagen,            32   \n",
       "52136       262888       315                    NaN           32   \n",
       "57067       106178       315  B15, Niederhubwagen,            32   \n",
       "60040       102674       315  B15, Niederhubwagen,            32   \n",
       "62125        25451       315  B15, Niederhubwagen,            32   \n",
       "66746        30355       315  B15, Niederhubwagen,            32   \n",
       "79821       272506       315  B15, Niederhubwagen,            32   \n",
       "107351      495093       315  B15, Niederhubwagen,            32   \n",
       "121822      496095       315  B15, Niederhubwagen,            32   \n",
       "122399      513437       315  B15, Niederhubwagen,            32   \n",
       "\n",
       "                                      ObjektArtText  VorgangsTypID  \\\n",
       "1082    Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "1710    Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "3525    Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "3786    Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "11101   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "13645   Flurförderzeuge / Putzmaschine / Rasenmäher              2   \n",
       "14105   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "22686   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "24898   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "25405   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "26160   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "32457   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "36300   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "39483   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "46099   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "47628   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "47634   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "52136   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "57067   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "60040   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "62125   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "66746   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "79821   Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "107351  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "121822  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "122399  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "\n",
       "                  VorgangsTypName VorgangsDatum  VorgangsStatusId  \\\n",
       "1082    Reparaturauftrag (Portal)    2022-02-21                 5   \n",
       "1710    Reparaturauftrag (Portal)    2020-11-12                 5   \n",
       "3525    Reparaturauftrag (Portal)    2021-12-16                 5   \n",
       "3786    Reparaturauftrag (Portal)    2022-06-01                 5   \n",
       "11101   Reparaturauftrag (Portal)    2023-04-05                 5   \n",
       "13645             Störungsmeldung    2021-09-16                 5   \n",
       "14105   Reparaturauftrag (Portal)    2020-10-23                 5   \n",
       "22686   Reparaturauftrag (Portal)    2020-09-23                 5   \n",
       "24898   Reparaturauftrag (Portal)    2020-08-05                 5   \n",
       "25405   Reparaturauftrag (Portal)    2020-11-16                 5   \n",
       "26160   Reparaturauftrag (Portal)    2020-06-29                 5   \n",
       "32457   Reparaturauftrag (Portal)    2019-09-16                 5   \n",
       "36300   Reparaturauftrag (Portal)    2021-07-12                 5   \n",
       "39483   Reparaturauftrag (Portal)    2023-05-24                 5   \n",
       "46099   Reparaturauftrag (Portal)    2020-12-16                 5   \n",
       "47628   Reparaturauftrag (Portal)    2021-04-08                 5   \n",
       "47634   Reparaturauftrag (Portal)    2021-04-08                 5   \n",
       "52136   Reparaturauftrag (Portal)    2022-07-11                 5   \n",
       "57067   Reparaturauftrag (Portal)    2021-03-01                 5   \n",
       "60040   Reparaturauftrag (Portal)    2021-02-09                 5   \n",
       "62125   Reparaturauftrag (Portal)    2019-12-18                 5   \n",
       "66746   Reparaturauftrag (Portal)    2020-01-11                 5   \n",
       "79821   Reparaturauftrag (Portal)    2022-08-19                 5   \n",
       "107351  Reparaturauftrag (Portal)    2022-11-16                 5   \n",
       "121822  Reparaturauftrag (Portal)    2022-12-13                 5   \n",
       "122399  Reparaturauftrag (Portal)    2023-02-14                 5   \n",
       "\n",
       "        VorgangsPrioritaet  ... VorgangsOrt                VorgangsArtText  \\\n",
       "1082                     0  ...         NaN                 Flurförderzeug   \n",
       "1710                     0  ...         NaN                 Flurförderzeug   \n",
       "3525                     0  ...         NaN                 Flurförderzeug   \n",
       "3786                     0  ...         NaN                 Flurförderzeug   \n",
       "11101                    0  ...         NaN                 Flurförderzeug   \n",
       "13645                    0  ...         NaN                 Flurförderzeug   \n",
       "14105                    0  ...         NaN                 Flurförderzeug   \n",
       "22686                    0  ...         NaN                 Flurförderzeug   \n",
       "24898                    0  ...         NaN                 Flurförderzeug   \n",
       "25405                    0  ...         NaN                 Flurförderzeug   \n",
       "26160                    0  ...         NaN  Allgemeine Reparaturarbeiten    \n",
       "32457                    0  ...         NaN                 Flurförderzeug   \n",
       "36300                    0  ...         NaN                 Flurförderzeug   \n",
       "39483                    0  ...         NaN                 Flurförderzeug   \n",
       "46099                    0  ...         NaN                 Flurförderzeug   \n",
       "47628                    0  ...         NaN                 Flurförderzeug   \n",
       "47634                    0  ...         NaN                 Flurförderzeug   \n",
       "52136                    0  ...         NaN                 Flurförderzeug   \n",
       "57067                    0  ...         NaN                 Flurförderzeug   \n",
       "60040                    0  ...         NaN                 Flurförderzeug   \n",
       "62125                    0  ...         NaN                 Flurförderzeug   \n",
       "66746                    0  ...         NaN                 Flurförderzeug   \n",
       "79821                    0  ...         NaN                 Flurförderzeug   \n",
       "107351                   0  ...         NaN                 Flurförderzeug   \n",
       "121822                   0  ...         NaN                 Flurförderzeug   \n",
       "122399                   0  ...         NaN                 Flurförderzeug   \n",
       "\n",
       "       ErledigungsDatum       ErledigungsArtText  \\\n",
       "1082         2022-02-22  Intern UTT - Reparatur    \n",
       "1710         2020-11-12   Intern UTT - Reinigung   \n",
       "3525         2021-12-16  Intern UTT - Reparatur    \n",
       "3786         2022-06-02  Intern UTT - Reparatur    \n",
       "11101        2023-04-21       Extern - Reparatur   \n",
       "13645        2021-09-16  Intern UTT - Reparatur    \n",
       "14105        2020-10-22  Intern UTT - Reparatur    \n",
       "22686        2020-09-24  Intern UTT - Reparatur    \n",
       "24898        2020-08-05  Intern UTT - Reparatur    \n",
       "25405        2020-11-19  Intern UTT - Reparatur    \n",
       "26160        2020-06-30    Intern UTT - Prüfung    \n",
       "32457        2019-09-17        Externe Reparatur   \n",
       "36300        2021-07-12       Extern - Reparatur   \n",
       "39483        2023-05-25  Intern UTT - Reparatur    \n",
       "46099        2020-12-16       Extern - Reparatur   \n",
       "47628        2021-04-08  Intern UTT - Reparatur    \n",
       "47634        2021-04-08  Intern UTT - Reparatur    \n",
       "52136        2022-07-12     Intern UTT - Wartung   \n",
       "57067        2021-03-02  Intern UTT - Reparatur    \n",
       "60040        2021-02-10  Intern UTT - Reparatur    \n",
       "62125        2019-12-18            Reparatur UTT   \n",
       "66746        2020-01-13            Reparatur UTT   \n",
       "79821        2022-08-22  Intern UTT - Reparatur    \n",
       "107351       2022-11-17  Intern UTT - Reparatur    \n",
       "121822       2022-12-13  Intern UTT - Reparatur    \n",
       "122399       2023-02-14  Intern UTT - Reparatur    \n",
       "\n",
       "                                  ErledigungsBeschreibung  \\\n",
       "1082    Laufrollen gesäubert und teilweise ausgewechselt.   \n",
       "1710                             Räder von Fäden befreit.   \n",
       "3525                           Stützrad  beide erneuert\\n   \n",
       "3786                                 Laufrollen gereinigt   \n",
       "11101   Fahrzeug verliert öl, Monteur muss verständigt...   \n",
       "13645                                     Räder gesäubert   \n",
       "14105                                Laufrollen gesäubert   \n",
       "22686     Bügel ausgerichtet und Räder von Fäden befreit.   \n",
       "24898    Bügel erneuert. Da ausrichten nicht möglich war    \n",
       "25405                      Bügel und Stützräder getauscht   \n",
       "26160    Ladegerät wurde geprüft gemäß DIN VDE 0701/0702.   \n",
       "32457                                                 NaN   \n",
       "36300                                                 NaN   \n",
       "39483         Laufrollen sauber gemacht von Fäden befreit   \n",
       "46099                                        Fädengezogen   \n",
       "47628   \\nwird bei folgendem Tk gemacht\\nsiehe TK \\n11...   \n",
       "47634   vordere Gabelrolle rechts Laufbelag runter\\n\\n...   \n",
       "52136                                     Räder gereinigt   \n",
       "57067   Antriebrad Stützräder und vordere Räder von Sc...   \n",
       "60040         Räder säubern\\n\\nSchutzbügel austauschen \\n   \n",
       "62125                               Bügel gerade gebogen.   \n",
       "66746                           fäden von rollen entfernt   \n",
       "79821     alle Räder gereinigt und gelenke abgeschmiert.    \n",
       "107351                                           erledigt   \n",
       "121822  Räder gesäubert.\\nschraube musste ausgebohrt w...   \n",
       "122399                                           erledigt   \n",
       "\n",
       "       MPMelderArbeitsplatz MPAbteilungBezeichnung Arbeitsbeginn  \\\n",
       "1082                Versand                Versand    2022-02-22   \n",
       "1710                Versand                Versand    2020-11-12   \n",
       "3525                Weberei                Weberei    2021-12-16   \n",
       "3786                Versand                Versand    2022-06-02   \n",
       "11101               Vorwerk                Vorwerk    2023-04-06   \n",
       "13645                   NaN                    NaN    2021-09-16   \n",
       "14105               Versand                Versand    2020-10-22   \n",
       "22686               Weberei                Weberei    2020-09-24   \n",
       "24898               Weberei                Weberei    2020-08-05   \n",
       "25405               Versand                Versand    2020-11-19   \n",
       "26160               Weberei                Weberei    2020-06-30   \n",
       "32457               Weberei                Weberei           NaT   \n",
       "36300               Weberei                Weberei    2021-07-12   \n",
       "39483               Versand                Versand    2023-05-25   \n",
       "46099               Versand                Versand    2020-12-16   \n",
       "47628               Versand                Versand    2021-04-08   \n",
       "47634               Versand                Versand    2021-04-08   \n",
       "52136               Versand                Versand    2022-07-12   \n",
       "57067               Versand                Versand    2021-03-02   \n",
       "60040               Versand                Versand    2021-02-10   \n",
       "62125               Versand                Versand    2019-12-18   \n",
       "66746               Weberei                Weberei    2020-01-13   \n",
       "79821               Versand                Versand    2022-08-22   \n",
       "107351              Versand                Versand    2022-11-16   \n",
       "121822              Versand                Versand    2022-12-13   \n",
       "122399              Weberei                Weberei    2023-02-14   \n",
       "\n",
       "       ErstellungsDatum                                    nlp_model_input  \n",
       "1082         2022-02-21                  Laufrollen vorne tauschen/säubern  \n",
       "1710         2020-11-12              Laufrollen vorne bedingt einsatzfähig  \n",
       "3525         2021-12-16                                    Stützrad defekt  \n",
       "3786         2022-06-01                    Laufrollen reinigen (Garnfäden)  \n",
       "11101        2023-04-05  Verliert Öl.\\nWenn Fz. länger steht bildet sic...  \n",
       "13645        2021-09-16                               Räder Sauber machen   \n",
       "14105        2020-10-23                                 Laufrollen säubern  \n",
       "22686        2020-09-23  Schutzbügel defekt verbogen bitte richten und ...  \n",
       "24898        2020-08-05                    Bügel verbogen bitte ausrichten  \n",
       "25405        2020-11-16  Schutzbügel defekt >reparatur reicht am 17.11....  \n",
       "26160        2020-06-29                         Ladestation nicht geprüft.  \n",
       "32457        2019-09-16                Schutzbügel verbogen bitte  richten  \n",
       "36300        2021-07-12  Räder bitte sauber machen und das defekte Rad ...  \n",
       "39483        2023-05-24                  Laufrollen wechseln/sauber machen  \n",
       "46099        2020-12-16                                             Rollen  \n",
       "47628        2021-04-08  Nachtrag zur vorangehenden Meldung: Antriebsra...  \n",
       "47634        2021-04-08  Rad defekt\\n\\nNachtrag zur vorangehenden Meldu...  \n",
       "52136        2022-07-11                        Laufrollen verstopft (Garn)  \n",
       "57067        2021-03-01                                         Rad defekt  \n",
       "60040        2021-02-09          Räder säubern\\n\\nSchutzbügel austauschen   \n",
       "62125        2019-12-18                               Schutzbügel verbogen  \n",
       "66746        2020-01-11                 Bitte Räder reinigen sauber machen  \n",
       "79821        2022-08-19                                      Räder säubern  \n",
       "107351       2022-11-16                          Laufrollen bitte säubern.  \n",
       "121822       2022-12-13                                 Laufrollen säubern  \n",
       "122399       2023-02-14        Bitte Räder von Fadenresten   sauber machen  \n",
       "\n",
       "[26 rows x 21 columns]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "anlys_data.loc[anlys_data['ObjektID']==315]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ObjektID\n",
       "640    3\n",
       "287    3\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test = num_activities_per_obj_id.iloc[300:302].copy()\n",
    "test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "tl_candidates = get_timeline_candidates_index(\n",
    "    data=anlys_data,\n",
    "    num_activities_per_obj_id=test,\n",
    "    model=model_stfr,\n",
    "    cos_sim_threshold=0.1,\n",
    "    model_input_feature=target_feature_name,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO:ihm_analyse.graphs:Graph properties: 3 Nodes, 3 Edges\n",
      "INFO:ihm_analyse.graphs:Node memory: 0.09 KB\n",
      "INFO:ihm_analyse.graphs:Edge memory: 0.16 KB\n",
      "INFO:ihm_analyse.graphs:Total memory: 0.26 KB\n",
      "obj_id=640, cands=[14720, 27393, 3878]\n",
      "INFO:ihm_analyse.graphs:Graph properties: 3 Nodes, 3 Edges\n",
      "INFO:ihm_analyse.graphs:Node memory: 0.09 KB\n",
      "INFO:ihm_analyse.graphs:Edge memory: 0.16 KB\n",
      "INFO:ihm_analyse.graphs:Total memory: 0.26 KB\n",
      "obj_id=287, cands=[19665, 61717, 15983]\n"
     ]
    }
   ],
   "source": [
    "for (obj_id, cands) in tl_candidates:\n",
    "    print(f'{obj_id=}, {cands=}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>VorgangsID</th>\n",
       "      <th>ObjektID</th>\n",
       "      <th>HObjektText</th>\n",
       "      <th>ObjektArtID</th>\n",
       "      <th>ObjektArtText</th>\n",
       "      <th>VorgangsTypID</th>\n",
       "      <th>VorgangsTypName</th>\n",
       "      <th>VorgangsDatum</th>\n",
       "      <th>VorgangsStatusId</th>\n",
       "      <th>VorgangsPrioritaet</th>\n",
       "      <th>...</th>\n",
       "      <th>VorgangsOrt</th>\n",
       "      <th>VorgangsArtText</th>\n",
       "      <th>ErledigungsDatum</th>\n",
       "      <th>ErledigungsArtText</th>\n",
       "      <th>ErledigungsBeschreibung</th>\n",
       "      <th>MPMelderArbeitsplatz</th>\n",
       "      <th>MPAbteilungBezeichnung</th>\n",
       "      <th>Arbeitsbeginn</th>\n",
       "      <th>ErstellungsDatum</th>\n",
       "      <th>nlp_model_input</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>14720</th>\n",
       "      <td>3798</td>\n",
       "      <td>640</td>\n",
       "      <td>R35, Schnelllauftor,</td>\n",
       "      <td>36</td>\n",
       "      <td>Falt- und Schnelllauftore</td>\n",
       "      <td>2</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>2019-07-03</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Schnelllauftor</td>\n",
       "      <td>2019-07-04</td>\n",
       "      <td>Reparatur UTT</td>\n",
       "      <td>Elektrokabel aus dem Führungsrahmen entfernt.</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-07-04</td>\n",
       "      <td>2019-07-03</td>\n",
       "      <td>Behang hängt bei Bedinung schief  \\nbitte kont...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27393</th>\n",
       "      <td>10974</td>\n",
       "      <td>640</td>\n",
       "      <td>R35, Schnelllauftor,</td>\n",
       "      <td>36</td>\n",
       "      <td>Falt- und Schnelllauftore</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2019-09-11</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Schnelllauftor</td>\n",
       "      <td>2019-09-11</td>\n",
       "      <td>Reparatur UTT</td>\n",
       "      <td>vom Schnelllauftor die Schiene ausgebaut und a...</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>Weberei</td>\n",
       "      <td>2019-09-11</td>\n",
       "      <td>2019-09-11</td>\n",
       "      <td>Schnellauftor R35  Defekt in Halle 54\\nGewalts...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3878</th>\n",
       "      <td>145910</td>\n",
       "      <td>640</td>\n",
       "      <td>R35, Schnelllauftor,</td>\n",
       "      <td>36</td>\n",
       "      <td>Falt- und Schnelllauftore</td>\n",
       "      <td>2</td>\n",
       "      <td>Störungsmeldung</td>\n",
       "      <td>2021-11-24</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Allgemeine Reparaturarbeiten</td>\n",
       "      <td>2021-12-16</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Beim Tor unterstes Torelement ausgerichtet abe...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2021-12-16</td>\n",
       "      <td>2021-11-24</td>\n",
       "      <td>Abdeckung austauschen, wurde angefahren</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       VorgangsID  ObjektID            HObjektText  ObjektArtID  \\\n",
       "14720        3798       640  R35, Schnelllauftor,            36   \n",
       "27393       10974       640  R35, Schnelllauftor,            36   \n",
       "3878       145910       640  R35, Schnelllauftor,            36   \n",
       "\n",
       "                   ObjektArtText  VorgangsTypID            VorgangsTypName  \\\n",
       "14720  Falt- und Schnelllauftore              2            Störungsmeldung   \n",
       "27393  Falt- und Schnelllauftore              3  Reparaturauftrag (Portal)   \n",
       "3878   Falt- und Schnelllauftore              2            Störungsmeldung   \n",
       "\n",
       "      VorgangsDatum  VorgangsStatusId  VorgangsPrioritaet  ... VorgangsOrt  \\\n",
       "14720    2019-07-03                 5                   0  ...         NaN   \n",
       "27393    2019-09-11                 5                   0  ...         NaN   \n",
       "3878     2021-11-24                 5                   0  ...         NaN   \n",
       "\n",
       "                     VorgangsArtText ErledigungsDatum  \\\n",
       "14720                 Schnelllauftor       2019-07-04   \n",
       "27393                 Schnelllauftor       2019-09-11   \n",
       "3878   Allgemeine Reparaturarbeiten        2021-12-16   \n",
       "\n",
       "            ErledigungsArtText  \\\n",
       "14720            Reparatur UTT   \n",
       "27393            Reparatur UTT   \n",
       "3878   Intern UTT - Reparatur    \n",
       "\n",
       "                                 ErledigungsBeschreibung MPMelderArbeitsplatz  \\\n",
       "14720      Elektrokabel aus dem Führungsrahmen entfernt.                  NaN   \n",
       "27393  vom Schnelllauftor die Schiene ausgebaut und a...              Weberei   \n",
       "3878   Beim Tor unterstes Torelement ausgerichtet abe...                  NaN   \n",
       "\n",
       "      MPAbteilungBezeichnung Arbeitsbeginn ErstellungsDatum  \\\n",
       "14720                    NaN    2019-07-04       2019-07-03   \n",
       "27393                Weberei    2019-09-11       2019-09-11   \n",
       "3878                     NaN    2021-12-16       2021-11-24   \n",
       "\n",
       "                                         nlp_model_input  \n",
       "14720  Behang hängt bei Bedinung schief  \\nbitte kont...  \n",
       "27393  Schnellauftor R35  Defekt in Halle 54\\nGewalts...  \n",
       "3878             Abdeckung austauschen, wurde angefahren  \n",
       "\n",
       "[3 rows x 21 columns]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res = anlys_data.loc[[14720, 27393, 3878]]\n",
    "res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "import plotly.express as px\n",
    "import plotly.io as pio\n",
    "pio.renderers.default = 'iframe'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [],
   "source": [
    "def filter_df(data, obj_id, cands):\n",
    "    res = data.loc[cands]\n",
    "    texts = res['HObjektText']\n",
    "    obj_text = texts.loc[~(texts.isna())].iat[0]\n",
    "    obj_text = obj_text.strip(r' ,.:')\n",
    "    return obj_text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "text = filter_df(anlys_data, 640, [14720, 27393, 3878])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'R35, Schnelllauftor'"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "t = res['ErstellungsDatum'].sort_values(ascending=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14720   2019-07-03\n",
       "27393   2019-09-11\n",
       "3878    2021-11-24\n",
       "Name: ErstellungsDatum, dtype: datetime64[ns]"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe\n",
       "    scrolling=\"no\"\n",
       "    width=\"100%\"\n",
       "    height=\"545px\"\n",
       "    src=\"iframe_figures/figure_57.html\"\n",
       "    frameborder=\"0\"\n",
       "    allowfullscreen\n",
       "></iframe>\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.scatter(data_frame=res, x='ErstellungsDatum')\n",
    "fig.update_yaxes(type='category')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "123735    Kettschrauben abgebrochen (Gewinde schneiden)\n",
       "Name: nlp_model_input, dtype: object"
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# filter each ObjID, get model input with index\n",
    "for obj_id in test.index:\n",
    "    test2 = anlys_data.loc[anlys_data[test.index.name]==obj_id]\n",
    "    test2 = test2[target_feature_name]\n",
    "test2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 292,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Regalbediengerät fällt immer wieder aus.\\nFehlercode VZK ER 204/ER 226 während der Fahrt.\\nFehlercode VZK ER 208 / ER 209',\n",
       " 'Hochregalstapler stoppt ständig.\\nFehleranzeige: VZA ER 179',\n",
       " 'Hier wird ein Hochlagerstapler Spezialist benötigt..\\n\\nToyota Herr Jörg Langner tel_Nr. 0172-8218647 UVV\\nDambach B12 (A)\\n\\n\\nFehlermeldung:\\nKetten schlaff\\nFehlermeldung: VZK - ER229\\n\\n\\nfehlermeldung trift nur sporadisch auf...\\nLaut Herr Frick beibt Gerät in Höhe stehen und fährt erst nach mehrmaligem Neustart oder teilweiseerst nach bis zu ca. 30Min.\\nwieder. \\n\\nLaut Herr Spennesberger soll Herr Langner (Toyota) anscheinend nächste Woche auch zur UVV erscheinen.',\n",
       " 'Gabeldrehen defekt > Kette gerissen\\n\\nSeitenhub defekt > Führung verbogen gerissen\\n\\nStapler ist irgendwo (? Regal ? ) angefahren\\n\\n',\n",
       " 'Herrn Langner bitte nochmals anfordern. Aktuell steht das Fahrzeug. Fehlercode VZA OK / VZK Error(s) Er229 / VZB OK\\nFr. Stöppel hat Herr Langer benachrichtigt.\\nElektriker bitte Schalter messen evtl. tauschen\\nHerr Frick und Herr Hochberger wissen bescheid',\n",
       " 'Halterung Seitenverstellung gebrochen',\n",
       " 'Gabelzinkenverstellung gebrochen\\nVerstärkung\\nGraf M.',\n",
       " 'Fehlermeldung\\n09101\\n09126\\n\\nLäuft langsam\\n\\nMagerl Martin 05.01.2021 8.00Uhr\\nStapler wurde bis an das hintere Ende gefahren, und hat dadurch seine Position verloren. \\nAnlernen mit Hilfe von Fabi (Versand) Funktionstest. Stapler läuft.\\n\\nInfo Graf /Frick /Magerl 07.01.2021 08.00Uhr Fehler ist wieder da\\nHerr Holzbock / Fr. Stöppel > informieren Toyota Service \\n(Monteur für Hochlagerregalstapler) zur Reparatur\\n',\n",
       " 'B12 Dambach\\nFehlermeldung \"Kette schlaff\"\\n\\nteilweise sporadischer fehler...\\n\\nnach ca 5-8maligen auseinschalten ist fehler zeitweise weg!!!!\\n\\nlaut Info von Herr Konrad R. wurde  von ,, Monteur Dammbachgeräte Toyota\\'\\'\\n\\nangeraten entsprechende Energiekettemit Kabeln zu wechseln dies ist bereits geschehen.\\n\\n07.01.2020 14.00Uhr Graf/Konrad.R >Feler soll von Toyota behoben werden... Herr Holzbock informiert Toyota.. ',\n",
       " 'Schraube an Hubmast gebrochen',\n",
       " 'Pumpenmotor zur Seitenhubverstellung defekt.\\nAnsteuerung Pumpenmotor evtl. defekt.\\n\\nStand 15.04.21 (Stöppel):\\t\\tMonteur ist geordert. Herr Langner ist krank. Ersatz muss organisiert werden.',\n",
       " 'Sensor defekt bzw. Störung']"
      ]
     },
     "execution_count": 292,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "batch = obj_data.conc.to_list()\n",
    "batch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 293,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Batches: 100%|██████████| 1/1 [00:01<00:00,  1.77s/it]\n"
     ]
    }
   ],
   "source": [
    "embds = model_stfr.encode(batch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 294,
   "metadata": {},
   "outputs": [],
   "source": [
    "cos_sim = sentence_transformers.util.cos_sim(embds, embds).numpy()\n",
    "np.fill_diagonal(cos_sim, 0.)\n",
    "cos_sim = np.triu(cos_sim)\n",
    "#cos_sim"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 299,
   "metadata": {},
   "outputs": [],
   "source": [
    "THRESHOLD = 0.5\n",
    "#np.where(cos_sim > THRESHOLD, cos_sim, 0)\n",
    "indices = np.argwhere(cos_sim >= THRESHOLD)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 287,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "text1='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - bei Laser1 an Bandsäge band abgerissen\\nund bitte Hydraulikbremsfeder kontrollieren', \n",
      " text2='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge ein-aus schalter defekt.\\n(Haltering von Stellschraube gebrochen) dieser fährt auf Endschalter', \n",
      " cos_sim_val=0.60256654 \n",
      "\n",
      "\n",
      "text1='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - bei Laser1 an Bandsäge band abgerissen\\nund bitte Hydraulikbremsfeder kontrollieren', \n",
      " text2='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge defekt geht sehr schwer hoch Hydraulik Problem     NICHT ERLEDIGT!!!!!!!\\n\\n13.06.2022: Feder eingebaut durch Hr. Özdemir und funtkionstüchtig', \n",
      " cos_sim_val=0.56998414 \n",
      "\n",
      "\n",
      "text1='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge ein-aus schalter defekt.\\n(Haltering von Stellschraube gebrochen) dieser fährt auf Endschalter', \n",
      " text2='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge defekt geht sehr schwer hoch Hydraulik Problem     NICHT ERLEDIGT!!!!!!!\\n\\n13.06.2022: Feder eingebaut durch Hr. Özdemir und funtkionstüchtig', \n",
      " cos_sim_val=0.6769313 \n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for idx_pair in indices:\n",
    "    idx1 = idx_pair[0]\n",
    "    idx2 = idx_pair[1]\n",
    "    text1 = batch[idx1]\n",
    "    text2 = batch[idx2]\n",
    "    \n",
    "    cos_sim_val = cos_sim[idx1,idx2]\n",
    "    \n",
    "    print(f\"{text1=}, \\n {text2=}, \\n {cos_sim_val=} \\n\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 290,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\nobj_data = anlys_data.loc[\\n    anlys_data.ObjektID==OBJ_ID_INTEREST,:\\n].copy()\\n'"
      ]
     },
     "execution_count": 290,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# test ID with small amount of entries\n",
    "# e.g. 19\n",
    "OBJ_ID_INTEREST = 311 # 311 # 87 #19\n",
    "obj_data = anlys_data.loc[\n",
    "    ((anlys_data.ObjektID==OBJ_ID_INTEREST) & \n",
    "    (anlys_data.VorgangsTypName=='Reparaturauftrag (Portal)')),:\n",
    "].copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "LOAD_CALC_FILES = False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# load preprocessed dataset\n",
    "DATA_SET_ID = 'Export4'\n",
    "\n",
    "SAVE_PATH_DF_DUPL_OCCUR = f'./02_1_Preprocess1/{DATA_SET_ID}_00_DF_wo_dupl.parquet'\n",
    "data = pd.read_parquet(SAVE_PATH_DF_DUPL_OCCUR)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['427 C , Webmaschine, DL 280 EMS Breite 280 ',\n",
       "       '621 C , Webmaschine, DL 280 EMS Breite 280 ',\n",
       "       '285 C, Webmaschine, SG 220 EMS', '107, Webmaschine, OM 220 EOS',\n",
       "       '00138, Schärmaschine 9, ', 'Warenschau allgemein',\n",
       "       'Neben der Türe', 'Schlagloch im Kettregalgang',\n",
       "       '294 C, Webmaschine, SG 240 EMS',\n",
       "       'Umkleideraum Herren beim Haupteingang'], dtype=object)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.iloc[:10,:].HObjektText.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "ret = data.loc[(data.ObjektID==0), 'HObjektText']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "517"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(ret)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "306"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(ret.unique())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "obj_id=0, uni texts: 306\n",
      "obj_id=906, uni texts: 4\n",
      "obj_id=1110, uni texts: 4\n"
     ]
    }
   ],
   "source": [
    "# mapping: dict[ObjektID, (total num of entries for given ID,\n",
    "# total num of unique objekt texts)]\n",
    "id_to_num_objs: dict[int, (int, int)] = dict()\n",
    "\n",
    "for obj_id in data.ObjektID.unique():\n",
    "    temp = data.loc[(data.ObjektID==obj_id), 'HObjektText']\n",
    "    temp1 = len(temp)\n",
    "    temp2 = len(temp.unique())\n",
    "    \n",
    "    id_to_num_objs[obj_id] = (temp1, temp2)\n",
    "    \n",
    "    if temp2 > 3:\n",
    "        print(f\"{obj_id=}, uni texts: {temp2}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 199,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ObjektID\n",
       "0       443\n",
       "1       253\n",
       "1654    223\n",
       "7       207\n",
       "151     185\n",
       "       ... \n",
       "686       1\n",
       "942       1\n",
       "387       1\n",
       "1122      1\n",
       "1797      1\n",
       "Name: count, Length: 389, dtype: int64"
      ]
     },
     "execution_count": 199,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# get ObIDs with repair orders and sort by number of occurences\n",
    "repair_freq = data.loc[(data.VorgangsTypName=='Reparaturauftrag (Portal)'), 'ObjektID'].value_counts()\n",
    "repair_freq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 236,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "idx=311, count=12\n"
     ]
    }
   ],
   "source": [
    "num_entry = 150\n",
    "count = repair_freq.iat[num_entry]\n",
    "idx = repair_freq.index[num_entry]\n",
    "print(f'{idx=}, {count=}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>num_entries</th>\n",
       "      <th>num_uni_ids</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ObID</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1110</th>\n",
       "      <td>1289</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1698</th>\n",
       "      <td>930</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>910</th>\n",
       "      <td>732</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1726</th>\n",
       "      <td>698</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1694</th>\n",
       "      <td>646</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2705</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2702</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2701</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2700</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2657</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1845 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      num_entries  num_uni_ids\n",
       "ObID                          \n",
       "1110         1289            4\n",
       "1698          930            2\n",
       "910           732            2\n",
       "1726          698            2\n",
       "1694          646            1\n",
       "...           ...          ...\n",
       "2705            1            1\n",
       "2702            1            1\n",
       "2701            1            1\n",
       "2700            1            1\n",
       "2657            1            1\n",
       "\n",
       "[1845 rows x 2 columns]"
      ]
     },
     "execution_count": 237,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "idx_overview = pd.DataFrame.from_dict(\n",
    "    id_to_num_objs, \n",
    "    orient='index',\n",
    "    columns=['num_entries', 'num_uni_ids']\n",
    ").sort_index()\n",
    "idx_overview.index.name = 'ObID'\n",
    "idx_overview = idx_overview.sort_values(by='num_entries', ascending=False)\n",
    "idx_overview"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "num_entries    2\n",
       "num_uni_ids    1\n",
       "Name: 2472, dtype: int64"
      ]
     },
     "execution_count": 190,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "idx_overview.iloc[1500,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- nur ObjektID==0 mehrfach vergeben\n",
    "- andere IDs nutzbar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {},
   "outputs": [],
   "source": [
    "anlys_data = data.loc[(data.ObjektID!=0), :].copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "len(data)=128936, len(anlys_data)=128419\n"
     ]
    }
   ],
   "source": [
    "print(f\"{len(data)=}, {len(anlys_data)=}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 288,
   "metadata": {},
   "outputs": [],
   "source": [
    "# VorgangsTypName, VorgangsArtText, VorgangsBeschreibung\n",
    "prop_interest = [\n",
    "    'VorgangsTypName', \n",
    "    'VorgangsArtText', \n",
    "    'VorgangsBeschreibung'\n",
    "]\n",
    "\n",
    "prop_interest = [\n",
    "    'VorgangsArtText', \n",
    "    'VorgangsBeschreibung'\n",
    "]\n",
    "\n",
    "prop_interest = [\n",
    "    'VorgangsBeschreibung'\n",
    "]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 289,
   "metadata": {},
   "outputs": [],
   "source": [
    "# concat features of interest\n",
    "for it, prop in enumerate(prop_interest):\n",
    "    if it == 0:\n",
    "        anlys_data['conc'] = anlys_data[prop].fillna('').astype(str)\n",
    "    else:\n",
    "        anlys_data['conc'] = anlys_data['conc'] + ' - ' + anlys_data[prop].fillna('').astype(str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 290,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\nobj_data = anlys_data.loc[\\n    anlys_data.ObjektID==OBJ_ID_INTEREST,:\\n].copy()\\n'"
      ]
     },
     "execution_count": 290,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# test ID with small amount of entries\n",
    "# e.g. 19\n",
    "OBJ_ID_INTEREST = 311 # 311 # 87 #19\n",
    "obj_data = anlys_data.loc[\n",
    "    ((anlys_data.ObjektID==OBJ_ID_INTEREST) & \n",
    "    (anlys_data.VorgangsTypName=='Reparaturauftrag (Portal)')),:\n",
    "].copy()\n",
    "\"\"\"\n",
    "obj_data = anlys_data.loc[\n",
    "    anlys_data.ObjektID==OBJ_ID_INTEREST,:\n",
    "].copy()\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 291,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>VorgangsID</th>\n",
       "      <th>ObjektID</th>\n",
       "      <th>HObjektText</th>\n",
       "      <th>ObjektArtID</th>\n",
       "      <th>ObjektArtText</th>\n",
       "      <th>VorgangsTypID</th>\n",
       "      <th>VorgangsTypName</th>\n",
       "      <th>VorgangsDatum</th>\n",
       "      <th>VorgangsStatusId</th>\n",
       "      <th>VorgangsPrioritaet</th>\n",
       "      <th>...</th>\n",
       "      <th>VorgangsOrt</th>\n",
       "      <th>VorgangsArtText</th>\n",
       "      <th>ErledigungsDatum</th>\n",
       "      <th>ErledigungsArtText</th>\n",
       "      <th>ErledigungsBeschreibung</th>\n",
       "      <th>MPMelderArbeitsplatz</th>\n",
       "      <th>MPAbteilungBezeichnung</th>\n",
       "      <th>Arbeitsbeginn</th>\n",
       "      <th>ErstellungsDatum</th>\n",
       "      <th>conc</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>254</th>\n",
       "      <td>142283</td>\n",
       "      <td>311</td>\n",
       "      <td>B12 (A), Regalbediengerät,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-11-02</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-11-23</td>\n",
       "      <td>Extern - Kundendienst</td>\n",
       "      <td>Externer Kundendienst wurde durchgeführt\\n\\nBe...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2021-11-23</td>\n",
       "      <td>2021-11-02</td>\n",
       "      <td>Regalbediengerät fällt immer wieder aus.\\nFehl...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12485</th>\n",
       "      <td>136107</td>\n",
       "      <td>311</td>\n",
       "      <td>B12 (A), Regalbediengerät,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2021-08-17</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2021-08-23</td>\n",
       "      <td>Extern - Reparatur</td>\n",
       "      <td>Externe Reparatur wurde durchgeführt\\n\\nBeanst...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2021-08-23</td>\n",
       "      <td>2021-08-17</td>\n",
       "      <td>Hochregalstapler stoppt ständig.\\nFehleranzeig...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14160</th>\n",
       "      <td>3998</td>\n",
       "      <td>311</td>\n",
       "      <td>B12 (A), Regalbediengerät,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2019-07-18</td>\n",
       "      <td>Kundendienst</td>\n",
       "      <td>None</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>Hier wird ein Hochlagerstapler Spezialist benö...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15016</th>\n",
       "      <td>62522</td>\n",
       "      <td>311</td>\n",
       "      <td>B12 (A), Regalbediengerät,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2020-10-22</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2020-10-23</td>\n",
       "      <td>Intern UTT - Reparatur</td>\n",
       "      <td>Kettenmitnehmer für Gabeldrehen angefertigt (F...</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2020-10-22</td>\n",
       "      <td>2020-10-22</td>\n",
       "      <td>Gabeldrehen defekt &gt; Kette gerissen\\n\\nSeitenh...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19343</th>\n",
       "      <td>4122</td>\n",
       "      <td>311</td>\n",
       "      <td>B12 (A), Regalbediengerät,</td>\n",
       "      <td>32</td>\n",
       "      <td>Flurförderzeuge / Putzmaschine / Rasenmäher</td>\n",
       "      <td>3</td>\n",
       "      <td>Reparaturauftrag (Portal)</td>\n",
       "      <td>2019-07-23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>Flurförderzeug</td>\n",
       "      <td>2019-08-27</td>\n",
       "      <td>Externe Reparatur</td>\n",
       "      <td>Wurde durch Hr. Heuberger repariert.</td>\n",
       "      <td>Versand</td>\n",
       "      <td>Versand</td>\n",
       "      <td>2019-08-27</td>\n",
       "      <td>2019-07-23</td>\n",
       "      <td>Herrn Langner bitte nochmals anfordern. Aktuel...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       VorgangsID  ObjektID                  HObjektText  ObjektArtID  \\\n",
       "254        142283       311  B12 (A), Regalbediengerät,            32   \n",
       "12485      136107       311  B12 (A), Regalbediengerät,            32   \n",
       "14160        3998       311  B12 (A), Regalbediengerät,            32   \n",
       "15016       62522       311  B12 (A), Regalbediengerät,            32   \n",
       "19343        4122       311  B12 (A), Regalbediengerät,            32   \n",
       "\n",
       "                                     ObjektArtText  VorgangsTypID  \\\n",
       "254    Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "12485  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "14160  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "15016  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "19343  Flurförderzeuge / Putzmaschine / Rasenmäher              3   \n",
       "\n",
       "                 VorgangsTypName VorgangsDatum  VorgangsStatusId  \\\n",
       "254    Reparaturauftrag (Portal)    2021-11-02                 5   \n",
       "12485  Reparaturauftrag (Portal)    2021-08-17                 5   \n",
       "14160  Reparaturauftrag (Portal)    2019-07-12                 5   \n",
       "15016  Reparaturauftrag (Portal)    2020-10-22                 5   \n",
       "19343  Reparaturauftrag (Portal)    2019-07-23                 0   \n",
       "\n",
       "       VorgangsPrioritaet  ... VorgangsOrt VorgangsArtText ErledigungsDatum  \\\n",
       "254                     0  ...        None  Flurförderzeug       2021-11-23   \n",
       "12485                   0  ...        None  Flurförderzeug       2021-08-23   \n",
       "14160                   0  ...        None  Flurförderzeug       2019-07-18   \n",
       "15016                   0  ...        None  Flurförderzeug       2020-10-23   \n",
       "19343                   0  ...        None  Flurförderzeug       2019-08-27   \n",
       "\n",
       "            ErledigungsArtText  \\\n",
       "254      Extern - Kundendienst   \n",
       "12485       Extern - Reparatur   \n",
       "14160             Kundendienst   \n",
       "15016  Intern UTT - Reparatur    \n",
       "19343        Externe Reparatur   \n",
       "\n",
       "                                 ErledigungsBeschreibung MPMelderArbeitsplatz  \\\n",
       "254    Externer Kundendienst wurde durchgeführt\\n\\nBe...              Versand   \n",
       "12485  Externe Reparatur wurde durchgeführt\\n\\nBeanst...              Versand   \n",
       "14160                                               None              Versand   \n",
       "15016  Kettenmitnehmer für Gabeldrehen angefertigt (F...              Versand   \n",
       "19343               Wurde durch Hr. Heuberger repariert.              Versand   \n",
       "\n",
       "      MPAbteilungBezeichnung Arbeitsbeginn ErstellungsDatum  \\\n",
       "254                  Versand    2021-11-23       2021-11-02   \n",
       "12485                Versand    2021-08-23       2021-08-17   \n",
       "14160                Versand    2019-07-12       2019-07-12   \n",
       "15016                Versand    2020-10-22       2020-10-22   \n",
       "19343                Versand    2019-08-27       2019-07-23   \n",
       "\n",
       "                                                    conc  \n",
       "254    Regalbediengerät fällt immer wieder aus.\\nFehl...  \n",
       "12485  Hochregalstapler stoppt ständig.\\nFehleranzeig...  \n",
       "14160  Hier wird ein Hochlagerstapler Spezialist benö...  \n",
       "15016  Gabeldrehen defekt > Kette gerissen\\n\\nSeitenh...  \n",
       "19343  Herrn Langner bitte nochmals anfordern. Aktuel...  \n",
       "\n",
       "[5 rows x 21 columns]"
      ]
     },
     "execution_count": 291,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "obj_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 292,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Regalbediengerät fällt immer wieder aus.\\nFehlercode VZK ER 204/ER 226 während der Fahrt.\\nFehlercode VZK ER 208 / ER 209',\n",
       " 'Hochregalstapler stoppt ständig.\\nFehleranzeige: VZA ER 179',\n",
       " 'Hier wird ein Hochlagerstapler Spezialist benötigt..\\n\\nToyota Herr Jörg Langner tel_Nr. 0172-8218647 UVV\\nDambach B12 (A)\\n\\n\\nFehlermeldung:\\nKetten schlaff\\nFehlermeldung: VZK - ER229\\n\\n\\nfehlermeldung trift nur sporadisch auf...\\nLaut Herr Frick beibt Gerät in Höhe stehen und fährt erst nach mehrmaligem Neustart oder teilweiseerst nach bis zu ca. 30Min.\\nwieder. \\n\\nLaut Herr Spennesberger soll Herr Langner (Toyota) anscheinend nächste Woche auch zur UVV erscheinen.',\n",
       " 'Gabeldrehen defekt > Kette gerissen\\n\\nSeitenhub defekt > Führung verbogen gerissen\\n\\nStapler ist irgendwo (? Regal ? ) angefahren\\n\\n',\n",
       " 'Herrn Langner bitte nochmals anfordern. Aktuell steht das Fahrzeug. Fehlercode VZA OK / VZK Error(s) Er229 / VZB OK\\nFr. Stöppel hat Herr Langer benachrichtigt.\\nElektriker bitte Schalter messen evtl. tauschen\\nHerr Frick und Herr Hochberger wissen bescheid',\n",
       " 'Halterung Seitenverstellung gebrochen',\n",
       " 'Gabelzinkenverstellung gebrochen\\nVerstärkung\\nGraf M.',\n",
       " 'Fehlermeldung\\n09101\\n09126\\n\\nLäuft langsam\\n\\nMagerl Martin 05.01.2021 8.00Uhr\\nStapler wurde bis an das hintere Ende gefahren, und hat dadurch seine Position verloren. \\nAnlernen mit Hilfe von Fabi (Versand) Funktionstest. Stapler läuft.\\n\\nInfo Graf /Frick /Magerl 07.01.2021 08.00Uhr Fehler ist wieder da\\nHerr Holzbock / Fr. Stöppel > informieren Toyota Service \\n(Monteur für Hochlagerregalstapler) zur Reparatur\\n',\n",
       " 'B12 Dambach\\nFehlermeldung \"Kette schlaff\"\\n\\nteilweise sporadischer fehler...\\n\\nnach ca 5-8maligen auseinschalten ist fehler zeitweise weg!!!!\\n\\nlaut Info von Herr Konrad R. wurde  von ,, Monteur Dammbachgeräte Toyota\\'\\'\\n\\nangeraten entsprechende Energiekettemit Kabeln zu wechseln dies ist bereits geschehen.\\n\\n07.01.2020 14.00Uhr Graf/Konrad.R >Feler soll von Toyota behoben werden... Herr Holzbock informiert Toyota.. ',\n",
       " 'Schraube an Hubmast gebrochen',\n",
       " 'Pumpenmotor zur Seitenhubverstellung defekt.\\nAnsteuerung Pumpenmotor evtl. defekt.\\n\\nStand 15.04.21 (Stöppel):\\t\\tMonteur ist geordert. Herr Langner ist krank. Ersatz muss organisiert werden.',\n",
       " 'Sensor defekt bzw. Störung']"
      ]
     },
     "execution_count": 292,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "batch = obj_data.conc.to_list()\n",
    "batch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 293,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Batches: 100%|██████████| 1/1 [00:01<00:00,  1.77s/it]\n"
     ]
    }
   ],
   "source": [
    "embds = model_stfr.encode(batch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 294,
   "metadata": {},
   "outputs": [],
   "source": [
    "cos_sim = sentence_transformers.util.cos_sim(embds, embds).numpy()\n",
    "np.fill_diagonal(cos_sim, 0.)\n",
    "cos_sim = np.triu(cos_sim)\n",
    "#cos_sim"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 299,
   "metadata": {},
   "outputs": [],
   "source": [
    "THRESHOLD = 0.5\n",
    "#np.where(cos_sim > THRESHOLD, cos_sim, 0)\n",
    "indices = np.argwhere(cos_sim >= THRESHOLD)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 287,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "text1='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - bei Laser1 an Bandsäge band abgerissen\\nund bitte Hydraulikbremsfeder kontrollieren', \n",
      " text2='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge ein-aus schalter defekt.\\n(Haltering von Stellschraube gebrochen) dieser fährt auf Endschalter', \n",
      " cos_sim_val=0.60256654 \n",
      "\n",
      "\n",
      "text1='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - bei Laser1 an Bandsäge band abgerissen\\nund bitte Hydraulikbremsfeder kontrollieren', \n",
      " text2='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge defekt geht sehr schwer hoch Hydraulik Problem     NICHT ERLEDIGT!!!!!!!\\n\\n13.06.2022: Feder eingebaut durch Hr. Özdemir und funtkionstüchtig', \n",
      " cos_sim_val=0.56998414 \n",
      "\n",
      "\n",
      "text1='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge ein-aus schalter defekt.\\n(Haltering von Stellschraube gebrochen) dieser fährt auf Endschalter', \n",
      " text2='Reparaturauftrag (Portal) - Allgemeine Reparaturarbeiten  - Bandsäge defekt geht sehr schwer hoch Hydraulik Problem     NICHT ERLEDIGT!!!!!!!\\n\\n13.06.2022: Feder eingebaut durch Hr. Özdemir und funtkionstüchtig', \n",
      " cos_sim_val=0.6769313 \n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for idx_pair in indices:\n",
    "    idx1 = idx_pair[0]\n",
    "    idx2 = idx_pair[1]\n",
    "    text1 = batch[idx1]\n",
    "    text2 = batch[idx2]\n",
    "    \n",
    "    cos_sim_val = cos_sim[idx1,idx2]\n",
    "    \n",
    "    print(f\"{text1=}, \\n {text2=}, \\n {cos_sim_val=} \\n\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 300,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "text1='Regalbediengerät fällt immer wieder aus.\\nFehlercode VZK ER 204/ER 226 während der Fahrt.\\nFehlercode VZK ER 208 / ER 209', \n",
      " text2='Hochregalstapler stoppt ständig.\\nFehleranzeige: VZA ER 179', \n",
      " cos_sim_val=0.5726533 \n",
      "\n",
      "\n",
      "text1='Regalbediengerät fällt immer wieder aus.\\nFehlercode VZK ER 204/ER 226 während der Fahrt.\\nFehlercode VZK ER 208 / ER 209', \n",
      " text2='Herrn Langner bitte nochmals anfordern. Aktuell steht das Fahrzeug. Fehlercode VZA OK / VZK Error(s) Er229 / VZB OK\\nFr. Stöppel hat Herr Langer benachrichtigt.\\nElektriker bitte Schalter messen evtl. tauschen\\nHerr Frick und Herr Hochberger wissen bescheid', \n",
      " cos_sim_val=0.5984524 \n",
      "\n",
      "\n",
      "text1='Hochregalstapler stoppt ständig.\\nFehleranzeige: VZA ER 179', \n",
      " text2='Herrn Langner bitte nochmals anfordern. Aktuell steht das Fahrzeug. Fehlercode VZA OK / VZK Error(s) Er229 / VZB OK\\nFr. Stöppel hat Herr Langer benachrichtigt.\\nElektriker bitte Schalter messen evtl. tauschen\\nHerr Frick und Herr Hochberger wissen bescheid', \n",
      " cos_sim_val=0.50384676 \n",
      "\n",
      "\n",
      "text1='Hier wird ein Hochlagerstapler Spezialist benötigt..\\n\\nToyota Herr Jörg Langner tel_Nr. 0172-8218647 UVV\\nDambach B12 (A)\\n\\n\\nFehlermeldung:\\nKetten schlaff\\nFehlermeldung: VZK - ER229\\n\\n\\nfehlermeldung trift nur sporadisch auf...\\nLaut Herr Frick beibt Gerät in Höhe stehen und fährt erst nach mehrmaligem Neustart oder teilweiseerst nach bis zu ca. 30Min.\\nwieder. \\n\\nLaut Herr Spennesberger soll Herr Langner (Toyota) anscheinend nächste Woche auch zur UVV erscheinen.', \n",
      " text2='Fehlermeldung\\n09101\\n09126\\n\\nLäuft langsam\\n\\nMagerl Martin 05.01.2021 8.00Uhr\\nStapler wurde bis an das hintere Ende gefahren, und hat dadurch seine Position verloren. \\nAnlernen mit Hilfe von Fabi (Versand) Funktionstest. Stapler läuft.\\n\\nInfo Graf /Frick /Magerl 07.01.2021 08.00Uhr Fehler ist wieder da\\nHerr Holzbock / Fr. Stöppel > informieren Toyota Service \\n(Monteur für Hochlagerregalstapler) zur Reparatur\\n', \n",
      " cos_sim_val=0.5819109 \n",
      "\n",
      "\n",
      "text1='Hier wird ein Hochlagerstapler Spezialist benötigt..\\n\\nToyota Herr Jörg Langner tel_Nr. 0172-8218647 UVV\\nDambach B12 (A)\\n\\n\\nFehlermeldung:\\nKetten schlaff\\nFehlermeldung: VZK - ER229\\n\\n\\nfehlermeldung trift nur sporadisch auf...\\nLaut Herr Frick beibt Gerät in Höhe stehen und fährt erst nach mehrmaligem Neustart oder teilweiseerst nach bis zu ca. 30Min.\\nwieder. \\n\\nLaut Herr Spennesberger soll Herr Langner (Toyota) anscheinend nächste Woche auch zur UVV erscheinen.', \n",
      " text2='B12 Dambach\\nFehlermeldung \"Kette schlaff\"\\n\\nteilweise sporadischer fehler...\\n\\nnach ca 5-8maligen auseinschalten ist fehler zeitweise weg!!!!\\n\\nlaut Info von Herr Konrad R. wurde  von ,, Monteur Dammbachgeräte Toyota\\'\\'\\n\\nangeraten entsprechende Energiekettemit Kabeln zu wechseln dies ist bereits geschehen.\\n\\n07.01.2020 14.00Uhr Graf/Konrad.R >Feler soll von Toyota behoben werden... Herr Holzbock informiert Toyota.. ', \n",
      " cos_sim_val=0.74113154 \n",
      "\n",
      "\n",
      "text1='Gabeldrehen defekt > Kette gerissen\\n\\nSeitenhub defekt > Führung verbogen gerissen\\n\\nStapler ist irgendwo (? Regal ? ) angefahren\\n\\n', \n",
      " text2='Gabelzinkenverstellung gebrochen\\nVerstärkung\\nGraf M.', \n",
      " cos_sim_val=0.50898415 \n",
      "\n",
      "\n",
      "text1='Gabeldrehen defekt > Kette gerissen\\n\\nSeitenhub defekt > Führung verbogen gerissen\\n\\nStapler ist irgendwo (? Regal ? ) angefahren\\n\\n', \n",
      " text2='Fehlermeldung\\n09101\\n09126\\n\\nLäuft langsam\\n\\nMagerl Martin 05.01.2021 8.00Uhr\\nStapler wurde bis an das hintere Ende gefahren, und hat dadurch seine Position verloren. \\nAnlernen mit Hilfe von Fabi (Versand) Funktionstest. Stapler läuft.\\n\\nInfo Graf /Frick /Magerl 07.01.2021 08.00Uhr Fehler ist wieder da\\nHerr Holzbock / Fr. Stöppel > informieren Toyota Service \\n(Monteur für Hochlagerregalstapler) zur Reparatur\\n', \n",
      " cos_sim_val=0.5738949 \n",
      "\n",
      "\n",
      "text1='Halterung Seitenverstellung gebrochen', \n",
      " text2='Gabelzinkenverstellung gebrochen\\nVerstärkung\\nGraf M.', \n",
      " cos_sim_val=0.57064235 \n",
      "\n",
      "\n",
      "text1='Halterung Seitenverstellung gebrochen', \n",
      " text2='Schraube an Hubmast gebrochen', \n",
      " cos_sim_val=0.54742706 \n",
      "\n",
      "\n",
      "text1='Fehlermeldung\\n09101\\n09126\\n\\nLäuft langsam\\n\\nMagerl Martin 05.01.2021 8.00Uhr\\nStapler wurde bis an das hintere Ende gefahren, und hat dadurch seine Position verloren. \\nAnlernen mit Hilfe von Fabi (Versand) Funktionstest. Stapler läuft.\\n\\nInfo Graf /Frick /Magerl 07.01.2021 08.00Uhr Fehler ist wieder da\\nHerr Holzbock / Fr. Stöppel > informieren Toyota Service \\n(Monteur für Hochlagerregalstapler) zur Reparatur\\n', \n",
      " text2='B12 Dambach\\nFehlermeldung \"Kette schlaff\"\\n\\nteilweise sporadischer fehler...\\n\\nnach ca 5-8maligen auseinschalten ist fehler zeitweise weg!!!!\\n\\nlaut Info von Herr Konrad R. wurde  von ,, Monteur Dammbachgeräte Toyota\\'\\'\\n\\nangeraten entsprechende Energiekettemit Kabeln zu wechseln dies ist bereits geschehen.\\n\\n07.01.2020 14.00Uhr Graf/Konrad.R >Feler soll von Toyota behoben werden... Herr Holzbock informiert Toyota.. ', \n",
      " cos_sim_val=0.5379714 \n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for idx_pair in indices:\n",
    "    idx1 = idx_pair[0]\n",
    "    idx2 = idx_pair[1]\n",
    "    text1 = batch[idx1]\n",
    "    text2 = batch[idx2]\n",
    "    \n",
    "    cos_sim_val = cos_sim[idx1,idx2]\n",
    "    \n",
    "    print(f\"{text1=}, \\n {text2=}, \\n {cos_sim_val=} \\n\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
