Assignment on Development of a hospital formulary for 300 bedded teaching hospital I need complete one formulary book which consist of detailed information About 30 pages A proper formulary for a 300-bedded teaching hospital should include: * Cover page * Certificate (optional) * Preface * Table of contents * Hospital Formulary Committee (P&T Committee) * Objectives and policies * Formulary management process * Prescribing guidelines * Antibiotic stewardship policy * Look-alike/sound-alike (LASA) drugs * High-alert medications * Hospital abbreviations * Emergency drugs * Detailed drug monographs (100–150 drugs) with: * Generic name * Brand names (optional) * Therapeutic class * Indications * Adult and pediatric doses * Contraindications * Adverse effects * Drug interactions * Pregnancy category/considerations * Renal/hepatic dose adjustments * Storage conditions * Available dosage forms * IV compatibility information * Insulin chart * Vaccination schedule * Antidote list * Crash cart contents * Appendix * Index * Vancouver references

Reading File
Running Command

mkdir -p /tmp/workspace/hospital-formulary && ls /tmp/workspace/hospital-formulary/

Yes continue

Writing File

~/hospital-formulary/formulary_part1.py


from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import copy

doc = Document()

# ── Page margins ──────────────────────────────────────────────────────────────
for section in doc.sections:
    section.top_margin    = Cm(2.0)
    section.bottom_margin = Cm(2.0)
    section.left_margin   = Cm(2.5)
    section.right_margin  = Cm(2.0)

# ── Global styles ─────────────────────────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Times New Roman"
normal.font.size = Pt(11)

def set_heading_style(paragraph, level, text, color=None):
    paragraph.style = doc.styles[f"Heading {level}"]
    run = paragraph.runs[0] if paragraph.runs else paragraph.add_run(text)
    if not paragraph.runs:
        paragraph.clear()
        run = paragraph.add_run(text)
    else:
        run = paragraph.runs[0]
        run.text = text
    run.font.name = "Times New Roman"
    if color:
        run.font.color.rgb = RGBColor(*color)
    return paragraph

def add_h1(text, color=(0,51,102)):
    p = doc.add_heading(text, level=1)
    for run in p.runs:
        run.font.name = "Times New Roman"
        run.font.color.rgb = RGBColor(*color)
    p.paragraph_format.space_before = Pt(12)
    p.paragraph_format.space_after  = Pt(6)
    return p

def add_h2(text, color=(0,70,127)):
    p = doc.add_heading(text, level=2)
    for run in p.runs:
        run.font.name = "Times New Roman"
        run.font.color.rgb = RGBColor(*color)
    p.paragraph_format.space_before = Pt(8)
    p.paragraph_format.space_after  = Pt(4)
    return p

def add_h3(text):
    p = doc.add_heading(text, level=3)
    for run in p.runs:
        run.font.name = "Times New Roman"
        run.font.color.rgb = RGBColor(0,0,0)
    return p

def add_para(text, bold=False, italic=False, size=11, align=WD_ALIGN_PARAGRAPH.JUSTIFY, indent=False):
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.font.name = "Times New Roman"
    run.font.size  = Pt(size)
    run.bold   = bold
    run.italic = italic
    p.alignment = align
    if indent:
        p.paragraph_format.left_indent = Inches(0.3)
    p.paragraph_format.space_after = Pt(4)
    return p

def add_bullet(text, level=0):
    p = doc.add_paragraph(style="List Bullet")
    run = p.add_run(text)
    run.font.name = "Times New Roman"
    run.font.size  = Pt(11)
    p.paragraph_format.left_indent = Inches(0.3 + level*0.2)
    return p

def page_break():
    doc.add_page_break()

def add_table_with_header(headers, rows, col_widths=None):
    table = doc.add_table(rows=1+len(rows), cols=len(headers))
    table.style = "Table Grid"
    table.alignment = WD_TABLE_ALIGNMENT.CENTER
    # Header row
    hdr = table.rows[0]
    for i, h in enumerate(headers):
        cell = hdr.cells[i]
        cell.text = h
        for run in cell.paragraphs[0].runs:
            run.bold = True
            run.font.name = "Times New Roman"
            run.font.size  = Pt(10)
        cell.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.CENTER
        # Header background
        tc = cell._tc
        tcPr = 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"), "003366")
        tcPr.append(shd)
        for run in cell.paragraphs[0].runs:
            run.font.color.rgb = RGBColor(255,255,255)
    # Data rows
    for ri, row_data in enumerate(rows):
        row = table.rows[ri+1]
        for ci, val in enumerate(row_data):
            cell = row.cells[ci]
            cell.text = str(val)
            for run in cell.paragraphs[0].runs:
                run.font.name = "Times New Roman"
                run.font.size  = Pt(10)
            if ri % 2 == 0:
                tc = cell._tc
                tcPr = 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"), "E8F0FE")
                tcPr.append(shd)
    # Column widths
    if col_widths:
        for i, w in enumerate(col_widths):
            for row in table.rows:
                row.cells[i].width = Inches(w)
    doc.add_paragraph()
    return table

# ═══════════════════════════════════════════════════════════════════════════════
# COVER PAGE
# ═══════════════════════════════════════════════════════════════════════════════
doc.add_paragraph()
doc.add_paragraph()

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("HOSPITAL FORMULARY")
run.font.name = "Times New Roman"
run.font.size  = Pt(28)
run.bold = True
run.font.color.rgb = RGBColor(0,51,102)

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("2024 – 2025 Edition")
run.font.name = "Times New Roman"
run.font.size  = Pt(16)
run.bold = True
run.font.color.rgb = RGBColor(0,70,127)

doc.add_paragraph()

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("CITY MEDICAL COLLEGE & TEACHING HOSPITAL")
run.font.name = "Times New Roman"
run.font.size  = Pt(20)
run.bold = True
run.font.color.rgb = RGBColor(0,0,0)

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("300-Bedded Tertiary Care Teaching Hospital")
run.font.name = "Times New Roman"
run.font.size  = Pt(13)
run.font.color.rgb = RGBColor(80,80,80)

doc.add_paragraph()
doc.add_paragraph()

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("─" * 50)
run.font.color.rgb = RGBColor(0,51,102)

doc.add_paragraph()

p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("Compiled & Approved by the\nPharmacy & Therapeutics Committee")
run.font.name = "Times New Roman"
run.font.size  = Pt(13)
run.bold = True

doc.add_paragraph()

cover_details = [
    ("Address",        "123, Medical College Road, Healthcare City – 560 001"),
    ("Phone",          "+91-80-XXXX XXXX"),
    ("Email",          "formulary@citymedcollege.edu.in"),
    ("Effective Date", "01 April 2024"),
    ("Review Date",    "31 March 2025"),
    ("Edition",        "First Edition"),
]
for label, val in cover_details:
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    r1 = p.add_run(f"{label}: ")
    r1.bold = True
    r1.font.name = "Times New Roman"
    r1.font.size  = Pt(11)
    r2 = p.add_run(val)
    r2.font.name = "Times New Roman"
    r2.font.size  = Pt(11)

doc.add_paragraph()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("FOR INTERNAL USE ONLY — NOT FOR SALE")
run.bold = True
run.font.name = "Times New Roman"
run.font.size  = Pt(10)
run.font.color.rgb = RGBColor(180,0,0)

page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CERTIFICATE
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CERTIFICATE")
add_para(
    "This is to certify that the Hospital Formulary of City Medical College & Teaching Hospital "
    "has been compiled by the Pharmacy & Therapeutics (P&T) Committee under the supervision of the "
    "Medical Superintendent. This formulary represents an evidence-based selection of drugs approved "
    "for use within this institution and has been reviewed for safety, efficacy, and cost-effectiveness.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
add_para(
    "All prescribers, pharmacists, and healthcare professionals are expected to adhere to the policies "
    "and guidelines outlined in this document.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
doc.add_paragraph()
sigs = [
    ("Dr. ____________________", "Medical Superintendent"),
    ("Dr. ____________________", "Chairman, P&T Committee"),
    ("Dr. ____________________", "Chief Pharmacist"),
    ("Dr. ____________________", "Principal, Medical College"),
]
for name, title in sigs:
    p = doc.add_paragraph()
    r1 = p.add_run(f"{name}     ")
    r1.bold = True; r1.font.name="Times New Roman"; r1.font.size=Pt(11)
    r2 = p.add_run(f"({title})")
    r2.font.name="Times New Roman"; r2.font.size=Pt(11)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# PREFACE
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("PREFACE")
add_para(
    "The Hospital Formulary is a dynamic, authoritative document that serves as the cornerstone of "
    "rational drug therapy at City Medical College & Teaching Hospital. It provides healthcare "
    "professionals with concise, evidence-based information on the drugs approved for use within our "
    "institution.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
add_para(
    "A hospital formulary is not merely a list of drugs; it is a tool for promoting rational prescribing, "
    "minimizing medication errors, and ensuring cost-effective therapy. The formulary helps standardize "
    "treatment, reduce therapeutic duplications, and guide clinical decision-making at every level of "
    "patient care.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
add_para(
    "This edition contains monographs for over 120 drugs organized by therapeutic class, along with "
    "essential clinical references including emergency drug protocols, antibiotic stewardship guidelines, "
    "high-alert medication lists, IV compatibility information, antidote charts, and vaccination schedules.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
add_para(
    "The P&T Committee will review this formulary annually or as required in response to new clinical "
    "evidence, regulatory updates, or significant changes in drug availability. Additions, deletions, and "
    "therapeutic substitutions are managed through a formal process described in Chapter 3.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
add_para(
    "We thank all faculty, clinicians, residents, pharmacists, and nursing staff who contributed their "
    "expertise to this publication. Your commitment to patient safety is the foundation upon which this "
    "formulary has been built.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
doc.add_paragraph()
add_para("Dr. [Name]", bold=True)
add_para("Chairman, Pharmacy & Therapeutics Committee")
add_para("City Medical College & Teaching Hospital")
add_para("Date: April 2024")
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# TABLE OF CONTENTS (manual)
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("TABLE OF CONTENTS")
toc_entries = [
    ("Certificate",                                      "2"),
    ("Preface",                                          "3"),
    ("Chapter 1: Pharmacy & Therapeutics (P&T) Committee", "5"),
    ("Chapter 2: Objectives and Policies",               "6"),
    ("Chapter 3: Formulary Management Process",          "7"),
    ("Chapter 4: Prescribing Guidelines",                "8"),
    ("Chapter 5: Antibiotic Stewardship Policy",         "9"),
    ("Chapter 6: Look-Alike / Sound-Alike (LASA) Drugs", "10"),
    ("Chapter 7: High-Alert Medications",                "11"),
    ("Chapter 8: Hospital Abbreviations",                "12"),
    ("Chapter 9: Emergency Drugs",                       "13"),
    ("Chapter 10: Drug Monographs",                      "14"),
    ("   Section A – Analgesics & Antipyretics",         "14"),
    ("   Section B – Antibiotics & Antimicrobials",      "16"),
    ("   Section C – Cardiovascular Drugs",              "18"),
    ("   Section D – Respiratory Drugs",                 "20"),
    ("   Section E – Gastrointestinal Drugs",            "22"),
    ("   Section F – Endocrine & Metabolic Drugs",       "23"),
    ("   Section G – Neurological & Psychiatric Drugs",  "25"),
    ("   Section H – Anticoagulants & Haematology",      "26"),
    ("   Section I – Oncology Supportive Care",          "27"),
    ("   Section J – Ophthalmic & ENT Drugs",            "27"),
    ("   Section K – Dermatological Drugs",              "28"),
    ("   Section L – Obstetric & Gynaecological Drugs",  "28"),
    ("   Section M – Vitamins, Minerals & Electrolytes", "29"),
    ("Chapter 11: IV Compatibility Information",         "30"),
    ("Chapter 12: Insulin Chart",                        "31"),
    ("Chapter 13: Vaccination Schedule",                 "32"),
    ("Chapter 14: Antidote List",                        "33"),
    ("Chapter 15: Crash Cart Contents",                  "34"),
    ("Appendix",                                         "35"),
    ("Index",                                            "36"),
    ("References (Vancouver Style)",                     "38"),
]
table = doc.add_table(rows=len(toc_entries), cols=2)
table.style = "Table Grid"
for ri, (title, page) in enumerate(toc_entries):
    row = table.rows[ri]
    row.cells[0].text = title
    row.cells[1].text = page
    row.cells[1].paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.RIGHT
    for ci in range(2):
        for run in row.cells[ci].paragraphs[0].runs:
            run.font.name = "Times New Roman"
            run.font.size  = Pt(11)
            if title.startswith("Chapter") or title in ("Certificate","Preface","Appendix","Index","References (Vancouver Style)"):
                run.bold = True
row.cells[0].width = Inches(5.0)
row.cells[1].width = Inches(1.0)
doc.add_paragraph()
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 1 – P&T COMMITTEE
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 1: PHARMACY & THERAPEUTICS (P&T) COMMITTEE")
add_h2("1.1 Purpose")
add_para(
    "The Pharmacy & Therapeutics (P&T) Committee is an advisory body to the Medical Superintendent "
    "and Hospital Administration. It serves as the principal policy-making authority on all matters "
    "related to drug therapy, medication use evaluation, and the hospital formulary system.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("1.2 Composition")
add_table_with_header(
    ["Designation", "Role in Committee"],
    [
        ["Medical Superintendent",         "Ex-Officio Chairperson"],
        ["HOD, Internal Medicine",         "Chairperson, P&T Committee"],
        ["HOD, Surgery",                   "Member"],
        ["HOD, Paediatrics",               "Member"],
        ["HOD, Obstetrics & Gynaecology",  "Member"],
        ["HOD, Pharmacology",              "Member & Drug Information Officer"],
        ["HOD, Microbiology",              "Member (Antibiotic Stewardship)"],
        ["Chief Pharmacist",               "Member Secretary"],
        ["Nursing Superintendent",         "Member"],
        ["Hospital Administrator",         "Member"],
        ["Quality Manager",                "Member"],
        ["Resident Representative",        "Special Invitee"],
    ],
    col_widths=[3.5, 2.5]
)

add_h2("1.3 Meetings")
add_para("The P&T Committee meets quarterly (every 3 months). Special meetings may be convened at the request of the Chairperson or any two members.")

add_h2("1.4 Functions")
functions = [
    "Develop and maintain the hospital formulary.",
    "Review and evaluate requests for addition, deletion, or modification of drugs.",
    "Establish policies for drug procurement, storage, and dispensing.",
    "Monitor adverse drug reactions (ADR) and medication errors.",
    "Develop antibiotic stewardship and antimicrobial resistance policies.",
    "Conduct drug utilization review and medication use evaluation.",
    "Oversee the management of high-alert medications and LASA drugs.",
    "Provide education and training on rational drug use.",
    "Review and approve drug protocol changes.",
    "Liaise with the infection control committee for antimicrobial policies.",
]
for f in functions:
    add_bullet(f)

add_h2("1.5 Quorum")
add_para("A quorum of 5 members is required for official decisions. All decisions are documented in minutes circulated within 2 weeks of the meeting.")
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 2 – OBJECTIVES & POLICIES
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 2: OBJECTIVES AND POLICIES")
add_h2("2.1 Objectives of the Hospital Formulary")
objectives = [
    "Promote rational, safe, and cost-effective drug therapy for all patients.",
    "Standardize drug selection across all clinical departments.",
    "Reduce medication errors through clear, evidence-based prescribing guidance.",
    "Support clinical decision-making with up-to-date drug information.",
    "Facilitate the teaching of clinical pharmacology to students and residents.",
    "Ensure availability of essential medicines at all times.",
    "Minimize therapeutic duplication and polypharmacy.",
    "Support the hospital's infection control and antibiotic stewardship programs.",
]
for o in objectives:
    add_bullet(o)

add_h2("2.2 Formulary Policies")
add_h3("2.2.1 Prescribing Policy")
policies_prescribing = [
    "All drugs must be prescribed by their generic (INN) names.",
    "Prescriptions must include patient name, age, weight (paediatric), diagnosis, drug name, dose, route, frequency, and duration.",
    "Only registered medical practitioners credentialed at this hospital may prescribe formulary drugs.",
    "Verbal orders are accepted only in emergency situations and must be co-signed within 24 hours.",
    "Non-formulary drugs require a Non-Formulary Drug Request Form approved by the HOD and Chief Pharmacist.",
]
for p in policies_prescribing:
    add_bullet(p)

add_h3("2.2.2 Dispensing Policy")
policies_dispensing = [
    "The pharmacy dispenses only formulary drugs unless a valid non-formulary request is approved.",
    "Therapeutic substitution may be performed by the pharmacist with prescriber notification.",
    "Unit-dose dispensing is practiced in ICU and critical care areas.",
    "All narcotic and controlled substances are dispensed as per the NDPS Act 1985 protocols.",
    "Floor stock is limited to essential drugs listed in the approved floor stock list.",
]
for p in policies_dispensing:
    add_bullet(p)

add_h3("2.2.3 Non-Formulary Drug Request Policy")
add_para(
    "A prescriber may request a non-formulary drug by completing the Non-Formulary Drug Request Form, "
    "stating the clinical rationale. Requests are reviewed within 48 hours (24 hours for urgent cases). "
    "Approval is granted by the P&T Chairperson or delegated pharmacist.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h3("2.2.4 Drug Substitution Policy")
add_para(
    "The pharmacy may substitute a formulary equivalent (same active ingredient, same dose and route) "
    "without prior prescriber approval, provided the prescriber is notified. Therapeutic substitutions "
    "(different drug, same class) require prescriber consent.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("2.3 Drug Procurement Policy")
add_para(
    "Drugs are procured from approved vendors meeting quality standards (GMP certified, CDSCO licensed). "
    "The pharmacy must maintain a minimum 30-day stock for essential drugs and 15-day stock for all "
    "other formulary items. Emergency purchases require HOD and Administration approval.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 3 – FORMULARY MANAGEMENT PROCESS
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 3: FORMULARY MANAGEMENT PROCESS")
add_h2("3.1 Drug Addition Process")
steps_add = [
    "Step 1: Prescriber or department submits Drug Addition Request Form to the P&T Committee.",
    "Step 2: Drug Information Officer reviews evidence (efficacy, safety, pharmacoeconomics).",
    "Step 3: P&T Committee reviews the dossier at the quarterly meeting.",
    "Step 4: Approval by majority vote; conditional approval may apply.",
    "Step 5: Drug is added to formulary, monograph prepared, and procurement initiated.",
    "Step 6: All relevant departments and pharmacy are notified.",
]
for s in steps_add:
    add_bullet(s)

add_h2("3.2 Drug Deletion Process")
steps_del = [
    "Deletion is triggered by: market withdrawal, safety alerts, lack of use (<10 prescriptions/year), or therapeutic obsolescence.",
    "Chief Pharmacist prepares a deletion proposal with supporting evidence.",
    "P&T Committee reviews and approves deletion.",
    "Notification to all prescribers with recommended alternatives is issued 30 days before removal.",
]
for s in steps_del:
    add_bullet(s)

add_h2("3.3 Formulary Review Cycle")
add_para(
    "The formulary is formally reviewed every 12 months. Critical safety updates (black box warnings, "
    "market withdrawals, new drug interactions) trigger immediate interim review. All changes are "
    "documented and communicated within 7 days via the hospital intranet and pharmacy bulletin.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("3.4 Drug Utilization Review (DUR)")
add_para(
    "The P&T Committee conducts quarterly DUR studies on selected drug classes to identify patterns "
    "of over-use, under-use, or inappropriate use. Findings are shared with clinical departments and "
    "used to update formulary policies.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("3.5 Adverse Drug Reaction (ADR) Monitoring")
add_para(
    "All suspected ADRs must be reported using the hospital ADR reporting form (based on WHO-UMC "
    "causality scale) and submitted to the pharmacovigilance cell. Serious ADRs are also reported to "
    "the National Pharmacovigilance Programme (PvPI), CDSCO.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 4 – PRESCRIBING GUIDELINES
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 4: PRESCRIBING GUIDELINES")
add_h2("4.1 General Principles of Rational Prescribing")
add_para("Rational prescribing follows the WHO steps:")
steps_rational = [
    "Define the patient's problem precisely.",
    "Specify the therapeutic objective.",
    "Verify the suitability of the chosen drug (efficacy, safety, cost).",
    "Start treatment with an appropriate dose, duration, and route.",
    "Give clear information, warnings, and instructions to the patient.",
    "Monitor and review treatment outcome.",
]
for i, s in enumerate(steps_rational, 1):
    add_bullet(f"Step {i}: {s}")

add_h2("4.2 Prescription Writing Standards")
add_para("All prescriptions must be written legibly in capital letters (or printed) and must contain:")
required = [
    "Patient full name, age, sex, weight (paediatric/ICU), IP/OP number",
    "Date and time of prescribing",
    "Diagnosis or indication",
    "Drug name (generic/INN), dose, route, frequency, and duration",
    "Prescriber's name, designation, and signature",
    "Ward/unit designation",
]
for r in required:
    add_bullet(r)

add_h2("4.3 Paediatric Prescribing")
add_para(
    "All paediatric doses must be calculated on a mg/kg basis. Never extrapolate adult doses without "
    "reference. The formulary provides weight-based paediatric doses in each monograph. Use the "
    "Broselow tape for emergency dosing in children. Maximum doses are indicated in each monograph.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("4.4 Prescribing in Renal Impairment")
add_para(
    "Renal function should be assessed using Cockcroft-Gault formula (CrCl) or eGFR before prescribing "
    "renally-cleared drugs. Dose adjustments for CrCl <60, <30, and <15 mL/min are specified in each "
    "drug monograph. Dialysis dosing supplements are also provided.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("4.5 Prescribing in Hepatic Impairment")
add_para(
    "For drugs with significant hepatic metabolism, the Child-Pugh score is used to guide dosage. "
    "Drugs with narrow therapeutic index and extensive hepatic metabolism require therapeutic drug "
    "monitoring (TDM) in hepatic impairment (e.g., phenytoin, warfarin).",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("4.6 Prescribing in Pregnancy & Lactation")
add_para(
    "Drug safety in pregnancy is indicated using the FDA Pregnancy Category system (A, B, C, D, X) "
    "and ADEC (Australian) categories where applicable. Consult Lactmed or WHO BeST database for "
    "lactation safety. Avoid category D and X drugs unless benefit clearly outweighs risk.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("4.7 Controlled Substances")
add_para(
    "Opioids and Schedule H/H1 drugs require special prescription forms as mandated by NDPS Act 1985 "
    "and Drugs & Cosmetics Act 1940 (amended). Prescriptions must state the drug, quantity in words and "
    "figures, and be countersigned by the HOD in the inpatient setting.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 5 – ANTIBIOTIC STEWARDSHIP
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 5: ANTIBIOTIC STEWARDSHIP POLICY")
add_h2("5.1 Introduction")
add_para(
    "Antimicrobial stewardship (AMS) is a coordinated program to promote appropriate use of antimicrobials, "
    "improve patient outcomes, reduce microbial resistance, and decrease costs. This hospital implements "
    "the WHO AWaRe classification (Access, Watch, Reserve) for all antibiotics.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("5.2 WHO AWaRe Classification")
add_table_with_header(
    ["Category", "Definition", "Examples"],
    [
        ["Access","First/second-choice for common infections; lower resistance potential",
         "Amoxicillin, Ampicillin, Cotrimoxazole, Doxycycline, Gentamicin"],
        ["Watch","Higher resistance potential; use restricted to specific indications",
         "Ciprofloxacin, Azithromycin, Clarithromycin, Ceftriaxone, Levofloxacin"],
        ["Reserve","Last-resort; use only for MDR organisms confirmed by culture",
         "Colistin, Linezolid, Meropenem (for ESBL), Vancomycin, Tigecycline"],
    ],
    col_widths=[1.2, 2.8, 2.8]
)

add_h2("5.3 Antibiotic Prescribing Rules")
rules_abx = [
    "All antibiotics in the 'Watch' category require HOD countersignature for inpatient use.",
    "All 'Reserve' antibiotics require Infectious Disease specialist / Microbiologist approval.",
    "Culture and sensitivity (C&S) must be collected BEFORE starting antibiotics wherever feasible.",
    "Duration of antibiotic therapy must be specified at the time of prescription.",
    "Intravenous to oral switch should be performed at 48-72 hours if the patient is clinically improving.",
    "Prophylactic antibiotics for surgery must be given 30-60 minutes before incision and stopped within 24 hours post-operatively.",
    "Empirical therapy must be reviewed and de-escalated based on C&S results.",
]
for r in rules_abx:
    add_bullet(r)

add_h2("5.4 Surgical Antibiotic Prophylaxis")
add_table_with_header(
    ["Procedure Type", "Recommended Agent", "Dose", "Duration"],
    [
        ["Clean surgery (e.g., hernia)","Cefazolin","1 g IV","Single dose"],
        ["Clean-contaminated (e.g., cholecystectomy)","Cefazolin","1 g IV","Single dose"],
        ["Colorectal surgery","Cefazolin + Metronidazole","1 g + 500 mg IV","Single dose"],
        ["Orthopaedic implants","Cefazolin","1 g IV","24 h"],
        ["Urological surgery (catheter)","Ciprofloxacin","500 mg PO","Single dose"],
        ["Caesarean section","Cefazolin","2 g IV","Single dose"],
        ["Penicillin allergy (alternative)","Clindamycin","600 mg IV","Single dose"],
    ],
    col_widths=[2.2, 1.8, 1.2, 1.2]
)

add_h2("5.5 Antibiotic Audit")
add_para(
    "The Microbiology department in liaison with the P&T Committee performs monthly antibiotic audits "
    "reviewing appropriateness of indications, duration, and de-escalation. Results are shared with all "
    "clinical heads quarterly.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 6 – LASA DRUGS
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 6: LOOK-ALIKE / SOUND-ALIKE (LASA) DRUGS")
add_h2("6.1 Introduction")
add_para(
    "Look-alike and sound-alike (LASA) drugs are among the most frequent causes of medication errors. "
    "This hospital has implemented the TALLMAN lettering system and color-coded labelling for identified "
    "LASA pairs. All storage areas must separate LASA drugs and display LASA warning stickers.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("6.2 TALLMAN Lettering Examples")
add_para("In TALLMAN lettering, the distinguishing letters are written in CAPITALS to prevent confusion.")

add_table_with_header(
    ["Drug 1 (TALLMAN)", "Drug 2 (TALLMAN)", "Risk"],
    [
        ["DOBUTamine",     "DOPamine",         "Both vasopressors, different doses"],
        ["HYDROmorphone",  "HYDROXYzine",      "Opioid vs antihistamine"],
        ["GlipiZIDE",      "GlyBURIDE",        "Both hypoglycaemics"],
        ["CeleBREX",       "CeleXA",           "NSAID vs antidepressant"],
        ["EPINEPHrine",    "ePHEDrine",        "Anaphylaxis dose differences"],
        ["vinBLASTine",    "vinCRIStine",      "Both vinca alkaloids, toxic if confused"],
        ["cycloSPORINE",   "cycloSERINE",      "Immunosuppressant vs antibiotic"],
        ["metFORMIN",      "metroNIDAZOLE",    "Antidiabetic vs antibiotic"],
        ["predniSONE",     "predniSOLONE",     "Steroid dose differences"],
        ["chlorproMAZINE", "chlorproPAMIDE",   "Antipsychotic vs antidiabetic"],
        ["hydrALAZINE",    "hydroXYZINE",      "Antihypertensive vs antihistamine"],
        ["LORazepam",      "ALPRAZolam",       "Benzodiazepines, dose differences"],
        ["AMiloride",      "AMlodipine",       "Diuretic vs calcium channel blocker"],
        ["cefAZOlin",      "cefOXitin",        "Different antimicrobial spectra"],
    ],
    col_widths=[2.0, 2.0, 2.5]
)

add_h2("6.3 Prevention Strategies")
strategies_lasa = [
    "Store LASA drugs in separate bins with warning labels.",
    "Use TALLMAN lettering on all pharmacy labels, computer screens, and storage bins.",
    "Affix LASA stickers (bright yellow) on all LASA drug storage positions.",
    "Double-check LASA drugs before dispensing — two-pharmacist verification for high-alert LASA pairs.",
    "Educate nursing staff and prescribers on LASA risk during induction training.",
    "Use barcode medication administration (BCMA) where available.",
]
for s in strategies_lasa:
    add_bullet(s)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 7 – HIGH-ALERT MEDICATIONS
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 7: HIGH-ALERT MEDICATIONS")
add_h2("7.1 Definition")
add_para(
    "High-alert medications (HAMs) are drugs that bear a heightened risk of causing significant patient "
    "harm when used in error. This hospital adopts the ISMP (Institute for Safe Medication Practices) "
    "High-Alert Medication list as its primary reference.",
    align=WD_ALIGN_PARAGRAPH.JUSTIFY
)

add_h2("7.2 High-Alert Medication List")
add_table_with_header(
    ["Drug / Drug Class", "Risk", "Safety Precautions"],
    [
        ["Concentrated Electrolytes\n(KCl >2 mEq/mL, NaCl >0.9%)",
         "Cardiac arrest if given undiluted or rapidly",
         "Store in pharmacy only; mandatory dilution; double-check"],
        ["Insulin (all types)", "Hypoglycaemia, wrong type/dose",
         "Standardized insulin chart; two-nurse verification; BG monitoring"],
        ["Opioids (IV/epidural)\n(Morphine, Fentanyl, Pethidine)",
         "Respiratory depression, death",
         "Naloxone available; infusion pump mandatory; vitals q1h"],
        ["Anticoagulants\n(Heparin, Warfarin, LMWH)",
         "Haemorrhage, thrombosis",
         "Dose weight-based (heparin); INR/aPTT monitoring; reversal agents stocked"],
        ["Neuromuscular Blocking Agents\n(Succinylcholine, Vecuronium)",
         "Respiratory arrest if given without ventilatory support",
         "ICU/OT only; labeled 'Paralytic Agent'; ventilator must be present"],
        ["Chemotherapy agents", "Severe toxicity, death",
         "Oncology-trained staff only; double-check; biosafety cabinet preparation"],
        ["Hypertonic Dextrose (>10%)", "Hyperglycaemia, phlebitis",
         "Central line only for >10%; BG monitoring"],
        ["Thrombolytics (tPA, Streptokinase)",
         "Fatal haemorrhage",
         "ICU/CCU only; strict inclusion/exclusion criteria; q15 min monitoring"],
        ["Methotrexate (oral weekly)",
         "Accidental daily dosing → fatal toxicity",
         "Clearly label 'Weekly Dose Only'; pharmacy counselling mandatory"],
        ["Digoxin", "Narrow therapeutic index; toxicity",
         "TDM; ECG monitoring; electrolyte checks"],
    ],
    col_widths=[1.8, 1.8, 2.8]
)

add_h2("7.3 HAM Safety Requirements")
ham_safety = [
    "HAMs are identified with a RED HIGH-ALERT sticker in all storage areas.",
    "Independent double-check by two nurses before administration for IV HAMs.",
    "HAMs must not be stored in nursing floor stock except in approved, quantity-limited crash kits.",
    "Pharmacy prepares all HAM IV infusions (not at ward level) where possible.",
    "All staff must complete HAM training during annual mandatory education.",
]
for s in ham_safety:
    add_bullet(s)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 8 – HOSPITAL ABBREVIATIONS
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 8: APPROVED HOSPITAL ABBREVIATIONS")
add_h2("8.1 Approved Abbreviations for Prescription Writing")
add_table_with_header(
    ["Abbreviation", "Full Term", "Abbreviation", "Full Term"],
    [
        ["OD",   "Once daily",               "BD",   "Twice daily"],
        ["TDS",  "Three times daily",         "QID",  "Four times daily"],
        ["HS",   "At bedtime",                "AC",   "Before meals"],
        ["PC",   "After meals",               "PRN",  "As needed"],
        ["SOS",  "If needed (emergency)",     "STAT", "Immediately"],
        ["PO",   "By mouth (oral)",           "IV",   "Intravenous"],
        ["IM",   "Intramuscular",             "SC",   "Subcutaneous"],
        ["SL",   "Sublingual",               "INH",  "Inhalation"],
        ["TOP",  "Topical",                  "PR",   "Per rectum"],
        ["NGT",  "Nasogastric tube",         "NEB",  "Nebulisation"],
        ["mcg",  "Microgram",               "mg",   "Milligram"],
        ["g",    "Gram",                     "mL",   "Millilitre"],
        ["IU",   "International Unit",       "mEq",  "Milliequivalent"],
        ["D/W",  "Dextrose in water",        "NS",   "Normal Saline (0.9%)"],
        ["RL",   "Ringer's Lactate",         "D5W",  "5% Dextrose in water"],
        ["D5NS", "5% Dextrose + Normal Saline","H/2NS","Half normal saline"],
        ["MANE","Morning",                   "NOCTE","Night"],
        ["WBC",  "White Blood Cell",         "RBC",  "Red Blood Cell"],
        ["INR",  "International Normalised Ratio","aPTT","Activated Partial Thromboplastin Time"],
        ["CrCl", "Creatinine Clearance",    "eGFR", "Estimated GFR"],
    ],
    col_widths=[1.0, 2.0, 1.0, 2.0]
)

add_h2("8.2 Prohibited / Error-Prone Abbreviations")
add_table_with_header(
    ["Do NOT Use", "Reason", "Use Instead"],
    [
        ["U or u (units)",      "Mistaken for '0' or '4'",        "Write 'units'"],
        ["IU",                  "Mistaken for 'IV' or '10'",       "Write 'International Units'"],
        ["QD (every day)",      "Mistaken for QID",                "Write 'Daily' or 'OD'"],
        ["QOD (every other day)","Mistaken for QD or QID",         "Write 'every other day'"],
        ["Trailing zero (1.0 mg)","Mistaken for 10 mg",            "Write '1 mg'"],
        ["Naked decimal (.5 mg)","Mistaken for 5 mg",              "Write '0.5 mg'"],
        ["MS or MSO4",          "Mistaken for magnesium sulfate",  "Write 'Morphine Sulfate'"],
        ["MgSO4",               "Mistaken for morphine sulfate",   "Write 'Magnesium Sulfate'"],
        ["MTX",                 "Could be confused for other drugs","Write 'Methotrexate'"],
        ["SS (sliding scale)",  "Mistaken for '55'",               "Write 'Sliding Scale'"],
    ],
    col_widths=[1.8, 2.2, 2.0]
)
page_break()

# ═══════════════════════════════════════════════════════════════════════════════
# CHAPTER 9 – EMERGENCY DRUGS
# ═══════════════════════════════════════════════════════════════════════════════
add_h1("CHAPTER 9: EMERGENCY DRUGS")
add_h2("9.1 Cardiopulmonary Resuscitation (CPR) Drugs")
add_table_with_header(
    ["Drug", "Indication", "Adult Dose", "Paediatric Dose", "Route"],
    [
        ["Epinephrine (Adrenaline)", "Cardiac arrest (asystole, PEA, VF/VT)",
         "1 mg every 3-5 min", "0.01 mg/kg (max 1 mg) q3-5 min", "IV/IO"],
        ["Amiodarone", "VF/pulseless VT", "300 mg bolus; then 150 mg",
         "5 mg/kg (max 300 mg)", "IV/IO"],
        ["Lidocaine", "VF/pulseless VT (if amiodarone NA)", "1-1.5 mg/kg",
         "1 mg/kg", "IV/IO"],
        ["Atropine", "Bradycardia, asystole",
         "0.5–1 mg; max 3 mg", "0.02 mg/kg; min 0.1 mg", "IV/IO"],
        ["Sodium Bicarbonate", "Severe metabolic acidosis, hyperkalaemia",
         "1 mEq/kg", "1 mEq/kg", "IV"],
        ["Calcium Gluconate 10%","Hyperkalaemia, Ca-channel blocker OD",
         "10 mL IV over 10 min", "0.3 mL/kg over 10 min", "IV"],
        ["Magnesium Sulfate", "Torsades de pointes, severe asthma",
         "1–2 g IV over 10 min", "25–50 mg/kg over 10-20 min", "IV"],
        ["Adenosine", "SVT (stable)",
         "6 mg rapid IV; then 12 mg", "0.1 mg/kg; max 6 mg", "IV (rapid)"],
        ["Vasopressin", "VF/VT (alternative to epinephrine)",
         "40 units single dose", "Not routinely used in paeds", "IV/IO"],
        ["Dopamine",   "Cardiogenic shock, bradycardia",
         "2–20 mcg/kg/min infusion", "2–20 mcg/kg/min", "IV infusion"],
    ],
    col_widths=[1.5, 1.8, 1.4, 1.4, 0.6]
)

add_h2("9.2 Anaphylaxis Management Drugs")
add_table_with_header(
    ["Drug", "Dose", "Route", "Note"],
    [
        ["Epinephrine (1:1000)", "0.3–0.5 mg IM (thigh)",
         "IM", "First-line; repeat q5-15 min; peds: 0.01 mg/kg"],
        ["Diphenhydramine",      "25–50 mg",
         "IV/IM", "H1 blocker; adjunct only"],
        ["Ranitidine/Famotidine","50 mg / 20 mg",
         "IV", "H2 blocker; adjunct"],
        ["Hydrocortisone",       "200-400 mg (adult)\n4 mg/kg (child)",
         "IV", "Prevents biphasic reaction; not first-line"],
        ["Salbutamol Nebuliser", "2.5–5 mg nebulized",
         "INH", "For bronchospasm component"],
        ["IV Normal Saline",     "1-2 L rapid bolus",
         "IV", "For hypotension/distributive shock"],
    ],
    col_widths=[1.8, 1.8, 0.8, 2.2]
)

add_h2("9.3 Acute Severe Asthma")
add_table_with_header(
    ["Drug",                  "Adult Dose",           "Paediatric Dose"],
    [
        ["Salbutamol Nebuliser",    "5 mg q20 min x3",      "2.5 mg q20 min x3"],
        ["Ipratropium Nebuliser",   "0.5 mg q20 min x3",    "0.25 mg q20 min x3"],
        ["Hydrocortisone IV",       "200 mg stat",          "4 mg/kg stat"],
        ["Prednisolone PO",         "40-50 mg daily x5d",   "1-2 mg/kg daily x3-5d"],
        ["Magnesium Sulfate IV",    "2 g over 20 min",      "40 mg/kg over 20 min"],
        ["IV Salbutamol",           "5 mcg/min infusion",   "1-5 mcg/kg/min infusion"],
    ],
    col_widths=[2.2, 2.2, 2.2]
)
page_break()

# ── Save after Part 1 ──────────────────────────────────────────────────────────
doc.save("/tmp/workspace/hospital-formulary/formulary_draft.docx")
print("Part 1 saved successfully.")
Running Command

cd /tmp/workspace/hospital-formulary && python3 formulary_part1.py

?

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