Hey. So, I think two days back, I asked you to make a PPT of, of surgery metabolic response to and you made a good PPT. Um, I want some changes on that, so I will send you the PPT you made, and I will also send you reference PPT.
The reference is not of the same topic. Actually, I want that, uh, in reference it is more human-like. People made it, like, more humanly. So that's why I want to, the people to look like, not the words, to how do it look like. And also, I'll send you some photos of the table and the picture, the figures in the building, to add those table instead of that, the, that you use through AI. Add those. Replace those, okay?
So these are the ppt you made and the reference one I don’t want that you make same desgin like reference one But i just want to say it looks more human So can you do that not the same But more human And I’ll send you the pictures also so wait
So these are the pictures No need to insert them all Use them wherever you need and replace them with AI one you used
~/
metabolic response to injury ERAS overview surgical stress response
~/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51
"surgical stress" AND metabolism
mkdir -p "/tmp/workspace/metabolic-response-revision/src" "/tmp/workspace/metabolic-response-revision/output" "/tmp/workspace/metabolic-response-revision/assets" && python -c "from pptx import Presentation; from pathlib import Path for f in [Path('/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/Blue and Teal Modern Surgical Presentation.pptx'),Path('/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/Bailey_Metabolic_Response_to_Injury.pptx')]: p=Presentation(str(f)); print('FILE',f.name,'slides',len(p.slides),'size',p.slide_width,p.slide_height) for i,s in enumerate(p.slides,1): texts=[] for sh in s.shapes: if sh.has_text_frame and sh.text.strip(): texts.append(sh.text.replace('\\n',' | ')) print(i, ' || '.join(texts)[:1000]) "
cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2485.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2486.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2487.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2488.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2489.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2490.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2491.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && cp "/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/IMG_2492.jpg" "/tmp/workspace/metabolic-response-revision/assets/" && python - <<'PY' from PIL import Image from pathlib import Path for p in sorted(Path('/tmp/workspace/metabolic-response-revision/assets').glob('*.jpg')): im=Image.open(p); print(p.name, im.size) PY
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/src/build.py') p.write_text(r'''from pptx import Presentation from pptx.util import Inches, Pt from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.enum.shapes import MSO_SHAPE from pptx.dml.color import RGBColor from pptx.enum.dml import MSO_THEME_COLOR from PIL import Image from io import BytesIO OUT='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Revised.pptx' AS='/tmp/workspace/metabolic-response-revision/assets' prs=Presentation(); prs.slide_width=Inches(13.333); prs.slide_height=Inches(7.5) blank=prs.slide_layouts[6] # palette NAVY=RGBColor(22,47,62); TEAL=RGBColor(35,124,129); SAGE=RGBColor(116,153,135); CORAL=RGBColor(204,112,92) CREAM=RGBColor(248,245,239); INK=RGBColor(35,46,53); MUTED=RGBColor(103,113,115); PALE=RGBColor(229,239,234); GOLD=RGBColor(209,161,88); WHITE=RGBColor(255,255,255) def rect(s,x,y,w,h,color, radius=False, line=None): sh=s.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE if radius else MSO_SHAPE.RECTANGLE, Inches(x), Inches(y), Inches(w), Inches(h)) sh.fill.solid(); sh.fill.fore_color.rgb=color sh.line.color.rgb=line if line else color if radius: sh.adjustments[0]=0.12 return sh def text(s,txt,x,y,w,h,sz=20,color=INK,bold=False,font='Aptos',align=PP_ALIGN.LEFT, valign=MSO_ANCHOR.TOP, italic=False): box=s.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(0.03); tf.margin_top=tf.margin_bottom=Inches(0.02); tf.vertical_anchor=valign for i,line in enumerate(txt.split('\n')): p=tf.paragraphs[0] if i==0 else tf.add_paragraph(); p.text=line; p.alignment=align p.space_after=Pt(2); p.font.name=font; p.font.size=Pt(sz); p.font.bold=bold; p.font.italic=italic; p.font.color.rgb=color return box def title(s,n,heading,kicker=None): text(s,f'{n:02d}',0.5,0.34,0.48,0.25,10,TEAL,True,align=PP_ALIGN.CENTER) rect(s,0.55,0.62,0.35,0.04,TEAL) text(s,heading,1.05,0.28,11.5,0.58,25,NAVY,True) if kicker: text(s,kicker,1.07,0.89,11.4,0.30,10,MUTED) rect(s,0.55,7.14,12.23,0.015,RGBColor(211,218,215)) def base(n,h,k=None): s=prs.slides.add_slide(blank); rect(s,0,0,13.333,7.5,CREAM); title(s,n,h,k); return s def add_picture_cover(s, fn,x,y,w,h): im=Image.open(f'{AS}/{fn}'); iw,ih=im.size; ar=iw/ih; tar=w/h # crop source for cover if ar>tar: nw=int(ih*tar); left=(iw-nw)//2; im=im.crop((left,0,left+nw,ih)) else: nh=int(iw/tar); top=(ih-nh)//2; im=im.crop((0,top,iw,top+nh)) buf=BytesIO(); im.save(buf,format='PNG'); buf.seek(0) s.shapes.add_picture(buf, Inches(x), Inches(y), width=Inches(w), height=Inches(h)) return rect(s,x,y,w,h,RGBColor(0,0,0)) def image(s,fn,x,y,w,h,caption=None): # white frame then image contained to preserve labels rect(s,x-0.05,y-0.05,w+0.1,h+0.1,WHITE,True,line=RGBColor(218,218,212)) im=Image.open(f'{AS}/{fn}'); iw,ih=im.size; ar=iw/ih if w/h>ar: ph=h; pw=h*ar; px=x+(w-pw)/2; py=y else: pw=w; ph=w/ar; px=x; py=y+(h-ph)/2 s.shapes.add_picture(f'{AS}/{fn}',Inches(px),Inches(py),width=Inches(pw),height=Inches(ph)) if caption:text(s,caption,x,y+h+0.08,w,0.25,8,MUTED,italic=True) def bullet(s,heading,items,x,y,w): text(s,heading,x,y,w,0.32,13,TEAL,True) yy=y+0.43 for it in items: text(s,'•',x,yy,0.25,0.28,16,CORAL,True) text(s,it,x+0.27,yy,w-0.27,0.52,14,INK) yy+=0.67 def pill(s,label,x,y,w,color=PALE): rect(s,x,y,w,0.38,color,True); text(s,label,x+0.10,y+0.08,w-0.2,0.18,10,NAVY,True,align=PP_ALIGN.CENTER) #1 s=prs.slides.add_slide(blank); rect(s,0,0,13.333,7.5,NAVY); rect(s,0,0,5.1,7.5,TEAL); rect(s,0.62,0.72,1.9,0.34,GOLD,True); text(s,'BAILEY & LOVE | SURGERY',0.76,0.81,1.6,0.15,8,NAVY,True,align=PP_ALIGN.CENTER) text(s,'Metabolic\nresponse\nto injury',0.65,1.55,4.0,2.25,31,WHITE,True); text(s,'How the body moves from acute stress to recovery',0.68,4.12,3.85,0.55,14,RGBColor(232,248,245)); text(s,'A visual, exam-focused overview',0.68,6.37,2.9,0.22,10,RGBColor(208,239,235),italic=True) add_picture_cover(s,'IMG_2486.jpg',5.1,0,8.233,7.5); rect(s,5.1,0,8.233,7.5,RGBColor(0,0,0)); s.shapes[-1].fill.transparency=55 text(s,'Homeostasis • stress response • recovery',5.55,6.56,6.7,0.35,15,WHITE,True) #2 s=base(2,'Start with the big picture','Injury disrupts homeostasis. The response is adaptive - until it is excessive or prolonged.') rect(s,0.7,1.55,11.9,1.02,PALE,True); text(s,'Surgical practice aims to limit metabolic stress and restore the conditions for healing.',1.05,1.88,11.1,0.34,20,NAVY,True,align=PP_ALIGN.CENTER) for x,head,body,co in [(0.9,'HOMEOSTASIS','Stable internal environment',SAGE),(4.72,'STRESSOR','Surgery • trauma • sepsis',CORAL),(8.54,'RECOVERY','Repair and restoration',TEAL)]: rect(s,x,3.45,3.0,1.35,WHITE,True,line=RGBColor(220,225,222)); rect(s,x,3.45,3.0,0.14,co); text(s,head,x+.28,3.75,2.5,.22,11,co,True); text(s,body,x+.28,4.12,2.5,.30,15,INK) text(s,'→',3.98,3.84,.45,.25,24,CORAL,True); text(s,'→',7.80,3.84,.45,.25,24,CORAL,True) text(s,'Learning objectives',0.95,5.58,2.7,.28,13,TEAL,True); text(s,'Classical concepts of homeostasis | Metabolic changes after injury | Physiological and biochemical recovery',0.95,6.02,11.25,.40,15,INK) #3 s=base(3,'The response is graded','Greater injury produces a larger and more sustained metabolic response.') image(s,'IMG_2485.jpg',0.78,1.36,5.1,4.98,'Figure adapted from supplied Bailey & Love page') bullet(s,'Read the curves',["Minor trauma: a modest, shorter-lived rise in metabolic rate and nitrogen loss.","Major trauma: greater hypermetabolism, catabolism and prolonged recovery.","Starvation lowers metabolic rate but compounds loss of body stores."],6.42,1.65,5.6) rect(s,6.42,5.44,5.55,.70,RGBColor(248,230,221),True); text(s,'Clinical takeaway: severity + duration of injury determine the metabolic burden.',6.72,5.68,4.98,.22,12,NAVY,True,align=PP_ALIGN.CENTER) #4 s=base(4,'Mediators of the metabolic response','The neuroendocrine system and innate immune system act together in the first 24-48 hours.') image(s,'IMG_2486.jpg',0.75,1.32,7.05,4.23,'Integrated response to surgical injury - supplied figure') for y,h,b in [(1.50,'NEUROENDOCRINE','ACTH, cortisol, catecholamines, glucagon and GH rise.'),(2.82,'INFLAMMATORY','IL-1, IL-6 and TNF-α amplify the response.'),(4.14,'METABOLIC EFFECT','Lipolysis, gluconeogenesis and proteolysis increase; insulin falls.')]: rect(s,8.27,y,3.85,0.94,WHITE,True,line=RGBColor(220,225,222)); text(s,h,8.52,y+.20,3.3,.18,10,TEAL,True); text(s,b,8.52,y+.46,3.25,.34,12,INK) #5 s=base(5,'Integrated response: injury to metabolism','Afferent signals, hormones and cytokines redirect fuel towards survival, immunity and repair.') image(s,'IMG_2486.jpg',0.78,1.32,6.45,3.87,'Use this diagram to follow the pathways from injury to metabolic effects') text(s,'WHAT CHANGES?',7.80,1.45,3.2,.23,12,TEAL,True) for i,(h,b) in enumerate([('Fuel','Adipocyte lipolysis ↑'),('Glucose','Hepatic gluconeogenesis ↑'),('Muscle','Protein degradation ↑'),('Temperature','Pyrexia + hypermetabolism')]): y=1.93+i*.77; rect(s,7.82,y,4.35,.57,WHITE,True,line=RGBColor(221,224,220)); text(s,h,8.03,y+.16,1.0,.18,11,CORAL,True); text(s,b,9.08,y+.16,2.8,.18,11,INK) rect(s,.84,5.78,11.30,.66,NAVY,True); text(s,'The response supports immediate survival, but prolonged activation drives tissue loss and complications.',1.12,5.99,10.72,.22,13,WHITE,True,align=PP_ALIGN.CENTER) #6 s=base(6,'Systemic inflammation after major injury','The response needs balance: proinflammatory activation followed by counter-regulation.') rect(s,.82,1.42,5.55,4.35,WHITE,True,line=RGBColor(220,225,222)); rect(s,6.95,1.42,5.55,4.35,WHITE,True,line=RGBColor(220,225,222)); text(s,'1. INITIAL ACTIVATION',1.15,1.78,4.8,.25,13,CORAL,True); bullet(s,'', ['IL-1, IL-6 and TNF-α rise early.','Cytokines and acute-phase mediators amplify the response.','An excessive response can become self-perpetuating.'],1.15,2.18,4.8) text(s,'2. COUNTER-REGULATION',7.27,1.78,4.8,.25,13,TEAL,True); bullet(s,'', ['Receptor antagonists and soluble receptors increase.','Pro- and anti-inflammatory activity must remain balanced.','Persistent imbalance contributes to complications.'],7.27,2.18,4.8) rect(s,5.86,3.13,1.60,.62,GOLD,True); text(s,'BALANCE',6.02,3.34,1.28,.18,11,NAVY,True,align=PP_ALIGN.CENTER); text(s,'Cytokines, cortisol, catecholamines and immune pathways form one interacting system.',1.05,6.18,11.2,.28,14,NAVY,True,align=PP_ALIGN.CENTER) #7 s=base(7,'The ebb-flow-recovery model','A practical timeline of the metabolic response after significant injury.') rect(s,1.0,2.68,10.95,.12,RGBColor(196,206,201)); for x,co,phase,time,desc in [(1.15,CORAL,'EBB','Hours','Shock • low metabolic rate\nhypovolaemia • hypothermia'),(4.72,GOLD,'FLOW','Days','Hypermetabolism • pyrexia\ncatabolism • O₂ consumption ↑'),(8.28,TEAL,'RECOVERY','Weeks','Anabolism and repair\nbody stores restored')]: rect(s,x,2.15,2.36,.95,co,True); text(s,phase,x+.13,2.38,2.1,.20,17,WHITE,True,align=PP_ALIGN.CENTER); text(s,time,x+.13,3.36,2.1,.20,12,co,True,align=PP_ALIGN.CENTER); text(s,desc,x+.05,3.77,2.28,.66,12,INK,align=PP_ALIGN.CENTER) text(s,'At about 24-48 hours, the early ebb phase gives way to a catabolic flow phase. Recovery may take weeks.',1.25,5.63,10.85,.30,16,NAVY,True,align=PP_ALIGN.CENTER) #8 s=base(8,'Fuel is redirected from peripheral to central tissues','Muscle, adipose tissue and skin provide amino acids, especially glutamine and alanine.') image(s,'IMG_2487.jpg',.85,1.45,6.0,3.68,'Peripheral tissue amino acids support liver, immunity and wound healing') rect(s,7.38,1.53,4.55,3.22,WHITE,True,line=RGBColor(220,225,222)); text(s,'KEY CATABOLIC ELEMENTS',7.72,1.83,3.85,.22,12,TEAL,True) for i,t in enumerate(['Hypermetabolism: energy expenditure and oxygen consumption ↑','Skeletal muscle: net protein catabolism and amino-acid release','Acute phase: hepatic protein synthesis is reprioritised']): text(s,'0'+str(i+1),7.72,2.32+i*.69,.35,.22,11,CORAL,True); text(s,t,8.20,2.27+i*.69,3.30,.47,12,INK) #9 s=base(9,'Skeletal muscle protein loss','In injury, protein breakdown exceeds synthesis, leading to net muscle loss.') image(s,'IMG_2488.jpg',.72,1.36,6.65,3.18,'Ubiquitin-proteasome pathway for myofibrillar protein degradation') rect(s,7.88,1.49,4.18,3.01,PALE,True); text(s,'CLINICAL CONSEQUENCES',8.18,1.82,3.5,.22,12,TEAL,True); text(s,'• Muscle wasting\n• Reduced function\n• Slower rehabilitation\n• Worse quality of life',8.18,2.26,3.25,1.50,16,INK) text(s,'Illness, immobility and inadequate nutritional support worsen skeletal-muscle loss.',.98,5.47,11.36,.30,16,NAVY,True,align=PP_ALIGN.CENTER) #10 s=base(10,'Acute phase response and insulin resistance','The liver shifts production priorities while glucose control becomes more difficult.') for x,h,co,items in [(0.85,'ACUTE-PHASE RESPONSE',TEAL,['Positive reactants ↑','CRP • plasminogen • fibrinogen','Negative reactants ↓','Albumin • transferrin • prealbumin']),(6.96,'INSULIN RESISTANCE',CORAL,['Glucose production ↑','Peripheral glucose uptake ↓','Hyperglycaemia may occur','Magnitude reflects injury severity'])]: rect(s,x,1.55,5.45,3.62,WHITE,True,line=RGBColor(219,224,220)); rect(s,x,1.55,5.45,.58,co,True); text(s,h,x+.28,1.73,4.9,.18,12,WHITE,True,align=PP_ALIGN.CENTER) for i,it in enumerate(items): text(s,'•',x+.38,2.43+i*.55,.2,.2,15,co,True); text(s,it,x+.67,2.39+i*.55,4.3,.27,14,INK) rect(s,1.38,5.85,10.55,.57,RGBColor(248,230,221),True); text(s,'Avoid unnecessary fasting and support early nutrition when appropriate.',1.72,6.03,9.9,.20,13,NAVY,True,align=PP_ALIGN.CENTER) #11 s=base(11,'Body composition: loss can be hidden by fluid gain','Protein and fat are lost while extracellular water may increase.') image(s,'IMG_2489.jpg',.92,1.39,4.15,4.15,'Chemical body composition of a normal 70-kg male') bullet(s,'What to remember',['Catabolism lowers fat mass and skeletal muscle mass.','Protein loss is accompanied by water and sodium retention.','Body weight may rise despite substantial tissue loss.'],5.95,1.72,5.75) rect(s,5.95,4.71,5.58,.76,NAVY,True); text(s,'Fluid retention can mask the severity of tissue loss.',6.25,4.97,4.98,.22,14,WHITE,True,align=PP_ALIGN.CENTER) #12 s=base(12,'Volume loss and avoidable stressors','Correcting secondary insults limits the catabolic response.') image(s,'IMG_2490.jpg',.74,1.39,7.15,3.27,'Factors that exacerbate the metabolic response to surgical injury') rect(s,8.27,1.38,3.85,3.46,WHITE,True,line=RGBColor(220,225,222)); text(s,'PRACTICAL TARGETS',8.60,1.70,3.2,.21,12,TEAL,True); text(s,'Control haemorrhage\nMaintain normothermia\nTreat sepsis\nProvide analgesia\nAvoid prolonged starvation\nEncourage mobilisation',8.60,2.15,2.95,2.05,15,INK) text(s,'Haemorrhage activates sympathetic pathways, cortisol, aldosterone and ADH - promoting salt and water retention.',.92,5.62,11.5,.31,14,NAVY,True,align=PP_ALIGN.CENTER) #13 s=base(13,'ERAS helps blunt the stress response','Multimodal perioperative care reduces adverse metabolic effects and supports earlier recovery.') image(s,'IMG_2491.jpg',.94,1.48,5.4,3.82,'Enhanced recovery after surgery (ERAS) compared with traditional care') bullet(s,'Core measures',['Minimise operative stress where possible.','Avoid prolonged fasting and excessive intravenous saline.','Use effective analgesia and maintain normothermia.','Support nutrition and early mobilisation.'],6.90,1.60,5.25) rect(s,6.90,5.05,5.02,.62,PALE,True); text(s,'Goal: preserve functional capacity and shorten recovery.',7.15,5.27,4.52,.20,12,NAVY,True,align=PP_ALIGN.CENTER) #14 s=base(14,'Take-home messages','Six ideas to carry into clinical practice and exams.') items=[('01','Injury disturbs homeostasis and triggers neuroendocrine plus immune responses.'),('02','The response is graded: greater injury causes greater and longer stress.'),('03','Ebb phase is followed by hypermetabolic, catabolic flow and later recovery.'),('04','Muscle fuel is redirected to liver, immune system and wound.'),('05','Insulin resistance, acute-phase changes and fluid retention are interconnected.'),('06','Control avoidable stressors to improve surgical recovery.')] for i,(n,t) in enumerate(items): col=i%2; row=i//2; x=.86+col*6.1; y=1.48+row*1.42 rect(s,x,y,5.52,1.02,WHITE,True,line=RGBColor(218,225,221)); rect(s,x+.18,y+.20,.58,.58,TEAL if i%2==0 else CORAL,True); text(s,n,x+.18,y+.37,.58,.18,11,WHITE,True,align=PP_ALIGN.CENTER); text(s,t,x+.95,y+.27,4.2,.5,13,INK) text(s,'Content and figures based on the supplied Bailey & Love textbook material.',.92,6.35,11.4,.23,10,MUTED,italic=True,align=PP_ALIGN.CENTER) prs.save(OUT) print(OUT) ''') PY python "/tmp/workspace/metabolic-response-revision/src/build.py" python - <<'PY' from pptx import Presentation p='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Revised.pptx'; prs=Presentation(p) print('slides',len(prs.slides),'size bytes',__import__('os').path.getsize(p)) for i,s in enumerate(prs.slides,1): print(i,len(s.shapes)) PY
python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Revised.pptx') prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height issues=[] for i,slide in enumerate(prs.slides,1): for j,shape in enumerate(slide.shapes,1): if shape.left < 0 or shape.top < 0 or shape.left+shape.width > sw or shape.top+shape.height > sh: issues.append((i,j,shape.name,shape.left,shape.top,shape.width,shape.height)) print('VALIDATION: slides=',len(prs.slides),' out_of_bounds=',len(issues),' bytes=',p.stat().st_size) assert len(prs.slides)==14 assert not issues PY unzip -t "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Revised.pptx" | tail -1
Metabolic Response to Injury Revised
Presentation · PPTX
Hey its loking more Ai now😭😭 Previous one was better Hey don’t add take home message Don’t things like the bigger pictures Make it simple Add those photos as it is
~/
Bailey Love metabolic response to injury surgical stress response ERAS
python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/Bailey_Metabolic_Response_to_Injury.pptx') prs=Presentation(str(p)) for n in [3,4,5,8,9,11,12,13,14]: s=prs.slides[n-1]; print('\nSLIDE',n) for i,sh in enumerate(s.shapes): txt=(sh.text[:60].replace('\n','|') if getattr(sh,'has_text_frame',False) else '') print(i,sh.shape_type,round(sh.left/914400,2),round(sh.top/914400,2),round(sh.width/914400,2),round(sh.height/914400,2),txt) PY
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/src/revise_simple.py') p.write_text(r'''from pptx import Presentation from pptx.util import Inches from pathlib import Path SRC='/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51/Bailey_Metabolic_Response_to_Injury.pptx' AS=Path('/tmp/workspace/attachments/07dc00cc-302c-453c-a8bf-c6147f73eb51') OUT='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Simple_Revised.pptx' prs=Presentation(SRC) def remove_shape(shape): el=shape._element el.getparent().remove(el) def remove_indices(slide, inds): for i in sorted(inds, reverse=True): remove_shape(slide.shapes[i]) def contain_add(slide, fn, x,y,w,h): from PIL import Image im=Image.open(AS/fn); iw,ih=im.size ar=iw/ih if w/h > ar: ph=h; pw=h*ar; px=x+(w-pw)/2; py=y else: pw=w; ph=w/ar; px=x; py=y+(h-ph)/2 slide.shapes.add_picture(str(AS/fn), Inches(px), Inches(py), width=Inches(pw), height=Inches(ph)) # S3: use the original printed chart instead of the drawn approximation. s=prs.slides[2] remove_indices(s, list(range(5,23))) contain_add(s,'IMG_2485.jpg',0.83,1.43,5.55,3.95) # S5: replace entirely constructed pathway with the supplied textbook figure. s=prs.slides[4] remove_indices(s, list(range(4,28))) contain_add(s,'IMG_2486.jpg',0.75,1.10,11.85,5.70) # S8: replace the synthetic transfer diagram with the supplied figure. s=prs.slides[7] remove_indices(s, list(range(4,12))) contain_add(s,'IMG_2487.jpg',0.82,1.55,11.55,2.58) # S9: replace the constructed proteolysis pathway with textbook artwork. s=prs.slides[8] remove_indices(s, list(range(8,22))) contain_add(s,'IMG_2488.jpg',5.05,1.45,7.20,4.92) # S11: replace the schematic body-composition stack. s=prs.slides[10] remove_indices(s, list(range(5,15))) contain_add(s,'IMG_2489.jpg',0.83,1.35,4.15,4.75) # S12: retain the clinical text but replace the lower constructed cascade. s=prs.slides[11] remove_indices(s, list(range(10,21))) contain_add(s,'IMG_2490.jpg',4.65,4.47,5.55,2.52) # S13: retain the ERAS points but substitute the supplied ERAS graph. s=prs.slides[12] remove_indices(s, list(range(8,23))) contain_add(s,'IMG_2491.jpg',0.85,4.15,5.35,2.83) # Remove the artificial take-home / summary slide, as requested. slide_id = prs.slides._sldIdLst[-1] rel_id = slide_id.rId prs.part.drop_rel(rel_id) prs.slides._sldIdLst.remove(slide_id) prs.save(OUT) print(OUT) ''') PY python "/tmp/workspace/metabolic-response-revision/src/revise_simple.py" python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Simple_Revised.pptx') prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height issues=[] for i,s in enumerate(prs.slides,1): for j,x in enumerate(s.shapes,1): if x.left<0 or x.top<0 or x.left+x.width>sw or x.top+x.height>sh: issues.append((i,j,x.name)) print('slides',len(prs.slides),'size',p.stat().st_size,'bounds errors',issues) for i,s in enumerate(prs.slides,1): print(i, sum(1 for x in s.shapes if x.shape_type==13), 'pictures') assert len(prs.slides)==13 and not issues PY unzip -t "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Simple_Revised.pptx" | tail -1
Metabolic Response to Injury Simple Revised
Presentation · PPTX
This is nice. Thank you so much. Thank you. Thank you so much. And one more thing, uh, remove that.
Hey, so network was networking, and I'm saying like, "Thank you so much. It was good." Just, uh, remove that learning objective thingy, and also remove that in the first page you wrote, you know, billion love and all that. Just write in first page, write the topic name, and then in the corner, right corner, my name, Toshiba Garg, T-O-S-H-I-B-A space G-A-R-G. And, and also add a thank you slide, a simple, just a simple thank you slide in the last. And, uh... Yeah, that's it.
~/
metabolic response to injury surgery overview
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/src/finalize.py') p.write_text(r'''from pptx import Presentation from pptx.util import Inches, Pt from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.enum.shapes import MSO_SHAPE from pptx.dml.color import RGBColor SRC='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Simple_Revised.pptx' OUT='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx' prs=Presentation(SRC) NAVY=RGBColor(22,47,62); TEAL=RGBColor(0,112,125); WHITE=RGBColor(255,255,255) def remove_shape(sh): sh._element.getparent().remove(sh._element) def textbox(slide, txt,x,y,w,h,size,color,bold=False,align=PP_ALIGN.LEFT): b=slide.shapes.add_textbox(Inches(x),Inches(y),Inches(w),Inches(h)); tf=b.text_frame; tf.clear(); tf.word_wrap=True; tf.margin_left=tf.margin_right=Inches(.02); tf.margin_top=tf.margin_bottom=Inches(.01); tf.vertical_anchor=MSO_ANCHOR.MIDDLE p=tf.paragraphs[0]; p.text=txt; p.alignment=align; p.font.name='Aptos'; p.font.size=Pt(size); p.font.bold=bold; p.font.color.rgb=color return b # Title slide: remove every existing item, preserving a plain title slide. s=prs.slides[0] for sh in list(s.shapes): remove_shape(sh) # simple, plain background with a thin teal strip bg=s.background.fill; bg.solid(); bg.fore_color.rgb=WHITE strip=s.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0), Inches(0), Inches(13.333), Inches(.16)); strip.fill.solid(); strip.fill.fore_color.rgb=TEAL; strip.line.color.rgb=TEAL textbox(s,'Metabolic Response to Injury',.78,2.75,8.8,.62,30,NAVY,True) textbox(s,'Toshiba Garg',9.70,.40,2.75,.28,13,NAVY,False,PP_ALIGN.RIGHT) # remove learning objectives and homeostasis slide (slide 2) sldId=prs.slides._sldIdLst[1]; rid=sldId.rId; prs.part.drop_rel(rid); prs.slides._sldIdLst.remove(sldId) # simple Thank You final slide s=prs.slides.add_slide(prs.slide_layouts[6]) bg=s.background.fill; bg.solid(); bg.fore_color.rgb=WHITE strip=s.shapes.add_shape(MSO_SHAPE.RECTANGLE, Inches(0), Inches(0), Inches(13.333), Inches(.16)); strip.fill.solid(); strip.fill.fore_color.rgb=TEAL; strip.line.color.rgb=TEAL textbox(s,'Thank You',0,3.18,13.333,.55,28,NAVY,True,PP_ALIGN.CENTER) textbox(s,'Toshiba Garg',0,4.02,13.333,.28,13,TEAL,False,PP_ALIGN.CENTER) prs.save(OUT) print(OUT) ''') PY python "/tmp/workspace/metabolic-response-revision/src/finalize.py" python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx') prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height print('slides',len(prs.slides),'bytes',p.stat().st_size) for i,s in enumerate(prs.slides,1): txt=' | '.join(x.text.replace('\n',' ') for x in s.shapes if getattr(x,'has_text_frame',False) and x.text.strip()) print(i,txt[:150]) for x in s.shapes: assert x.left>=0 and x.top>=0 and x.left+x.width<=sw and x.top+x.height<=sh assert len(prs.slides)==13 PY unzip -t "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx" | tail -1
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/src/finalize_clean.py') p.write_text(r'''from pptx import Presentation from pptx.util import Inches, Pt from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.enum.shapes import MSO_SHAPE from pptx.dml.color import RGBColor SRC='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Simple_Revised.pptx' OUT='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx' prs=Presentation(SRC) NAVY=RGBColor(22,47,62); TEAL=RGBColor(0,112,125); WHITE=RGBColor(255,255,255) def remove(sh): sh._element.getparent().remove(sh._element) def textbox(s,txt,x,y,w,h,sz,col,bold=False,align=PP_ALIGN.LEFT): b=s.shapes.add_textbox(Inches(x),Inches(y),Inches(w),Inches(h)); t=b.text_frame; t.clear(); t.margin_left=t.margin_right=Inches(.02); t.margin_top=t.margin_bottom=Inches(.01); t.vertical_anchor=MSO_ANCHOR.MIDDLE p=t.paragraphs[0]; p.text=txt; p.alignment=align; p.font.name='Aptos'; p.font.size=Pt(sz); p.font.bold=bold; p.font.color.rgb=col # First slide s=prs.slides[0] for sh in list(s.shapes): remove(sh) s.background.fill.solid(); s.background.fill.fore_color.rgb=WHITE bar=s.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(0),Inches(0),Inches(13.333),Inches(.16)); bar.fill.solid(); bar.fill.fore_color.rgb=TEAL; bar.line.color.rgb=TEAL textbox(s,'Metabolic Response to Injury',.78,2.76,9,.58,30,NAVY,True) textbox(s,'Toshiba Garg',9.7,.40,2.75,.28,13,NAVY,False,PP_ALIGN.RIGHT) # Delete learning-objectives slide sid=prs.slides._sldIdLst[1]; prs.part.drop_rel(sid.rId); prs.slides._sldIdLst.remove(sid) # Change now-final ERAS slide into Thank You, rather than adding a new slide s=prs.slides[-1] for sh in list(s.shapes): remove(sh) s.background.fill.solid(); s.background.fill.fore_color.rgb=WHITE bar=s.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(0),Inches(0),Inches(13.333),Inches(.16)); bar.fill.solid(); bar.fill.fore_color.rgb=TEAL; bar.line.color.rgb=TEAL textbox(s,'Thank You',0,3.18,13.333,.55,28,NAVY,True,PP_ALIGN.CENTER) textbox(s,'Toshiba Garg',0,4.02,13.333,.28,13,TEAL,False,PP_ALIGN.CENTER) prs.save(OUT) print(OUT) ''') PY rm -f "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx" && python "/tmp/workspace/metabolic-response-revision/src/finalize_clean.py" python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx') prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height assert len(prs.slides)==12, len(prs.slides) for i,s in enumerate(prs.slides,1): t=' | '.join(x.text.replace('\n',' ') for x in s.shapes if getattr(x,'has_text_frame',False) and x.text.strip()) print(i,t[:110]) for x in s.shapes: assert x.left>=0 and x.top>=0 and x.left+x.width<=sw and x.top+x.height<=sh assert 'Learning objectives' not in '\n'.join(x.text for s in prs.slides for x in s.shapes if getattr(x,'has_text_frame',False)) assert 'Bailey & Love' not in '\n'.join(x.text for x in prs.slides[0].shapes if getattr(x,'has_text_frame',False)) print('Validated',p.stat().st_size) PY unzip -t "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx" | tail -1
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/src/finalize_correct.py') p.write_text(r'''from pptx import Presentation from pptx.util import Inches, Pt from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.enum.shapes import MSO_SHAPE from pptx.dml.color import RGBColor SRC='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Simple_Revised.pptx' OUT='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx' prs=Presentation(SRC) NAVY=RGBColor(22,47,62); TEAL=RGBColor(0,112,125); WHITE=RGBColor(255,255,255) def remove(sh): sh._element.getparent().remove(sh._element) def tb(s,txt,x,y,w,h,sz,col,bold=False,align=PP_ALIGN.LEFT): b=s.shapes.add_textbox(Inches(x),Inches(y),Inches(w),Inches(h)); t=b.text_frame; t.clear(); t.margin_left=t.margin_right=Inches(.02); t.margin_top=t.margin_bottom=Inches(.01); t.vertical_anchor=MSO_ANCHOR.MIDDLE p=t.paragraphs[0]; p.text=txt; p.alignment=align; p.font.name='Aptos'; p.font.size=Pt(sz); p.font.bold=bold; p.font.color.rgb=col # revise cover s=prs.slides[0] for sh in list(s.shapes): remove(sh) s.background.fill.solid(); s.background.fill.fore_color.rgb=WHITE bar=s.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(0),Inches(0),Inches(13.333),Inches(.16)); bar.fill.solid(); bar.fill.fore_color.rgb=TEAL; bar.line.color.rgb=TEAL tb(s,'Metabolic Response to Injury',.78,2.76,9,.58,30,NAVY,True) tb(s,'Toshiba Garg',9.7,.40,2.75,.28,13,NAVY,False,PP_ALIGN.RIGHT) # Add Thank You while deck still has all original relationships, then remove learning objectives. s=prs.slides.add_slide(prs.slide_layouts[6]) s.background.fill.solid(); s.background.fill.fore_color.rgb=WHITE bar=s.shapes.add_shape(MSO_SHAPE.RECTANGLE,Inches(0),Inches(0),Inches(13.333),Inches(.16)); bar.fill.solid(); bar.fill.fore_color.rgb=TEAL; bar.line.color.rgb=TEAL tb(s,'Thank You',0,3.18,13.333,.55,28,NAVY,True,PP_ALIGN.CENTER) tb(s,'Toshiba Garg',0,4.02,13.333,.28,13,TEAL,False,PP_ALIGN.CENTER) # Remove slide 2 learning objectives. sid=prs.slides._sldIdLst[1]; prs.part.drop_rel(sid.rId); prs.slides._sldIdLst.remove(sid) prs.save(OUT) ''') PY rm -f "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx" && python "/tmp/workspace/metabolic-response-revision/src/finalize_correct.py" python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx'); prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height print('slides:',len(prs.slides),'bytes:',p.stat().st_size) for i,s in enumerate(prs.slides,1): text=' | '.join(x.text.replace('\n',' ') for x in s.shapes if getattr(x,'has_text_frame',False) and x.text.strip()) print(i,text[:125]) for x in s.shapes: assert x.left>=0 and x.top>=0 and x.left+x.width<=sw and x.top+x.height<=sh alltext='\n'.join(x.text for s in prs.slides for x in s.shapes if getattr(x,'has_text_frame',False)) assert len(prs.slides)==13 assert 'Learning objectives' not in alltext assert 'Bailey & Love' not in '\n'.join(x.text for x in prs.slides[0].shapes if getattr(x,'has_text_frame',False)) assert 'Concepts behind enhanced recovery after surgery' in alltext assert prs.slides[-1].shapes[1].text == 'Thank You' PY unzip -t "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx" | tail -1
Metabolic Response to Injury Toshiba Garg
Presentation · PPTX
Hey, my name is in bottom right, not top right. And remove my name from thank you slide. And you put green color, no? Put purple color because it is looking different from whole 3D.
~/
metabolic response to injury surgery overview
python - <<'PY' from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/src/update_cover_purple.py') p.write_text(r'''from pptx import Presentation from pptx.util import Inches from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN SRC='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg.pptx' OUT='/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg_Final.pptx' PURPLE=RGBColor(101,72,143) prs=Presentation(SRC) def remove_shape(sh): sh._element.getparent().remove(sh._element) def add_name(slide): b=slide.shapes.add_textbox(Inches(9.65), Inches(6.72), Inches(2.8), Inches(.28)) tf=b.text_frame; tf.clear(); tf.margin_left=tf.margin_right=Inches(.02); tf.margin_top=tf.margin_bottom=Inches(.01) p=tf.paragraphs[0]; p.text='Toshiba Garg'; p.alignment=PP_ALIGN.RIGHT p.font.name='Aptos'; p.font.size=__import__('pptx').util.Pt(13); p.font.color.rgb=PURPLE # First slide: move name from top right to bottom right; recolour the existing top strip purple. s=prs.slides[0] for sh in list(s.shapes): if getattr(sh,'has_text_frame',False) and sh.text.strip()=='Toshiba Garg': remove_shape(sh) for sh in s.shapes: if sh.shape_type==1 and sh.top < Inches(.25): sh.fill.solid(); sh.fill.fore_color.rgb=PURPLE; sh.line.color.rgb=PURPLE add_name(s) # Final thank-you slide: remove name and recolour its strip purple. s=prs.slides[-1] for sh in list(s.shapes): if getattr(sh,'has_text_frame',False) and sh.text.strip()=='Toshiba Garg': remove_shape(sh) for sh in s.shapes: if sh.shape_type==1 and sh.top < Inches(.25): sh.fill.solid(); sh.fill.fore_color.rgb=PURPLE; sh.line.color.rgb=PURPLE prs.save(OUT) print(OUT) ''') PY python "/tmp/workspace/metabolic-response-revision/src/update_cover_purple.py" python - <<'PY' from pptx import Presentation from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg_Final.pptx') prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height print('slides',len(prs.slides),'bytes',p.stat().st_size) for si in [0,-1]: s=prs.slides[si]; print('slide',si+1 if si>=0 else len(prs.slides),[(x.text,round(x.left/914400,2),round(x.top/914400,2)) for x in s.shapes if getattr(x,'has_text_frame',False) and x.text.strip()]) for x in s.shapes: assert x.left>=0 and x.top>=0 and x.left+x.width<=sw and x.top+x.height<=sh assert any(x.text=='Toshiba Garg' and x.top>Inches(6) for x in prs.slides[0].shapes if getattr(x,'has_text_frame',False)) assert not any(x.text=='Toshiba Garg' for x in prs.slides[-1].shapes if getattr(x,'has_text_frame',False)) PY unzip -t "/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg_Final.pptx" | tail -1
python - <<'PY' from pptx import Presentation from pptx.util import Inches from pathlib import Path p=Path('/tmp/workspace/metabolic-response-revision/output/Metabolic_Response_to_Injury_Toshiba_Garg_Final.pptx') prs=Presentation(str(p)); sw,sh=prs.slide_width,prs.slide_height assert len(prs.slides)==13 cover=prs.slides[0]; thank=prs.slides[-1] assert any(x.text=='Toshiba Garg' and x.top>Inches(6) for x in cover.shapes if getattr(x,'has_text_frame',False)) assert not any(x.text=='Toshiba Garg' for x in thank.shapes if getattr(x,'has_text_frame',False)) for s in prs.slides: for x in s.shapes: assert x.left>=0 and x.top>=0 and x.left+x.width<=sw and x.top+x.height<=sh print('Verified: 13 slides, name bottom-right on cover only, purple accents applied.') PY