Create a single page note taking like image of this content and add infographics and illustrations wherever needed for quick understanding
ls /home/daytona/workspace/ 2>/dev/null && python3 -c "import matplotlib; import PIL; print('OK')"
python3 - <<'PY' from PIL import Image, ImageDraw, ImageFont import textwrap, os W, H = 2200, 3400 img = Image.new('RGB', (W, H), 'white') d = ImageDraw.Draw(img) # Fonts try: title_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 64) h1_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 38) h2_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 30) body_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24) small_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 20) except: title_f = h1_f = h2_f = body_f = small_f = ImageFont.load_default() # Colors navy = (23, 43, 77) blue = (48, 104, 184) lt = (241, 246, 255) gray = (80, 80, 80) red = (200, 60, 60) green = (40, 140, 90) # Header margin = 60 y = 40 d.rounded_rectangle((40, 20, W-40, 220), radius=24, fill=(232,241,255), outline=blue, width=3) d.text((margin, y), 'ANEMIA: STEPWISE DIAGNOSTIC GUIDE', font=title_f, fill=navy) d.text((margin, y+78), 'Quick Notes | Decision Flow | High-Yield Labs & Morphology', font=body_f, fill=gray) # Definition box y = 250 d.rounded_rectangle((40, y, W-40, y+240), radius=20, fill=lt, outline=(180,200,230), width=2) d.text((60,y+18), 'Definition (WHO): Hb <13 g/dL (men), <12 g/dL (non-pregnant women), <11 g/dL (pregnancy)', font=body_f, fill=navy) d.text((60,y+68), 'Physiology: Renal EPO (HIF-1α pathway) responds to hypoxia; defects in EPO, marrow, or substrate (iron/B12/folate) cause anemia.', font=body_f, fill=gray) d.text((60,y+130), 'Most critical early split: Reticulocyte count -> Hyperproliferative vs Hypoproliferative', font=h2_f, fill=red) # Flow chart zone y = 540 d.text((60,y), 'Core Diagnostic Algorithm', font=h1_f, fill=navy) def box(x1,y1,x2,y2,title,lines,fill=(248,250,255),outline=(160,180,210)): d.rounded_rectangle((x1,y1,x2,y2), radius=16, fill=fill, outline=outline, width=2) d.text((x1+18,y1+12), title, font=h2_f, fill=navy) yy = y1+55 for ln in lines: d.text((x1+18,yy), '• '+ln, font=body_f, fill=gray) yy += 34 box(60,600,1020,880,'Step 1-3: Initial Evaluation',[ 'Focused history + physical exam', 'CBC with differential + MCV, RDW', 'Peripheral smear is mandatory' ]) box(1160,600,2140,880,'Step 4: Reticulocyte Branch Point',[ 'ARC >100k/µL: bleeding or hemolysis', 'ARC <50k/µL: underproduction', 'RPI <2 hypo, >3 hyperproliferative' ],fill=(255,246,246),outline=(230,170,170)) # Arrows for p in [((1020,740),(1160,740)),((1600,880),(1600,980))]: d.line([p[0],p[1]], fill=blue, width=8) # Two branch panels box(60,980,1040,1540,'High Retic -> Hemolysis/Blood loss',[ 'Rule out active bleeding first', 'Hemolysis labs: LDH↑, indirect bili↑', 'Haptoglobin↓, DAT/Coombs', 'Smear clues: spherocytes/schistocytes', 'Targeted: G6PD, Hb electrophoresis,', 'PNH flow cytometry (CD55/CD59)' ],fill=(255,248,248),outline=(235,180,180)) box(1160,980,2140,1540,'Low/Normal Retic -> Underproduction',[ 'Use MCV classification', 'Microcytic (<80): ferritin, iron, TIBC', 'Normocytic (80-100): renal/endocrine/marrow', 'Macrocytic (>100): B12/folate vs MDS', 'Consider marrow biopsy if unexplained' ],fill=(248,255,249),outline=(170,215,180)) # MCV triad d.text((60,1610), 'MCV-based targeted workup', font=h1_f, fill=navy) box(60,1660,700,2140,'Microcytic',[ 'Iron deficiency', 'Thalassemia', 'Anemia of inflammation', 'Sideroblastic / lead' ]) box(780,1660,1420,2140,'Normocytic',[ 'Renal EPO deficiency', 'Inflammation/chronic disease', 'Early blood loss', 'Marrow infiltration/aplasia' ]) box(1500,1660,2140,2140,'Macrocytic',[ 'Megaloblastic: B12/folate', 'Non-megaloblastic: liver,', 'alcohol, hypothyroid, retics', 'MDS if persistent + dysplasia' ]) # Quick comparison tables simplified d.text((60,2200), 'High-yield distinctions', font=h1_f, fill=navy) d.rounded_rectangle((60,2250,1060,2830), radius=16, fill=lt, outline=(160,180,210), width=2) d.text((80,2270), 'Iron Deficiency vs Inflammation', font=h2_f, fill=navy) rows = [ ('Ferritin','Low (<15-30)','Normal/High'), ('Serum iron','Low','Low'), ('TIBC','High','Low'), ('RDW','High','Normal/mild'), ('Hepcidin','Low','High') ] yr=2320 for r in rows: d.text((80,yr), f'{r[0]}: ', font=body_f, fill=gray) d.text((280,yr), r[1], font=body_f, fill=red) d.text((620,yr), r[2], font=body_f, fill=green) yr+=90 # B12/Folate/MDS d = ImageDraw.Draw(img) d.rounded_rectangle((1140,2250,2140,2830), radius=16, fill=lt, outline=(160,180,210), width=2) d.text((1160,2270), 'Macrocytic differential', font=h2_f, fill=navy) rows2 = [ ('B12','MMA↑, neuro signs'), ('Folate','MMA normal, no neuro signs'), ('MDS','Dysplasia, cytopenias, BM biopsy') ] yr=2330 for k,v in rows2: d.text((1160,yr), k+':', font=body_f, fill=gray) d.text((1320,yr), v, font=body_f, fill=blue) yr+=120 # Footer pearls d.rounded_rectangle((40,2890,W-40,3340), radius=20, fill=(245,247,250), outline=(190,200,210), width=2) d.text((60,2920), 'Key pearls', font=h2_f, fill=navy) pearls = [ '1) Reticulocyte count is the most important test after CBC.', '2) Peripheral smear can be diagnostic and should be reviewed in every case.', '3) Ferritin can be falsely high during inflammation.', '4) Bone marrow biopsy: unexplained anemia, pancytopenia, dysplasia, myelophthisic pattern.' ] yr=2970 for p in pearls: d.text((70,yr), p, font=body_f, fill=gray) yr+=75 d.text((60,3310), 'Sources: Harrison 22E | Robbins & Kumar | Goldman-Cecil | Tintinalli', font=small_f, fill=(100,100,100)) out = '/home/daytona/workspace/anemia-note/output' os.makedirs(out, exist_ok=True) fp = out + '/anemia_single_page_infographic.png' img.save(fp, quality=95) print(fp) PY
python3 - <<'PY' from PIL import Image, ImageDraw, ImageFont import os W, H = 2200, 3400 img = Image.new('RGB', (W, H), 'white') d = ImageDraw.Draw(img) try: title_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 64) h1_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 38) h2_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 30) body_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 24) small_f = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 20) except: title_f = h1_f = h2_f = body_f = small_f = ImageFont.load_default() navy = (23, 43, 77) blue = (48, 104, 184) lt = (241, 246, 255) gray = (80, 80, 80) red = (200, 60, 60) green = (40, 140, 90) margin = 60 y = 40 d.rounded_rectangle((40, 20, W-40, 220), radius=24, fill=(232,241,255), outline=blue, width=3) d.text((margin, y), 'ANEMIA: STEPWISE DIAGNOSTIC GUIDE', font=title_f, fill=navy) d.text((margin, y+78), 'Quick Notes | Decision Flow | High-Yield Labs & Morphology', font=body_f, fill=gray) y = 250 d.rounded_rectangle((40, y, W-40, y+240), radius=20, fill=lt, outline=(180,200,230), width=2) d.text((60,y+18), 'Definition (WHO): Hb <13 g/dL (men), <12 g/dL (non-pregnant women), <11 g/dL (pregnancy)', font=body_f, fill=navy) d.text((60,y+68), 'Physiology: Renal EPO (HIF-1α pathway) responds to hypoxia; defects in EPO, marrow, or substrate cause anemia.', font=body_f, fill=gray) d.text((60,y+130), 'Most critical split: Reticulocyte count -> Hyperproliferative vs Hypoproliferative', font=h2_f, fill=red) y = 540 d.text((60,y), 'Core Diagnostic Algorithm', font=h1_f, fill=navy) def box(x1,y1,x2,y2,title,lines,fill=(248,250,255),outline=(160,180,210)): d.rounded_rectangle((x1,y1,x2,y2), radius=16, fill=fill, outline=outline, width=2) d.text((x1+18,y1+12), title, font=h2_f, fill=navy) yy = y1+55 for ln in lines: d.text((x1+18,yy), '• '+ln, font=body_f, fill=gray) yy += 34 box(60,600,1020,880,'Step 1-3: Initial Evaluation',['Focused history + physical exam','CBC with differential + MCV, RDW','Peripheral smear is mandatory']) box(1160,600,2140,880,'Step 4: Reticulocyte Branch Point',['ARC >100k/µL: bleeding or hemolysis','ARC <50k/µL: underproduction','RPI <2 hypo, >3 hyperproliferative'],fill=(255,246,246),outline=(230,170,170)) d.line([(1020,740),(1160,740)], fill=blue, width=8) d.line([(1600,880),(1600,980)], fill=blue, width=8) box(60,980,1040,1540,'High Retic -> Hemolysis/Blood loss',['Rule out active bleeding first','Hemolysis labs: LDH↑, indirect bili↑','Haptoglobin↓, DAT/Coombs','Smear clues: spherocytes/schistocytes','Targeted: G6PD, Hb electrophoresis,','PNH flow cytometry (CD55/CD59)'],fill=(255,248,248),outline=(235,180,180)) box(1160,980,2140,1540,'Low/Normal Retic -> Underproduction',['Use MCV classification','Microcytic (<80): ferritin, iron, TIBC','Normocytic (80-100): renal/endocrine/marrow','Macrocytic (>100): B12/folate vs MDS','Consider marrow biopsy if unexplained'],fill=(248,255,249),outline=(170,215,180)) d.text((60,1610), 'MCV-based targeted workup', font=h1_f, fill=navy) box(60,1660,700,2140,'Microcytic',['Iron deficiency','Thalassemia','Anemia of inflammation','Sideroblastic / lead']) box(780,1660,1420,2140,'Normocytic',['Renal EPO deficiency','Inflammation/chronic disease','Early blood loss','Marrow infiltration/aplasia']) box(1500,1660,2140,2140,'Macrocytic',['Megaloblastic: B12/folate','Non-megaloblastic: liver,','alcohol, hypothyroid, retics','MDS if persistent + dysplasia']) d.text((60,2200), 'High-yield distinctions', font=h1_f, fill=navy) d.rounded_rectangle((60,2250,1060,2830), radius=16, fill=lt, outline=(160,180,210), width=2) d.text((80,2270), 'Iron Deficiency vs Inflammation', font=h2_f, fill=navy) rows = [('Ferritin','Low (<15-30)','Normal/High'),('Serum iron','Low','Low'),('TIBC','High','Low'),('RDW','High','Normal/mild'),('Hepcidin','Low','High')] yr=2320 for r in rows: d.text((80,yr), f'{r[0]}: ', font=body_f, fill=gray) d.text((280,yr), r[1], font=body_f, fill=red) d.text((620,yr), r[2], font=body_f, fill=green) yr+=90 d.rounded_rectangle((1140,2250,2140,2830), radius=16, fill=lt, outline=(160,180,210), width=2) d.text((1160,2270), 'Macrocytic differential', font=h2_f, fill=navy) rows2 = [('B12','MMA↑, neuro signs'),('Folate','MMA normal, no neuro signs'),('MDS','Dysplasia, cytopenias, BM biopsy')] yr=2330 for k,v in rows2: d.text((1160,yr), k+':', font=body_f, fill=gray) d.text((1320,yr), v, font=body_f, fill=blue) yr+=120 d.rounded_rectangle((40,2890,W-40,3340), radius=20, fill=(245,247,250), outline=(190,200,210), width=2) d.text((60,2920), 'Key pearls', font=h2_f, fill=navy) pearls = ['1) Reticulocyte count is the most important test after CBC.','2) Peripheral smear can be diagnostic and should be reviewed in every case.','3) Ferritin can be falsely high during inflammation.','4) Bone marrow biopsy: unexplained anemia, pancytopenia, dysplasia, myelophthisic pattern.'] yr=2970 for p in pearls: d.text((70,yr), p, font=body_f, fill=gray) yr+=75 d.text((60,3310), 'Sources: Harrison 22E | Robbins & Kumar | Goldman-Cecil | Tintinalli', font=small_f, fill=(100,100,100)) out = '/home/daytona/workspace/anemia-note/output' os.makedirs(out, exist_ok=True) fp = out + '/anemia_single_page_infographic.png' img.save(fp) print(fp) PY
anemia single page infographic
Image · PNG