attachment
attachment

Samjho or treatment batao

Reading File
analyse_media
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Ab main poora answer deta hoon. Saari information mil gayi hai.

📋 Report Summary - Miss Mohini Yadav (26 saal, Female)

Gayatri Diagnostic Centre, Indore | Date: 07/08/2026 Referring Doctor: Dr. Pinky Rajalwal

🔍 USG Findings ka Matlab

✅ Jo Normal Hai (Accha):

  • Liver, Gallbladder, Pancreas, Spleen - sab normal size aur texture
  • Dono Kidneys - normal, koi pathri nahi, koi swelling nahi
  • Urinary Bladder - normal, koi pathri nahi
  • Uterus - normal size (7.7 x 4.7 x 3.7 cm), anteverted position - yeh normal hai
  • Endometrium - 8 mm, normal hai
  • Dono Ovaries - normal size, koi cyst nahi, koi dominant follicle nahi
  • IVC, Aorta - normal, koi lymphadenopathy nahi

⚠️ Jo Abnormal Hai (Dhyan dene wali baat):

FindingMatlab
Free fluid in Cul-de-sac (Pouch of Douglas mein fluid)Pelvic area mein infection/inflammation ki wajah se fluid jama hua hai
Distended bowel loopIntestine mein thodi swelling - yeh bhi pelvic infection ke sath common hai

🩺 Impression: PID (Pelvic Inflammatory Disease)

PID Kya Hota Hai?

PID (Pelvic Inflammatory Disease) matlab hai - mahila ke reproductive organs (uterus, fallopian tubes, ovaries) mein infection ya soojan (inflammation). Yeh ek sexually transmitted infection hai jo mainly Neisseria gonorrhoeae ya Chlamydia trachomatis bacteria se hota hai, lekin anaerobes aur gram-negative bacteria bhi zimmedar ho sakte hain.

PID ke Common Symptoms:

  • Pelvic ya lower abdominal pain (neeche pet mein dard)
  • Abnormal vaginal discharge (badbu wala ya mucopurulent)
  • Intercourse ke waqt dard
  • Irregular periods
  • Bukhar (38.3°C se upar)
  • Nausea/Ulti

💊 Treatment (CDC Guidelines ke Anusar)

Outpatient Treatment (Ghar se) - Mild/Moderate Cases:

Regimen A (Preferred):
  • Ceftriaxone 250 mg IM - ek injection
  • + Doxycycline 100 mg twice daily x 14 din
  • + Metronidazole 500 mg twice daily x 14 din
Regimen B (Alternative):
  • Cefoxitin 2g IM + Probenecid 1g oral (ek saath)
  • + Doxycycline 100 mg twice daily x 14 din
  • ± Metronidazole 500 mg twice daily x 14 din

Hospital Mein Admit Kab Karna Chahiye?

Agar neeche likhi koi baat ho toh hospitalize karein aur IV antibiotics dein:
  1. Pregnancy ho
  2. Bahut tez bukhar + ulti + severe pain ho
  3. Tubo-ovarian abscess (TOA) ban gaya ho
  4. Outpatient treatment fail ho gayi ho
  5. Surgical emergency rule out karna ho
IV Treatment (Inpatient):
  • Cefotetan 2g IV har 12 ghante + Doxycycline 100mg (oral ya IV) Ya
  • Clindamycin 900mg IV har 8 ghante + Gentamicin IV

⚠️ Important Baatein

  1. Partner Treatment: Patient ke sexual partner ko bhi tests karwane chahiye aur unhe bhi treat karna zaroori hai - warna infection baar baar ho sakta hai.
  2. Complications agar treatment delay ho:
    • Infertility (ek episode ke baad 15% chance)
    • Ectopic pregnancy ka risk
    • Chronic pelvic pain
    • Tubo-ovarian abscess
  3. NSAIDs (jaise Ibuprofen) - dard ke liye useful hain.
  4. Follow-up: 72 ghante mein gynecologist se follow-up zaroori hai ki treatment kaam kar rahi hai ya nahi.
  5. Radiologist ne likha hai: "Clinic pathological correlation/follow up suggested" - matlab sirf USG se diagnosis confirm nahi hoti. Gynecologist se milna aur clinical examination + lab tests (vaginal swab, CBC, CRP) karwana zaroori hai.

⚠️ Disclaimer: Yeh information educational purpose ke liye hai. Kripya patient ko Dr. Pinky Rajalwal ya kisi qualified gynecologist ke paas le jayen. Woh clinical examination karke correct antibiotic regimen prescribe karenge. Self-medication se bachain.
Sources: Tintinalli's Emergency Medicine, Swanson's Family Medicine Review - CDC PID Treatment Guidelines

Make a quick reference PDF of antibiotic regimens & dosages

Reading File
Running Command

mkdir -p /tmp/workspace/pid-pdf && ls /tmp/workspace/

Writing File

~/pid-pdf/generate_pid_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.pdfgen import canvas
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
from reportlab.platypus.frames import Frame
import datetime

OUTPUT_PATH = "/tmp/workspace/pid-pdf/PID_Antibiotic_Quick_Reference.pdf"

# --- Colors ---
RED_DARK    = colors.HexColor("#B71C1C")
RED_LIGHT   = colors.HexColor("#FFEBEE")
RED_MID     = colors.HexColor("#EF9A9A")
ORANGE_D    = colors.HexColor("#E65100")
ORANGE_L    = colors.HexColor("#FFF3E0")
GREEN_D     = colors.HexColor("#1B5E20")
GREEN_L     = colors.HexColor("#E8F5E9")
BLUE_D      = colors.HexColor("#0D47A1")
BLUE_L      = colors.HexColor("#E3F2FD")
BLUE_MID    = colors.HexColor("#90CAF9")
GREY_DARK   = colors.HexColor("#37474F")
GREY_LIGHT  = colors.HexColor("#ECEFF1")
GREY_MID    = colors.HexColor("#B0BEC5")
WHITE       = colors.white
YELLOW_L    = colors.HexColor("#FFFDE7")
YELLOW_D    = colors.HexColor("#F57F17")
PURPLE_D    = colors.HexColor("#4A148C")
PURPLE_L    = colors.HexColor("#F3E5F5")

# --- Styles ---
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

title_style = S("title_s", fontName="Helvetica-Bold", fontSize=18,
                textColor=WHITE, alignment=TA_CENTER, leading=22)
subtitle_style = S("sub_s", fontName="Helvetica", fontSize=10,
                   textColor=WHITE, alignment=TA_CENTER, leading=14)
section_hdr = S("sec_hdr", fontName="Helvetica-Bold", fontSize=12,
                textColor=WHITE, alignment=TA_CENTER, leading=16)
sub_hdr = S("sub_hdr", fontName="Helvetica-Bold", fontSize=10,
            textColor=GREY_DARK, alignment=TA_LEFT, leading=13)
body = S("body_s", fontName="Helvetica", fontSize=8.5,
         textColor=GREY_DARK, alignment=TA_LEFT, leading=12)
body_bold = S("body_b", fontName="Helvetica-Bold", fontSize=8.5,
              textColor=GREY_DARK, alignment=TA_LEFT, leading=12)
small = S("small_s", fontName="Helvetica", fontSize=7.5,
          textColor=GREY_DARK, alignment=TA_LEFT, leading=11)
small_bold = S("small_b", fontName="Helvetica-Bold", fontSize=7.5,
               textColor=GREY_DARK, alignment=TA_LEFT, leading=11)
note_style = S("note_s", fontName="Helvetica-Oblique", fontSize=7.5,
               textColor=ORANGE_D, alignment=TA_LEFT, leading=11)
warn_style = S("warn_s", fontName="Helvetica-BoldOblique", fontSize=8,
               textColor=RED_DARK, alignment=TA_LEFT, leading=12)
footer_style = S("footer_s", fontName="Helvetica", fontSize=7,
                 textColor=GREY_MID, alignment=TA_CENTER, leading=10)

def make_section_header(text, bg_color):
    data = [[Paragraph(text, section_hdr)]]
    t = Table(data, colWidths=[17.4*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg_color),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("RIGHTPADDING",  (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [4, 4, 4, 4]),
    ]))
    return t

def make_drug_table(headers, rows, col_widths, header_bg, stripe_bg):
    header_row = [Paragraph(h, S("th", fontName="Helvetica-Bold", fontSize=8,
                                  textColor=WHITE, alignment=TA_CENTER, leading=11))
                  for h in headers]
    table_data = [header_row]
    for i, row in enumerate(rows):
        styled = []
        for j, cell in enumerate(row):
            if j == 0:
                styled.append(Paragraph(cell, S("td0", fontName="Helvetica-Bold",
                                                  fontSize=8, textColor=GREY_DARK,
                                                  alignment=TA_LEFT, leading=11)))
            else:
                styled.append(Paragraph(cell, S("td", fontName="Helvetica",
                                                  fontSize=8, textColor=GREY_DARK,
                                                  alignment=TA_LEFT, leading=11)))
        table_data.append(styled)

    t = Table(table_data, colWidths=col_widths)
    style = [
        ("BACKGROUND", (0, 0), (-1, 0), header_bg),
        ("GRID", (0, 0), (-1, -1), 0.4, GREY_MID),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING",    (0, 0), (-1, -1), 4),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 4),
        ("LEFTPADDING",   (0, 0), (-1, -1), 5),
        ("RIGHTPADDING",  (0, 0), (-1, -1), 5),
    ]
    for i in range(1, len(table_data)):
        bg = WHITE if i % 2 == 1 else stripe_bg
        style.append(("BACKGROUND", (0, i), (-1, i), bg))
    t.setStyle(TableStyle(style))
    return t

def make_pill_box(lines, bg, border_color):
    content = "\n".join(lines)
    data = [[Paragraph(content, S("pill", fontName="Helvetica", fontSize=8,
                                   textColor=GREY_DARK, alignment=TA_LEFT, leading=12))]]
    t = Table(data, colWidths=[17.4*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("BOX", (0,0), (-1,-1), 1, border_color),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return t

story = []

# =========================================================
# HEADER BANNER
# =========================================================
banner_data = [[
    Paragraph("PID ANTIBIOTIC QUICK REFERENCE", title_style),
    Paragraph("Pelvic Inflammatory Disease | CDC-Based Treatment Regimens", subtitle_style),
    Paragraph(f"Date: {datetime.date.today().strftime('%d %B %Y')}  •  Source: Tintinalli's EM / Swanson's Family Medicine / CDC Guidelines", subtitle_style),
]]
# Stack vertically
banner_rows = [
    [Paragraph("PID ANTIBIOTIC QUICK REFERENCE", title_style)],
    [Paragraph("Pelvic Inflammatory Disease | CDC-Based Treatment Regimens", subtitle_style)],
    [Paragraph(f"Date: {datetime.date.today().strftime('%d %B %Y')}  |  Tintinalli's EM / Swanson's FM / CDC STI Guidelines", subtitle_style)],
]
banner_t = Table(banner_rows, colWidths=[17.4*cm])
banner_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), RED_DARK),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 10),
    ("RIGHTPADDING",  (0,0), (-1,-1), 10),
]))
story.append(banner_t)
story.append(Spacer(1, 8))

# =========================================================
# SECTION 1: OUTPATIENT REGIMENS
# =========================================================
story.append(KeepTogether([
    make_section_header("OUTPATIENT (ORAL/IM) REGIMENS  —  Mild to Moderate PID", BLUE_D),
    Spacer(1, 4),
]))

# Regimen A box
reg_a_data = [
    [Paragraph("<b>REGIMEN A</b> (Preferred)", S("rh", fontName="Helvetica-Bold", fontSize=9, textColor=BLUE_D, leading=12)),
     Paragraph("", body)],
    [Paragraph("Ceftriaxone", body_bold),
     Paragraph("250 mg IM — Single dose", body)],
    [Paragraph("<b>+</b> Doxycycline", body_bold),
     Paragraph("100 mg PO <b>twice daily x 14 days</b>", body)],
    [Paragraph("<b>±</b> Metronidazole", body_bold),
     Paragraph("500 mg PO <b>twice daily x 14 days</b>  (add if bacterial vaginosis suspected or anaerobic coverage needed)", body)],
]
reg_a_t = Table(reg_a_data, colWidths=[4.5*cm, 12.9*cm])
reg_a_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), BLUE_L),
    ("SPAN", (0,0), (-1,0)),
    ("BACKGROUND", (0,1), (-1,-1), WHITE),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, BLUE_MID),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, BLUE_D),
]))
story.append(reg_a_t)
story.append(Spacer(1, 6))

# Regimen B box
reg_b_data = [
    [Paragraph("<b>REGIMEN B</b> (Alternative)", S("rh2", fontName="Helvetica-Bold", fontSize=9, textColor=BLUE_D, leading=12)),
     Paragraph("", body)],
    [Paragraph("Cefoxitin", body_bold),
     Paragraph("2 g IM once", body)],
    [Paragraph("<b>+</b> Probenecid", body_bold),
     Paragraph("1 g PO — given concurrently with cefoxitin", body)],
    [Paragraph("<b>+</b> Doxycycline", body_bold),
     Paragraph("100 mg PO <b>twice daily x 14 days</b>", body)],
    [Paragraph("<b>±</b> Metronidazole", body_bold),
     Paragraph("500 mg PO <b>twice daily x 14 days</b>", body)],
]
reg_b_t = Table(reg_b_data, colWidths=[4.5*cm, 12.9*cm])
reg_b_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), BLUE_L),
    ("SPAN", (0,0), (-1,0)),
    ("BACKGROUND", (0,1), (-1,-1), WHITE),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, BLUE_MID),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, BLUE_D),
]))
story.append(reg_b_t)
story.append(Spacer(1, 6))

# Regimen C
reg_c_data = [
    [Paragraph("<b>REGIMEN C</b> (If cephalosporin not feasible + low fluoroquinolone resistance area)", S("rh3", fontName="Helvetica-Bold", fontSize=9, textColor=BLUE_D, leading=12)),
     Paragraph("", body)],
    [Paragraph("Levofloxacin", body_bold),
     Paragraph("500 mg PO once daily x 14 days", body)],
    [Paragraph("OR Ofloxacin", body_bold),
     Paragraph("400 mg PO twice daily x 14 days", body)],
    [Paragraph("<b>±</b> Metronidazole", body_bold),
     Paragraph("500 mg PO <b>twice daily x 14 days</b>", body)],
]
reg_c_t = Table(reg_c_data, colWidths=[4.5*cm, 12.9*cm])
reg_c_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), BLUE_L),
    ("SPAN", (0,0), (-1,0)),
    ("BACKGROUND", (0,1), (-1,-1), WHITE),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, BLUE_MID),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, BLUE_D),
]))
story.append(reg_c_t)
story.append(Spacer(1, 4))

fq_warn = Table([[Paragraph(
    "⚠  Fluoroquinolones (Levofloxacin/Ofloxacin) are NO LONGER first-line for gonorrhea. Use only if local resistance data confirm susceptibility.",
    warn_style)]],
    colWidths=[17.4*cm])
fq_warn.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), RED_LIGHT),
    ("BOX", (0,0), (-1,-1), 1, RED_DARK),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
]))
story.append(fq_warn)
story.append(Spacer(1, 10))

# =========================================================
# SECTION 2: INPATIENT REGIMENS
# =========================================================
story.append(KeepTogether([
    make_section_header("INPATIENT (IV/PARENTERAL) REGIMENS  —  Severe / Hospitalized Cases", RED_DARK),
    Spacer(1, 4),
]))

# IV Regimen A
iv_a_data = [
    [Paragraph("<b>IV REGIMEN A</b> (Preferred)", S("ivh", fontName="Helvetica-Bold", fontSize=9, textColor=RED_DARK, leading=12)),
     Paragraph("", body)],
    [Paragraph("Cefotetan", body_bold),
     Paragraph("2 g IV every 12 hours", body)],
    [Paragraph("OR Cefoxitin", body_bold),
     Paragraph("2 g IV every 6 hours", body)],
    [Paragraph("<b>+</b> Doxycycline", body_bold),
     Paragraph("100 mg PO or IV every 12 hours  <i>(PO preferred — same bioavailability, less painful)</i>", body)],
]
iv_a_t = Table(iv_a_data, colWidths=[4.5*cm, 12.9*cm])
iv_a_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED_LIGHT),
    ("SPAN", (0,0), (-1,0)),
    ("BACKGROUND", (0,1), (-1,-1), WHITE),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, RED_MID),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, RED_DARK),
]))
story.append(iv_a_t)
story.append(Spacer(1, 6))

# IV Regimen B
iv_b_data = [
    [Paragraph("<b>IV REGIMEN B</b> (Alternative)", S("ivh2", fontName="Helvetica-Bold", fontSize=9, textColor=RED_DARK, leading=12)),
     Paragraph("", body)],
    [Paragraph("Clindamycin", body_bold),
     Paragraph("900 mg IV every 8 hours", body)],
    [Paragraph("<b>+</b> Gentamicin", body_bold),
     Paragraph("<b>Loading dose:</b> 2 mg/kg IV or IM<br/><b>Maintenance:</b> 1.5 mg/kg every 8 h  <i>(or 3–5 mg/kg once daily)</i>", body)],
]
iv_b_t = Table(iv_b_data, colWidths=[4.5*cm, 12.9*cm])
iv_b_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED_LIGHT),
    ("SPAN", (0,0), (-1,0)),
    ("BACKGROUND", (0,1), (-1,-1), WHITE),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, RED_MID),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, RED_DARK),
]))
story.append(iv_b_t)
story.append(Spacer(1, 6))

# IV Regimen C (Alternative)
iv_c_data = [
    [Paragraph("<b>IV REGIMEN C</b> (Limited data — Alternative Parenteral)", S("ivh3", fontName="Helvetica-Bold", fontSize=9, textColor=RED_DARK, leading=12)),
     Paragraph("", body)],
    [Paragraph("Ampicillin/Sulbactam", body_bold),
     Paragraph("3 g IV every 6 hours", body)],
    [Paragraph("<b>+</b> Doxycycline", body_bold),
     Paragraph("100 mg PO or IV every 12 hours", body)],
]
iv_c_t = Table(iv_c_data, colWidths=[4.5*cm, 12.9*cm])
iv_c_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED_LIGHT),
    ("SPAN", (0,0), (-1,0)),
    ("BACKGROUND", (0,1), (-1,-1), WHITE),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, RED_MID),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, RED_DARK),
]))
story.append(iv_c_t)
story.append(Spacer(1, 4))

switch_note = Table([[Paragraph(
    "✔  Step-down: Switch IV → Oral antibiotics after clinical improvement (usually 24-48 h afebrile). Complete 14-day total course.",
    S("sn", fontName="Helvetica-BoldOblique", fontSize=8, textColor=GREEN_D, leading=12))]], colWidths=[17.4*cm])
switch_note.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), GREEN_L),
    ("BOX", (0,0), (-1,-1), 1, GREEN_D),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
]))
story.append(switch_note)
story.append(Spacer(1, 10))

# =========================================================
# SECTION 3: HOSPITALIZATION CRITERIA
# =========================================================
story.append(make_section_header("INDICATIONS FOR HOSPITALIZATION", ORANGE_D))
story.append(Spacer(1, 4))

hosp_rows = [
    ["1.", "Pregnancy"],
    ["2.", "Severe illness: high fever, nausea, vomiting, unable to tolerate oral medications"],
    ["3.", "Tubo-ovarian abscess (TOA) present on imaging"],
    ["4.", "Outpatient oral treatment has failed (no improvement in 72 h)"],
    ["5.", "Surgical emergency cannot be excluded (e.g. appendicitis)"],
    ["6.", "Patient unable to follow or comply with oral regimen"],
]
hosp_data = [[Paragraph(r[0], body_bold), Paragraph(r[1], body)] for r in hosp_rows]
hosp_t = Table(hosp_data, colWidths=[1*cm, 16.4*cm])
hosp_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), ORANGE_L),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, colors.HexColor("#FFCC80")),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, ORANGE_D),
]))
story.append(hosp_t)
story.append(Spacer(1, 10))

# =========================================================
# SECTION 4: QUICK DRUG SUMMARY TABLE
# =========================================================
story.append(make_section_header("QUICK DRUG SUMMARY", GREY_DARK))
story.append(Spacer(1, 4))

drug_headers = ["Drug", "Route", "Dose", "Frequency", "Duration", "Setting"]
drug_rows = [
    ["Ceftriaxone",       "IM",   "250 mg",           "Single dose",    "Once",    "Outpatient"],
    ["Doxycycline",       "PO/IV","100 mg",           "Twice daily",    "14 days", "Both"],
    ["Metronidazole",     "PO",   "500 mg",           "Twice daily",    "14 days", "Both"],
    ["Cefoxitin",         "IM/IV","2 g",              "IM once / IV q6h","Once/14d","Both"],
    ["Probenecid",        "PO",   "1 g",              "Once (with cefoxitin)","Once","Outpatient"],
    ["Levofloxacin",      "PO",   "500 mg",           "Once daily",     "14 days", "Outpatient*"],
    ["Ofloxacin",         "PO",   "400 mg",           "Twice daily",    "14 days", "Outpatient*"],
    ["Cefotetan",         "IV",   "2 g",              "Every 12 hours", "Until improved","Inpatient"],
    ["Clindamycin",       "IV",   "900 mg",           "Every 8 hours",  "Until improved","Inpatient"],
    ["Gentamicin",        "IV/IM","2 mg/kg (LD)\n1.5 mg/kg (MD)","q8h (or 3-5 mg/kg q24h)","Until improved","Inpatient"],
    ["Ampicillin/Sulbactam","IV", "3 g",              "Every 6 hours",  "Until improved","Inpatient"],
]
drug_t = make_drug_table(
    drug_headers, drug_rows,
    col_widths=[3.2*cm, 1.6*cm, 2.8*cm, 3.2*cm, 2.8*cm, 2.4*cm],  # adjusted to 16cm col total — adjust
    header_bg=GREY_DARK,
    stripe_bg=GREY_LIGHT
)
# re-calc colWidths for full width
drug_t._argW = [3.5*cm, 1.5*cm, 2.8*cm, 3.3*cm, 2.6*cm, 2.4*cm]  # ~16.1 cm, slightly less than 17.4
story.append(drug_t)
story.append(Spacer(1, 4))
story.append(Paragraph(
    "* Fluoroquinolones only if cephalosporin not feasible AND local fluoroquinolone resistance is low. "
    "No longer recommended as first-line for gonorrhea.  LD = Loading Dose, MD = Maintenance Dose.",
    note_style))
story.append(Spacer(1, 10))

# =========================================================
# SECTION 5: FOLLOW UP & KEY POINTS
# =========================================================
story.append(make_section_header("FOLLOW-UP & KEY CLINICAL POINTS", PURPLE_D))
story.append(Spacer(1, 4))

key_rows = [
    ["Follow-up",       "72 hours after starting treatment to assess clinical response."],
    ["Partner Tx",      "ALL sexual partners within prior 60 days MUST be evaluated and treated. Without this, re-infection is likely."],
    ["Causative Organisms", "N. gonorrhoeae, C. trachomatis, anaerobes, gram-negative facultative bacteria, streptococci."],
    ["Complications",   "Infertility (15% after 1 episode), ectopic pregnancy, chronic pelvic pain, tubo-ovarian abscess (TOA)."],
    ["Pain Management", "NSAIDs are very effective for pelvic pain. Add adequate analgesia and antiemetics if needed."],
    ["IUD",             "Current CDC guidelines: insufficient evidence to recommend routine IUD removal during PID treatment. Close follow-up required."],
    ["Minimal Dx Criteria", "Cervical motion tenderness OR uterine tenderness OR adnexal tenderness (in absence of other diagnosis)."],
    ["Empiric Rx",      "CDC recommends low threshold for empiric treatment — overtreatment is preferred over missed diagnosis."],
]
key_data = [[Paragraph(r[0], small_bold), Paragraph(r[1], small)] for r in key_rows]
key_t = Table(key_data, colWidths=[3.8*cm, 13.6*cm])
key_t.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), PURPLE_L),
    ("LINEBELOW", (0,0), (-1,-1), 0.3, colors.HexColor("#CE93D8")),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("BOX", (0,0), (-1,-1), 1, PURPLE_D),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(key_t)
story.append(Spacer(1, 10))

# =========================================================
# FOOTER DISCLAIMER
# =========================================================
story.append(HRFlowable(width="100%", thickness=0.5, color=GREY_MID))
story.append(Spacer(1, 4))
story.append(Paragraph(
    "DISCLAIMER: This quick reference is for educational purposes only. All treatment decisions must be made by a qualified clinician based on "
    "individual patient assessment, local resistance patterns, allergy history, and current guidelines. "
    "Sources: Tintinalli's Emergency Medicine (9th Ed.), Swanson's Family Medicine Review, CDC STI Treatment Guidelines.",
    footer_style))

# =========================================================
# BUILD PDF
# =========================================================
doc = SimpleDocTemplate(
    OUTPUT_PATH,
    pagesize=A4,
    rightMargin=1.3*cm,
    leftMargin=1.3*cm,
    topMargin=1.5*cm,
    bottomMargin=1.5*cm,
    title="PID Antibiotic Quick Reference",
    author="Orris Medical Assistant",
    subject="Pelvic Inflammatory Disease Treatment Regimens",
)
doc.build(story)
print(f"PDF created: {OUTPUT_PATH}")
Running Command

cd /tmp/workspace/pid-pdf && python generate_pid_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/pid-pdf/PID_Antibiotic_Quick_Reference.pdf

PDF ready hai! Yahan se download karein:

PID Antibiotic Quick Reference

PDF Document · PDF


PDF mein kya kya hai:
SectionContent
Outpatient RegimensRegimen A (Ceftriaxone+Doxy±Metro), B (Cefoxitin+Probenecid+Doxy), C (Fluoroquinolone - alternative) with full doses
Inpatient IV RegimensIV Regimen A (Cefotetan/Cefoxitin + Doxy), B (Clindamycin + Gentamicin), C (Ampicillin/Sulbactam + Doxy)
Hospitalization Criteria6 clear indications listed
Drug Summary TableSaari drugs ek table mein - route, dose, frequency, duration, setting
Key Clinical PointsFollow-up timing, partner treatment, complications, IUD guidance, minimal diagnostic criteria
DisclaimerSource references (Tintinalli's EM, Swanson's FM, CDC Guidelines)
This is a shared conversation. Sign in to Orris to start your own chat.