CoolFace
Apppublic

malepati/custom_template_working

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
get_problematic_code.py44 linesDownload Raw Back to root
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 9# Full PID from previous step (I need to get it again properly or just search)10cursor.execute("SELECT id, presentation, content, layout_id FROM slides")11rows = cursor.fetchall()12search_label = "Bipolar Disorder in MDD"13 14target_pid = None15target_lid = None16 17for row in rows:18    try:19        content = json.loads(row[2])20        if "chart" in content:21            for item in content["chart"].get("data", []):22                if search_label in str(item.get("label", "")):23                    target_pid = row[1]24                    target_lid = row[3]25                    break26    except:27        pass28 29if target_pid and target_lid:30    print(f"Found Slide. PID: {target_pid}, LID: {target_lid}")31    # Now get the code from presentation_layout_codes32    cursor.execute("SELECT layout_code FROM presentation_layout_codes WHERE presentation = ? AND layout_id = ?", (target_pid, target_lid))33    code_row = cursor.fetchone()34    if code_row:35        with open("problematic_layout.tsx", "w", encoding="utf-8") as f:36            f.write(code_row[0])37        print("Saved problematic layout code to problematic_layout.tsx")38    else:39        print("Could not find layout code in presentation_layout_codes")40else:41    print("Could not find the target slide.")42 43conn.close()44