Pilon nephritis in pregnancy. Make a comprehensive 7 to 8 pages PPT with images, important images added.
ACOG pyelonephritis pregnancy clinical consensus inpatient antibiotics 2023
pyelonephritis AND pregnancy
acute pyelonephritis pregnancy renal ultrasound diagram urinary tract pregnancy
https://www.acog.org/clinical/clinical-guidance/clinical-con…
pyelonephritis pregnancy ultrasound hydronephrosis illustrative image Wikimedia Commons
~/
mkdir -p "/tmp/workspace/pyelonephritis-pregnancy-ppt/src" "/tmp/workspace/pyelonephritis-pregnancy-ppt/assets" "/tmp/workspace/pyelonephritis-pregnancy-ppt/output" && python /tmp/skills/shared/scripts/fetch_images.py "https://upload.wikimedia.org/wikipedia/commons/f/f8/Ultrasound_of_right_kidney_moderate_hydronephrosis.jpg" "https://cdn.ncbi.nlm.nih.gov/pmc/blobs/259a/4939717/f443506ca73b/usg-15073-f1.jpg" > "/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/fetched_images.json"
~/pyelonephritis-pregnancy-ppt/src/create_deck.py
import os, json, base64
from io import BytesIO
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.shapes import MSO_SHAPE, MSO_CONNECTOR
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.enum.dml import MSO_THEME_COLOR
ROOT='/tmp/workspace/pyelonephritis-pregnancy-ppt'
OUT=f'{ROOT}/output/Acute_Pyelonephritis_in_Pregnancy.pptx'
ASSET=f'{ROOT}/assets'
with open(f'{ASSET}/fetched_images.json') as f: imgs=json.load(f)
for i,item in enumerate(imgs):
if item.get('base64'):
raw=base64.b64decode(item['base64'].split(',',1)[1])
open(f'{ASSET}/img_{i}.jpg','wb').write(raw)
US=f'{ASSET}/img_1.jpg'
# Palette
NAVY=RGBColor(16,43,66); TEAL=RGBColor(22,128,137); MINT=RGBColor(219,243,240)
CORAL=RGBColor(221,93,83); GOLD=RGBColor(231,173,64); INK=RGBColor(33,45,57)
MUTED=RGBColor(91,106,119); WHITE=RGBColor(255,255,255); PALE=RGBColor(246,249,250)
REDPALE=RGBColor(253,237,235); BLUEPALE=RGBColor(232,244,246)
prs=Presentation(); prs.slide_width=Inches(13.333); prs.slide_height=Inches(7.5)
blank=prs.slide_layouts[6]
def rect(slide,x,y,w,h,fill, radius=False, line=None):
s=slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE if radius else MSO_SHAPE.RECTANGLE, Inches(x), Inches(y), Inches(w), Inches(h))
s.fill.solid(); s.fill.fore_color.rgb=fill
s.line.color.rgb=line if line else fill
return s
def text(slide, x,y,w,h, value, size=18, color=INK, bold=False, font='Aptos', align=None, valign=None):
tb=slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h)); tf=tb.text_frame
tf.clear(); tf.word_wrap=True; tf.margin_left=tf.margin_right=tf.margin_top=tf.margin_bottom=0
lines=value.split('\n')
for idx,line in enumerate(lines):
p=tf.paragraphs[0] if idx==0 else tf.add_paragraph(); p.text=line
p.font.name=font; p.font.size=Pt(size); p.font.bold=bold; p.font.color.rgb=color
if align: p.alignment=align
p.space_after=Pt(0)
if valign: tf.vertical_anchor=valign
return tb
def rich_bullets(slide,x,y,w,h,items,size=17, color=INK, accent=TEAL):
tb=slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h)); tf=tb.text_frame; tf.clear(); tf.word_wrap=True
tf.margin_left=tf.margin_right=tf.margin_top=tf.margin_bottom=0
for n,item in enumerate(items):
p=tf.paragraphs[0] if n==0 else tf.add_paragraph(); p.text=item; p.font.name='Aptos'; p.font.size=Pt(size); p.font.color.rgb=color
p.level=0; p.space_after=Pt(8); p._p.get_or_add_pPr().insert(0, __import__('pptx').oxml.parse_xml('<a:buChar xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" char="•"/>'))
return tb
def title(slide,kicker,heading,sub=''):
text(slide,.62,.30,12,.24,kicker.upper(),10,TEAL,True)
text(slide,.62,.58,12,0.56,heading,27,NAVY,True)
if sub:text(slide,.62,1.16,12,.33,sub,12,MUTED)
rect(slide,.62,1.57,12.05,.025,TEAL)
def footer(slide,n,src):
rect(slide,.62,7.10,12.05,.015,RGBColor(209,219,222))
text(slide,.62,7.18,1,.16,str(n).zfill(2),9,TEAL,True)
text(slide,1.1,7.18,11.55,.18,src,8,MUTED,False,align=PP_ALIGN.RIGHT)
def pill(slide,x,y,w,label,fill=BLUEPALE,fg=NAVY):
s=rect(slide,x,y,w,.34,fill,True); text(slide,x+.12,y+.07,w-.24,.15,label,10,fg,True,align=PP_ALIGN.CENTER)
def add_pic(slide,path,x,y,w,h):
if os.path.exists(path): slide.shapes.add_picture(path, Inches(x), Inches(y), width=Inches(w), height=Inches(h))
def kidney(slide,x,y,scale=1,fill=CORAL):
# simplified kidney anatomy icon
s=slide.shapes.add_shape(MSO_SHAPE.TEARDROP, Inches(x), Inches(y), Inches(.75*scale), Inches(1.05*scale)); s.rotation=210
s.fill.solid();s.fill.fore_color.rgb=fill;s.line.color.rgb=fill
ln=slide.shapes.add_connector(MSO_CONNECTOR.CURVE,Inches(x+.58*scale),Inches(y+.8*scale),Inches(x+.9*scale),Inches(y+1.55*scale));ln.line.color.rgb=fill;ln.line.width=Pt(2)
# 1 Cover
s=prs.slides.add_slide(blank); rect(s,0,0,13.333,7.5,NAVY); rect(s,8.85,0,4.483,7.5,TEAL)
# abstract urinary tree
kidney(s,9.7,1.1,2.15,MINT); kidney(s,11.25,1.2,1.8,MINT)
for x,y,yy in [(10.9,3.3,5.5),(12.0,3.0,5.5)]:
ln=s.shapes.add_connector(MSO_CONNECTOR.STRAIGHT,Inches(x),Inches(y),Inches(x),Inches(yy)); ln.line.color.rgb=MINT; ln.line.width=Pt(4)
rect(s,10.65,5.3,1.75,1.1,MINT,True); text(s,.72,.75,5.8,.28,'OBSTETRIC MEDICINE',11,MINT,True)
text(s,.72,1.45,7.4,1.24,'Acute Pyelonephritis\nin Pregnancy',36,WHITE,True)
text(s,.75,3.05,6.7,.46,'Recognition, safe evaluation, and time-critical management',17,RGBColor(214,234,237))
pill(s,.75,4.05,1.82,'MATERNAL SEPSIS',RGBColor(60,98,118),WHITE);pill(s,2.72,4.05,1.5,'PRETERM RISK',RGBColor(60,98,118),WHITE)
text(s,.75,6.5,6,.3,'Educational clinical deck | Updated September 2026',11,RGBColor(195,215,219))
footer(s,1,'Key sources: ACOG Clinical Consensus No. 4 (2023); Creasy & Resnik MFM')
# 2 definition epidemiology
s=prs.slides.add_slide(blank);title(s,'01 | Clinical framing','Why pregnancy changes the risk','Acute bacterial infection of the renal pelvis and parenchyma, usually from ascending lower-tract infection.')
rect(s,.68,1.9,3.55,4.64,PALE,True);text(s,.98,2.18,2.9,.28,'AT A GLANCE',12,TEAL,True);text(s,.98,2.63,2.7,.63,'1% to 2.5%',31,NAVY,True);text(s,.98,3.3,2.8,.55,'reported incidence\nin pregnancy',14,MUTED)
rect(s,.98,4.15,2.85,.02,TEAL);text(s,.98,4.45,2.8,.4,'Often occurs in the\nsecond or third trimester.',16,INK,True)
rect(s,4.6,1.9,3.65,4.64,BLUEPALE,True);text(s,4.92,2.18,2.9,.28,'KEY RISKS',12,TEAL,True);rich_bullets(s,4.92,2.65,2.95,2.8,['Untreated asymptomatic bacteriuria (ASB)','Previous UTI or pyelonephritis','Urinary obstruction, stones, neurogenic bladder','Diabetes or structural urinary anomaly'],15)
rect(s,8.65,1.9,3.98,4.64,REDPALE,True);text(s,8.97,2.18,3.15,.28,'WHY IT MATTERS',12,CORAL,True);rich_bullets(s,8.97,2.65,3.1,2.7,['Maternal sepsis and shock','Acute respiratory distress syndrome','Preterm contractions or delivery','Fetal growth and neonatal risks'],16,INK,CORAL)
footer(s,2,'Sources: Creasy & Resnik’s Maternal-Fetal Medicine, pp. 1124-26; ACOG 2023')
# 3 pathophysiology
s=prs.slides.add_slide(blank);title(s,'02 | Mechanism','Pregnancy creates urinary stasis and facilitates ascent')
# flow cards
cards=[('Progesterone','↓ ureteric tone\n↓ peristalsis',TEAL),('Enlarging uterus','Mechanical ureteric\ncompression',GOLD),('Collecting system','Dilatation + reflux\n+ urinary stasis',CORAL),('Ascending infection','Cystitis / ASB →\nrenal infection',NAVY)]
for i,(a,b,c) in enumerate(cards):
x=.73+i*3.12; rect(s,x,2.38,2.52,1.65,PALE,True);rect(s,x,2.38,2.52,.18,c,True);text(s,x+.18,2.75,2.15,.27,a,16,NAVY,True);text(s,x+.18,3.16,2.15,.44,b,13,MUTED)
if i<3:
ln=s.shapes.add_connector(MSO_CONNECTOR.STRAIGHT,Inches(x+2.55),Inches(3.20),Inches(x+3.03),Inches(3.20));ln.line.color.rgb=TEAL;ln.line.width=Pt(2.5)
# lower panel
rect(s,.73,4.62,7.25,1.38,BLUEPALE,True);text(s,1.02,4.86,6.7,.22,'THE MICROBIOLOGY',11,TEAL,True);text(s,1.02,5.19,6.55,.47,'Most cases are due to enteric Gram-negative organisms, especially Escherichia coli. Culture-directed therapy matters.',15,INK)
rect(s,8.31,4.62,4.3,1.38,REDPALE,True);text(s,8.6,4.86,3.6,.22,'CLINICAL IMPLICATION',11,CORAL,True);text(s,8.6,5.19,3.55,.47,'ASB in pregnancy deserves screening and treatment to reduce progression risk.',15,INK)
footer(s,3,'Sources: Creasy & Resnik’s Maternal-Fetal Medicine, p. 1124; Bailey & Love, p. 1404')
# 4 presentation diagnosis
s=prs.slides.add_slide(blank);title(s,'03 | Recognition','Diagnose clinically, confirm microbiologically, assess severity')
rect(s,.7,1.92,3.65,4.7,REDPALE,True);text(s,1,2.18,3,.28,'SUSPECT WHEN',12,CORAL,True);text(s,1,2.7,2.8,.55,'Fever ≥38°C',27,NAVY,True);rich_bullets(s,1,3.44,2.9,2.5,['Flank pain or costovertebral angle tenderness','Pyuria, bacteriuria, nitrites on urine studies','Nausea, vomiting, chills, tachycardia'],15)
rect(s,4.66,1.92,3.74,4.7,BLUEPALE,True);text(s,4.96,2.18,3,.28,'INITIAL WORK-UP',12,TEAL,True);rich_bullets(s,4.96,2.65,3,3.2,['Urinalysis and urine culture before antibiotics if feasible','CBC, creatinine, electrolytes; blood cultures if septic','Maternal observations, urine output, oxygen saturation','Fetal assessment appropriate to gestation'],15)
rect(s,8.72,1.92,3.88,4.7,PALE,True);text(s,9.02,2.18,3,.28,'ALWAYS SCREEN FOR',12,TEAL,True);rich_bullets(s,9.02,2.65,3.05,3.2,['Sepsis: hypotension, altered mentation, rising lactate','Preterm labor and uterine irritability','Obstruction or stone','Alternate source: appendicitis, chorioamnionitis, renal colic'],15)
footer(s,4,'Diagnosis threshold and inpatient principle: ACOG Clinical Consensus No. 4 (2023)')
# 5 ultrasound image
s=prs.slides.add_slide(blank);title(s,'04 | Imaging & complications','Ultrasound first when the course is atypical or response is poor')
rect(s,.7,1.9,6.07,4.75,NAVY,True);add_pic(s,US,.9,2.1,5.67,3.64);text(s,.95,5.84,5.55,.38,'Example renal ultrasound: inflammatory renal changes / collecting-system dilatation',10,WHITE)
rect(s,7.15,1.9,5.45,2.1,BLUEPALE,True);text(s,7.47,2.18,4.8,.25,'WHEN TO IMAGE',12,TEAL,True);rich_bullets(s,7.47,2.58,4.55,1.15,['No clinical improvement after initial therapy','Concern for obstruction, stone, pyonephrosis, or renal abscess'],15)
rect(s,7.15,4.25,5.45,2.4,REDPALE,True);text(s,7.47,4.53,4.8,.25,'ESCALATE URGENTLY',12,CORAL,True);rich_bullets(s,7.47,4.92,4.6,1.2,['Persistent fever, worsening pain, sepsis, oliguria, or respiratory compromise','Involve obstetrics, urology, radiology, and critical care as indicated'],15)
footer(s,5,'Image: PMC9552702, Figure 1 (renal ultrasound features). Imaging guidance: Bailey & Love, p. 1404')
# 6 treatment
s=prs.slides.add_slide(blank);title(s,'05 | Management','Inpatient care, IV antibiotics with renal penetration, culture-directed step-down')
# timeline
steps=[('1','ADMIT & STABILIZE','IV access; cultures; fluids; antipyretic; assess sepsis and fetus'),('2','START EMPIRIC IV THERAPY','Use local susceptibility data and pregnancy-safe agent with renal tissue penetration'),('3','REASSESS AT 24–48 H','Vitals, urine output, symptoms, laboratory response; review culture'),('4','STEP DOWN & COMPLETE','Change to susceptible oral therapy when improving; total antibiotic course 14 days')]
for i,(num,a,b) in enumerate(steps):
y=1.95+i*1.16; rect(s,.92,y,1.0,.78,TEAL if i<3 else CORAL,True);text(s,.92,y+.13,1,.36,num,23,WHITE,True,align=PP_ALIGN.CENTER)
rect(s,2.16,y,9.85,.78,PALE,True);text(s,2.47,y+.13,3.45,.18,a,13,NAVY,True);text(s,5.72,y+.13,5.82,.32,b,12,MUTED)
rect(s,.92,6.68,11.1,.2,REDPALE,True);text(s,1.15,6.72,10.7,.14,'Do not use nitrofurantoin or fosfomycin to treat pyelonephritis: they do not achieve adequate renal tissue levels.',10,CORAL,True,align=PP_ALIGN.CENTER)
footer(s,6,'ACOG 2023: inpatient initial management; parenteral therapy until clinical improvement; total 14 days')
# 7 agents safety
s=prs.slides.add_slide(blank);title(s,'06 | Antimicrobial choices','Choose regimen with obstetric, renal, culture, and local-resistance context')
headers=['Situation','Common IV options*','Key point']
xs=[.73,3.6,8.4]; widths=[2.6,4.55,4.1]
for x,w,h in zip(xs,widths,headers): rect(s,x,1.95,w,.5,NAVY,True);text(s,x+.14,2.1,w-.28,.18,h,12,WHITE,True)
rows=[('Typical empiric inpatient therapy','Ceftriaxone; cefepime; or ampicillin + gentamicin','Use regimen guided by local antibiogram, allergy history, and severity.'),('Severe beta-lactam allergy','Aztreonam may be considered','Seek specialist advice, especially if septic or resistance risk is high.'),('Oral step-down','Culture-susceptible oral agent','Complete total 14-day treatment course after clinical improvement.'),('Avoid as treatment for upper-tract infection','Nitrofurantoin; fosfomycin','Inadequate renal parenchymal concentrations.')]
for i,row in enumerate(rows):
y=2.48+i*.93; fill=PALE if i%2==0 else BLUEPALE
for x,w,val in zip(xs,widths,row): rect(s,x,y,w,.88,fill,False);text(s,x+.14,y+.12,w-.28,.56,val,12,INK, i==0 and x==.73)
text(s,.75,6.36,11.7,.3,'*Illustrative options, not a substitute for local protocol. Adjust when culture and susceptibility results return.',10,MUTED)
footer(s,7,'Sources: ACOG 2023; Merck Manual Professional (accessed 2026); StatPearls UTI in Pregnancy')
# 8 prevention
s=prs.slides.add_slide(blank);title(s,'07 | Prevention & take-home algorithm','Prevent recurrence and treat the next febrile pregnant patient as a potential sepsis case')
# algorithm
for i,(a,b,c) in enumerate([('Fever + flank pain','Obtain urine studies and assess maternal/fetal severity',TEAL),('Admit','Start IV therapy with renal tissue penetration',NAVY),('Culture review','Tailor therapy; investigate poor response / obstruction',GOLD),('Follow-up','14 days total therapy; consider culture-matched suppression if recurrence risk',CORAL)]):
x=.72+i*3.05; rect(s,x,2.02,2.55,1.45,PALE,True);rect(s,x,2.02,2.55,.16,c,True);text(s,x+.18,2.43,2.14,.22,a,15,NAVY,True);text(s,x+.18,2.78,2.12,.38,b,11,MUTED)
if i<3:
ln=s.shapes.add_connector(MSO_CONNECTOR.STRAIGHT,Inches(x+2.58),Inches(2.75),Inches(x+2.98),Inches(2.75));ln.line.color.rgb=TEAL;ln.line.width=Pt(2)
rect(s,.73,4.22,5.72,1.72,BLUEPALE,True);text(s,1.03,4.5,5.1,.2,'PREVENTION',12,TEAL,True);rich_bullets(s,1.03,4.84,4.95,.8,['Screen once early in prenatal care with urine culture for ASB','Treat ASB when identified; culture-based surveillance where clinically indicated'],14)
rect(s,6.8,4.22,5.8,1.72,REDPALE,True);text(s,7.1,4.5,5.1,.2,'TAKE-HOME',12,CORAL,True);rich_bullets(s,7.1,4.84,5.0,.8,['Pregnancy pyelonephritis is an inpatient disease at presentation','Act early to protect maternal respiratory, renal, and obstetric outcomes'],14)
text(s,.75,6.3,11.75,.34,'Suggested reference: ACOG. Urinary Tract Infections in Pregnant Individuals. Obstet Gynecol. 2023;142:435-445.',9,MUTED)
footer(s,8,'Educational use only. Follow local obstetric, infectious disease, and antimicrobial stewardship protocols.')
# metadata
prs.core_properties.title='Acute Pyelonephritis in Pregnancy'
prs.core_properties.subject='Clinical educational presentation'
prs.core_properties.author='Orris'
prs.save(OUT)
print(OUT)
python "/tmp/workspace/pyelonephritis-pregnancy-ppt/src/create_deck.py" && ls -lh "/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Acute_Pyelonephritis_in_Pregnancy.pptx"
~/pyelonephritis-pregnancy-ppt/src/create_deck.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/pyelonephritis-pregnancy-ppt/src/create_deck.py'
python "/tmp/workspace/pyelonephritis-pregnancy-ppt/src/create_deck.py" && ls -lh "/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Acute_Pyelonephritis_in_Pregnancy.pptx"
python - <<'PY' from pptx import Presentation p='/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Acute_Pyelonephritis_in_Pregnancy.pptx' prs=Presentation(p) print('slides',len(prs.slides)) for i,s in enumerate(prs.slides,1): texts=[sh.text_frame.text.replace('\n',' | ') for sh in s.shapes if sh.has_text_frame and sh.text_frame.text.strip()] pics=sum(1 for sh in s.shapes if sh.shape_type==13) print(i, 'shapes=',len(s.shapes),'pictures=',pics,'title=',texts[1] if len(texts)>1 else texts[0]) PY python - <<'PY' import zipfile p='/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Acute_Pyelonephritis_in_Pregnancy.pptx' with zipfile.ZipFile(p) as z: print('embedded media', [x for x in z.namelist() if x.startswith('ppt/media/')]) PY
Acute Pyelonephritis in Pregnancy
Presentation · PPTX