In one hour i have anatomy exam i left with these topics so make a pdf which includes answer for this topics so that i can understand easily and within less timewith diagrams refer vishram singh text book of abdomen
Vishram Singh abdomen anatomy duodenum caecum appendix portal vein porto-caval anastomosis pancreas spleen kidney ureter liver stomach
abdominal anatomy education
labelled diagram portal vein porto-caval anastomoses pancreas duodenum kidney ureter abdominal anatomy
~/
~/attachments/99c30fba-ec59-497b-b36a-3e6032f20586
portal systemic anastomoses anatomy diagram
duodenum pancreas labelled anatomy diagram
kidney ureter labelled anatomy diagram
stomach liver spleen labelled anatomy diagram
mkdir -p "/tmp/workspace/anatomy-last-hour/src" "/tmp/workspace/anatomy-last-hour/output"
~/anatomy-last-hour/src/make_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak, Table, TableStyle, KeepTogether
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfmetrics
from reportlab.lib.units import cm
from reportlab.pdfgen import canvas
from reportlab.lib.colors import HexColor
from reportlab.graphics.shapes import Drawing, Rect, Circle, Line, String, Polygon
from reportlab.graphics import renderPDF
OUT='/tmp/workspace/anatomy-last-hour/output/Last_Hour_Abdomen_Anatomy_Revision.pdf'
W,H=A4
styles=getSampleStyleSheet()
styles.add(ParagraphStyle(name='Title2',parent=styles['Title'],fontName='Helvetica-Bold',fontSize=23,leading=28,textColor=HexColor('#123B5D'),alignment=TA_CENTER,spaceAfter=10))
styles.add(ParagraphStyle(name='Sub',parent=styles['Normal'],fontSize=10,leading=13,textColor=HexColor('#38546A'),alignment=TA_CENTER))
styles.add(ParagraphStyle(name='H',parent=styles['Heading1'],fontName='Helvetica-Bold',fontSize=16,leading=19,textColor=HexColor('#0A5674'),spaceBefore=5,spaceAfter=5))
styles.add(ParagraphStyle(name='h2x',parent=styles['Heading2'],fontName='Helvetica-Bold',fontSize=11.5,leading=14,textColor=HexColor('#9A3E12'),spaceBefore=5,spaceAfter=2))
styles.add(ParagraphStyle(name='B',parent=styles['Normal'],fontSize=8.6,leading=11.2,spaceAfter=3))
styles.add(ParagraphStyle(name='Tiny',parent=styles['Normal'],fontSize=7.3,leading=9))
styles.add(ParagraphStyle(name='Box',parent=styles['Normal'],fontSize=8.2,leading=10.5,textColor=HexColor('#172E3C')))
def P(txt,style='B'): return Paragraph(txt,styles[style])
def bullets(items): return [P('• '+x) for x in items]
def header_footer(c,doc):
c.saveState(); c.setStrokeColor(HexColor('#1E6E8C')); c.setLineWidth(.6); c.line(1.35*cm,H-1.15*cm,W-1.35*cm,H-1.15*cm)
c.setFont('Helvetica',7.5); c.setFillColor(HexColor('#46606F')); c.drawString(1.35*cm,.75*cm,'LAST-HOUR ABDOMEN ANATOMY REVISION | Original diagrams for quick recall')
c.drawRightString(W-1.35*cm,.75*cm,f'Page {doc.page}')
c.restoreState()
def diagram(kind):
d=Drawing(470,145)
blue=HexColor('#2079A6'); orange=HexColor('#E77C31'); dark=HexColor('#153C54'); pale=HexColor('#DCEFF5'); red=HexColor('#B7433E'); green=HexColor('#62A66B')
def lab(x,y,t): d.add(String(x,y,t,fontName='Helvetica',fontSize=7.2,fillColor=dark))
if kind=='duodenum':
d.add(Circle(65,77,38,fillColor=pale,strokeColor=blue)); d.add(Rect(60,40,80,75,fillColor=None,strokeColor=orange,strokeWidth=7)); d.add(Rect(160,55,105,45,fillColor=HexColor('#F5D0A4'),strokeColor=orange));
d.add(Line(142,78,210,78,strokeColor=dark,strokeWidth=2)); lab(16,127,'Stomach / pylorus'); lab(147,112,'1st part'); lab(270,95,'2nd part: major papilla'); lab(147,35,'3rd part crosses IVC + aorta'); lab(30,17,'4th part → DJ flexure (Treitz)'); lab(174,82,'Head of pancreas')
elif kind=='portal':
d.add(Polygon([180,20,290,20,330,115,145,115],fillColor=HexColor('#C97A61'),strokeColor=red)); d.add(Line(235,5,235,48,strokeColor=blue,strokeWidth=7)); d.add(Line(235,48,180,72,strokeColor=blue,strokeWidth=5)); d.add(Line(235,48,285,72,strokeColor=blue,strokeWidth=5)); d.add(Line(180,72,110,55,strokeColor=blue,strokeWidth=4)); d.add(Line(285,72,345,55,strokeColor=blue,strokeWidth=4));
lab(195,122,'LIVER'); lab(241,5,'Portal vein'); lab(38,49,'SMV: gut'); lab(348,49,'Splenic v.'); lab(68,135,'Portal tributaries → portal vein → sinusoids → hepatic veins → IVC')
elif kind=='gut':
d.add(Circle(110,78,43,fillColor=HexColor('#F8D4B1'),strokeColor=orange)); d.add(Line(152,78,205,78,strokeColor=orange,strokeWidth=8)); d.add(Circle(235,78,28,fillColor=HexColor('#F8D4B1'),strokeColor=orange)); d.add(Line(263,78,330,78,strokeColor=orange,strokeWidth=8)); d.add(Circle(354,78,25,fillColor=HexColor('#F8D4B1'),strokeColor=orange)); d.add(Line(354,53,378,26,strokeColor=green,strokeWidth=6));
lab(75,130,'Caecum'); lab(202,130,'Ileocaecal valve'); lab(316,130,'Appendix'); lab(17,13,'Appendix base: convergence of three taeniae coli | Surface: McBurney point')
elif kind=='pancreas':
d.add(Rect(44,32,98,85,fillColor=HexColor('#FAE4AF'),strokeColor=orange,strokeWidth=4)); d.add(Polygon([140,70,245,105,400,78,245,44],fillColor=HexColor('#F6CD84'),strokeColor=orange)); d.add(Line(52,74,375,74,strokeColor=blue,strokeWidth=3)); d.add(Circle(34,74,26,fillColor=None,strokeColor=blue,strokeWidth=6));
lab(12,125,'Duodenum'); lab(68,120,'Head'); lab(145,120,'Neck'); lab(230,120,'Body'); lab(365,120,'Tail → spleen'); lab(140,20,'Main pancreatic duct joins bile duct at major papilla')
elif kind=='kidney':
d.add(Polygon([100,18,55,45,52,96,85,128,130,118,145,74,129,34],fillColor=HexColor('#CE6E66'),strokeColor=red)); d.add(Line(119,80,188,80,strokeColor=blue,strokeWidth=5)); d.add(Line(119,68,188,68,strokeColor=red,strokeWidth=5)); d.add(Line(117,55,190,25,strokeColor=green,strokeWidth=5)); d.add(Line(190,25,390,25,strokeColor=green,strokeWidth=5));
lab(45,136,'Right kidney: lower than left'); lab(198,86,'Vein'); lab(198,67,'Artery'); lab(198,20,'Pelvis → ureter'); lab(232,48,'Hilum anterior→posterior: V-A-P')
elif kind=='liver':
d.add(Polygon([40,55,100,120,340,124,430,82,365,31,115,25],fillColor=HexColor('#C97862'),strokeColor=red)); d.add(Circle(335,67,16,fillColor=HexColor('#5C9A59'),strokeColor=green)); d.add(Line(226,28,226,121,strokeColor=dark)); lab(105,132,'Right lobe'); lab(255,132,'Left lobe'); lab(345,70,'GB'); lab(54,10,'Porta hepatis: portal vein posterior, hepatic artery left, bile duct right')
elif kind=='stomach':
d.add(Circle(130,86,47,fillColor=HexColor('#F8D4B1'),strokeColor=orange)); d.add(Polygon([150,115,300,110,345,72,290,38,145,48],fillColor=HexColor('#F8D4B1'),strokeColor=orange)); d.add(Line(346,73,418,73,strokeColor=orange,strokeWidth=9)); lab(80,137,'Fundus'); lab(190,130,'Body'); lab(275,28,'Pyloric antrum/canal'); lab(398,88,'Duodenum'); lab(45,10,'Lesser curvature: lesser omentum | Greater curvature: greater omentum')
elif kind=='spleen':
d.add(Polygon([105,25,50,55,65,105,125,130,190,102,195,52,150,23],fillColor=HexColor('#9C5C79'),strokeColor=dark)); d.add(Line(194,78,315,78,strokeColor=blue,strokeWidth=5)); lab(47,140,'Spleen: 9th-11th ribs, long axis along 10th rib'); lab(208,86,'Splenic vessels at hilum'); lab(245,58,'Notch on superior border')
return d
def topic(title, sketch, sections, box=None):
flow=[P(title,'H'), diagram(sketch)]
for h,items in sections:
flow.append(P(h,'h2x')); flow.extend(bullets(items))
if box:
t=Table([[P('<b>EXAM CLINCHER:</b> '+box,'Box')]],colWidths=[17.5*cm]);t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,-1),HexColor('#FFF1D6')),('BOX',(0,0),(-1,-1),.5,orange),('LEFTPADDING',(0,0),(-1,-1),7),('RIGHTPADDING',(0,0),(-1,-1),7),('TOPPADDING',(0,0),(-1,-1),5),('BOTTOMPADDING',(0,0),(-1,-1),5)]));flow += [Spacer(1,3),t]
flow.append(PageBreak()); return flow
story=[]
story += [Spacer(1,1.5*cm),P('LAST-HOUR ABDOMEN<br/>ANATOMY REVISION','Title2'),P('Duodenum • caecum • appendix • portal vein • porto-caval anastomoses • pancreas • spleen • kidney • ureter • liver • stomach','Sub'),Spacer(1,.4*cm),P('<b>How to use this in 60 minutes</b>','h2x'),P('Read the bold headings first. Learn each “exam clincher”, then redraw each diagram once. In a long answer, use the order: definition/extent → parts/relations → vessels → nerve/lymph → applied anatomy.'),Spacer(1,.25*cm)]
quick=[['0-7 min','Portal vein + porto-caval anastomoses'],['7-15 min','Duodenum + pancreas'],['15-23 min','Kidney + ureter'],['23-32 min','Stomach + liver'],['32-40 min','Caecum + appendix'],['40-47 min','Spleen'],['47-60 min','Redraw diagrams + clinical clinchers']]
t=Table([[P('<b>Time</b>','B'),P('<b>Focus</b>','B')]]+[[P(a),P(b)] for a,b in quick],colWidths=[3*cm,14.5*cm]); t.setStyle(TableStyle([('GRID',(0,0),(-1,-1),.35,HexColor('#A6C6D6')),('BACKGROUND',(0,0),(-1,0),HexColor('#DCEFF5')),('VALIGN',(0,0),(-1,-1),'MIDDLE'),('LEFTPADDING',(0,0),(-1,-1),6),('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4)]));story += [t,Spacer(1,.35*cm),P('<b>Scope:</b> concise undergraduate anatomical revision, arranged in the usual Abdomen & Lower Limb text sequence, including original simplified revision diagrams. Verify terminology/page references against your edition of Vishram Singh before quoting it as a source.'),PageBreak()]
story += topic('1. DUODENUM', 'duodenum', [('Definition, extent & parts',['C-shaped first part of small intestine, 25 cm long; pylorus (L1) to duodenojejunal flexure (left of L2).','Four parts: superior (D1), descending (D2), horizontal/inferior (D3), ascending (D4). Retroperitoneal except proximal 2 cm of D1.']),('High-yield relations',['D1: anterior to gastroduodenal artery, bile duct, portal vein and IVC. D2: right kidney behind; head of pancreas medially; receives bile + main pancreatic duct at major papilla.','D3: anteriorly crossed by SMA and SMV; posterior to it are IVC and aorta. D4 ends at DJ flexure, supported by ligament of Treitz.']),('Vessels & nerve',['Above major papilla: foregut, coeliac trunk via superior pancreaticoduodenal branches. Below: midgut, SMA via inferior pancreaticoduodenal branches.','Veins drain to portal system. Sympathetic T9-T10 via coeliac/superior mesenteric plexuses; vagal parasympathetic.'])], 'D3 compression between SMA and aorta can cause superior mesenteric artery syndrome. A posterior D1 ulcer may erode the gastroduodenal artery causing severe bleeding.')
story += topic('2. PORTAL VEIN & PORTO-CAVAL ANASTOMOSES','portal',[('Portal vein',['Formed behind neck of pancreas by union of SMV and splenic vein, at L2. It ascends in hepatoduodenal ligament to porta hepatis.','Tributaries: left and right gastric, cystic, para-umbilical veins; SMV and splenic vein. It divides into right and left branches in liver.']),('Porto-caval sites: learn 4',['Lower oesophagus: left gastric (portal) ↔ oesophageal veins → azygos (systemic): oesophageal varices.','Around umbilicus: para-umbilical (portal) ↔ superficial epigastric/thoracoepigastric (systemic): caput medusae.','Anal canal: superior rectal (portal) ↔ middle/inferior rectal (systemic): anorectal varices.','Retroperitoneal: colic/splenic/pancreaticoduodenal (portal) ↔ retroperitoneal lumbar veins (systemic).'])], 'Portal hypertension diverts blood through these channels. State the exact portal and systemic veins, then the clinical sign.')
story += topic('3. CAECUM & VERMIFORM APPENDIX','gut',[('Caecum',['Blind pouch of large intestine below ileocaecal junction, in right iliac fossa. Usually completely peritoneal, mobile, no mesentery.','Ileocaecal orifice guarded by ileocaecal valve. Taeniae coli converge at base of appendix.']),('Appendix',['Narrow diverticulum from posteromedial caecum, 2 cm below ileocaecal junction; average 9 cm. Base fixed, tip variable: retrocaecal most common, pelvic next.','Mesoappendix carries appendicular artery, a branch of ileocolic artery. Vein → ileocolic vein → SMV. Lymph → ileocolic nodes.','Visceral pain initially T10, felt periumbilically. Parietal peritoneal irritation later localizes to right iliac fossa.']),('Surface anatomy',['McBurney point: junction of lateral 1/3 and medial 2/3 of line from right ASIS to umbilicus. Appendix base corresponds here.'])], 'In appendicitis: early periumbilical pain is visceral; later right iliac fossa pain is parietal. This is a common viva question.')
story += topic('4. PANCREAS','pancreas',[('Parts & position',['Secondarily retroperitoneal gland behind stomach, extending from duodenum to spleen. Parts: head with uncinate process, neck, body, tail. Tail lies in splenorenal ligament.','Head sits in C-loop of duodenum. Uncinate process passes posterior to SMA/SMV. Portal vein forms behind neck.']),('Ducts & vessels',['Main pancreatic duct joins common bile duct to open at major papilla. Accessory duct, if present, opens at minor papilla.','Arterial supply: superior and inferior pancreaticoduodenal arteries to head; branches of splenic artery to body/tail. Venous drainage → splenic/SMV → portal vein.']),('Applied',['Carcinoma of head can compress bile duct causing painless progressive obstructive jaundice. Pancreatitis may track fluid in retroperitoneum.'])], 'Relation to remember: portal vein behind neck; bile duct in groove on posterior head; SMA/SMV anterior to uncinate process.')
story += topic('5. SPLEEN','spleen',[('Situation & features',['Largest lymphoid organ, left hypochondrium, under ribs 9-11. Long axis follows 10th rib. Intraperitoneal except hilum.','Two surfaces: diaphragmatic and visceral. Visceral surface has gastric, renal and colic impressions; hilum between gastric and renal impressions.']),('Peritoneal ligaments & vessels',['Gastrosplenic ligament: short gastric + left gastro-omental vessels. Splenorenal ligament: splenic vessels + tail of pancreas.','Splenic artery from coeliac trunk, tortuous along superior border of pancreas. Splenic vein passes behind pancreas to form portal vein.']),('Applied',['Splenomegaly: moves inferomedially and notch can be felt. Rupture after left lower chest trauma can cause intraperitoneal haemorrhage.'])], 'Spleen is protected by ribs, but its close relation to 9th-11th ribs makes it vulnerable in trauma.')
story += topic('6. KIDNEY','kidney',[('Position & coverings',['Retroperitoneal, opposite T12-L3; right kidney lower due to liver. Left: 11th and 12th ribs posteriorly; right: 12th rib.','Coverings from within out: fibrous capsule → perirenal fat → renal fascia → pararenal fat.']),('External features & relations',['Hilum at L1, left slightly higher. Anterior to posterior order at hilum: renal Vein, renal Artery, renal Pelvis (V-A-P).','Posterior relations: diaphragm, psoas major, quadratus lumborum, transversus abdominis; subcostal vessels and nerves, iliohypogastric and ilioinguinal nerves.']),('Blood, lymph, nerve',['Renal arteries arise from aorta; right artery longer and passes behind IVC. Renal veins drain to IVC; left renal vein crosses anterior to aorta below SMA.','Lymph → lateral aortic nodes. Sympathetic T10-L1 via renal plexus; referred pain may travel loin to groin.'])], 'Left renal vein can be compressed between SMA and aorta: “nutcracker” phenomenon. Know V-A-P for hilar structures.')
story += topic('7. URETER','kidney',[('Course',['Muscular retroperitoneal tube, 25 cm, from renal pelvis to urinary bladder. Abdominal part descends on psoas major, crossed anteriorly by gonadal vessels.','At pelvic brim it crosses anterior to bifurcation of common iliac artery or external iliac artery. In pelvis it runs to bladder.']),('Three constrictions',['1. Pelvi-ureteric junction. 2. Crossing iliac vessels at pelvic brim. 3. Vesico-ureteric junction/intramural part. These are sites of stone impaction.']),('Relations & supply',['Male: ductus deferens crosses superior to ureter near bladder. Female: uterine artery crosses superior to ureter, 2 cm lateral to cervix: “water under the bridge”.','Arterial supply is segmental: renal, gonadal, aortic, common/internal iliac and vesical branches. Pain afferents T11-L2.'])], 'During hysterectomy, identify ureter before ligating uterine artery. In renal colic pain radiates “loin to groin”.')
story += topic('8. LIVER','liver',[('Situation & surfaces',['Largest gland, mainly right hypochondrium and epigastrium, extending to left hypochondrium. Has diaphragmatic and visceral surfaces.','Anatomical lobes: right, left, caudate, quadrate. Functional right/left division follows Cantlie line from gallbladder fossa to IVC.']),('Porta hepatis & blood',['Porta hepatis transmits portal vein, proper hepatic artery, hepatic ducts, lymphatics and nerves. In hepatoduodenal ligament: bile duct right, hepatic artery left, portal vein posterior.','Dual blood supply: portal vein about 75% of flow, hepatic artery about 25%. Hepatic veins drain directly to IVC.']),('Peritoneal reflections',['Falciform ligament divides anterior surface into right/left anatomical lobes. Bare area contacts diaphragm and is bounded by coronary ligament.'])], 'Pringle manoeuvre compresses the hepatoduodenal ligament to control bleeding from hepatic artery or portal vein, not hepatic veins/IVC.')
story += topic('9. STOMACH','stomach',[('Parts & location',['J-shaped intraperitoneal organ in epigastrium, umbilical and left hypochondrium. Parts: cardia, fundus, body, pyloric part (antrum + canal + pylorus).','Pylorus is near transpyloric plane L1. Greater curvature gives attachment to greater omentum; lesser curvature to lesser omentum.']),('Relations & vessels',['Stomach bed posteriorly: diaphragm, spleen, left kidney, left suprarenal, pancreas, transverse mesocolon and transverse colon.','Arteries: left/right gastric on lesser curvature; left/right gastro-omental on greater curvature; short gastric to fundus. Veins drain to portal system.']),('Nerves & lymph',['Anterior vagal trunk mainly left vagus; posterior trunk mainly right vagus. Sympathetic T6-T9 via greater splanchnic and coeliac plexus.','Lymph follows arteries to gastric/gastro-omental nodes, then coeliac nodes.'])], 'Posterior gastric ulcer can erode pancreas or splenic artery. Vagotomy affects gastric motor/secretory innervation.')
story += [P('Final 2-minute recall','H'),P('<b>Draw from memory:</b> four duodenal parts + papilla; portal-systemic four sites; appendix base/McBurney point; pancreas and portal vein behind neck; V-A-P at renal hilum; ureter constrictions; liver portal triad; stomach arterial arcades.'),Spacer(1,10),P('This rapid revision PDF was prepared as an original educational aid. It does not reproduce textbook figures or pages. Use your prescribed Vishram Singh text for exact diagrams and your institution’s preferred terminology.','Tiny')]
doc=SimpleDocTemplate(OUT,pagesize=A4,rightMargin=1.35*cm,leftMargin=1.35*cm,topMargin=1.45*cm,bottomMargin=1.25*cm)
doc.build(story,onFirstPage=header_footer,onLaterPages=header_footer)
print(OUT)
python "/tmp/workspace/anatomy-last-hour/src/make_pdf.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/anatomy-last-hour/output/Last_Hour_Abdomen_Anatomy_Revision.pdf'; r=PdfReader(p); print('pages=',len(r.pages)); print('chars=',sum(len(x.extract_text() or '') for x in r.pages))"
~/anatomy-last-hour/src/make_pdf.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/anatomy-last-hour/src/make_pdf.py'
python "/tmp/workspace/anatomy-last-hour/src/make_pdf.py" && python -c "from pypdf import PdfReader; p='/tmp/workspace/anatomy-last-hour/output/Last_Hour_Abdomen_Anatomy_Revision.pdf'; r=PdfReader(p); print('pages=',len(r.pages)); print('chars=',sum(len(x.extract_text() or '') for x in r.pages))"
python -c "import fitz; p='/tmp/workspace/anatomy-last-hour/output/Last_Hour_Abdomen_Anatomy_Revision.pdf'; d=fitz.open(p); print('pages',d.page_count); print('last page text:',d[-1].get_text()[:250]); pix=d[1].get_pixmap(matrix=fitz.Matrix(1,1),alpha=False); pix.save('/tmp/workspace/anatomy-last-hour/output/page2_preview.png')"
python -c "from pypdf import PdfReader; p='/tmp/workspace/anatomy-last-hour/output/Last_Hour_Abdomen_Anatomy_Revision.pdf'; r=PdfReader(p); print([(i+1,len(pg.extract_text() or '')) for i,pg in enumerate(r.pages)]); print(r.pages[-1].extract_text()[:350])"
Last Hour Abdomen Anatomy Revision
PDF Document · PDF