Can you make a sample icu file for Acute kidney injury with hypertension

Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Running Command

mkdir -p /tmp/workspace/icu-file && ls /tmp/workspace/icu-file/

Writing File

~/icu-file/create_icu_file.py

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import datetime

doc = Document()

# ── Page margins ──────────────────────────────────────────
from docx.shared import Cm
section = doc.sections[0]
section.top_margin    = Cm(1.8)
section.bottom_margin = Cm(1.8)
section.left_margin   = Cm(2.0)
section.right_margin  = Cm(2.0)

# ── Default styles ────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Arial"
normal.font.size = Pt(10)

def set_heading(para, text, level=1):
    para.clear()
    run = para.add_run(text)
    run.font.bold = True
    run.font.name = "Arial"
    if level == 1:
        run.font.size = Pt(13)
        run.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D)
    elif level == 2:
        run.font.size = Pt(11)
        run.font.color.rgb = RGBColor(0x2E, 0x74, 0xB5)
    else:
        run.font.size = Pt(10)
        run.font.color.rgb = RGBColor(0x37, 0x37, 0x37)
    para.paragraph_format.space_before = Pt(8)
    para.paragraph_format.space_after  = Pt(3)

def shaded_heading(doc, text, r=0x1F, g=0x49, b=0x7D):
    """Full-width shaded heading row (used as section dividers)."""
    para = doc.add_paragraph()
    para.paragraph_format.space_before = Pt(6)
    para.paragraph_format.space_after  = Pt(2)
    pPr = para._p.get_or_add_pPr()
    shd = OxmlElement("w:shd")
    shd.set(qn("w:val"),   "clear")
    shd.set(qn("w:color"), "auto")
    shd.set(qn("w:fill"),  f"{r:02X}{g:02X}{b:02X}")
    pPr.append(shd)
    run = para.add_run(f"  {text}")
    run.font.name  = "Arial"
    run.font.size  = Pt(11)
    run.font.bold  = True
    run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
    return para

def add_table(doc, headers, rows, col_widths=None):
    t = doc.add_table(rows=1+len(rows), cols=len(headers))
    t.style = "Table Grid"
    # header row
    hdr = t.rows[0]
    for i, h in enumerate(headers):
        c = hdr.cells[i]
        c.text = h
        for para in c.paragraphs:
            for run in para.runs:
                run.font.bold = True
                run.font.size = Pt(9)
                run.font.name = "Arial"
        # shading
        tcPr = c._tc.get_or_add_tcPr()
        shd = OxmlElement("w:shd")
        shd.set(qn("w:val"),   "clear")
        shd.set(qn("w:color"), "auto")
        shd.set(qn("w:fill"),  "2E74B5")
        tcPr.append(shd)
        for para in c.paragraphs:
            for run in para.runs:
                run.font.color.rgb = RGBColor(0xFF,0xFF,0xFF)
    # data rows
    for ri, row_data in enumerate(rows):
        row = t.rows[ri+1]
        for ci, cell_text in enumerate(row_data):
            c = row.cells[ci]
            c.text = cell_text
            for para in c.paragraphs:
                for run in para.runs:
                    run.font.size = Pt(9)
                    run.font.name = "Arial"
            if ri % 2 == 1:
                tcPr = c._tc.get_or_add_tcPr()
                shd = OxmlElement("w:shd")
                shd.set(qn("w:val"),   "clear")
                shd.set(qn("w:color"), "auto")
                shd.set(qn("w:fill"),  "EAF0F8")
                tcPr.append(shd)
    if col_widths:
        for ri2, row in enumerate(t.rows):
            for ci2, cell in enumerate(row.cells):
                if ci2 < len(col_widths):
                    cell.width = Inches(col_widths[ci2])
    doc.add_paragraph()
    return t

def bullet(doc, text, level=0):
    p = doc.add_paragraph(style="List Bullet")
    p.paragraph_format.left_indent = Inches(0.25 * (level+1))
    p.paragraph_format.space_after = Pt(1)
    run = p.add_run(text)
    run.font.size = Pt(9.5)
    run.font.name = "Arial"
    return p

def kv(doc, label, value):
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(1)
    r1 = p.add_run(f"{label}: ")
    r1.font.bold = True
    r1.font.size = Pt(9.5)
    r1.font.name = "Arial"
    r2 = p.add_run(value)
    r2.font.size = Pt(9.5)
    r2.font.name = "Arial"

def small_para(doc, text):
    p = doc.add_paragraph(text)
    p.paragraph_format.space_after = Pt(2)
    for run in p.runs:
        run.font.size = Pt(9.5)
        run.font.name = "Arial"
    return p

# ═══════════════════════════════════════════════════════════
# HEADER BLOCK
# ═══════════════════════════════════════════════════════════
title = doc.add_paragraph()
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
tr = title.add_run("INTENSIVE CARE UNIT PATIENT FILE")
tr.font.name  = "Arial"
tr.font.size  = Pt(16)
tr.font.bold  = True
tr.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D)

sub = doc.add_paragraph()
sub.alignment = WD_ALIGN_PARAGRAPH.CENTER
sr = sub.add_run("Acute Kidney Injury with Hypertension")
sr.font.name  = "Arial"
sr.font.size  = Pt(13)
sr.font.bold  = True
sr.font.color.rgb = RGBColor(0x2E, 0x74, 0xB5)

doc.add_paragraph()

# ── Horizontal rule ───────────────────────────────────────
def add_hr(doc):
    p = doc.add_paragraph()
    pPr = p._p.get_or_add_pPr()
    pBdr = OxmlElement("w:pBdr")
    bottom = OxmlElement("w:bottom")
    bottom.set(qn("w:val"), "single")
    bottom.set(qn("w:sz"), "6")
    bottom.set(qn("w:space"), "1")
    bottom.set(qn("w:color"), "2E74B5")
    pBdr.append(bottom)
    pPr.append(pBdr)
    p.paragraph_format.space_after = Pt(4)

add_hr(doc)

# ═══════════════════════════════════════════════════════════
# SECTION 1 – PATIENT DEMOGRAPHICS
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 1 – PATIENT DEMOGRAPHICS & ADMISSION DETAILS")
add_table(doc,
    headers=["Field", "Details"],
    rows=[
        ["Patient Name",            "___________________________"],
        ["Age / Sex / Weight",       "_____ yrs  /  M / F  /  _____ kg"],
        ["MRN / Hospital ID",        "___________________________"],
        ["Date of Admission",        "___________________________"],
        ["Admitting Unit",           "ICU / Medical ICU / Nephrology ICU"],
        ["Admitting Physician",      "___________________________"],
        ["Primary Diagnosis",        "Acute Kidney Injury (AKI) + Hypertension"],
        ["ICD-10 Codes",             "N17.9 (AKI, unspecified)  |  I10 (Hypertension)"],
        ["Source of Admission",      "Emergency Dept / Ward / OPD / Transfer"],
        ["Code Status",              "Full Code  /  DNR  /  DNI"],
    ],
    col_widths=[2.2, 4.2]
)

# ═══════════════════════════════════════════════════════════
# SECTION 2 – HISTORY & BACKGROUND
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 2 – CLINICAL HISTORY")

p = doc.add_paragraph()
set_heading(p, "Chief Complaint", level=2)
small_para(doc, "Oliguria / anuria  |  Rising creatinine / BUN  |  Hypertensive emergency  |  Fluid overload  |  Uremic symptoms")

p = doc.add_paragraph()
set_heading(p, "History of Present Illness", level=2)
small_para(doc, "Onset, duration, precipitating factors (e.g., sepsis, nephrotoxins, contrast, NSAID use, dehydration, volume depletion), prior CKD history, baseline creatinine.")

p = doc.add_paragraph()
set_heading(p, "Past Medical History", level=2)
for item in ["Chronic Kidney Disease (stage: _____)", "Hypertension – duration: _____ years",
             "Diabetes Mellitus", "Heart failure / Ischemic heart disease",
             "Renovascular disease / Renal artery stenosis", "Collagen vascular disease (SLE, Scleroderma)",
             "Recent surgery / trauma / contrast exposure"]:
    bullet(doc, item)

p = doc.add_paragraph()
set_heading(p, "Current Medications", level=2)
small_para(doc, "List all medications especially ACE-I, ARBs, NSAIDs, diuretics, aminoglycosides, vancomycin, contrast agents, immunosuppressants.")

p = doc.add_paragraph()
set_heading(p, "Allergies", level=2)
small_para(doc, "_______________________________________________________")

# ═══════════════════════════════════════════════════════════
# SECTION 3 – VITAL SIGNS & MONITORING
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 3 – VITAL SIGNS & HEMODYNAMIC MONITORING")
add_table(doc,
    headers=["Parameter", "On Admission", "Target/Goal", "6h", "12h", "24h"],
    rows=[
        ["BP (mmHg)",              "",  "SBP 140-160 (acute)", "", "", ""],
        ["MAP (mmHg)",             "",  "≥65 mmHg",           "", "", ""],
        ["Heart Rate (bpm)",       "",  "60-100",              "", "", ""],
        ["Temperature (°C)",       "",  "36.5-37.5",           "", "", ""],
        ["SpO2 (%)",               "",  "≥94%",                "", "", ""],
        ["Respiratory Rate",       "",  "12-20/min",           "", "", ""],
        ["GCS",                    "",  "15",                  "", "", ""],
        ["Urine Output (mL/hr)",   "",  "≥0.5 mL/kg/hr",      "", "", ""],
        ["CVP (mmHg)",             "",  "8-12 mmHg",           "", "", ""],
    ],
    col_widths=[1.8, 1.0, 1.4, 0.8, 0.8, 0.8]
)

# ═══════════════════════════════════════════════════════════
# SECTION 4 – AKI STAGING (KDIGO 2012)
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 4 – AKI STAGING (KDIGO 2012)")

p = doc.add_paragraph()
set_heading(p, "KDIGO AKI Definition (any ONE criterion):", level=2)
for crit in [
    "Serum creatinine increase ≥0.3 mg/dL (≥26.5 µmol/L) within 48 hours",
    "Serum creatinine increase to ≥1.5× baseline within 7 days",
    "Urine output <0.5 mL/kg/hr for ≥6 consecutive hours"
]:
    bullet(doc, crit)

add_table(doc,
    headers=["Stage", "Serum Creatinine Criteria", "Urine Output Criteria"],
    rows=[
        ["1", "1.5–1.9× baseline  OR  rise ≥0.3 mg/dL (48 h)", "<0.5 mL/kg/hr for 6–12 h"],
        ["2", "2.0–2.9× baseline",                              "<0.5 mL/kg/hr for ≥12 h"],
        ["3", "≥3.0× baseline  OR  sCr ≥4 mg/dL  OR  RRT initiated", "<0.3 mL/kg/hr for ≥24 h  OR  anuria ≥12 h"],
    ],
    col_widths=[0.6, 3.5, 2.5]
)

kv(doc, "Current AKI Stage", "Stage ___  (Circle: 1 / 2 / 3)")
kv(doc, "Baseline Creatinine", "_____ mg/dL")
kv(doc, "Admission Creatinine", "_____ mg/dL")
kv(doc, "AKI Category", "Pre-renal  /  Intrinsic (ATN / GN / Interstitial)  /  Post-renal")

# ═══════════════════════════════════════════════════════════
# SECTION 5 – HYPERTENSION ASSESSMENT
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 5 – HYPERTENSION ASSESSMENT")

p = doc.add_paragraph()
set_heading(p, "Classification", level=2)
add_table(doc,
    headers=["Class", "SBP (mmHg)", "DBP (mmHg)", "Action Required"],
    rows=[
        ["Hypertensive Urgency",   ">180",  ">120", "Oral agents; reduce over 24-48 h; no end-organ damage"],
        ["Hypertensive Emergency", ">180",  ">120", "IV agents; reduce MAP by ≤25% in first hour; end-organ damage present"],
        ["Malignant Hypertension", ">>180", ">>120","Papilledema ± retinal hemorrhages; treat as emergency"],
    ],
    col_widths=[2.0, 1.2, 1.2, 2.9]
)

p = doc.add_paragraph()
set_heading(p, "Current Classification", level=2)
kv(doc, "Admission BP", "_____ / _____ mmHg")
kv(doc, "Classified As", "Urgency  /  Emergency  /  Malignant  (circle one)")

p = doc.add_paragraph()
set_heading(p, "End-Organ Damage Assessment", level=2)
for organ in [
    "Renal: sCr elevation, proteinuria, hematuria (current AKI)",
    "Cardiac: ECG – LVH, ischemia / Echo – EF, diastolic dysfunction",
    "Neurologic: encephalopathy, focal deficits, fundoscopy",
    "Ophthalmologic: papilledema, hemorrhages, exudates",
    "Vascular: aortic dissection excluded"
]:
    bullet(doc, organ)

# ═══════════════════════════════════════════════════════════
# SECTION 6 – INVESTIGATIONS
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 6 – INVESTIGATIONS")

p = doc.add_paragraph()
set_heading(p, "Baseline Labs (on admission)", level=2)
add_table(doc,
    headers=["Test", "Result", "Normal Range", "Repeat Interval"],
    rows=[
        ["Serum Creatinine (mg/dL)",    "", "0.6–1.2",     "Q6–8 h"],
        ["BUN (mg/dL)",                 "", "7–20",        "Q12 h"],
        ["eGFR (mL/min/1.73m²)",        "", ">60",         "Daily"],
        ["Serum Potassium (mEq/L)",     "", "3.5–5.0",     "Q6 h"],
        ["Serum Sodium (mEq/L)",        "", "135–145",     "Q12 h"],
        ["Serum Bicarbonate (mEq/L)",   "", "22–29",       "Q12 h"],
        ["Chloride (mEq/L)",            "", "98–106",      "Daily"],
        ["Calcium / Phosphorus",        "", "8.5–10.5 / 2.5–4.5", "Daily"],
        ["Serum Uric Acid",             "", "2.4–6.0",     "On admission"],
        ["CBC with differential",       "", "—",           "Daily"],
        ["CRP / Procalcitonin",         "", "—",           "Daily if sepsis"],
        ["Blood cultures",              "", "—",           "× 2 sets on admission"],
        ["Urine output (mL/hr)",        "", "≥0.5 mL/kg/hr","Continuous"],
        ["Urinalysis + microscopy",     "", "—",           "On admission"],
        ["Urine Na / Cr (spot)",        "", "—",           "On admission"],
        ["FENa (%)",                    "", "<1% = prerenal", "On admission"],
        ["FEUrea (%)",                  "", "<35% = prerenal","If on diuretics"],
        ["24-h urine protein",          "", "<150 mg/day", "On admission"],
        ["Urine β2-microglobulin / NGAL","","—",           "If available"],
        ["ABG / VBG",                   "", "pH 7.35–7.45","Q6 h if acidosis"],
        ["PT / INR / aPTT",             "", "—",           "Daily"],
        ["LDH / Haptoglobin (TMA?)",    "", "—",           "If TMA suspected"],
        ["ANA, ANCA, Anti-GBM, C3/C4", "", "—",           "If GN suspected"],
        ["Chest X-ray",                 "", "—",           "On admission; repeat PRN"],
        ["ECG",                         "", "—",           "On admission; daily"],
        ["Renal Ultrasound",            "", "—",           "On admission"],
        ["Echocardiogram",              "", "—",           "If cardiac emergency"],
    ],
    col_widths=[2.5, 1.0, 1.6, 1.2]
)

# ═══════════════════════════════════════════════════════════
# SECTION 7 – MANAGEMENT PLAN
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 7 – MANAGEMENT PLAN")

# ── 7a Fluid
p = doc.add_paragraph()
set_heading(p, "7A. Fluid Management", level=2)
for b in [
    "Assess volume status: JVP, CVP, lung auscultation, weight, skin turgor",
    "Pre-renal AKI: Cautious IV fluid resuscitation – isotonic crystalloid (0.9% NaCl or Lactated Ringer's)",
    "Target MAP ≥65 mmHg to maintain renal perfusion",
    "Avoid fluid overload – daily weights, strict I&O, reassess Q4-6 h",
    "Avoid colloids (albumin only if severe hypoalbuminemia + intravascular depletion)",
    "Volume-overloaded AKI + HTN: restrict fluids; consider loop diuretics if urine output present",
    "Furosemide: 40–80 mg IV bolus; may titrate up to 200 mg IV if oliguric"
]:
    bullet(doc, b)

# ── 7b Antihypertensives
p = doc.add_paragraph()
set_heading(p, "7B. Antihypertensive Therapy (AKI-specific)", level=2)

small_para(doc, "Goal: Reduce MAP by ≤25% in first hour (hypertensive emergency). Avoid abrupt BP reduction (risk of AKI worsening from ischemia).")
add_table(doc,
    headers=["Drug", "Dose / Route", "Renal Use Notes", "Avoid If"],
    rows=[
        ["Nicardipine (CCB)",  "5–15 mg/hr IV infusion",       "First choice – maintains renal blood flow",        "Severe aortic stenosis"],
        ["Labetalol (α+β)",   "20–80 mg IV bolus Q10 min;\nor 2 mg/min infusion",  "Safe in renal disease",     "Asthma, acute decompensated HF, bradycardia"],
        ["Fenoldopam",        "0.1–0.3 µg/kg/min IV",          "Dopamine-1 agonist – increases renal blood flow; preferred in AKI + HTN emergency", "Glaucoma"],
        ["Clevidipine (CCB)", "1–21 mg/hr IV",                 "Short-acting; titratable",                        "Allergy to soybean/egg"],
        ["Hydralazine",       "10–20 mg IV Q4–6 h",            "Second-line",                                     "Avoid as monotherapy in emergencies"],
        ["Esmolol",           "500 µg/kg bolus then 50–300 µg/kg/min", "Only if tachycardia-driven",             "Asthma, severe bradycardia"],
        ["Sodium Nitroprusside", "0.3–10 µg/kg/min IV",        "AVOID in AKI – risk of cyanide/thiocyanate accumulation", "AKI (relative)"],
    ],
    col_widths=[1.6, 1.9, 2.2, 1.5]
)

small_para(doc, "NOTE: ACE inhibitors and ARBs are generally avoided in acute hypertensive emergency with AKI (bilateral RAS risk, hyperkalemia, worsening GFR). May be reintroduced cautiously at discharge after renal recovery.")

# ── 7c Electrolytes
p = doc.add_paragraph()
set_heading(p, "7C. Electrolyte & Metabolic Management", level=2)
add_table(doc,
    headers=["Problem", "Treatment"],
    rows=[
        ["Hyperkalemia K+ >5.5", "Calcium gluconate 10% 10 mL IV (cardiac protection)\nSodium bicarbonate 8.4% 50 mL IV if acidotic\nInsulin 10 units + Dextrose 50% 25 g IV\nSalbutamol nebulization 10–20 mg\nKayexalate (SPS) 15–30 g PO if tolerated\nDialysis if K+ >6.5 or ECG changes"],
        ["Metabolic Acidosis (pH<7.35)", "Treat underlying cause; IV sodium bicarbonate if pH <7.2\nTarget HCO3 ≥15 mEq/L; dialysis if refractory"],
        ["Hyperphosphatemia", "Dietary restriction; phosphate binders (calcium carbonate with meals)"],
        ["Hypocalcemia", "Calcium gluconate 1–2 g IV over 10 min (symptomatic only)"],
        ["Hyponatremia", "Identify cause (dilutional vs. depletion); fluid restrict if dilutional"],
        ["Hyperuricemia", "Usually managed conservatively; colchicine/NSAID avoid; consider rasburicase if TLS"],
    ],
    col_widths=[2.2, 4.2]
)

# ── 7d RRT
p = doc.add_paragraph()
set_heading(p, "7D. Renal Replacement Therapy (RRT) – Indications", level=2)
small_para(doc, "Absolute indications (AEIOU mnemonic):")
for ind in [
    "A – Acidosis: pH <7.2 refractory to bicarbonate therapy",
    "E – Electrolytes: Hyperkalemia >6.5 mEq/L or ECG changes, refractory hyponatremia",
    "I – Intoxication: Methanol, ethylene glycol, salicylates, lithium",
    "O – Overload: Volume overload (pulmonary edema) unresponsive to diuretics",
    "U – Uremia: BUN >100 mg/dL; uremic encephalopathy; uremic pericarditis (friction rub)"
]:
    bullet(doc, ind)

small_para(doc, "RRT Modality Choice:")
add_table(doc,
    headers=["Modality", "Use In"],
    rows=[
        ["IHD (Intermittent HD)",           "Hemodynamically stable patients; rapid solute clearance needed"],
        ["CRRT (CVVHDF / CVVH)",            "Hemodynamically unstable; preferred in ICU; better for volume control"],
        ["SLED (Sustained Low-Efficiency D.)", "Intermediate stability; used in step-down ICU setting"],
        ["Peritoneal Dialysis",              "Resource-limited settings; less preferred in AKI ICU"],
    ],
    col_widths=[2.5, 4.0]
)

kv(doc, "RRT Access", "Double-lumen catheter – Right internal jugular (preferred) / Subclavian / Femoral")
kv(doc, "RRT Initiated", "Yes / No  |  Date/Time: _______________")
kv(doc, "Modality Used", "_________________________________")

# ── 7e Medications to Adjust
p = doc.add_paragraph()
set_heading(p, "7E. Medications Requiring Dose Adjustment / Avoidance in AKI", level=2)
add_table(doc,
    headers=["Drug Category", "Action"],
    rows=[
        ["NSAIDs",                     "STOP – reduce renal blood flow, worsen AKI"],
        ["Metformin",                  "STOP – risk of lactic acidosis (hold until sCr normalizes)"],
        ["ACE inhibitors / ARBs",      "HOLD in acute phase – risk of worsening GFR, hyperkalemia"],
        ["Aminoglycosides",            "AVOID – nephrotoxic; use alternatives"],
        ["Vancomycin",                 "Dose per level + renal function (AUC/MIC monitoring)"],
        ["Contrast agents (IV)",       "AVOID or pre-hydrate + N-acetylcysteine; use LOCA only"],
        ["Low molecular weight heparin","Use UFH; LMWH accumulates in severe AKI (GFR<30)"],
        ["Digoxin",                    "Reduce dose; monitor levels closely"],
        ["Antibiotics (renally cleared)","Adjust doses per GFR (e.g., piperacillin-tazobactam, meropenem)"],
    ],
    col_widths=[2.2, 4.2]
)

# ── 7f Nutrition
p = doc.add_paragraph()
set_heading(p, "7F. Nutrition in AKI", level=2)
for n in [
    "Energy: 20–25 kcal/kg/day (critically ill)",
    "Protein: 1.0–1.5 g/kg/day (non-dialysis AKI);  up to 1.7 g/kg/day (CRRT patients)",
    "Restrict potassium, phosphorus, sodium in diet",
    "Avoid enteral/parenteral supplementation of potassium unless documented hypokalemia",
    "Preferred route: Enteral nutrition (if gut functional); start within 24–48 h of ICU admission",
    "Glycemic control: Target glucose 140–180 mg/dL; avoid hypoglycemia"
]:
    bullet(doc, n)

# ═══════════════════════════════════════════════════════════
# SECTION 8 – DAILY ICU MONITORING CHART
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 8 – DAILY MONITORING & PROGRESS CHART")
add_table(doc,
    headers=["Parameter", "Day 1", "Day 2", "Day 3", "Day 4", "Day 5"],
    rows=[
        ["Weight (kg)",           "", "", "", "", ""],
        ["BP (mmHg)",             "", "", "", "", ""],
        ["MAP (mmHg)",            "", "", "", "", ""],
        ["HR (bpm)",              "", "", "", "", ""],
        ["SpO2 (%)",              "", "", "", "", ""],
        ["UO total (mL/24h)",     "", "", "", "", ""],
        ["Total intake (mL/24h)", "", "", "", "", ""],
        ["Fluid balance (mL)",    "", "", "", "", ""],
        ["Creatinine (mg/dL)",    "", "", "", "", ""],
        ["BUN (mg/dL)",           "", "", "", "", ""],
        ["K+ (mEq/L)",            "", "", "", "", ""],
        ["Na+ (mEq/L)",           "", "", "", "", ""],
        ["HCO3- (mEq/L)",         "", "", "", "", ""],
        ["pH (ABG)",              "", "", "", "", ""],
        ["RRT session",           "", "", "", "", ""],
        ["AKI Stage",             "", "", "", "", ""],
        ["Antihypertensive IV",   "", "", "", "", ""],
        ["Antihypertensive PO",   "", "", "", "", ""],
    ],
    col_widths=[2.2, 0.85, 0.85, 0.85, 0.85, 0.85]
)

# ═══════════════════════════════════════════════════════════
# SECTION 9 – COMPLICATIONS WATCH
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 9 – COMPLICATIONS TO MONITOR")
add_table(doc,
    headers=["Complication", "Signs/Triggers", "Immediate Action"],
    rows=[
        ["Pulmonary Edema",          "Rising FiO2 need, crackles, CXR",         "Furosemide IV / CPAP / RRT if refractory"],
        ["Hyperkalemia (severe)",    "K+ >6.5, ECG: peaked T, wide QRS",        "Calcium gluconate, insulin-dextrose, emergent dialysis"],
        ["Uremic encephalopathy",    "Confusion, asterixis, seizures",           "Emergent RRT"],
        ["Uremic pericarditis",      "Pleuritic chest pain, friction rub",       "Urgent RRT; avoid anticoagulation"],
        ["Hypertensive encephalopathy","Headache, confusion, seizures, BP >>180","IV nicardipine or labetalol; reduce MAP by ≤25% in 1 h"],
        ["Hypertensive Pulmonary Edema","SOB, pink frothy sputum, hypertension", "IV nitroglycerin + loop diuretic; CPAP/NIV"],
        ["Thrombotic Microangiopathy","Low platelets, hemolysis, AKI",           "Nephrology + hematology consult; plasma exchange"],
        ["Sepsis (driving AKI)",     "Fever/hypothermia, WBC rise, cultures +", "Broad-spectrum antibiotics; source control; fluids"],
        ["Post-obstructive AKI",     "Bladder fullness, US: hydronephrosis",     "Urinary catheterization; urology consult"],
    ],
    col_widths=[2.0, 2.3, 2.3]
)

# ═══════════════════════════════════════════════════════════
# SECTION 10 – RECOVERY CRITERIA & DISCHARGE PLANNING
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 10 – RECOVERY CRITERIA & DISCHARGE PLANNING")

p = doc.add_paragraph()
set_heading(p, "Criteria for ICU Step-Down / Discharge Readiness", level=2)
for c in [
    "BP controlled on oral medications (SBP <160 mmHg)",
    "Urine output ≥0.5 mL/kg/hr consistently for >12 h without diuretics",
    "Creatinine trending downward toward baseline",
    "Serum potassium <5.5 mEq/L on oral/no treatment",
    "Metabolic acidosis resolved (pH ≥7.35, HCO3 ≥18)",
    "No active indications for RRT",
    "Patient hemodynamically stable, off intravenous antihypertensives",
    "Patient tolerating oral medications and enteral nutrition"
]:
    bullet(doc, c)

p = doc.add_paragraph()
set_heading(p, "Discharge Medications (Sample)", level=2)
add_table(doc,
    headers=["Drug Class", "Example Agent", "Notes"],
    rows=[
        ["CCB",                 "Amlodipine 5–10 mg PO OD",              "Preferred; renal-safe"],
        ["ACE-I (if eGFR stable)", "Ramipril 2.5–5 mg PO OD",            "After AKI resolved; monitor K+/Cr at 1 week"],
        ["Loop Diuretic",       "Furosemide 40 mg PO OD",                "If residual volume overload"],
        ["Potassium supplement", "KCl 20 mEq PO TID (if hypokalemic)",   "Monitor levels closely"],
        ["Phosphate binder",    "Calcium carbonate 500 mg TID with meals","If persistent hyperphosphatemia"],
        ["Statin",              "Atorvastatin 20–40 mg PO OD",           "Cardiovascular protection; generally safe in AKI recovery"],
    ],
    col_widths=[1.8, 2.4, 2.4]
)

p = doc.add_paragraph()
set_heading(p, "Follow-Up Plan", level=2)
for fu in [
    "Nephrology OPD at 1 week: repeat creatinine, eGFR, electrolytes, urinalysis",
    "BP monitoring: target <130/80 mmHg at 4 weeks",
    "24-h urine protein at 4 weeks (persistent proteinuria → renal biopsy consideration)",
    "Repeat renal ultrasound if obstruction/structural abnormality suspected",
    "Review and reintroduce ACE-I/ARB only after sCr stable ×2 readings",
    "Educate patient: avoid NSAIDs, maintain hydration, BP medication compliance",
    "CKD surveillance if AKI not fully recovered at 3 months"
]:
    bullet(doc, fu)

# ═══════════════════════════════════════════════════════════
# SECTION 11 – PHYSICIAN ORDERS & SIGNATURES
# ═══════════════════════════════════════════════════════════
shaded_heading(doc, "SECTION 11 – ORDERS & SIGNATURES")
add_table(doc,
    headers=["Order Category", "Details", "Signed By", "Date/Time"],
    rows=[
        ["Monitoring",   "Vitals Q1h; strict I&O; daily weights; urine output Q1h", "", ""],
        ["Labs",         "sCr, BUN, electrolytes Q6-12h; CBC daily; ABG Q6h if acidosis", "", ""],
        ["Fluid Orders", "Type: ___  Rate: ___ mL/hr  Duration: ___", "", ""],
        ["Antihypertensive", "Drug: ___  Dose: ___  Route: ___  Frequency: ___", "", ""],
        ["RRT Order",    "Modality: ___  Access: ___  Anticoagulation: ___", "", ""],
        ["Diet",         "Low K+/PO4/Na+  Fluid restrict: ___ mL/day  Protein: ___", "", ""],
        ["Consults",     "Nephrology / Cardiology / Ophthalmology / Other: ___", "", ""],
        ["Nurse Instructions", "Notify if UO <30 mL/hr; K+ >5.5; SBP >180 or <90; O2 sat <92%", "", ""],
    ],
    col_widths=[1.6, 2.8, 1.3, 0.9]
)

doc.add_paragraph()
add_hr(doc)

# Footer note
foot = doc.add_paragraph()
foot.alignment = WD_ALIGN_PARAGRAPH.CENTER
fr = foot.add_run(
    f"Generated: {datetime.date.today().strftime('%B %d, %Y')}  |  "
    "References: KDIGO AKI Guidelines 2012 · Comprehensive Clinical Nephrology 7e · "
    "Fischer's Mastery of Surgery 8e · Washington Manual of Medical Therapeutics · "
    "Brenner & Rector's The Kidney 2e"
)
fr.font.size = Pt(7.5)
fr.font.name = "Arial"
fr.font.color.rgb = RGBColor(0x60, 0x60, 0x60)

out = "/tmp/workspace/icu-file/ICU_AKI_Hypertension.docx"
doc.save(out)
print(f"Saved: {out}")
Running Command

cd /tmp/workspace/icu-file && python create_icu_file.py

Running Command

ls -lh /tmp/workspace/icu-file/ICU_AKI_Hypertension.docx

The file is ready. Here is your download link:

ICU AKI Hypertension

Word Document · DOCX


What's inside the ICU file

The document is a complete, print-ready ICU patient management file organized into 11 sections:
SectionContent
1 - Demographics & AdmissionPatient identifiers, ICD-10 codes (N17.9 + I10), code status
2 - Clinical HistoryChief complaint, HPI, PMH, current medications, allergies
3 - Vital Signs & HemodynamicsAdmission + 6h/12h/24h tracking table with target ranges (MAP ≥65, UO ≥0.5 mL/kg/hr, etc.)
4 - AKI Staging (KDIGO 2012)All 3 diagnostic criteria, 3-stage table (creatinine + urine output criteria), AKI category classification
5 - Hypertension AssessmentUrgency vs. Emergency vs. Malignant classification table, end-organ damage checklist
6 - Investigations27-parameter table: labs, urinary indices (FENa, FEUrea), biomarkers, imaging, ECG, repeat intervals
7 - Management PlanFluid resuscitation, IV antihypertensive drug table (nicardipine, labetalol, fenoldopam, clevidipine; nitroprusside flagged as avoid in AKI), electrolyte emergencies, RRT indications + modality table (IHD/CRRT/SLED), drug adjustment list, nutrition targets
8 - Daily Monitoring Chart5-day rolling table: BP, creatinine, BUN, K+, pH, fluid balance, RRT sessions, AKI stage
9 - Complications Watch9 critical complications with triggers and immediate actions (hyperkalemia, uremic pericarditis, TMA, hypertensive encephalopathy, etc.)
10 - Recovery & DischargeDischarge criteria, safe oral antihypertensive regimen, nephrology follow-up schedule
11 - Orders & SignaturesNurse alert thresholds, physician order block with sign/date fields
Clinical basis: KDIGO AKI Guidelines 2012 - Comprehensive Clinical Nephrology 7e - Fischer's Mastery of Surgery 8e - Washington Manual of Medical Therapeutics - Brenner & Rector's The Kidney.
This is a shared conversation. Sign in to Orris to start your own chat.