make a flowchart on Anime management from medicine

Reading File
Finding Sources
Finding Sources
Searching the Web

anemia management flowchart algorithm diagnosis treatment

Reading File
Running Command

python3 -c "import graphviz; print('graphviz python ok')" ; which dot; dot -V

Graphviz is available. I'll build a clinical flowchart for anemia diagnosis and management based on the MCV/reticulocyte approach (standard internal medicine workup).
Writing File

~/anemia-flowchart/anemia_flowchart.py

from graphviz import Digraph

g = Digraph('AnemiaManagement', format='png')
g.attr(rankdir='TB', splines='ortho', bgcolor='white', fontname='Helvetica')
g.attr('node', fontname='Helvetica', fontsize='11', style='filled')
g.attr('edge', fontname='Helvetica', fontsize='10')

# ---- Step 1: Confirm ----
g.node('start', 'Suspected Anemia\n(Hb <13 g/dL men, <12 g/dL women)\nHistory + Physical Exam + CBC', shape='box', fillcolor='#FDE9D9', style='filled,rounded')

g.node('cbc', 'CBC + Reticulocyte Count\n+ Peripheral Blood Smear\n+ Check MCV', shape='box', fillcolor='#DCE6F1', style='filled,rounded')

g.edge('start', 'cbc')

# ---- Step 2: Classify by MCV ----
g.node('mcv', 'Classify by MCV', shape='diamond', fillcolor='#FFF2CC')
g.edge('cbc', 'mcv')

g.node('micro', 'MICROCYTIC\nMCV <80 fL', shape='box', fillcolor='#F2DCDB', style='filled,rounded')
g.node('normo', 'NORMOCYTIC\nMCV 80-100 fL', shape='box', fillcolor='#EAF1DD', style='filled,rounded')
g.node('macro', 'MACROCYTIC\nMCV >100 fL', shape='box', fillcolor='#E4DFEC', style='filled,rounded')

g.edge('mcv', 'micro')
g.edge('mcv', 'normo')
g.edge('mcv', 'macro')

# ---- Microcytic branch ----
g.node('iron_studies', 'Check Ferritin, Serum Iron,\nTIBC/Transferrin Sat., TSH', shape='box', fillcolor='#F2DCDB')
g.edge('micro', 'iron_studies')

g.node('ida', 'Low ferritin + Low Fe\n= Iron Deficiency Anemia\n(find source of blood loss:\nGI, menstrual, dietary)', shape='box', fillcolor='#F2DCDB', style='filled,rounded')
g.node('acd', 'Normal/High ferritin,\nLow Fe, Low TIBC\n= Anemia of Chronic Disease/\nInflammation, CKD', shape='box', fillcolor='#F2DCDB', style='filled,rounded')
g.node('thal', 'Normal iron studies +\nabnormal Hb electrophoresis\n= Thalassemia /\nHemoglobinopathy', shape='box', fillcolor='#F2DCDB', style='filled,rounded')

g.edge('iron_studies', 'ida')
g.edge('iron_studies', 'acd')
g.edge('iron_studies', 'thal')

g.node('tx_ida', 'Rx: Oral/IV iron\n(ferrous sulfate or IV iron\nif intolerant/malabsorption/\nsevere) + treat bleeding source\nRecheck Hb/retic in 2-4 wks', shape='box', fillcolor='#FBE5D6', style='filled,rounded')
g.node('tx_acd', 'Rx: Treat underlying disease\n(infection, inflammation, CKD)\n+/- EPO agents in CKD/oncology\nif appropriate', shape='box', fillcolor='#FBE5D6', style='filled,rounded')
g.node('tx_thal', 'Rx: Genetic counseling,\nfolate, avoid unnecessary iron,\ntransfusion/chelation if severe', shape='box', fillcolor='#FBE5D6', style='filled,rounded')

g.edge('ida', 'tx_ida')
g.edge('acd', 'tx_acd')
g.edge('thal', 'tx_thal')

# ---- Normocytic branch ----
g.node('retic_check', 'Check Reticulocyte\nProduction Index (RPI)', shape='diamond', fillcolor='#EAF1DD')
g.edge('normo', 'retic_check')

g.node('retic_low', 'LOW retic (<2%)\n= Hypoproliferative\n(marrow failure, CKD, chronic\ndisease, early Fe deficiency,\naplastic anemia, malignancy\ninfiltration)', shape='box', fillcolor='#EAF1DD', style='filled,rounded')
g.node('retic_high', 'HIGH retic (>2-3%)\n= Increased destruction/loss\n(hemolysis or acute\nblood loss)', shape='box', fillcolor='#EAF1DD', style='filled,rounded')

g.edge('retic_check', 'retic_low')
g.edge('retic_check', 'retic_high')

g.node('workup_low', 'Workup: renal function,\nEPO level, marrow biopsy\nif indicated, iron studies', shape='box', fillcolor='#D8E4BC', style='filled,rounded')
g.node('workup_high', 'Workup: LDH, haptoglobin,\nbilirubin, Coombs test,\nsmear for schistocytes\n(hemolysis) or evidence of bleeding', shape='box', fillcolor='#D8E4BC', style='filled,rounded')

g.edge('retic_low', 'workup_low')
g.edge('retic_high', 'workup_high')

g.node('tx_low', 'Rx: Treat cause\n(EPO for CKD, stop marrow-\nsuppressive drugs, treat\nmalignancy), transfuse if\nsymptomatic/severe', shape='box', fillcolor='#C4D79B', style='filled,rounded')
g.node('tx_high', 'Rx: Treat hemolysis cause\n(steroids for AIHA, stop offending\ndrug, splenectomy if refractory)\nor control bleeding source;\ntransfuse if severe', shape='box', fillcolor='#C4D79B', style='filled,rounded')

g.edge('workup_low', 'tx_low')
g.edge('workup_high', 'tx_high')

# ---- Macrocytic branch ----
g.node('b12_folate', 'Check Vitamin B12,\nFolate, TSH, LFTs,\nreview smear (megaloblastic\nchanges, hypersegmented\nneutrophils)', shape='box', fillcolor='#E4DFEC', style='filled,rounded')
g.edge('macro', 'b12_folate')

g.node('meg', 'Low B12 or Folate\n= Megaloblastic Anemia\n(pernicious anemia, poor\nintake, malabsorption)', shape='box', fillcolor='#E4DFEC', style='filled,rounded')
g.node('nonmeg', 'Normal B12/Folate\n= Non-megaloblastic\n(liver disease, hypothyroidism,\nalcohol use, myelodysplasia,\nreticulocytosis)', shape='box', fillcolor='#E4DFEC', style='filled,rounded')

g.edge('b12_folate', 'meg')
g.edge('b12_folate', 'nonmeg')

g.node('tx_meg', 'Rx: B12 (IM/oral) or\nfolate replacement;\ninvestigate/treat cause\nof malabsorption', shape='box', fillcolor='#CCC1DA', style='filled,rounded')
g.node('tx_nonmeg', 'Rx: Treat underlying cause\n(thyroid replacement, stop\nalcohol, hematology referral\nfor MDS workup)', shape='box', fillcolor='#CCC1DA', style='filled,rounded')

g.edge('meg', 'tx_meg')
g.edge('nonmeg', 'tx_nonmeg')

# ---- Common endpoint ----
g.node('followup', 'Reassess: repeat CBC/retic in\n2-4 weeks; escalate to\nHematology if no response,\ndiagnosis unclear, or severe/\nsymptomatic anemia', shape='box', fillcolor='#FDE9D9', style='filled,rounded')

for n in ['tx_ida','tx_acd','tx_thal','tx_low','tx_high','tx_meg','tx_nonmeg']:
    g.edge(n, 'followup')

g.render('/tmp/workspace/anemia-flowchart/anemia_management_flowchart', cleanup=True)
print("done")
Running Command

mkdir -p /tmp/workspace/anemia-flowchart && cd /tmp/workspace/anemia-flowchart && python3 anemia_flowchart.py && ls -la

Reading File
Searching PubMed

"anemia" AND "management" AND "guideline"

Quick answer

This is a shared conversation. Sign in to Orris to start your own chat.