Can you add Exsanguinating external hemorrhage before ABCDE taking reference from Sabiston 22nd edition Primary survey(xABCDE)
cd /tmp/workspace && mkdir -p exsang_task && cp "/tmp/workspace/attachments/0e474fbc-5e6b-4e3c-a4ef-00762dc6d648/Initial_Assessment_and_Management_of_Trauma copy copy.pptx" exsang_task/deck.pptx && python3 -c " from pptx import Presentation prs = Presentation('exsang_task/deck.pptx') for i, slide in enumerate(prs.slides, 1): texts=[] for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): texts.append(shape.text_frame.text) joined = ' | '.join(texts) if 'ABCDE' in joined or 'Primary survey' in joined or 'Primary Survey' in joined: print('SLIDE', i) print(joined) print('---') "
cd /tmp/workspace/exsang_task && python /tmp/skills/pptx/scripts/office/unpack.py deck.pptx unpacked/ && ls unpacked/ppt/slides/ | head -60
~/exsang_task/edit_slide11.py
import re
path = "/tmp/workspace/exsang_task/unpacked/ppt/slides/slide11.xml"
xml = open(path).read()
orig_len = len(xml)
# 1. Shrink box width for A-E boxes to make room for the new X box
assert xml.count('cx="1993392"') == 5, xml.count('cx="1993392"')
xml = xml.replace('cx="1993392"', 'cx="1623060"')
# 2. Reposition existing A-E boxes to the right
box_moves = [
('640080', '2491740'), # A
('2862072', '4343400'), # B
('5084064', '6195060'), # C
('7306056', '8046720'), # D
('9528048', '9898380'), # E
]
for old, new in box_moves:
marker = f'x="{old}" y="2103120"'
assert xml.count(marker) == 1, (marker, xml.count(marker))
xml = xml.replace(marker, f'x="{new}" y="2103120"')
# 3. Reposition existing 4 arrows (A->B, B->C, C->D, D->E)
arrow_moves = [
('2651760', '4133088'),
('4873752', '5984748'),
('7095744', '7836408'),
('9317736', '9688068'),
]
for old, new in arrow_moves:
marker = f'x="{old}" y="3154680"'
assert xml.count(marker) == 1, (marker, xml.count(marker))
xml = xml.replace(marker, f'x="{new}" y="3154680"')
# 4. Build new X box + new arrow (X -> A), inserted before box A (id=6)
new_shapes = ''' <p:sp>
<p:nvSpPr>
<p:cNvPr id="200" name="Rounded Rectangle X"/>
<p:cNvSpPr/>
<p:nvPr/>
</p:nvSpPr>
<p:spPr>
<a:xfrm>
<a:off x="640080" y="2103120"/>
<a:ext cx="1623060" cy="2377440"/>
</a:xfrm>
<a:prstGeom prst="roundRect">
<a:avLst/>
</a:prstGeom>
<a:solidFill>
<a:srgbClr val="6B0F0F"/>
</a:solidFill>
<a:ln w="25400">
<a:solidFill>
<a:srgbClr val="FFFFFF"/>
</a:solidFill>
</a:ln>
<a:effectLst/>
</p:spPr>
<p:style>
<a:lnRef idx="1">
<a:schemeClr val="accent1"/>
</a:lnRef>
<a:fillRef idx="3">
<a:schemeClr val="accent1"/>
</a:fillRef>
<a:effectRef idx="2">
<a:schemeClr val="accent1"/>
</a:effectRef>
<a:fontRef idx="minor">
<a:schemeClr val="lt1"/>
</a:fontRef>
</p:style>
<p:txBody>
<a:bodyPr wrap="square" tIns="76200" rtlCol="0" anchor="ctr"/>
<a:lstStyle/>
<a:p>
<a:pPr algn="ctr"/>
<a:r>
<a:rPr sz="4000" b="1" dirty="0">
<a:solidFill>
<a:srgbClr val="FFFFFF"/>
</a:solidFill>
<a:latin typeface="Calibri"/>
</a:rPr>
<a:t>X</a:t>
</a:r>
</a:p>
<a:p>
<a:pPr algn="ctr"/>
<a:r>
<a:rPr sz="1300" b="1" dirty="0">
<a:solidFill>
<a:srgbClr val="FFFFFF"/>
</a:solidFill>
<a:latin typeface="Calibri"/>
</a:rPr>
<a:t>Exsanguinating external</a:t>
</a:r>
<a:br>
<a:rPr dirty="0"/>
</a:br>
<a:r>
<a:rPr sz="1300" b="1" dirty="0">
<a:solidFill>
<a:srgbClr val="FFFFFF"/>
</a:solidFill>
<a:latin typeface="Calibri"/>
</a:rPr>
<a:t>haemorrhage control</a:t>
</a:r>
</a:p>
</p:txBody>
</p:sp>
<p:sp>
<p:nvSpPr>
<p:cNvPr id="201" name="Right Arrow X"/>
<p:cNvSpPr/>
<p:nvPr/>
</p:nvSpPr>
<p:spPr>
<a:xfrm>
<a:off x="2281428" y="3154680"/>
<a:ext cx="210312" cy="274320"/>
</a:xfrm>
<a:prstGeom prst="rightArrow">
<a:avLst/>
</a:prstGeom>
<a:solidFill>
<a:srgbClr val="0B2569"/>
</a:solidFill>
<a:ln>
<a:noFill/>
</a:ln>
<a:effectLst/>
</p:spPr>
<p:style>
<a:lnRef idx="1">
<a:schemeClr val="accent1"/>
</a:lnRef>
<a:fillRef idx="3">
<a:schemeClr val="accent1"/>
</a:fillRef>
<a:effectRef idx="2">
<a:schemeClr val="accent1"/>
</a:effectRef>
<a:fontRef idx="minor">
<a:schemeClr val="lt1"/>
</a:fontRef>
</p:style>
<p:txBody>
<a:bodyPr rtlCol="0" anchor="ctr"/>
<a:lstStyle/>
<a:p>
<a:pPr algn="ctr"/>
<a:endParaRPr/>
</a:p>
</p:txBody>
</p:sp>
'''
anchor = ' <p:sp>\n <p:nvSpPr>\n <p:cNvPr id="6" name="Rounded Rectangle 5"/>'
assert xml.count(anchor) == 1
xml = xml.replace(anchor, new_shapes + anchor)
open(path, 'w').write(xml)
print("OK, before:", orig_len, "after:", len(xml))
cd /tmp/workspace/exsang_task && python3 edit_slide11.py
cd /tmp/workspace/exsang_task && python /tmp/skills/pptx/scripts/clean.py unpacked/ && python /tmp/skills/pptx/scripts/office/pack.py unpacked/ output.pptx --original deck.pptx && python3 -c " from pptx import Presentation prs = Presentation('output.pptx') slide = prs.slides[10] for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(repr(shape.text_frame.text)) print(shape.shape_id, shape.name, shape.left, shape.top, shape.width, shape.height) "
640080, 5303520) sits well below the boxes (which end at y=4480560), so nothing overlaps.output
Presentation · PPTX
Make 2-3 slides on x- Exsanguinating external hemorrhage before Airway slides
cd /tmp/workspace/exsang_task && python3 -c " from pptx import Presentation prs = Presentation('output.pptx') for i, slide in enumerate(prs.slides, 1): if 10 <= i <= 18: texts=[] for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): texts.append(shape.text_frame.text) print('SLIDE', i, '(layout:', slide.slide_layout.name, ')') print(' | '.join(texts)) print('---') "
cd /tmp/workspace/exsang_task && python /tmp/skills/pptx/scripts/add_slide.py unpacked/ slide13.xml && python /tmp/skills/pptx/scripts/add_slide.py unpacked/ slide14.xml && python /tmp/skills/pptx/scripts/add_slide.py unpacked/ slide14.xml
cd /tmp/workspace/exsang_task/unpacked && grep -n 'slide13.xml\|slide59.xml\|slide60.xml\|slide61.xml' ppt/_rels/presentation.xml.rels echo --- grep -n 'sldId ' ppt/presentation.xml | head -20 echo ---MAXID--- grep -o 'id="[0-9]*"' ppt/presentation.xml | grep -o '[0-9]*' | sort -n | tail -5
cd /tmp/workspace/exsang_task/unpacked && python3 - <<'EOF' import re p = "ppt/presentation.xml" xml = open(p).read() old = '<p:sldId id="269" r:id="rId14"/>' assert old in xml new = ('<p:sldId id="321" r:id="rId65"/>\n' ' <p:sldId id="322" r:id="rId66"/>\n' ' <p:sldId id="323" r:id="rId67"/>\n' ' ' + old) xml = xml.replace(old, new) open(p, 'w').write(xml) print("presentation.xml updated") EOF grep -n 'sldId id="32\|sldId id="269"' ppt/presentation.xml
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && grep -n '<a:t>' slide59.xml && echo ---60--- && grep -n '<a:t>' slide60.xml && echo ---61--- && grep -n '<a:t>' slide61.xml
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && python3 - <<'EOF' import re # Slide 59: divider p = "slide59.xml" xml = open(p).read() xml = xml.replace("<a:t>A – Airway</a:t>", "<a:t>X – Exsanguinating External Hemorrhage</a:t>") open(p, "w").write(xml) # Slide 60: Why control hemorrhage first p = "slide60.xml" xml = open(p).read() xml = xml.replace("<a:t>Assessing the Airway</a:t>", "<a:t>Why Control Hemorrhage First?</a:t>") repl60 = [ ("<a:t>▸ Look, listen and feel: ask the patient a question – a clear verbal reply confirms a patent airway</a:t>", "<a:t>▸ First priority in the primary survey – control catastrophic external bleeding before Airway (“life before airway”)</a:t>"), ("<a:t>▸ Look for agitation (may indicate hypoxia) or a depressed conscious level (may indicate hypercarbia)</a:t>", "<a:t>▸ TCCC MARCH algorithm (Massive haemorrhage, Airway, Respiration, Circulation, Hypothermia) – adapted from the battlefield to civilian trauma in PHTLS 10th ed. and ATLS 11th ed.</a:t>"), ("<a:t>▸ Look for foreign bodies, facial/mandibular/laryngeal/tracheal fractures that can cause obstruction</a:t>", "<a:t>▸ The xABC protocol has shown improved prehospital survival compared with the standard ABC protocol</a:t>"), ("<a:t>▸ Listen for abnormal sounds – snoring, gurgling, stridor (partial obstruction) or hoarseness</a:t>", "<a:t>▸ Common sources: extremity wounds, scalp lacerations, and junctional zones (groin, axilla, neck)</a:t>"), ("<a:t>▸ Assume a cervical spine injury in any patient with multi-system trauma, especially with head/neck injury and altered consciousness</a:t>", "<a:t>▸ STOP THE BLEED campaign (Hartford Consensus, post-2012) has trained over 2.6 million lay public in 138 countries</a:t>"), ] for old, new in repl60: assert old in xml, old xml = xml.replace(old, new) open(p, "w").write(xml) # Slide 61: Controlling exsanguinating hemorrhage p = "slide61.xml" xml = open(p).read() xml = xml.replace("<a:t>Assessing the Airway</a:t>", "<a:t>Controlling Exsanguinating Hemorrhage</a:t>") repl61 = [ ("<a:t>▸ Look, listen and feel: ask the patient a question – a clear verbal reply confirms a patent airway</a:t>", "<a:t>▸ Direct pressure and wound packing are the first-line manoeuvres for external bleeding</a:t>"), ("<a:t>▸ Look for agitation (may indicate hypoxia) or a depressed conscious level (may indicate hypercarbia)</a:t>", "<a:t>▸ Haemostatic dressings (e.g. kaolin-impregnated gauze) are used when direct pressure alone fails to control bleeding</a:t>"), ("<a:t>▸ Look for foreign bodies, facial/mandibular/laryngeal/tracheal fractures that can cause obstruction</a:t>", "<a:t>▸ Tourniquet: apply 2–3 inches (5–8 cm) proximal to the bleeding site, on skin not clothing, and not over a joint; tighten with the windlass until bleeding stops and record the application time</a:t>"), ("<a:t>▸ Listen for abnormal sounds – snoring, gurgling, stridor (partial obstruction) or hoarseness</a:t>", "<a:t>▸ Civilian tourniquet use has increased, with improved outcomes and no rise in complications</a:t>"), ("<a:t>▸ Assume a cervical spine injury in any patient with multi-system trauma, especially with head/neck injury and altered consciousness</a:t>", "<a:t>▸ Junctional bleeding (groin/axilla/neck) needs a junctional tourniquet or packing; suspected pelvic fracture haemorrhage needs an early pelvic binder</a:t>"), ] for old, new in repl61: assert old in xml, old xml = xml.replace(old, new) open(p, "w").write(xml) print("All three slides edited OK") EOF
cd /tmp/workspace/exsang_task && python /tmp/skills/pptx/scripts/clean.py unpacked/ && python /tmp/skills/pptx/scripts/office/pack.py unpacked/ output2.pptx --original output.pptx 2>&1 | tail -5
cd /tmp/workspace/exsang_task && python3 -c " from pptx import Presentation prs = Presentation('output2.pptx') for i, slide in enumerate(prs.slides, 1): if 10 <= i <= 16: texts=[] for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): texts.append(shape.text_frame.text) print('SLIDE', i) print(' | '.join(texts)) print('---') "
output2
Presentation · PPTX
Super
output2
Presentation · PPTX
Can you change slide 11 like in slide 5 format without colours
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && grep -n '<a:t>\|<a:off\|<a:ext\|prstGeom prst\|solidFill\|noFill\|sz="' slide5.xml | sed -n '1,200p'
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && grep -n 'srgbClr val=' slide11.xml
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && sed -n '825,845p' slide11.xml
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && python3 - <<'EOF' import re p = "slide11.xml" xml = open(p).read() # Box fill colors -> no fill (monochrome, like slide 5) box_fills = ["6B0F0F", "C1291D", "D97B0B", "B8860B", "1E7A3C", "1367A3"] for c in box_fills: old = f'<a:solidFill>\n <a:srgbClr val="{c}"/>\n </a:solidFill>' new = '<a:noFill/>' cnt = xml.count(old) assert cnt == 1, (c, cnt) xml = xml.replace(old, new) # Box borders: white -> dark thin outline (222A33), matching slide5 text colour xml = xml.replace( '<a:ln w="25400">\n <a:solidFill>\n <a:srgbClr val="FFFFFF"/>\n </a:solidFill>\n </a:ln>', '<a:ln w="12700">\n <a:solidFill>\n <a:srgbClr val="222A33"/>\n </a:solidFill>\n </a:ln>' ) # Text inside boxes: white -> dark (222A33) since boxes no longer filled xml = xml.replace('<a:srgbClr val="FFFFFF"/>', '<a:srgbClr val="222A33"/>') # Arrows: navy 0B2569 -> dark gray 222A33 (match slide 5 arrow colour) xml = xml.replace('<a:srgbClr val="0B2569"/>', '<a:srgbClr val="222A33"/>') open(p, "w").write(xml) print("slide11 recoloured") EOF grep -n 'srgbClr val=' slide11.xml
cd /tmp/workspace/exsang_task/unpacked/ppt/slides && python3 - <<'EOF' import re p = "slide11.xml" xml = open(p).read() # 1. Box fills (roundRect shapes only) -> noFill, monochrome like slide 5 pattern = re.compile( r'(<a:prstGeom prst="roundRect">\s*<a:avLst/>\s*</a:prstGeom>\s*)<a:solidFill>\s*<a:srgbClr val="[0-9A-F]{6}"/>\s*</a:solidFill>' ) xml, n = pattern.subn(r'\1<a:noFill/>', xml) print("box fills replaced:", n) assert n == 6 # 2. Box borders: white -> dark thin outline (222A33) xml, n2 = re.subn( r'<a:ln w="25400">\s*<a:solidFill>\s*<a:srgbClr val="FFFFFF"/>\s*</a:solidFill>\s*</a:ln>', '<a:ln w="12700">\n <a:solidFill>\n <a:srgbClr val="222A33"/>\n </a:solidFill>\n </a:ln>', xml ) print("borders replaced:", n2) assert n2 == 6 # 3. Text inside boxes: white -> dark (222A33) xml, n3 = re.subn(r'<a:srgbClr val="FFFFFF"/>', '<a:srgbClr val="222A33"/>', xml) print("text colours replaced:", n3) # 4. Arrows: navy 0B2569 -> dark gray 222A33 (match slide 5 arrow colour) xml, n4 = re.subn(r'<a:srgbClr val="0B2569"/>', '<a:srgbClr val="222A33"/>', xml) print("arrow colours replaced:", n4) assert n4 == 5 open(p, "w").write(xml) print("DONE") EOF grep -n 'srgbClr val=' slide11.xml
cd /tmp/workspace/exsang_task && python /tmp/skills/pptx/scripts/clean.py unpacked/ && python /tmp/skills/pptx/scripts/office/pack.py unpacked/ output3.pptx --original output2.pptx 2>&1 | tail -5
cd /tmp/workspace/exsang_task && python3 -c " from pptx import Presentation prs = Presentation('output3.pptx') slide = prs.slides[10] for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(repr(shape.text_frame.text)) "
output3
Presentation · PPTX