Pyelonephritis in pregnancy.create a comprehensive ppt of 7/8 pages with important clinical images
ACOG pyelonephritis pregnancy clinical consensus inpatient treatment antibiotics 2023
pyelonephritis pregnancy renal ultrasound illustration infected kidney urinary tract
pyelonephritis pregnancy
https://www.acog.org/clinical/clinical-guidance/clinical-con…
pyelonephritis pregnancy renal ultrasound image clinical figure
~/
https://pmc.ncbi.nlm.nih.gov/articles/PMC9552702
~/
mkdir -p "/tmp/workspace/pyelonephritis-pregnancy-ppt/assets" "/tmp/workspace/pyelonephritis-pregnancy-ppt/src" "/tmp/workspace/pyelonephritis-pregnancy-ppt/output" && python /tmp/skills/shared/scripts/fetch_images.py "https://cdn.ncbi.nlm.nih.gov/pmc/blobs/6caa/9552702/a9cc978ff80f/cureus-0014-00000029029-i01.jpg" > "/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/image_fetch.json" && python -c "import json; d=json.load(open('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/image_fetch.json')); print([(x.get('url'), bool(x.get('base64')),x.get('error')) for x in d])"
python -c "import json,base64; from pathlib import Path; d=json.load(open('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/image_fetch.json')); Path('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/renal_ultrasound.jpg').write_bytes(base64.b64decode(d[0]['base64'].split(',',1)[1]))" && python -c "from PIL import Image; im=Image.open('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/renal_ultrasound.jpg'); print(im.size)"
python /tmp/skills/shared/scripts/fetch_images.py "https://f6publishing.blob.core.windows.net/2c6405c8-3cff-4c41-b13b-4bd55523af95/98300-g002.png" "https://static.elsevier.es/multimedia/20132514/0000002900000005/v0_201502091625/X2013251409003801/v0_201502091626/en/main.assets/42718078_f1_pag492.jpg" > "/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/image_fetch_2.json" && python -c "import json;d=json.load(open('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/image_fetch_2.json'));print([(x['url'],bool(x.get('base64')),x.get('error')) for x in d])"
python -c "import json,base64; from pathlib import Path; d=json.load(open('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/image_fetch_2.json')); [(Path('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets') / ('renal_mri.png' if i==0 else 'renal_image2.jpg')).write_bytes(base64.b64decode(x['base64'].split(',',1)[1])) for i,x in enumerate(d)]" && python -c "from PIL import Image; import os; [print(f,Image.open('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/'+f).size) for f in os.listdir('/tmp/workspace/pyelonephritis-pregnancy-ppt/assets') if f.endswith(('.jpg','.png'))]"
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/pyelonephritis-pregnancy-ppt/src/create_deck.py') p.write_text(r'''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 from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE from PIL import Image import os OUT='/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Pyelonephritis_in_Pregnancy.pptx' AS='/tmp/workspace/pyelonephritis-pregnancy-ppt/assets' W,H=13.333,7.5 NAVY=RGBColor(12,42,68); TEAL=RGBColor(22,126,133); MINT=RGBColor(221,244,239) CORAL=RGBColor(225,104,82); GOLD=RGBColor(238,178,63); INK=RGBColor(27,43,56); MUTED=RGBColor(89,108,120); PALE=RGBColor(246,249,250); RED=RGBColor(170,51,55) WHITE=RGBColor(255,255,255); LIGHTBLUE=RGBColor(227,241,246) prs=Presentation(); prs.slide_width=Inches(W); prs.slide_height=Inches(H) blank=prs.slide_layouts[6] def rect(slide,x,y,w,h,fill,line=None,r=False): sh=slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE if r else MSO_SHAPE.RECTANGLE,Inches(x),Inches(y),Inches(w),Inches(h)) sh.fill.solid(); sh.fill.fore_color.rgb=fill sh.line.color.rgb=line if line else fill if r: sh.adjustments[0]=0.08 return sh def text(slide,x,y,w,h,s,size=20,color=INK,bold=False, font='Aptos',align=None, valign=MSO_ANCHOR.TOP,margin=0.04): box=slide.shapes.add_textbox(Inches(x),Inches(y),Inches(w),Inches(h)); tf=box.text_frame tf.clear(); tf.word_wrap=True; tf.margin_left=tf.margin_right=Inches(margin); tf.margin_top=tf.margin_bottom=Inches(margin); tf.vertical_anchor=valign lines=s.split('\n') for i,line in enumerate(lines): p=tf.paragraphs[0] if i==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(2) return box def rich_bullets(slide,x,y,w,h,items,size=18, color=INK): box=slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h)); tf=box.text_frame; tf.clear(); tf.word_wrap=True tf.margin_left=tf.margin_right=Inches(.06); tf.margin_top=Inches(.03); tf.margin_bottom=Inches(.02) for i,item in enumerate(items): p=tf.paragraphs[0] if i==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.text='• '+item; p.space_after=Pt(8) return box def title(slide,kicker,heading,sub=''): text(slide,.55,.31,12.2,.28,kicker.upper(),10,TEAL,True) text(slide,.55,.59,12.15,.57,heading,28,NAVY,True) if sub: text(slide,.57,1.18,12,.3,sub,11,MUTED) rect(slide,.55,1.55,12.2,.025,TEAL) def footer(slide,n): text(slide,.55,7.17,8.8,.18,'Teaching deck | Clinical decision-making should follow local protocols and culture susceptibility.',8,MUTED) text(slide,12.18,7.13,.55,.22,f'{n:02d}',10,TEAL,True,align=PP_ALIGN.RIGHT) def image_crop(slide,path,x,y,w,h): # Cover crop while retaining center im=Image.open(path); iw,ih=im.size; ar=iw/ih; tar=w/h if ar>tar: crop_w=int(ih*tar); left=(iw-crop_w)//2; im=im.crop((left,0,left+crop_w,ih)) else: crop_h=int(iw/tar); top=(ih-crop_h)//2; im=im.crop((0,top,iw,top+crop_h)) tmp='/tmp/workspace/pyelonephritis-pregnancy-ppt/assets/crop_'+os.path.basename(path)+f'_{int(x*100)}.png'; im.save(tmp) slide.shapes.add_picture(tmp,Inches(x),Inches(y),width=Inches(w),height=Inches(h)) def pill(slide,x,y,w,label,fill=LIGHTBLUE,tc=NAVY): rect(slide,x,y,w,.34,fill,r=True); text(slide,x+.08,y+.07,w-.16,.16,label,10,tc,True,align=PP_ALIGN.CENTER) # 1 cover s=prs.slides.add_slide(blank); rect(s,0,0,W,H,NAVY); rect(s,0,0,.18,H,TEAL) # visual anatomy abstraction for cx,cy,rx,ry in [(10.8,2.4,.65,.9),(11.9,2.4,.65,.9)]: sh=s.shapes.add_shape(MSO_SHAPE.OVAL,Inches(cx-rx),Inches(cy-ry),Inches(2*rx),Inches(2*ry)); sh.fill.solid();sh.fill.fore_color.rgb=RGBColor(65,156,163);sh.line.color.rgb=RGBColor(65,156,163) sh2=s.shapes.add_shape(MSO_SHAPE.OVAL,Inches(cx-rx*.58),Inches(cy-ry*.56),Inches(rx*1.16),Inches(ry*1.12)); sh2.fill.solid();sh2.fill.fore_color.rgb=RGBColor(137,204,203);sh2.line.color.rgb=RGBColor(137,204,203) # ureters for x in [10.8,11.9]: ln=s.shapes.add_connector(MSO_CONNECTOR.STRAIGHT,Inches(x),Inches(3.3),Inches(x),Inches(4.55)); ln.line.color.rgb=RGBColor(137,204,203);ln.line.width=Pt(3) bl=s.shapes.add_shape(MSO_SHAPE.OVAL,Inches(10.87),Inches(4.42),Inches(.95),Inches(.7));bl.fill.solid();bl.fill.fore_color.rgb=RGBColor(137,204,203);bl.line.color.rgb=RGBColor(137,204,203) text(s,.72,.75,8.5,.3,'MATERNAL MEDICINE | 8-SLIDE CLINICAL REVIEW',12,RGBColor(150,219,213),True) text(s,.72,1.42,8.7,1.32,'Pyelonephritis\nin Pregnancy',34,WHITE,True) text(s,.75,3.08,7.9,.6,'Recognition, inpatient stabilization, antimicrobial therapy, and prevention',17,RGBColor(216,235,237)) rect(s,.73,4.25,7.45,.7,RGBColor(20,66,89),r=True); text(s,.98,4.47,6.9,.22,'A fever-plus-flank-pain emergency: protect both mother and fetus.',16,RGBColor(255,218,132),True) text(s,.75,6.65,7.5,.2,'Prepared for clinical teaching | September 2026',10,RGBColor(165,202,208)) footer(s,1) # 2 why pregnancy s=prs.slides.add_slide(blank); title(s,'Why it happens','Pregnancy facilitates ascending infection','Anatomy, hormonal effects, and urinary stasis lower the threshold for upper-tract infection.') # flow steps=[('1','Progesterone','↓ ureteric tone and peristalsis'),('2','Growing uterus','Ureteric compression and dilation'),('3','Bladder changes','↑ capacity and incomplete emptying'),('4','Result','Reflux + urinary stasis → ascent to kidney')] for i,(num,head,body) in enumerate(steps): x=.65+i*3.08 rect(s,x,2.08,2.65,2.48,WHITE,r=True) rect(s,x+.18,2.27,.45,.45,TEAL,r=True); text(s,x+.18,2.37,.45,.15,num,13,WHITE,True,align=PP_ALIGN.CENTER) text(s,x+.2,2.94,2.25,.3,head,17,NAVY,True) text(s,x+.2,3.42,2.25,.65,body,14,MUTED) if i<3: text(s,x+2.74,3.13,.26,.3,'→',21,TEAL,True,align=PP_ALIGN.CENTER) rect(s,.67,5.05,5.8,1.35,MINT,r=True); text(s,.92,5.28,5.25,.25,'Main pathogen: uropathogenic Escherichia coli',17,NAVY,True); text(s,.92,5.68,5.15,.38,'Adherence to uroepithelium supports colonization and ascension.',13,INK) rect(s,6.78,5.05,5.9,1.35,RGBColor(255,243,228),r=True); text(s,7.03,5.28,5.3,.25,'Risk factors to actively identify',17,CORAL,True); text(s,7.03,5.68,5.25,.44,'Prior pyelonephritis, asymptomatic bacteriuria, stones/obstruction, and neurogenic urinary tract disease.',13,INK) text(s,.67,6.72,12,.2,'Textbook source: Creasy & Resnik’s Maternal-Fetal Medicine, pp. 1124-1125.',9,MUTED); footer(s,2) # 3 diagnosis s=prs.slides.add_slide(blank); title(s,'Clinical recognition','Think pyelonephritis when fever and upper-tract signs coexist','Diagnosis is clinical, supported by urinalysis and culture.') rect(s,.65,1.9,4.0,4.64,RGBColor(255,242,239),r=True); text(s,.92,2.15,3.5,.3,'CORE SYNDROME',12,RED,True); text(s,.92,2.6,3.35,.5,'Fever ≥38°C',27,RED,True); text(s,.92,3.3,3.1,.3,'plus urine studies suggesting UTI',15,INK) text(s,.92,4.04,3.2,.25,'Supporting upper-tract features',14,NAVY,True); rich_bullets(s,.92,4.35,3.3,1.5,['Flank pain or CVA tenderness','Chills, nausea, vomiting','Dysuria, urgency, frequency'],15) rect(s,4.98,1.9,3.55,4.64,WHITE,r=True); text(s,5.25,2.15,3,.3,'INITIAL WORK-UP',12,TEAL,True); rich_bullets(s,5.25,2.65,2.95,3.25,['Vitals and sepsis assessment','Urinalysis and urine culture before antibiotics if feasible','CBC, creatinine, electrolytes; blood cultures if severe/systemically ill','Assess contractions and fetal status according to gestation/severity'],15) rect(s,8.85,1.9,3.82,4.64,LIGHTBLUE,r=True); text(s,9.12,2.15,3.25,.3,'IMPORTANT DIFFERENTIALS',12,NAVY,True); rich_bullets(s,9.12,2.65,3.2,3.15,['Acute cystitis','Nephrolithiasis / obstructed infected system','Appendicitis, cholecystitis, gastroenteritis','Chorioamnionitis or other source of sepsis'],15) text(s,.67,6.72,12,.2,'ACOG: fever ≥38°C, urine studies suggesting UTI, and flank pain or CVA tenderness support the diagnosis.',9,MUTED); footer(s,3) #4 image imaging s=prs.slides.add_slide(blank); title(s,'Imaging and escalation','Ultrasound is the first imaging test when the course is complicated','Image when there is no clinical improvement by 48-72 hours or concern for obstruction, stone, abscess, or alternate diagnosis.') image_crop(s,AS+'/renal_ultrasound.jpg',.65,1.92,6.1,3.95); rect(s,.65,5.87,6.1,.44,NAVY); text(s,.78,5.99,5.85,.17,'Renal ultrasound: features compatible with pyelonephritis',11,WHITE,True) rect(s,7.07,1.92,5.6,4.39,WHITE,r=True); text(s,7.35,2.18,5.0,.25,'What sonography may show',17,NAVY,True); rich_bullets(s,7.35,2.72,4.9,2.4,['Renal enlargement or altered echotexture','Loss of corticomedullary differentiation','Altered Doppler perfusion','Collecting-system dilatation / hydronephrosis'],16) rect(s,7.35,5.31,4.9,.58,RGBColor(255,243,228),r=True); text(s,7.55,5.5,4.5,.18,'A normal ultrasound does not exclude pyelonephritis.',12,CORAL,True) text(s,.67,6.72,12,.22,'Clinical image: ultrasound figure from Ogunlusi et al., Cureus 2022 (CC BY 4.0). Clinical escalation consistent with ACOG 2023.',8,MUTED); footer(s,4) #5 management s=prs.slides.add_slide(blank); title(s,'Immediate management','Admit, resuscitate, culture, and start renal-tissue-penetrating IV therapy','Do not wait for culture results when acute pyelonephritis is suspected.') items=[('0–1 h','Admit and stabilize','Assess ABCs, sepsis physiology, IV access, fluids as indicated; antipyretic/antiemetic support.'),('Early','Cultures and monitoring','Urine culture and susceptibility; labs; monitor maternal vitals, urine output, contractions/fetal status as indicated.'),('Empiric IV','Antibiotic therapy','Use local obstetric protocol and susceptibility patterns. Ensure adequate renal tissue penetration; tailor to culture.'),('48–72 h','Reassess response','Clinical improvement should include symptom improvement and afebrile status. If not improving, evaluate resistance and obstruction/abscess.'),('After response','Complete therapy','Transition to culture-directed oral agent when clinically improved. Complete 14 days total antibiotics.')] for i,(t,h,b) in enumerate(items): y=1.88+i*.93; rect(s,.68,y,1.05,.63,TEAL if i<3 else NAVY,r=True); text(s,.79,y+.16,.82,.18,t,12,WHITE,True,align=PP_ALIGN.CENTER) text(s,1.98,y+.05,2.25,.23,h,15,NAVY,True); text(s,4.18,y+.03,8.05,.42,b,13,INK) rect(s,.68,6.64,12,.25,RGBColor(255,242,239),r=True); text(s,.88,6.69,11.6,.13,'Avoid using nitrofurantoin or fosfomycin to complete pyelonephritis treatment: inadequate renal parenchymal levels.',10,RED,True) footer(s,5) #6 antibiotics s=prs.slides.add_slide(blank); title(s,'Antibiotic principles','Choose empiric therapy with renal parenchymal penetration, then de-escalate to culture','Specific agent and dose must follow local antibiogram, allergy history, renal function, and obstetric protocol.') rect(s,.65,1.92,3.65,4.74,WHITE,r=True); text(s,.93,2.16,3.1,.3,'EMPIRIC INPATIENT APPROACH',13,TEAL,True); rich_bullets(s,.93,2.68,2.9,3.15,['Start parenteral therapy that covers likely uropathogens and penetrates renal tissue','Modify after culture and sensitivity return','Review recent antimicrobial exposure and local resistance','Escalate/seek specialist input for severe sepsis, resistant isolate, allergy complexity, or obstruction'],15) rect(s,4.55,1.92,3.85,4.74,RGBColor(255,248,229),r=True); text(s,4.84,2.16,3.1,.3,'COMMON PROTOCOL OPTIONS',13,RGBColor(148,98,0),True); text(s,4.84,2.69,3.15,.46,'Examples often used in hospital protocols',14,NAVY,True); rich_bullets(s,4.84,3.3,3.05,2.0,['Ceftriaxone','Cefepime','Ampicillin plus gentamicin (where appropriate)','Aztreonam with beta-lactam allergy'],15) rect(s,8.66,1.92,4.01,4.74,RGBColor(255,242,239),r=True); text(s,8.95,2.16,3.3,.3,'DO NOT MISS',13,RED,True); rich_bullets(s,8.95,2.68,3.1,2.55,['Adjust drugs to culture susceptibility','Continue IV until clinical improvement','Complete 14 days total therapy','Nitrofurantoin and fosfomycin are not suitable for renal parenchymal infection'],15) text(s,.67,6.74,12,.18,'ACOG identifies ceftriaxone, cefepime, and ampicillin plus gentamicin as example inpatient regimens; follow your institutional guideline.',8,MUTED); footer(s,6) #7 complications s=prs.slides.add_slide(blank); title(s,'Maternal and fetal risk','Clinical deterioration can be rapid','Prompt inpatient treatment reduces the chance of sepsis-related and obstetric complications.') # maternal/fetal columns rect(s,.65,1.92,5.76,4.7,RGBColor(255,242,239),r=True); text(s,.95,2.18,5.0,.3,'MATERNAL COMPLICATIONS',14,RED,True); rich_bullets(s,.95,2.76,4.7,2.9,['Sepsis and septic shock','Acute respiratory distress syndrome','Acute kidney injury','Anemia and bacteremia','Renal/perinephric abscess or obstructed infected system'],18) rect(s,6.68,1.92,5.98,4.7,MINT,r=True); text(s,6.98,2.18,5.0,.3,'OBSTETRIC / FETAL CONSEQUENCES',14,TEAL,True); rich_bullets(s,6.98,2.76,4.8,2.9,['Uterine contractions and preterm labor','Preterm birth','Fetal tachycardia or compromise in maternal sepsis','Growth-related risks in severe/prolonged illness'],18) rect(s,.66,6.67,11.98,.25,NAVY,r=True); text(s,.86,6.72,11.5,.12,'Red flags: hypotension, altered mental state, hypoxia, oliguria, rising creatinine, persistent fever, or persistent tachycardia.',10,WHITE,True) footer(s,7) #8 prevention source s=prs.slides.add_slide(blank); title(s,'Prevention and take-home algorithm','Screen bacteriuria, treat early, and prevent recurrence','This is a clinical teaching summary, not a substitute for patient-specific care.') # algorithm for i,(h,b,c) in enumerate([('Prenatal urine culture','Screen once early in prenatal care; treat clinically significant asymptomatic bacteriuria.',TEAL),('Acute symptoms','Differentiate cystitis from upper-tract infection; send culture.',NAVY),('Fever + flank pain','Admit for suspected pyelonephritis, IV therapy, and maternal-fetal surveillance.',CORAL),('After recovery','Culture-directed completion of 14-day total treatment; consider suppression if recurrent, individualized.',TEAL)]): x=.67+i*3.06; rect(s,x,2.03,2.72,2.78,WHITE,r=True); rect(s,x,2.03,2.72,.15,c); text(s,x+.18,2.44,2.33,.38,h,17,NAVY,True,align=PP_ALIGN.CENTER); text(s,x+.2,3.12,2.3,.97,b,13,INK,align=PP_ALIGN.CENTER); if i<3: text(s,x+2.75,3.12,.25,.2,'→',18,c,True,align=PP_ALIGN.CENTER) rect(s,.67,5.26,12,1.05,LIGHTBLUE,r=True); text(s,.95,5.48,11.4,.22,'Take home: fever ≥38°C plus urine evidence of UTI and flank pain/CVA tenderness warrants an inpatient, culture-directed treatment pathway.',15,NAVY,True,align=PP_ALIGN.CENTER) text(s,.68,6.52,12,.2,'Key references',11,NAVY,True) text(s,.68,6.75,12,.37,'1. ACOG Clinical Consensus: Urinary Tract Infections in Pregnant Individuals (2023). 2. Creasy & Resnik’s Maternal-Fetal Medicine, 9th ed., pp. 1124-1125. 3. Ogunlusi et al. Pyelonephritis in Pregnancy, Cureus 2022.',8,MUTED) footer(s,8) prs.save(OUT) print(OUT) ''') PY python "/tmp/workspace/pyelonephritis-pregnancy-ppt/src/create_deck.py" python - <<'PY' from pptx import Presentation p='/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Pyelonephritis_in_Pregnancy.pptx' prs=Presentation(p); print('slides',len(prs.slides)); print([len(s.shapes) for s in prs.slides]) PY
python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Pyelonephritis_in_Pregnancy.pptx') prs=Presentation(str(p)) assert len(prs.slides)==8 for i,s in enumerate(prs.slides,1): texts=[sh.text for sh in s.shapes if getattr(sh,'has_text_frame',False) and sh.text.strip()] assert texts, f'blank slide {i}' print('verified:',p.exists(),p.stat().st_size,'bytes;',len(prs.slides),'slides') PY ls -lh "/tmp/workspace/pyelonephritis-pregnancy-ppt/output/Pyelonephritis_in_Pregnancy.pptx"
Give it download form ppt