malepati/custom_template_working
0
1import sqlite32import json3 4db_path = r"c:\Users\DELL\Documents\upgrading\Accusaga_slides_presentation\servers\fastapi\app_data\fastapi.db"5 6conn = sqlite3.connect(db_path)7cursor = conn.cursor()8 9cursor.execute("PRAGMA table_info(slides);")10cols = cursor.fetchall()11col_names = [col[1] for col in cols]12 13cursor.execute("SELECT * FROM slides")14rows = cursor.fetchall()15 16search_label = "Bipolar Disorder in MDD"17 18for row in rows:19 row_dict = dict(zip(col_names, row))20 content_str = row_dict.get('content') or row_dict.get('slide_content')21 if content_str:22 try:23 content = json.loads(content_str)24 if "chart" in content:25 for item in content["chart"].get("data", []):26 if search_label in str(item.get("label", "")):27 print(f"MATCH FOUND!")28 print(f"Slide ID: {row_dict.get('id')}")29 print(f"Layout ID: {row_dict.get('layout_id') or row_dict.get('layout')}")30 print(f"Presentation: {row_dict.get('presentation')}")31 break32 except:33 pass34 35conn.close()36 