For this python code, `import cv2
from deep_sort_realtime.deepsort_tracker import DeepSort

class ObjectTracker:
    def __init__(self, db, detection_model):
        self.db = db
        self.detection_model = detection_model
        self.tracker = DeepSort(max_age=10, n_init=3, nms_max_overlap=1.0, max_cosine_distance=0.4, nn_budget=None)

    def is_near(self, existing_obj, new_obj, threshold=30):
        ex, ey, ew, eh = existing_obj
        nx, ny, nw, nh = new_obj
        return not (nx > ex + ew + threshold or
                    nx + nw < ex - threshold or
                    ny > ey + eh + threshold or
                    ny + nh < ey - threshold)

    def track_objects(self, img):
        detections = self.detection_model.detect_objects(img)
        formatted_detections = []

        for class_name, x1, y1, width, height, confidence in detections:
            existing_objs = self.db.fetch_objects(class_name)
            new_obj = (x1, y1, width, height)
            preexisting_obj = False
            for existing_obj in existing_objs:
                db_x1, db_y1, db_width, db_height = existing_obj[2], existing_obj[3], existing_obj[4], existing_obj[5]
                if self.is_near((db_x1, db_y1, db_width, db_height), new_obj):
                    preexisting_obj = True
                    self.db.update_object(existing_obj[0], x1, y1, width, height)

            if not preexisting_obj:
                self.db.insert_object(class_name, x1, y1, width, height)

            formatted_detections.append(([x1, y1, width, height], confidence, class_name))
            cv2.rectangle(img, (x1, y1), (x1 + width, y1 + height), (255, 0, 255), 3)
            cv2.putText(img, f'{class_name} {confidence:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (255, 0, 0), 2)

        tracks = self.tracker.update_tracks(formatted_detections, frame=img)
        return img``from ultralytics import YOLO

class ObjectDetection:
    def __init__(self, model_path="yolo-Weights/yolov8n.pt"):
        self.model = YOLO(model_path)
        self.classNames = ["person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat",
                           "traffic light", "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat",
                           "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella",
                           "handbag", "tie", "suitcase", "frisbee", "skis", "snowboard", "sports ball", "kite", "baseball bat",
                           "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup",
                           "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange", "broccoli",
                           "carrot", "hot dog", "pizza", "donut", "cake", "chair", "sofa", "pottedplant", "bed",
                           "diningtable", "toilet", "tvmonitor", "laptop", "mouse", "remote", "keyboard", "cell phone",
                           "microwave", "oven", "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors",
                           "teddy bear", "hair drier", "toothbrush"]
        self.allowed_classes = {0, 24, 25, 26, 31, 36, 37, 39, 40, 41, 53, 63, 65, 67}

    def detect_objects(self, img):
        results = self.model(img, stream=True)
        detections = []
        for r in results:
            for box in r.boxes:
                confidence = box.conf[0].item()
                if confidence < 0.55:
                    continue

                cls = int(box.cls[0])
                if cls not in self.allowed_classes:
                    continue

                x1, y1, x2, y2 = map(int, box.xyxy[0])
                width, height = x2 - x1, y2 - y1
                class_name = self.classNames[cls]
                detections.append((class_name, x1, y1, width, height, confidence))
        return detections``import sqlite3

class Database:
    def __init__(self, db_name='object_tracking.db'):
        self.conn = sqlite3.connect(db_name)
        self.cursor = self.conn.cursor()
        self.create_table()

    def create_table(self):
        self.cursor.execute('''
            CREATE TABLE IF NOT EXISTS tracked_objects (
                id INTEGER PRIMARY KEY AUTOINCREMENT,
                class_name TEXT,
                x1 INTEGER,
                y1 INTEGER,
                width INTEGER,
                height INTEGER
            )
        ''')
        self.conn.commit()

    def fetch_objects(self, class_name):
        self.cursor.execute(f'SELECT * FROM tracked_objects WHERE class_name="{class_name}"')
        return self.cursor.fetchall()

    def update_object(self, obj_id, x1, y1, width, height):
        self.cursor.execute('''
            UPDATE tracked_objects 
            SET x1=?, y1=?, width=?, height=? 
            WHERE id=?
        ''', (x1, y1, width, height, obj_id))
        self.conn.commit()

    def insert_object(self, class_name, x1, y1, width, height):
        self.cursor.execute('''
            INSERT INTO tracked_objects (class_name, x1, y1, width, height) 
            VALUES (?, ?, ?, ?, ?)
        ''', (class_name, x1, y1, width, height))
        self.conn.commit()``# Import necessary libraries
from Database import Database
from ObjectDetection import ObjectDetection
from ObjectTracker import ObjectTracker
import cv2

def main():
    db = Database()
    detection_model = ObjectDetection()
    tracker = ObjectTracker(db, detection_model)

    cap = cv2.VideoCapture(0)
    cap.set(3, 640)
    cap.set(4, 480)

    while True:
        success, img = cap.read()
        if not success:
            break

        img = tracker.track_objects(img)
        cv2.imshow('Webcam', img)

        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    cap.release()
    cv2.destroyAllWindows()

if __name__ == "__main__":
    main()`, I would like you to modify the code so the database stores the time the item was last detected and if they've been in the database for over lets say 15mins and have not been detected, if the item was last seen near the edge of the frame, store in the database a comment saying the item was last seen leaving the room.