i want to complete a project work abou rheumatiod arthirtis

Asking for Preferences
Reading File
Reading File
Finding Sources
Searching PubMed

"rheumatoid arthritis"[MeSH Terms] AND management

Searching the Web

rheumatoid arthritis pathophysiology diagnosis treatment 2024 overview

Finding Sources
Finding Sources
Searching PubMed

"rheumatoid arthritis"[MeSH Terms] AND treatment

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /tmp/workspace/rheumatoid-arthritis-project && ls /tmp/workspace/

Writing File

~/rheumatoid-arthritis-project/build_report.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 ──────────────────────────────────────────────────────────────
section = doc.sections[0]
section.top_margin    = Inches(1)
section.bottom_margin = Inches(1)
section.left_margin   = Inches(1.2)
section.right_margin  = Inches(1.2)

# ── Default body style ────────────────────────────────────────────────────────
normal = doc.styles["Normal"]
normal.font.name = "Times New Roman"
normal.font.size = Pt(12)
normal.paragraph_format.space_after = Pt(6)

# ── Helper: set heading colour ────────────────────────────────────────────────
def coloured_heading(doc, text, level, rgb=(0, 51, 102)):
    h = doc.add_heading(text, level=level)
    for run in h.runs:
        run.font.color.rgb = RGBColor(*rgb)
    return h

# ── Helper: add body paragraph ───────────────────────────────────────────────
def add_body(doc, text, bold=False, italic=False, indent=False):
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(6)
    if indent:
        p.paragraph_format.left_indent = Inches(0.3)
    run = p.add_run(text)
    run.bold  = bold
    run.italic = italic
    run.font.name = "Times New Roman"
    run.font.size = Pt(12)
    return p

# ── Helper: add bullet ───────────────────────────────────────────────────────
def add_bullet(doc, text, bold_prefix=None):
    p = doc.add_paragraph(style="List Bullet")
    p.paragraph_format.space_after = Pt(3)
    if bold_prefix:
        r1 = p.add_run(bold_prefix + ": ")
        r1.bold = True
        r1.font.name = "Times New Roman"
        r1.font.size = Pt(12)
    r2 = p.add_run(text)
    r2.font.name = "Times New Roman"
    r2.font.size = Pt(12)

# ── Helper: 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"), "003366")
    pBdr.append(bottom)
    pPr.append(pBdr)

# ══════════════════════════════════════════════════════════════════════════════
# TITLE PAGE
# ══════════════════════════════════════════════════════════════════════════════
for _ in range(4):
    doc.add_paragraph()

title_para = doc.add_paragraph()
title_para.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = title_para.add_run("RHEUMATOID ARTHRITIS")
run.bold = True
run.font.name = "Times New Roman"
run.font.size = Pt(26)
run.font.color.rgb = RGBColor(0, 51, 102)

doc.add_paragraph()

subtitle = doc.add_paragraph()
subtitle.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = subtitle.add_run("A Comprehensive Project Report")
r.font.name = "Times New Roman"
r.font.size = Pt(16)
r.italic = True
r.font.color.rgb = RGBColor(100, 100, 100)

doc.add_paragraph()

for _ in range(3):
    doc.add_paragraph()

info_lines = [
    "Submitted By: [Your Name]",
    "Course: Undergraduate Nursing / Health Sciences",
    "Institution: [Institution Name]",
    f"Date: {datetime.date.today().strftime('%B %d, %Y')}",
]
for line in info_lines:
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    r = p.add_run(line)
    r.font.name = "Times New Roman"
    r.font.size = Pt(13)

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════════════════
# TABLE OF CONTENTS (manual)
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "Table of Contents", level=1)
add_hr(doc)
toc_entries = [
    ("1.", "Definition and Overview", "3"),
    ("2.", "Epidemiology and Risk Factors", "3"),
    ("3.", "Pathophysiology and Immunology", "4"),
    ("4.", "Clinical Features", "5"),
    ("5.", "Diagnosis", "6"),
    ("6.", "Treatment and Management", "8"),
    ("7.", "Complications and Prognosis", "10"),
    ("8.", "Nursing Considerations", "11"),
    ("9.", "Conclusion", "12"),
    ("10.", "References", "12"),
]
for num, title, page in toc_entries:
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(4)
    r1 = p.add_run(f"{num}  {title}")
    r1.font.name = "Times New Roman"
    r1.font.size = Pt(12)
    tab_count = 60 - len(title)
    r2 = p.add_run("." * tab_count + f" {page}")
    r2.font.name = "Times New Roman"
    r2.font.size = Pt(12)
    r2.font.color.rgb = RGBColor(120, 120, 120)

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 – DEFINITION
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "1. Definition and Overview", level=1)
add_hr(doc)
add_body(doc, "Rheumatoid arthritis (RA) is a chronic, systemic, autoimmune inflammatory disease of unknown aetiology. It primarily targets the synovial membrane of diarthrodial joints, leading to persistent synovitis, progressive joint destruction, and significant functional disability. Unlike osteoarthritis, RA is not simply a 'wear-and-tear' condition; it is driven by immune dysregulation that attacks the body's own tissues.")
add_body(doc, "Any joint lined by a synovial membrane may be affected; however, extra-articular involvement of organs such as the skin, heart, lungs, and eyes can also occur. Without treatment, the naturally fluctuating disease course results in progressive joint destruction. The clinical status of RA patients has improved markedly in recent years due to medical advances in diagnosis and treatment that have made it possible to reduce disease activity and prevent systemic complications.")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 – EPIDEMIOLOGY
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "2. Epidemiology and Risk Factors", level=1)
add_hr(doc)

coloured_heading(doc, "2.1 Prevalence and Incidence", level=2, rgb=(0, 80, 130))
add_body(doc, "Rheumatoid arthritis affects approximately 1-2% of adults worldwide, making it one of the more common chronic inflammatory diseases. The prevalence ranges from 0.3% of the population younger than age 35 years to about 10% of those older than age 65 years. The disease has a peak incidence between 20 and 50 years of age and occurs in all age groups.")

coloured_heading(doc, "2.2 Sex Distribution", level=2, rgb=(0, 80, 130))
add_body(doc, "RA affects women approximately 3 times more frequently than men (3:1 ratio), with approximately 70% of patients having an insidious onset. The female predominance is thought to be related to hormonal influences, as disease activity can fluctuate during pregnancy and with oral contraceptive use.")

coloured_heading(doc, "2.3 Risk Factors", level=2, rgb=(0, 80, 130))
add_body(doc, "RA is a multifactorial disease, and several risk factors have been identified:")
factors = [
    ("Genetic factors", "Account for approximately 50% of the risk. Key genetic associations include HLA-DRB1 alleles (especially the 'shared epitope' - QKRAA motif), which are strongly linked to seropositive RA. Monozygotic twins show higher concordance than dizygotic twins."),
    ("Cigarette smoking", "The most well-established environmental trigger; particularly dangerous in individuals with HLA-DRB1 alleles, demonstrating gene-environment interaction. Smoking promotes protein citrullination and ACPA production."),
    ("Sex hormones", "Female sex hormones appear to promote autoimmunity. Postmenopausal women have a higher incidence, and breastfeeding appears slightly protective."),
    ("Infections", "Certain viruses (Epstein-Barr virus, parvovirus B19) and bacteria (Proteus mirabilis) have been implicated as possible triggers in genetically susceptible individuals."),
    ("Microbiome alterations", "Changes in gut and oral microbiome composition (e.g., Porphyromonas gingivalis from periodontal disease) have been associated with RA development."),
    ("Obesity and physical inactivity", "These increase systemic inflammation and are associated with higher RA risk and severity."),
    ("Occupation", "Exposure to silica dust, mineral oil, and heavy physical work has been linked to increased RA risk."),
]
for bold, text in factors:
    add_bullet(doc, text, bold_prefix=bold)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 – PATHOPHYSIOLOGY
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "3. Pathophysiology and Immunology", level=1)
add_hr(doc)
add_body(doc, "The pathogenesis of RA involves a complex interaction between genetic susceptibility, environmental triggers, and dysregulation of both innate and adaptive immune responses. The synovial joint is the primary target, where a cascade of immunological events leads to chronic inflammation and tissue destruction.")

coloured_heading(doc, "3.1 Initiating Events", level=2, rgb=(0, 80, 130))
add_body(doc, "In genetically susceptible individuals, environmental triggers (especially cigarette smoking and infections) promote the citrullination of proteins - a post-translational modification in which arginine is converted to citrulline by the enzyme peptidylarginine deiminase (PAD). These citrullinated proteins are recognised as foreign by the immune system in individuals carrying the HLA-DRB1 shared epitope, triggering the production of anti-citrullinated protein antibodies (ACPAs). This pre-clinical autoimmunity may precede clinical arthritis by years.")

coloured_heading(doc, "3.2 Synovial Inflammation and Pannus Formation", level=2, rgb=(0, 80, 130))
add_body(doc, "Once triggered, the disease process centres on the synovium:")
path_bullets = [
    ("Synovial hyperplasia", "The synovial lining (normally 1-2 cell layers thick) proliferates dramatically, forming a thick, vascular, and invasive tissue called pannus. Synovial lining cells (fibroblast-like synoviocytes and macrophage-like synoviocytes) undergo hyperplasia."),
    ("Immune cell infiltration", "T lymphocytes (predominantly CD4+ helper T cells), B lymphocytes, plasma cells, and macrophages infiltrate the synovium. T cells activate macrophages and B cells, creating a self-sustaining inflammatory loop."),
    ("Cytokine storm", "Activated macrophages and T cells produce pro-inflammatory cytokines including TNF-alpha, IL-1, IL-6, IL-17, and IL-18. These cytokines are the primary drivers of inflammation, systemic symptoms, and joint destruction. TNF-alpha and IL-6 are the most therapeutically relevant targets."),
    ("Rheumatoid factor (RF)", "Plasma cells produce autoantibodies to the Fc fragment of IgG (rheumatoid factor). RF forms immune complexes that activate complement and further amplify inflammation. RF is positive in 70-80% of RA patients."),
    ("ACPA antibodies", "Anti-citrullinated protein antibodies (tested as anti-CCP) are highly specific for RA (>95% specificity). They contribute directly to synovial inflammation and bone erosion by activating osteoclasts."),
]
for bold, text in path_bullets:
    add_bullet(doc, text, bold_prefix=bold)

coloured_heading(doc, "3.3 Joint Destruction", level=2, rgb=(0, 80, 130))
add_body(doc, "The pannus tissue is highly invasive. Activated fibroblast-like synoviocytes and osteoclasts (stimulated by RANKL and TNF-alpha) erode cartilage and subchondral bone at the cartilage-pannus junction. Matrix metalloproteinases (MMPs) secreted by synoviocytes degrade the extracellular matrix of cartilage. Proteases (collagenase, stromelysin) further break down collagen and proteoglycans. The eventual result is cartilage loss, bone erosion, tendon damage, and joint deformity.")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4 – CLINICAL FEATURES
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "4. Clinical Features", level=1)
add_hr(doc)

coloured_heading(doc, "4.1 Articular (Joint) Manifestations", level=2, rgb=(0, 80, 130))
add_body(doc, "The hallmark of RA is symmetric synovitis with morning stiffness lasting more than 1 hour (a key distinguishing feature from osteoarthritis). Joint symptoms typically begin in the small joints of the hands:")
articular = [
    "Proximal interphalangeal (PIP) and metacarpophalangeal (MCP) joints are most commonly involved first",
    "Metatarsophalangeal (MTP) joints of the feet are also frequently affected early",
    "Importantly, RA typically SPARES the distal interphalangeal (DIP) joints (unlike osteoarthritis and psoriatic arthritis)",
    "As disease progresses: wrists, knees, elbows, ankles, hips, and shoulders become involved",
    "Cervical spine involvement, especially the C1-C2 articulation, can occur and may lead to subluxation",
    "The cricoarytenoid joint may cause hoarseness or throat fullness in advanced disease",
]
for a in articular:
    p = doc.add_paragraph(a, style="List Bullet")
    p.paragraph_format.space_after = Pt(3)
    for run in p.runs:
        run.font.name = "Times New Roman"
        run.font.size = Pt(12)

add_body(doc, "Classic deformities seen in advanced RA include:")
deformities = [
    ("Swan-neck deformity", "Hyperextension at PIP joint and flexion at DIP joint"),
    ("Boutonniere deformity", "Flexion at PIP and hyperextension at DIP"),
    ("Ulnar deviation (drift)", "Characteristic lateral deviation of fingers at MCP joints"),
    ("Z-deformity of thumb", "Hyperextension at interphalangeal joint and fixed flexion at MCP"),
]
for bold, text in deformities:
    add_bullet(doc, text, bold_prefix=bold)

coloured_heading(doc, "4.2 Extra-Articular Manifestations", level=2, rgb=(0, 80, 130))
add_body(doc, "RA is a systemic disease. Extra-articular features are more common in patients who are seropositive (RF and/or ACPA positive) and in those with severe or long-standing disease.")

systems = [
    ("Constitutional symptoms", "Fatigue, low-grade fever, weight loss, malaise, anorexia - often the earliest symptoms before joint swelling is apparent"),
    ("Skin - Rheumatoid nodules", "Present in approximately 20% of RF-positive patients. Firm, non-tender subcutaneous nodules on extensor surfaces (especially forearms), over joints, and pressure points. Histologically, they show central fibrinoid necrosis surrounded by palisading macrophages."),
    ("Cardiovascular", "Two-fold increased risk of cardiovascular disease (myocardial infarction, stroke). Pericarditis, pericardial effusion, and myocarditis can occur. Accelerated atherosclerosis due to chronic systemic inflammation."),
    ("Pulmonary", "Pleuritis, pleural effusion, interstitial lung disease (ILD), pulmonary nodules, and rarely Caplan syndrome (RA + pneumoconiosis nodules)."),
    ("Haematological - Anaemia", "Anaemia of chronic disease is very common. Felty syndrome (RA + splenomegaly + neutropenia) occurs in severe seropositive disease."),
    ("Ophthalmologic", "Keratoconjunctivitis sicca (dry eyes), episcleritis, and scleritis (painful red eye). Secondary Sjogren syndrome is common."),
    ("Neurological", "Peripheral nerve entrapment (carpal tunnel syndrome, tarsal tunnel syndrome), mononeuritis multiplex from vasculitis, and cervical cord compression from C1-C2 subluxation."),
    ("Vasculitis", "Rheumatoid vasculitis can manifest as small brown infarcts of the palms and fingers, skin ulcers, and mononeuritis multiplex."),
    ("Osteoporosis", "Increased fracture risk due to chronic inflammation, glucocorticoid use, and reduced physical activity."),
]
for bold, text in systems:
    add_bullet(doc, text, bold_prefix=bold)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5 – DIAGNOSIS
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "5. Diagnosis", level=1)
add_hr(doc)
add_body(doc, "RA has no single pathognomonic (disease-specific) finding. The diagnosis requires integrating clinical history, physical examination findings, laboratory results, and imaging. Early and accurate diagnosis is critical because all current treatment paradigms stress early and aggressive use of disease-modifying antirheumatic drugs (DMARDs) to prevent irreversible joint damage.")

coloured_heading(doc, "5.1 Clinical Assessment", level=2, rgb=(0, 80, 130))
add_body(doc, "The diagnosis of RA requires the presence of inflammation (swelling, warmth, or both) on physical examination and/or imaging. The distribution of involved joints is a critical clue:")
add_bullet(doc, "Symmetric polyarthritis of small joints (MCP, PIP, MTP) suggests RA")
add_bullet(doc, "Morning stiffness lasting >1 hour is characteristic of inflammatory arthritis")
add_bullet(doc, "DIP joint sparing helps differentiate from osteoarthritis and psoriatic arthritis")

coloured_heading(doc, "5.2 ACR/EULAR 2010 Classification Criteria", level=2, rgb=(0, 80, 130))
add_body(doc, "The 2010 ACR/EULAR classification criteria use a scoring system (score ≥6/10 is classified as definite RA). The domains scored are:")
criteria = [
    ("Joint involvement", "1 large joint = 0; 2-10 large joints = 1; 1-3 small joints = 2; 4-10 small joints = 3; >10 joints (at least 1 small) = 5"),
    ("Serology", "Negative RF AND negative ACPA = 0; Low-positive RF OR ACPA = 2; High-positive RF OR ACPA (>3x ULN) = 3"),
    ("Acute-phase reactants", "Normal CRP AND normal ESR = 0; Abnormal CRP OR abnormal ESR = 1"),
    ("Duration of symptoms", "<6 weeks = 0; ≥6 weeks = 1"),
]
for bold, text in criteria:
    add_bullet(doc, text, bold_prefix=bold)

add_body(doc, "The 1987 ACR criteria (7 criteria, requiring 4 of 7 for diagnosis, all present ≥6 weeks) are still widely referenced and include: morning stiffness >1 hour, arthritis of ≥3 joint areas, arthritis of hand joints, symmetric arthritis, rheumatoid nodules, serum RF, and radiologic changes.")

coloured_heading(doc, "5.3 Laboratory Investigations", level=2, rgb=(0, 80, 130))
labs = [
    ("Rheumatoid Factor (RF)", "Positive in ~70-80% of RA patients (seropositive RA). Not specific - also elevated in Sjogren's syndrome, SLE, chronic hepatitis, and even healthy elderly individuals. Finding RF alone is insufficient to diagnose RA."),
    ("Anti-CCP (ACPA)", "Anti-cyclic citrullinated peptide antibodies are highly specific for RA (>95%) and often precede the clinical onset of disease by years. High-titre ACPA suggests more aggressive disease course and greater erosive potential."),
    ("ESR and CRP", "Non-specific markers of inflammation. Useful for monitoring disease activity and response to treatment. Both are elevated in active RA."),
    ("Full Blood Count (FBC)", "Anaemia of chronic disease (normocytic normochromic) is common. Thrombocytosis in active disease. Neutropenia in Felty syndrome."),
    ("Synovial fluid analysis", "Inflammatory synovial fluid: WBC count >2,000/mm3 (often 5,000-50,000), predominantly neutrophils. Glucose is low relative to serum. No crystals (differentiates from gout/pseudogout)."),
    ("Liver function tests and renal function", "Baseline required before initiating DMARDs (especially methotrexate)."),
]
for bold, text in labs:
    add_bullet(doc, text, bold_prefix=bold)

coloured_heading(doc, "5.4 Imaging", level=2, rgb=(0, 80, 130))
imaging = [
    ("Plain X-ray (hands and feet)", "First-line imaging. Early: soft tissue swelling and periarticular osteoporosis. Later: joint space narrowing, bony erosions at cartilage-pannus junction, and deformities. Erosions confirm diagnosis but appear months to 1 year after disease onset."),
    ("Ultrasound", "Detects synovitis, effusion, and erosions before they are visible on X-ray. Useful for early disease confirmation and guided joint injections."),
    ("MRI", "Most sensitive modality for early synovitis, bone oedema (pre-erosive changes), and tendon involvement. Useful when clinical diagnosis is uncertain."),
]
for bold, text in imaging:
    add_bullet(doc, text, bold_prefix=bold)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6 – TREATMENT
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "6. Treatment and Management", level=1)
add_hr(doc)
add_body(doc, "The overarching goal of RA treatment is disease remission (or very low disease activity) as measured by validated indices such as the Disease Activity Score (DAS28). When RA is treated early, remission is achievable in over 50% of patients. All patients with RA should receive disease-modifying antirheumatic drug (DMARD) therapy. Therapy should be escalated rapidly to ensure maximal suppression of disease while minimising toxicity.")

add_body(doc, "Three types of pharmacological therapies are used:", bold=True)

coloured_heading(doc, "6.1 Nonsteroidal Anti-Inflammatory Drugs (NSAIDs)", level=2, rgb=(0, 80, 130))
add_body(doc, "NSAIDs provide symptomatic relief (pain and stiffness) but play only a minor role in altering the underlying disease process. They should rarely be used without concomitant DMARD therapy. Examples: ibuprofen 400 mg QID, naproxen 500 mg BD, celecoxib 200 mg daily. Key concerns include gastrointestinal bleeding, cardiovascular toxicity (especially COX-2 selective NSAIDs), and renal impairment. A proton pump inhibitor should be co-prescribed.")

coloured_heading(doc, "6.2 Glucocorticoids", level=2, rgb=(0, 80, 130))
add_body(doc, "Glucocorticoids provide rapid and dramatic symptomatic improvement and significantly decrease radiographic progression. They are ideally suited as 'bridge therapy' while DMARDs reach their full effect. Prednisone is most commonly used at doses ≤10 mg/day for articular manifestations. Long-term toxicities are significant (osteoporosis, infections - 25% increased risk of serious infection at doses as low as 5 mg/day, diabetes, adrenal suppression, weight gain) so they must be tapered to the lowest effective dose as soon as possible. Higher doses may be needed for extra-articular manifestations such as vasculitis or scleritis.")

coloured_heading(doc, "6.3 Conventional (Synthetic) DMARDs (csDMARDs)", level=2, rgb=(0, 80, 130))
add_body(doc, "These are the backbone of RA therapy. They slow disease progression, reduce erosions, and induce remission. They typically take 4-12 weeks to reach full effect.")
cdmards = [
    ("Methotrexate (MTX)", "7.5-25 mg PO/SC once weekly - The anchor drug of RA therapy. Most commonly used first-line csDMARD. Requires folic acid supplementation to reduce side effects. Monitoring: LFTs, FBC, renal function."),
    ("Hydroxychloroquine", "200-400 mg PO daily (5 mg/kg) - An antimalarial used for mild disease or in combination. Annual ophthalmologic screening required to detect retinal toxicity."),
    ("Sulfasalazine", "2 g/day in divided doses - Often used in combination with MTX. Monitor FBC and LFTs."),
    ("Leflunomide", "10-20 mg PO daily - Alternative to MTX. Long half-life. Hepatotoxic; avoid in liver disease and pregnancy."),
    ("Azathioprine", "1-2.5 mg/kg/day - Used for refractory cases. Monitor FBC for myelosuppression."),
    ("Triple therapy", "Combination of MTX + hydroxychloroquine + sulfasalazine has efficacy comparable to biologic DMARDs in some patients."),
]
for bold, text in cdmards:
    add_bullet(doc, text, bold_prefix=bold)

coloured_heading(doc, "6.4 Biologic DMARDs (bDMARDs)", level=2, rgb=(0, 80, 130))
add_body(doc, "Biologic agents are large-molecule targeted therapies used when conventional DMARDs provide inadequate disease control (typically in combination with methotrexate). They are highly effective but expensive and carry risks of serious infection, reactivation of TB (screen with IGRA/TST before starting TNF inhibitors), and malignancy.")
bdmards = [
    ("TNF-alpha inhibitors", "Etanercept 50 mg SC weekly; Adalimumab 40 mg SC every 2 weeks; Infliximab 3-5 mg/kg IV at 0, 2, 6 weeks then every 4-8 weeks; Certolizumab; Golimumab. Most widely used biologics. Screen for TB and hepatitis B before initiating."),
    ("IL-6 receptor inhibitor", "Tocilizumab 4-8 mg/kg IV every 4 weeks. Effective as monotherapy (unlike TNF inhibitors). Can mask fever and CRP as signs of infection."),
    ("T-cell co-stimulation blocker", "Abatacept 500-1000 mg IV at 0, 2, 4 weeks then monthly. Blocks T cell activation by interrupting CD28-CD80/86 interaction."),
    ("B-cell depleting therapy", "Rituximab 2x1000 mg IV (two infusions 2 weeks apart) every 6 months. Depletes CD20+ B cells. Particularly useful in patients with RF/ACPA-positive disease and in those who have failed TNF inhibitors."),
    ("IL-1 inhibitor", "Anakinra. Less commonly used due to daily injection requirement."),
]
for bold, text in bdmards:
    add_bullet(doc, text, bold_prefix=bold)

coloured_heading(doc, "6.5 Targeted Synthetic DMARDs (tsDMARDs) - JAK Inhibitors", level=2, rgb=(0, 80, 130))
add_body(doc, "JAK inhibitors (Janus kinase inhibitors) are oral small-molecule drugs that block intracellular cytokine signalling pathways. They are as effective as biologic DMARDs and have the advantage of being orally administered.")
jak = [
    ("Tofacitinib", "5 mg PO twice daily - First JAK inhibitor approved for RA. Inhibits JAK1 and JAK3."),
    ("Baricitinib", "2-4 mg PO once daily - JAK1/JAK2 inhibitor. Once-daily dosing."),
    ("Upadacitinib", "15 mg PO once daily - JAK1-selective inhibitor with high efficacy."),
]
for bold, text in jak:
    add_bullet(doc, text, bold_prefix=bold)
add_body(doc, "Note: JAK inhibitors carry a class warning for increased risk of serious cardiovascular events, malignancy, and thromboembolism (especially at higher doses), based on post-marketing surveillance data.")

coloured_heading(doc, "6.6 Non-Pharmacological Management", level=2, rgb=(0, 80, 130))
non_pharm = [
    ("Patient education", "Understanding the disease, medication adherence, self-management strategies"),
    ("Physical therapy", "Range-of-motion exercises, strengthening, aerobic exercise to maintain joint function and muscle strength"),
    ("Occupational therapy", "Joint protection techniques, adaptive devices, splinting of inflamed wrists/hands"),
    ("Dietary modifications", "Mediterranean-style diet with omega-3 fatty acids (fish oil) has anti-inflammatory effects; weight management"),
    ("Psychological support", "Depression and anxiety are common in RA patients; psychological support and social services"),
    ("Orthopaedic surgery", "Synovectomy, joint replacement (arthroplasty), and reconstructive surgery for advanced joint damage not controlled by medications"),
]
for bold, text in non_pharm:
    add_bullet(doc, text, bold_prefix=bold)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 7 – COMPLICATIONS
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "7. Complications and Prognosis", level=1)
add_hr(doc)

coloured_heading(doc, "7.1 Disease-Related Complications", level=2, rgb=(0, 80, 130))
complications = [
    ("Joint destruction and disability", "Progressive loss of joint architecture leads to permanent deformities and functional disability. 70% of seropositive RA patients develop joint erosions within 2 years without treatment."),
    ("Cardiovascular disease", "The most important extra-articular cause of premature death in RA. Two-fold increased risk of MI and stroke compared to the general population, driven by accelerated atherosclerosis from chronic inflammation and traditional CV risk factors."),
    ("Felty syndrome", "Triad of RA + splenomegaly + neutropenia. Predisposes to recurrent bacterial infections. Now rare with better RA control."),
    ("Atlantoaxial subluxation", "C1-C2 instability from erosion and ligament laxity. Can cause cervical cord compression, myelopathy, and potentially death. Must be detected before anaesthesia."),
    ("Amyloidosis (AA type)", "Secondary amyloidosis from chronic inflammation. Deposits in kidneys, liver, and spleen, leading to renal failure in severe long-standing disease."),
    ("Pulmonary fibrosis", "Interstitial lung disease (ILD) is a significant cause of morbidity and mortality in RA, especially in males and smokers."),
    ("Septic arthritis", "Inflamed joints are vulnerable to haematogenous bacterial seeding. RA patients on immunosuppressive therapy are at high risk."),
    ("Drug-related complications", "Methotrexate - hepatotoxicity, myelosuppression, pneumonitis. NSAIDs - GI bleeding, renal impairment. Glucocorticoids - osteoporosis, infections, diabetes. Biologics - serious infections, TB reactivation."),
]
for bold, text in complications:
    add_bullet(doc, text, bold_prefix=bold)

coloured_heading(doc, "7.2 Prognosis", level=2, rgb=(0, 80, 130))
add_body(doc, "The prognosis of RA has improved dramatically in the era of early aggressive DMARD therapy and biologic agents. Poor prognostic indicators include:")
prognosis = [
    "High-titre RF and/or ACPA positivity at presentation",
    "High swollen joint count at baseline",
    "Presence of erosions on early imaging",
    "Elevated inflammatory markers (CRP, ESR)",
    "Radiographic progression at 1 year",
    "Extra-articular manifestations",
    "Failure of early DMARD therapy",
    "Low socioeconomic status and delayed access to specialist care",
]
for p_item in prognosis:
    pb = doc.add_paragraph(p_item, style="List Bullet")
    pb.paragraph_format.space_after = Pt(3)
    for run in pb.runs:
        run.font.name = "Times New Roman"
        run.font.size = Pt(12)

add_body(doc, "When treated early with remission-targeted strategies (treat-to-target approach), over 50% of patients achieve remission and at least another 35% achieve low disease activity. Patients with RA have a life expectancy approximately 5-10 years shorter than the general population, primarily due to cardiovascular disease, infections, and malignancy.")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 8 – NURSING CONSIDERATIONS
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "8. Nursing Considerations", level=1)
add_hr(doc)
add_body(doc, "Nurses play a central role in the multidisciplinary management of RA patients. Key nursing considerations include:")

nursing = [
    ("Pain and symptom assessment", "Use standardised pain scales (NRS/VAS). Assess joint swelling, warmth, and range of motion. Monitor morning stiffness duration as an indicator of disease activity."),
    ("Medication management and monitoring", "Educate patients on DMARD schedules, importance of adherence, and the risk of stopping medication suddenly. Monitor for drug toxicities (LFTs for MTX, eye checks for hydroxychloroquine, BP for NSAIDs, blood glucose for steroids)."),
    ("Infection surveillance", "Patients on immunosuppressants have increased infection risk. Educate to report fever, cough, or unusual symptoms promptly. Ensure vaccinations are up to date (flu, pneumococcal, COVID-19) - live vaccines contraindicated while on biologics."),
    ("Fall prevention and mobility", "Assess for joint instability, weakness, and balance problems. Arrange physiotherapy and appropriate assistive devices. Monitor cervical spine stability, especially before procedures."),
    ("Psychological and psychosocial support", "Screen for depression and anxiety (PHQ-9, GAD-7). Refer to support groups and occupational therapy for adaptation strategies. Acknowledge the impact on quality of life, relationships, and employment."),
    ("Patient education", "Educate on disease process, treatment goals, medication compliance, joint protection, energy conservation, and importance of follow-up. Teach patients to self-monitor for flares."),
    ("Nutritional assessment", "Address anaemia of chronic disease. Encourage omega-3 rich diet. Monitor weight (important for dosing and cardiovascular risk)."),
    ("Pre-operative nursing care", "For surgical patients, confirm DMARDs (especially biologics) are withheld perioperatively as per protocol. Assess for cervical instability before anaesthesia induction."),
]
for bold, text in nursing:
    add_bullet(doc, text, bold_prefix=bold)

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 9 – CONCLUSION
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "9. Conclusion", level=1)
add_hr(doc)
add_body(doc, "Rheumatoid arthritis is a complex, chronic autoimmune disease that poses significant challenges for patients and healthcare providers alike. Its pathogenesis involves a sophisticated interplay of genetic susceptibility, environmental triggers, and immune dysregulation that ultimately leads to synovial inflammation, joint destruction, and systemic complications.")
add_body(doc, "The diagnosis relies on the integration of clinical findings, serological tests (RF and anti-CCP), inflammatory markers, and imaging modalities. Early diagnosis and the prompt initiation of DMARD therapy - with a treat-to-target strategy aiming for remission - have transformed the outcomes for RA patients. The therapeutic landscape has expanded dramatically with the introduction of biologic agents (TNF inhibitors, IL-6 blockers, B-cell depletion therapy) and oral JAK inhibitors.")
add_body(doc, "Healthcare professionals, particularly nurses, have an essential role in patient education, medication monitoring, infection surveillance, psychological support, and coordinating multidisciplinary care. With early diagnosis, optimal pharmacotherapy, and holistic nursing care, the majority of RA patients can achieve good disease control and maintain a meaningful quality of life.")

doc.add_paragraph()

# ══════════════════════════════════════════════════════════════════════════════
# SECTION 10 – REFERENCES
# ══════════════════════════════════════════════════════════════════════════════
coloured_heading(doc, "10. References", level=1)
add_hr(doc)
references = [
    "Goldman, L. & Schafer, A.I. (2022). Goldman-Cecil Medicine International Edition (26th ed.). Elsevier. Chapter 243: Rheumatoid Arthritis.",
    "Rakel, R.E. & Rakel, D.P. (2016). Textbook of Family Medicine (9th ed.). Elsevier. Chapter 32: Rheumatology.",
    "Firestein, G.S., Budd, R.C., Gabriel, S.E., McInnes, I.B., O'Dell, J.R. & Koretzky, G.A. (2021). Firestein & Kelley's Textbook of Rheumatology (11th ed.). Elsevier.",
    "Smolen, J.S., Landewe, R.B.M., Bijlsma, J.W.J. et al. (2023). EULAR recommendations for the management of rheumatoid arthritis with synthetic and biological disease-modifying antirheumatic drugs: 2022 update. Annals of the Rheumatic Diseases, 82(1), 3-18.",
    "Aletaha, D., Neogi, T., Silman, A.J. et al. (2010). 2010 Rheumatoid arthritis classification criteria: An ACR/EULAR collaborative initiative. Arthritis & Rheumatism, 62(9), 2569-2581.",
    "Sparks, J.A. (2019). Rheumatoid Arthritis. Annals of Internal Medicine, 170(1), ITC1-ITC16. doi:10.7326/AITC201901010",
    "Gibofsky, A. (2014). Epidemiology, pathophysiology, and diagnosis of rheumatoid arthritis: A synopsis. American Journal of Managed Care, 20(7 Suppl), S128-135.",
    "Radu, A.F. & Bungau, S.G. (2021). Management of rheumatoid arthritis: An overview. Cells, 10(11), 2857. doi:10.3390/cells10112857",
    "Deane, K.D. & Demoruelle, M.K. (2021). The ABC of rheumatoid arthritis pathophysiology. Immunological Reviews, 294, 148-163.",
    "Schett, G. & Firestein, G.S. (2020). Mr Outside and Mr Inside: classic and alternative views on the pathogenesis of rheumatoid arthritis. Annals of the Rheumatic Diseases, 79, 580-586.",
]
for i, ref in enumerate(references, 1):
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(4)
    p.paragraph_format.left_indent = Inches(0.4)
    p.paragraph_format.first_line_indent = Inches(-0.4)
    run = p.add_run(f"{i}. {ref}")
    run.font.name = "Times New Roman"
    run.font.size = Pt(11)

# ── Save ─────────────────────────────────────────────────────────────────────
output_path = "/tmp/workspace/rheumatoid-arthritis-project/Rheumatoid_Arthritis_Project.docx"
doc.save(output_path)
print(f"Document saved to: {output_path}")
Running Command

cd /tmp/workspace/rheumatoid-arthritis-project && python3 build_report.py

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/rheumatoid-arthritis-project/Rheumatoid_Arthritis_Project.docx') headings = [p.text for p in doc.paragraphs if p.style.name.startswith('Heading')] print('HEADINGS:') for h in headings: print(' -', h) print() total_paras = len([p for p in doc.paragraphs if p.text.strip()]) print(f'Total non-empty paragraphs: {total_paras}') import os size = os.path.getsize('/tmp/workspace/rheumatoid-arthritis-project/Rheumatoid_Arthritis_Project.docx') print(f'File size: {size/1024:.1f} KB') "

Your project report is ready for download:

Rheumatoid Arthritis Project

Word Document · DOCX


Here's a summary of what the document contains (178 paragraphs, 47 KB, professionally formatted):
Document Structure:
SectionContent
Title PageReady for your name and institution
Table of ContentsAll 10 sections listed
1. DefinitionWhat RA is, systemic vs OA difference
2. Epidemiology & Risk Factors1-2% prevalence, 3:1 F:M ratio, peak 20-50 yrs; genetic (HLA-DRB1), smoking, hormones, microbiome
3. PathophysiologyCitrullination, ACPA/RF production, synovial hyperplasia, pannus formation, cytokine cascade (TNF-a, IL-1, IL-6), osteoclast-mediated bone erosion
4. Clinical FeaturesJoint features (MCP/PIP/MTP symmetric synovitis, morning stiffness >1hr, DIP sparing, deformities) + 9 extra-articular systems
5. Diagnosis2010 ACR/EULAR criteria (scored), 1987 criteria, all lab tests (RF, anti-CCP, ESR/CRP, synovial fluid), imaging (X-ray, USS, MRI)
6. TreatmentNSAIDs, glucocorticoids, csDMARDs (MTX, HCQ, SSZ, leflunomide), bDMARDs (TNF inhibitors, tocilizumab, rituximab, abatacept), JAK inhibitors (tofacitinib, baricitinib, upadacitinib), non-pharmacological
7. Complications & PrognosisCV disease, Felty syndrome, amyloidosis, ILD, subluxation, drug toxicities; poor prognostic markers
8. Nursing ConsiderationsPain assessment, drug monitoring, infection surveillance, fall prevention, patient education
9. ConclusionSummary paragraph
10. References10 peer-reviewed textbook and journal citations (Goldman-Cecil, Firestein & Kelley, ACR/EULAR guidelines, etc.)
Sources used: Goldman-Cecil Medicine, Textbook of Family Medicine, Firestein & Kelley's Textbook of Rheumatology, and recent peer-reviewed literature. Just fill in your name and institution on the title page.

Create a PowerPoint presentation summarizing the RA project for class00 pages

Reading File
Reading File
Writing File

~/rheumatoid-arthritis-project/build_pptx.py

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.oxml.ns import qn
from pptx.oxml import OxmlElement
from io import BytesIO

# ── Colour palette ────────────────────────────────────────────────────────────
NAVY      = RGBColor(0x00, 0x2B, 0x5C)   # dark navy heading
BLUE      = RGBColor(0x00, 0x5B, 0x99)   # medium blue accents
TEAL      = RGBColor(0x00, 0x8B, 0x8B)   # bullet icons / sub-headings
WHITE     = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT_BG  = RGBColor(0xEA, 0xF2, 0xFB)   # soft blue background
DARK_TEXT = RGBColor(0x1A, 0x1A, 0x2E)
GRAY_LINE = RGBColor(0xCC, 0xCC, 0xCC)
AMBER     = RGBColor(0xE8, 0x8A, 0x00)   # highlight colour
GREEN     = RGBColor(0x1A, 0x7A, 0x3C)

prs = Presentation()
prs.slide_width  = Inches(13.333)
prs.slide_height = Inches(7.5)
BLANK = prs.slide_layouts[6]

# ── Low-level helpers ─────────────────────────────────────────────────────────
def add_rect(slide, x, y, w, h, fill_rgb=None, line_rgb=None, line_width_pt=0):
    shape = slide.shapes.add_shape(
        1,  # MSO_SHAPE_TYPE.RECTANGLE
        Inches(x), Inches(y), Inches(w), Inches(h)
    )
    fill = shape.fill
    if fill_rgb:
        fill.solid()
        fill.fore_color.rgb = fill_rgb
    else:
        fill.background()
    line = shape.line
    if line_rgb:
        line.color.rgb = line_rgb
        line.width = Pt(line_width_pt)
    else:
        line.fill.background()
    return shape

def add_tb(slide, x, y, w, h, text, size, bold=False, italic=False,
           color=DARK_TEXT, align=PP_ALIGN.LEFT, wrap=True,
           v_anchor=MSO_ANCHOR.TOP, margin=True):
    tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.vertical_anchor = v_anchor
    if not margin:
        tf.margin_left = tf.margin_right = tf.margin_top = tf.margin_bottom = 0
    p = tf.paragraphs[0]
    p.alignment = align
    run = p.add_run()
    run.text = text
    run.font.name = "Calibri"
    run.font.size = Pt(size)
    run.font.bold = bold
    run.font.italic = italic
    run.font.color.rgb = color
    return tf

def add_para(tf, text, size, bold=False, italic=False,
             color=DARK_TEXT, align=PP_ALIGN.LEFT, space_before=0):
    p = tf.add_paragraph()
    p.alignment = align
    p.space_before = Pt(space_before)
    run = p.add_run()
    run.text = text
    run.font.name = "Calibri"
    run.font.size = Pt(size)
    run.font.bold = bold
    run.font.italic = italic
    run.font.color.rgb = color
    return p

def slide_bg(slide, color=LIGHT_BG):
    """Fill slide background with a solid colour."""
    bg = slide.background
    fill = bg.fill
    fill.solid()
    fill.fore_color.rgb = color

def header_bar(slide, title, subtitle=None):
    """Dark navy top bar with title."""
    add_rect(slide, 0, 0, 13.333, 1.35, fill_rgb=NAVY)
    # accent line
    add_rect(slide, 0, 1.35, 13.333, 0.07, fill_rgb=TEAL)
    tb = slide.shapes.add_textbox(Inches(0.45), Inches(0.12), Inches(12.4), Inches(0.85))
    tf = tb.text_frame
    tf.word_wrap = True
    tf.margin_left = 0; tf.margin_right = 0; tf.margin_top = 0; tf.margin_bottom = 0
    p = tf.paragraphs[0]
    p.alignment = PP_ALIGN.LEFT
    run = p.add_run()
    run.text = title
    run.font.name = "Calibri"
    run.font.size = Pt(28)
    run.font.bold = True
    run.font.color.rgb = WHITE
    if subtitle:
        p2 = tf.add_paragraph()
        p2.alignment = PP_ALIGN.LEFT
        r2 = p2.add_run()
        r2.text = subtitle
        r2.font.name = "Calibri"
        r2.font.size = Pt(14)
        r2.font.italic = True
        r2.font.color.rgb = RGBColor(0xAA, 0xD4, 0xF5)

def bullet_block(slide, x, y, w, h, items, size=15, bullet="●", bcolor=TEAL):
    """Add a block of bulleted text items."""
    tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
    tf = tb.text_frame
    tf.word_wrap = True
    tf.margin_left = Pt(4); tf.margin_top = Pt(2)
    first = True
    for item in items:
        if first:
            p = tf.paragraphs[0]
            first = False
        else:
            p = tf.add_paragraph()
        p.space_before = Pt(4)
        # bullet symbol
        rb = p.add_run()
        rb.text = bullet + "  "
        rb.font.name = "Calibri"
        rb.font.size = Pt(size)
        rb.font.color.rgb = bcolor
        rb.font.bold = True
        # text
        rt = p.add_run()
        if isinstance(item, tuple):
            rt.text = item[0]
            rt.font.bold = True
            rt.font.name = "Calibri"
            rt.font.size = Pt(size)
            rt.font.color.rgb = NAVY
            if len(item) > 1:
                rt2 = p.add_run()
                rt2.text = ": " + item[1]
                rt2.font.name = "Calibri"
                rt2.font.size = Pt(size)
                rt2.font.color.rgb = DARK_TEXT
        else:
            rt.text = str(item)
            rt.font.name = "Calibri"
            rt.font.size = Pt(size)
            rt.font.color.rgb = DARK_TEXT
    return tf

def two_col(slide, left_items, right_items, y=1.55, h=5.6, size=14):
    bullet_block(slide, 0.4, y, 6.2, h, left_items, size=size)
    bullet_block(slide, 6.8, y, 6.2, h, right_items, size=size)

def divider(slide, y=1.5):
    add_rect(slide, 0.4, y, 12.5, 0.04, fill_rgb=GRAY_LINE)

def slide_number(slide, n, total=20):
    add_tb(slide, 12.3, 7.15, 0.9, 0.3, f"{n} / {total}",
           size=10, color=RGBColor(0x88,0x88,0x88), align=PP_ALIGN.RIGHT)

def footer(slide, text="Rheumatoid Arthritis | Undergraduate Nursing Project"):
    add_rect(slide, 0, 7.2, 13.333, 0.3, fill_rgb=NAVY)
    add_tb(slide, 0.3, 7.22, 12.8, 0.25, text,
           size=10, color=WHITE, align=PP_ALIGN.CENTER, margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 1 – TITLE
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, NAVY)
# Large gradient-style accent rectangle
add_rect(s, 0, 0, 13.333, 7.5, fill_rgb=NAVY)
add_rect(s, 0, 5.5, 13.333, 2.0, fill_rgb=RGBColor(0x00, 0x3D, 0x7A))
add_rect(s, 0, 5.5, 0.25, 2.0, fill_rgb=TEAL)  # left accent bar

# Decorative circles
for cx, cy, sz, col in [(11.5,1.0,2.2,RGBColor(0x00,0x45,0x80)),
                         (12.5,2.5,1.6,RGBColor(0x00,0x35,0x60)),
                         (1.0, 6.5,0.8,RGBColor(0x00,0x8B,0x8B))]:
    circ = s.shapes.add_shape(9, Inches(cx), Inches(cy), Inches(sz), Inches(sz))
    circ.fill.solid(); circ.fill.fore_color.rgb = col
    circ.line.fill.background()

add_tb(s, 1.0, 1.6, 10.5, 0.6, "UNDERGRADUATE NURSING PROJECT",
       size=16, color=TEAL, bold=True, align=PP_ALIGN.LEFT)
add_tb(s, 1.0, 2.15, 10.5, 1.8,
       "RHEUMATOID ARTHRITIS",
       size=52, bold=True, color=WHITE, align=PP_ALIGN.LEFT, wrap=True)
add_tb(s, 1.0, 3.85, 10.5, 0.55,
       "Pathophysiology • Diagnosis • Treatment • Nursing Care",
       size=17, italic=True, color=RGBColor(0xAA,0xD4,0xF5), align=PP_ALIGN.LEFT)

add_tb(s, 1.0, 5.6, 5.0, 0.35, "Presented by: [Your Name]",
       size=13, color=WHITE, align=PP_ALIGN.LEFT)
add_tb(s, 1.0, 5.95, 5.0, 0.35, "Course: Undergraduate Nursing / Health Sciences",
       size=13, color=RGBColor(0xAA,0xD4,0xF5), align=PP_ALIGN.LEFT)
add_tb(s, 1.0, 6.30, 5.0, 0.35, "Date: July 2026",
       size=13, color=RGBColor(0xAA,0xD4,0xF5), align=PP_ALIGN.LEFT)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 2 – OVERVIEW / AGENDA
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Presentation Overview")
footer(s); slide_number(s, 2)

topics = [
    ("1", "Definition & Overview"),
    ("2", "Epidemiology & Risk Factors"),
    ("3", "Pathophysiology & Immunology"),
    ("4", "Clinical Features"),
    ("5", "Diagnosis & Classification"),
    ("6", "Treatment & Management"),
    ("7", "Complications & Prognosis"),
    ("8", "Nursing Considerations"),
    ("9", "Conclusion & Key Takeaways"),
]
for i, (num, topic) in enumerate(topics):
    col = 0 if i < 5 else 1
    row = i if i < 5 else i - 5
    x = 0.5 + col * 6.5
    y = 1.6 + row * 0.9
    add_rect(s, x, y, 6.0, 0.75, fill_rgb=WHITE,
             line_rgb=RGBColor(0xCC,0xCC,0xCC), line_width_pt=0.5)
    add_rect(s, x, y, 0.5, 0.75, fill_rgb=BLUE)
    add_tb(s, x+0.05, y+0.1, 0.4, 0.55, num, size=16, bold=True,
           color=WHITE, align=PP_ALIGN.CENTER, margin=False)
    add_tb(s, x+0.6, y+0.15, 5.3, 0.5, topic, size=15,
           color=NAVY, bold=False, margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 3 – DEFINITION
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Definition & Overview", "What is Rheumatoid Arthritis?")
footer(s); slide_number(s, 3)

# Key definition box
add_rect(s, 0.4, 1.55, 12.5, 1.55, fill_rgb=NAVY,
         line_rgb=TEAL, line_width_pt=1.5)
tb = s.shapes.add_textbox(Inches(0.6), Inches(1.62), Inches(12.1), Inches(1.4))
tf = tb.text_frame; tf.word_wrap = True
p = tf.paragraphs[0]
r = p.add_run()
r.text = ("Rheumatoid arthritis (RA) is a chronic, systemic, autoimmune inflammatory disease "
          "that primarily targets the synovial membrane of diarthrodial joints, causing "
          "persistent synovitis, progressive joint destruction, and significant functional disability.")
r.font.name = "Calibri"; r.font.size = Pt(15.5); r.font.italic = True
r.font.color.rgb = WHITE

bullet_block(s, 0.4, 3.25, 12.4, 4.0, [
    ("Autoimmune origin", "immune system attacks the body's own synovial tissue"),
    ("Systemic disease", "affects not just joints but also skin, heart, lungs, eyes, and vessels"),
    ("Chronic and fluctuating", "periods of flare and remission throughout a patient's lifetime"),
    ("Distinct from osteoarthritis", "RA is driven by immune dysregulation, NOT simple 'wear and tear'"),
    ("Highly treatable", "early DMARD therapy can achieve remission in >50% of patients"),
], size=15)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 4 – EPIDEMIOLOGY
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Epidemiology & Risk Factors")
footer(s); slide_number(s, 4)

# Stats boxes
stats = [
    ("1–2%", "Global adult\nprevalence"),
    ("3 : 1", "Female to\nmale ratio"),
    ("20–50", "Peak onset\n(years)"),
    ("70%", "Insidious\nonset"),
]
for i, (val, label) in enumerate(stats):
    x = 0.4 + i * 3.1
    add_rect(s, x, 1.55, 2.85, 1.55, fill_rgb=BLUE,
             line_rgb=NAVY, line_width_pt=1)
    add_tb(s, x+0.1, 1.6, 2.65, 0.9, val, size=30, bold=True,
           color=WHITE, align=PP_ALIGN.CENTER, margin=False)
    add_tb(s, x+0.1, 2.45, 2.65, 0.6, label, size=12, italic=True,
           color=RGBColor(0xAA,0xD4,0xF5), align=PP_ALIGN.CENTER, margin=False)

add_tb(s, 0.4, 3.22, 4.5, 0.35, "KEY RISK FACTORS", size=13,
       bold=True, color=TEAL, margin=False)
add_tb(s, 7.0, 3.22, 4.5, 0.35, "PROTECTIVE / MODIFIABLE", size=13,
       bold=True, color=GREEN, margin=False)

bullet_block(s, 0.4, 3.55, 6.1, 3.5, [
    ("Genetic (HLA-DRB1)", "shared epitope accounts for ~50% risk"),
    ("Cigarette smoking", "strongest modifiable trigger; synergises with HLA-DRB1"),
    ("Female sex", "oestrogen promotes autoimmunity"),
    ("Infections", "EBV, parvovirus B19, P. gingivalis"),
    ("Gut/oral microbiome alterations", "dysbiosis promotes ACPA production"),
    ("Obesity & inactivity", "amplify systemic inflammation"),
], size=13)

bullet_block(s, 6.8, 3.55, 6.1, 3.5, [
    ("Smoking cessation", "most impactful lifestyle change"),
    ("Healthy weight", "reduces inflammatory burden"),
    ("Breastfeeding", "slight protective effect in women"),
    ("Oral hygiene", "treating periodontitis reduces P. gingivalis exposure"),
    ("Omega-3 diet", "anti-inflammatory dietary pattern"),
], size=13, bullet="▶", bcolor=GREEN)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 5 – PATHOPHYSIOLOGY OVERVIEW
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Pathophysiology & Immunology", "The Cascade of Joint Destruction")
footer(s); slide_number(s, 5)

# Flow diagram (boxes + arrows)
steps = [
    ("GENETIC\nSUSCEPTIBILITY\n(HLA-DRB1)", 0.4),
    ("ENVIRONMENTAL\nTRIGGERS\n(smoking, infection)", 2.85),
    ("PROTEIN\nCITRULLINATION\n(PAD enzymes)", 5.30),
    ("ACPA & RF\nPRODUCTION\n(B-cell activation)", 7.75),
    ("SYNOVIAL\nINFLAMMATION\n(pannus formation)", 10.2),
]
for label, x in steps:
    add_rect(s, x, 1.6, 2.25, 1.6, fill_rgb=NAVY,
             line_rgb=TEAL, line_width_pt=1.2)
    add_tb(s, x+0.1, 1.65, 2.05, 1.5, label, size=12, bold=True,
           color=WHITE, align=PP_ALIGN.CENTER, v_anchor=MSO_ANCHOR.MIDDLE, margin=False)
    if x < 10.2:
        add_tb(s, x+2.25, 2.1, 0.6, 0.7, "→", size=28, bold=True,
               color=AMBER, align=PP_ALIGN.CENTER, margin=False)

# Cytokines highlight
add_rect(s, 0.4, 3.45, 12.5, 0.9, fill_rgb=RGBColor(0xFF,0xF3,0xCD),
         line_rgb=AMBER, line_width_pt=1)
add_tb(s, 0.55, 3.52, 12.1, 0.76,
       "⚡  KEY CYTOKINES DRIVING INFLAMMATION:  TNF-α  •  IL-1  •  IL-6  •  IL-17  "
       "(targets for biologic therapy)",
       size=14, bold=True, color=RGBColor(0x6B,0x3A,0x00),
       align=PP_ALIGN.CENTER, margin=False)

bullet_block(s, 0.4, 4.45, 6.0, 2.8, [
    ("Pannus tissue", "invasive synovial tissue erodes cartilage & bone"),
    ("Osteoclast activation", "RANKL + TNF-α drive bone erosion"),
    ("MMP secretion", "matrix metalloproteinases destroy cartilage collagen"),
], size=14)

bullet_block(s, 6.8, 4.45, 6.0, 2.8, [
    ("T-cell infiltration", "CD4+ T-helper cells sustain inflammation"),
    ("B-cell role", "plasma cells produce RF and ACPA autoantibodies"),
    ("Pre-clinical phase", "ACPA can precede symptoms by years"),
], size=14)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 6 – CLINICAL FEATURES (ARTICULAR)
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Clinical Features", "Articular (Joint) Manifestations")
footer(s); slide_number(s, 6)

# Hallmark box
add_rect(s, 0.4, 1.55, 12.5, 0.9, fill_rgb=TEAL)
add_tb(s, 0.6, 1.6, 12.1, 0.8,
       "HALLMARK:  Symmetric synovitis with morning stiffness > 1 hour",
       size=18, bold=True, color=WHITE, align=PP_ALIGN.CENTER, margin=False)

add_tb(s, 0.4, 2.6, 6.0, 0.3, "JOINTS TYPICALLY AFFECTED", size=13,
       bold=True, color=NAVY, margin=False)
add_tb(s, 7.0, 2.6, 6.0, 0.3, "CLASSIC DEFORMITIES", size=13,
       bold=True, color=NAVY, margin=False)

bullet_block(s, 0.4, 2.92, 6.0, 2.5, [
    ("PIP & MCP joints", "most common first site (small joints of hands)"),
    ("MTP joints", "feet affected early — tender on squeezing"),
    ("DIP joints SPARED", "key differentiator from OA and psoriatic arthritis"),
    ("Wrists, knees, elbows, ankles, hips, shoulders", "involved as disease progresses"),
    ("Cervical spine C1-C2", "erosion can cause dangerous subluxation"),
], size=14)

bullet_block(s, 6.8, 2.92, 6.0, 2.5, [
    ("Swan-neck deformity", "PIP hyperextension + DIP flexion"),
    ("Boutonniere deformity", "PIP flexion + DIP hyperextension"),
    ("Ulnar deviation", "lateral drift of fingers at MCP joints"),
    ("Z-deformity of thumb", "characteristic thumb deformity"),
    ("Wrist subluxation", "dorsal tendon swelling and carpal collapse"),
], size=14)

add_rect(s, 0.4, 5.62, 12.5, 0.04, fill_rgb=GRAY_LINE)
add_tb(s, 0.4, 5.7, 12.5, 0.3,
       "Constitutional symptoms often PRECEDE joint symptoms:  fatigue  •  low-grade fever  •  weight loss  •  malaise",
       size=13, italic=True, color=RGBColor(0x44,0x44,0x44), align=PP_ALIGN.CENTER)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 7 – EXTRA-ARTICULAR FEATURES
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Clinical Features", "Extra-Articular (Systemic) Manifestations")
footer(s); slide_number(s, 7)

systems = [
    ("Skin", "Rheumatoid nodules (20% of RF+ patients) — firm, non-tender, on extensor surfaces"),
    ("Cardiovascular", "2× increased MI & stroke risk; pericarditis; accelerated atherosclerosis"),
    ("Pulmonary", "Pleuritis, interstitial lung disease (ILD), pulmonary nodules"),
    ("Haematological", "Anaemia of chronic disease; Felty syndrome (RA + splenomegaly + neutropenia)"),
    ("Ophthalmological", "Dry eyes (sicca), episcleritis, scleritis"),
    ("Neurological", "Carpal tunnel syndrome; C1-C2 myelopathy; mononeuritis multiplex"),
    ("Renal/Metabolic", "Secondary amyloidosis (AA type); drug-related nephrotoxicity"),
    ("Musculoskeletal", "Osteoporosis — from chronic inflammation + glucocorticoid use"),
]

for i, (sys, text) in enumerate(systems):
    col = i % 2
    row = i // 2
    x = 0.4 + col * 6.5
    y = 1.6 + row * 1.3
    add_rect(s, x, y, 6.1, 1.2, fill_rgb=WHITE,
             line_rgb=RGBColor(0xBB,0xCC,0xDD), line_width_pt=0.8)
    add_rect(s, x, y, 1.5, 1.2, fill_rgb=BLUE)
    add_tb(s, x+0.05, y+0.25, 1.4, 0.7, sys, size=13, bold=True,
           color=WHITE, align=PP_ALIGN.CENTER, margin=False)
    add_tb(s, x+1.65, y+0.15, 4.35, 0.9, text, size=13,
           color=DARK_TEXT, wrap=True, margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 8 – DIAGNOSIS OVERVIEW
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Diagnosis", "No single pathognomonic test — integrated approach required")
footer(s); slide_number(s, 8)

add_tb(s, 0.4, 1.62, 12.5, 0.35,
       "2010 ACR/EULAR Classification Criteria  —  Score ≥ 6 / 10 = Definite RA",
       size=15, bold=True, color=NAVY, align=PP_ALIGN.CENTER, margin=False)

# Criteria table
rows_data = [
    ("DOMAIN", "SCORE", True),
    ("Joint involvement: 1 large joint", "0", False),
    ("2–10 large joints", "1", False),
    ("1–3 small joints (MCP, PIP, MTP)", "2", False),
    ("4–10 small joints", "3", False),
    (">10 joints (at least 1 small)", "5", False),
    ("Serology: Negative RF AND ACPA", "0", False),
    ("Low-positive RF OR ACPA", "2", False),
    ("High-positive RF OR ACPA (>3× ULN)", "3", False),
    ("Acute-phase reactants: Normal CRP + ESR", "0", False),
    ("Abnormal CRP OR ESR", "1", False),
    ("Duration of symptoms ≥ 6 weeks", "1", False),
]
col_w = [9.5, 1.5]
col_x = [0.4, 10.1]
y = 2.05
for text, score, is_header in rows_data:
    bg = NAVY if is_header else (WHITE if rows_data.index((text, score, is_header)) % 2 == 0
                                  else RGBColor(0xF0,0xF5,0xFF))
    tc = WHITE if is_header else DARK_TEXT
    add_rect(s, col_x[0], y, col_w[0], 0.36, fill_rgb=bg,
             line_rgb=GRAY_LINE, line_width_pt=0.4)
    add_rect(s, col_x[1], y, col_w[1], 0.36, fill_rgb=bg,
             line_rgb=GRAY_LINE, line_width_pt=0.4)
    add_tb(s, col_x[0]+0.1, y+0.04, col_w[0]-0.1, 0.28, text,
           size=12 if not is_header else 13, bold=is_header,
           color=tc, margin=False)
    add_tb(s, col_x[1]+0.1, y+0.04, col_w[1]-0.1, 0.28, score,
           size=12 if not is_header else 13, bold=is_header,
           color=AMBER if not is_header and score not in ("0","SCORE") else tc,
           align=PP_ALIGN.CENTER, margin=False)
    y += 0.36

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 9 – LABORATORY & IMAGING
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Diagnosis", "Laboratory Investigations & Imaging")
footer(s); slide_number(s, 9)

add_tb(s, 0.4, 1.62, 5.8, 0.3, "LABORATORY TESTS", size=14,
       bold=True, color=NAVY, margin=False)
add_tb(s, 6.9, 1.62, 5.8, 0.3, "IMAGING MODALITIES", size=14,
       bold=True, color=NAVY, margin=False)
add_rect(s, 0.4, 1.95, 12.5, 0.04, fill_rgb=TEAL)

bullet_block(s, 0.4, 2.1, 6.0, 4.8, [
    ("Rheumatoid Factor (RF)", "positive in 70-80%; NOT specific — also in Sjogren's, SLE, chronic hepatitis"),
    ("Anti-CCP (ACPA)", ">95% specific for RA; can be positive YEARS before symptoms; predicts erosive disease"),
    ("ESR & CRP", "non-specific markers of active inflammation; used to monitor disease activity"),
    ("Full Blood Count", "anaemia of chronic disease; thrombocytosis in active RA; neutropenia in Felty's"),
    ("Synovial fluid analysis", "WBC >2,000/mm³, predominantly neutrophils; no crystals"),
    ("LFTs + renal function", "baseline required before DMARDs — especially methotrexate"),
], size=13)

bullet_block(s, 6.8, 2.1, 6.0, 4.8, [
    ("Plain X-ray (hands/feet)", "first-line; soft tissue swelling → periarticular osteoporosis → erosions → deformities"),
    ("Ultrasound", "detects synovitis and erosions BEFORE X-ray changes; guides joint injections"),
    ("MRI", "most sensitive — bone oedema (pre-erosive), tendon/ligament involvement; used in uncertain cases"),
    ("Bone densitometry (DEXA)", "osteoporosis screening in all RA patients, especially those on glucocorticoids"),
], size=13)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 10 – TREATMENT OVERVIEW
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Treatment & Management", "Treat-to-Target Strategy: Goal = REMISSION")
footer(s); slide_number(s, 10)

# Goal box
add_rect(s, 0.4, 1.55, 12.5, 0.85, fill_rgb=GREEN)
add_tb(s, 0.6, 1.62, 12.1, 0.72,
       "🎯  TREAT-TO-TARGET:  When treated early, remission achievable in >50% of patients "
       "and low disease activity in a further 35%",
       size=15, bold=True, color=WHITE, align=PP_ALIGN.CENTER, margin=False)

# Treatment pyramid
pyramid_items = [
    ("NON-PHARMACOLOGICAL", "Physiotherapy • OT • Patient education • Diet • Surgery",
     RGBColor(0x88,0xAA,0xCC), 0.4, 2.55, 12.5, 0.85),
    ("NSAIDs & GLUCOCORTICOIDS", "Symptom relief & bridge therapy — always use WITH DMARDs",
     RGBColor(0x55,0x88,0xBB), 0.4, 3.48, 12.5, 0.85),
    ("CONVENTIONAL DMARDs (csDMARDs)", "Methotrexate (anchor drug) • Hydroxychloroquine • Sulfasalazine • Leflunomide",
     RGBColor(0x22,0x66,0xAA), 0.4, 4.41, 12.5, 0.85),
    ("BIOLOGIC DMARDs (bDMARDs)", "TNF inhibitors • Tocilizumab • Rituximab • Abatacept — if csDMARDs inadequate",
     RGBColor(0x00,0x44,0x88), 0.4, 5.34, 12.5, 0.85),
    ("TARGETED SYNTHETIC DMARDs (tsDMARDs)", "JAK inhibitors: Tofacitinib • Baricitinib • Upadacitinib",
     NAVY, 0.4, 6.27, 12.5, 0.85),
]
for title, subtitle, color, x, y, w, h in pyramid_items:
    add_rect(s, x, y, w, h, fill_rgb=color)
    add_tb(s, x+0.2, y+0.05, w-0.4, 0.38, title, size=13, bold=True,
           color=WHITE, margin=False)
    add_tb(s, x+0.2, y+0.42, w-0.4, 0.38, subtitle, size=12, italic=True,
           color=RGBColor(0xCC,0xE4,0xF8), margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 11 – csDMARDs DETAIL
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Conventional DMARDs (csDMARDs)", "The Backbone of RA Therapy")
footer(s); slide_number(s, 11)

dmards = [
    ("Methotrexate (MTX)", "7.5–25 mg PO/SC once weekly",
     "ANCHOR drug. Most effective csDMARD. Requires folic acid supplementation. Monitor LFTs + FBC."),
    ("Hydroxychloroquine", "200–400 mg PO daily",
     "Antimalarial; used in mild disease / combination. Annual ophthalmology check for retinal toxicity."),
    ("Sulfasalazine", "2 g/day in divided doses",
     "Often combined with MTX. Monitor FBC and LFTs. Can cause orange urine (harmless)."),
    ("Leflunomide", "10–20 mg PO daily",
     "Alternative to MTX. Very long half-life. Hepatotoxic — avoid in liver disease and pregnancy."),
    ("Triple therapy", "MTX + HCQ + SSZ",
     "Efficacy comparable to some biologics at lower cost. Good option before escalating to biologics."),
]
y = 1.58
for drug, dose, note in dmards:
    add_rect(s, 0.4, y, 12.5, 1.0, fill_rgb=WHITE,
             line_rgb=RGBColor(0xBB,0xCC,0xDD), line_width_pt=0.7)
    add_rect(s, 0.4, y, 3.2, 1.0, fill_rgb=BLUE)
    add_tb(s, 0.5, y+0.08, 3.0, 0.5, drug, size=13, bold=True,
           color=WHITE, margin=False)
    add_tb(s, 0.5, y+0.55, 3.0, 0.38, dose, size=11, italic=True,
           color=RGBColor(0xCC,0xE4,0xF8), margin=False)
    add_tb(s, 3.75, y+0.18, 9.0, 0.65, note, size=13,
           color=DARK_TEXT, wrap=True, margin=False)
    y += 1.07

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 12 – BIOLOGIC DMARDs
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Biologic DMARDs (bDMARDs)", "Targeted Immunotherapy — Used When csDMARDs Fail")
footer(s); slide_number(s, 12)

add_tb(s, 0.4, 1.62, 12.5, 0.35,
       "⚠  Screen for TB (IGRA) and Hepatitis B BEFORE starting any biologic. Live vaccines are CONTRAINDICATED.",
       size=13, bold=True, color=RGBColor(0x8B,0x00,0x00), align=PP_ALIGN.CENTER, margin=False)

biologics = [
    ("TNF-α Inhibitors", NAVY,
     ["Etanercept 50 mg SC weekly",
      "Adalimumab 40 mg SC every 2 weeks",
      "Infliximab 3–5 mg/kg IV (0, 2, 6 wks then q4–8 wks)",
      "Certolizumab • Golimumab"]),
    ("IL-6 Inhibitor", RGBColor(0x00,0x55,0x88),
     ["Tocilizumab 4–8 mg/kg IV every 4 weeks",
      "Effective as MONOTHERAPY (unique among biologics)",
      "Masks CRP and fever — caution re: hidden infection"]),
    ("T-cell Blocker", RGBColor(0x00,0x44,0x77),
     ["Abatacept 500–1000 mg IV every 4 weeks",
      "Blocks CD28-CD80/86 co-stimulation",
      "Good safety profile in patients with ILD"]),
    ("B-cell Depleter", RGBColor(0x00,0x33,0x66),
     ["Rituximab 2×1000 mg IV every 6 months",
      "Depletes CD20+ B cells",
      "Preferred in RF/ACPA-high disease & post-TNF failure"]),
]
for i, (name, color, items) in enumerate(biologics):
    col = i % 2
    row = i // 2
    x = 0.4 + col * 6.5
    y = 2.1 + row * 2.5
    add_rect(s, x, y, 6.1, 2.4, fill_rgb=WHITE,
             line_rgb=RGBColor(0xBB,0xCC,0xDD), line_width_pt=0.7)
    add_rect(s, x, y, 6.1, 0.48, fill_rgb=color)
    add_tb(s, x+0.15, y+0.07, 5.8, 0.35, name, size=14, bold=True,
           color=WHITE, margin=False)
    for j, item in enumerate(items):
        add_tb(s, x+0.25, y+0.58+j*0.57, 5.7, 0.5,
               "▸  " + item, size=12.5, color=DARK_TEXT, margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 13 – JAK INHIBITORS + NSAIDs/STEROIDS
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "JAK Inhibitors & Adjunct Therapies")
footer(s); slide_number(s, 13)

add_tb(s, 0.4, 1.6, 5.8, 0.32, "JAK INHIBITORS (tsDMARDs)", size=14,
       bold=True, color=NAVY, margin=False)
add_rect(s, 0.4, 1.95, 6.0, 0.04, fill_rgb=TEAL)

jaks = [
    ("Tofacitinib", "5 mg PO twice daily", "JAK1/3 inhibitor. First oral targeted DMARD for RA."),
    ("Baricitinib", "2–4 mg PO once daily", "JAK1/2 inhibitor. Convenient once-daily dosing."),
    ("Upadacitinib", "15 mg PO once daily", "JAK1-selective. High efficacy; well-tolerated."),
]
y = 2.1
for drug, dose, note in jaks:
    add_rect(s, 0.4, y, 6.0, 1.3, fill_rgb=RGBColor(0xE8,0xF0,0xFE),
             line_rgb=BLUE, line_width_pt=0.7)
    add_tb(s, 0.55, y+0.1, 3.2, 0.4, drug, size=14, bold=True, color=NAVY, margin=False)
    add_tb(s, 0.55, y+0.5, 3.2, 0.35, dose, size=12, italic=True, color=BLUE, margin=False)
    add_tb(s, 0.55, y+0.85, 5.7, 0.35, note, size=12, color=DARK_TEXT, margin=False)
    y += 1.4

add_rect(s, 0.4, 6.25, 6.0, 0.85,
         fill_rgb=RGBColor(0xFF,0xF0,0xF0),
         line_rgb=RGBColor(0xCC,0x00,0x00), line_width_pt=0.8)
add_tb(s, 0.55, 6.3, 5.7, 0.7,
       "⚠ CLASS WARNING: Increased risk of CV events, malignancy & thromboembolism "
       "— use lowest effective dose",
       size=11.5, bold=True, color=RGBColor(0x8B,0x00,0x00), wrap=True, margin=False)

add_tb(s, 6.9, 1.6, 5.8, 0.32, "NSAIDs & GLUCOCORTICOIDS", size=14,
       bold=True, color=NAVY, margin=False)
add_rect(s, 6.8, 1.95, 6.0, 0.04, fill_rgb=TEAL)

bullet_block(s, 6.8, 2.1, 6.0, 2.2, [
    ("NSAIDs", "ibuprofen, naproxen, celecoxib — symptomatic relief ONLY; always co-prescribe PPI"),
    ("Prednisone", "≤10 mg/day as bridge; taper ASAP; never long-term without DMARD cover"),
    ("Intra-articular steroids", "useful for localised flares in single joints"),
], size=13)

add_rect(s, 6.8, 4.4, 6.0, 2.7, fill_rgb=RGBColor(0xFFF8E1),
         line_rgb=AMBER, line_width_pt=0.8)
add_tb(s, 6.95, 4.5, 5.7, 0.35, "LONG-TERM STEROID RISKS:", size=13,
       bold=True, color=RGBColor(0x6B,0x3A,0x00), margin=False)
risks = ["Osteoporosis (give bisphosphonate + Ca/Vit D)",
         "Diabetes mellitus & weight gain",
         "Serious infections (25% ↑ risk at just 5 mg/day)",
         "Adrenal suppression • Cataracts • Hypertension"]
for i, r in enumerate(risks):
    add_tb(s, 6.95, 4.9+i*0.5, 5.7, 0.44,
           "•  " + r, size=12, color=RGBColor(0x6B,0x3A,0x00), margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 14 – NON-PHARMACOLOGICAL MANAGEMENT
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Non-Pharmacological Management", "Essential alongside medications")
footer(s); slide_number(s, 14)

cards = [
    ("🏋", "Physical Therapy", "ROM exercises, muscle strengthening, aerobic activity — maintain function & prevent atrophy"),
    ("🖐", "Occupational Therapy", "Joint protection, adaptive devices, wrist/hand splints, activity modification"),
    ("📚", "Patient Education", "Disease understanding, DMARD adherence, self-monitoring for flares, recognising drug side effects"),
    ("🥗", "Diet & Nutrition", "Mediterranean diet; omega-3 fatty acids (fish oil) — anti-inflammatory; weight management"),
    ("🧠", "Psychological Support", "CBT, support groups, mindfulness — depression & anxiety are common in RA"),
    ("🏥", "Orthopaedic Surgery", "Synovectomy, total joint replacement (arthroplasty), tendon repair for end-stage damage"),
]
for i, (icon, title, text) in enumerate(cards):
    col = i % 3
    row = i // 3
    x = 0.4 + col * 4.27
    y = 1.62 + row * 2.55
    add_rect(s, x, y, 4.0, 2.4, fill_rgb=WHITE,
             line_rgb=RGBColor(0xBB,0xCC,0xDD), line_width_pt=0.7)
    add_rect(s, x, y, 4.0, 0.7, fill_rgb=BLUE)
    add_tb(s, x+0.15, y+0.1, 3.7, 0.55, title, size=14, bold=True,
           color=WHITE, margin=False)
    add_tb(s, x+0.15, y+0.82, 3.7, 1.45, text, size=12,
           color=DARK_TEXT, wrap=True, margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 15 – COMPLICATIONS
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Complications & Prognosis")
footer(s); slide_number(s, 15)

add_tb(s, 0.4, 1.6, 5.8, 0.3, "DISEASE COMPLICATIONS", size=14,
       bold=True, color=NAVY, margin=False)
add_tb(s, 7.0, 1.6, 5.8, 0.3, "DRUG-RELATED COMPLICATIONS", size=14,
       bold=True, color=NAVY, margin=False)

bullet_block(s, 0.4, 1.97, 6.0, 3.5, [
    ("Joint destruction", "70% develop erosions within 2 years without treatment"),
    ("Cardiovascular disease", "2× risk of MI & stroke — #1 cause of premature death in RA"),
    ("Atlantoaxial subluxation", "cervical cord compression — warn anaesthetists!"),
    ("Felty syndrome", "RA + splenomegaly + neutropenia → recurrent infections"),
    ("Amyloidosis (AA)", "renal failure from chronic untreated inflammation"),
    ("ILD / Pulmonary fibrosis", "significant morbidity — worse in male smokers"),
    ("Septic arthritis", "inflamed joints susceptible to haematogenous seeding"),
], size=13)

bullet_block(s, 6.8, 1.97, 6.0, 3.5, [
    ("Methotrexate", "hepatotoxicity, myelosuppression, pneumonitis"),
    ("NSAIDs", "GI bleeding, peptic ulcer, renal impairment, CV risk"),
    ("Glucocorticoids", "osteoporosis, diabetes, infection, adrenal suppression"),
    ("Biologics / JAK inhibitors", "serious infections, TB reactivation, malignancy, VTE"),
    ("Hydroxychloroquine", "retinal toxicity — requires annual eye monitoring"),
], size=13)

add_rect(s, 0.4, 5.58, 12.5, 0.04, fill_rgb=TEAL)
add_tb(s, 0.4, 5.68, 12.5, 0.3, "PROGNOSIS — POOR PROGNOSTIC INDICATORS:", size=13,
       bold=True, color=NAVY, margin=False)
add_tb(s, 0.4, 5.98, 12.5, 0.85,
       "High-titre RF / ACPA  •  High swollen joint count  •  Early erosions on imaging  "
       "•  Elevated CRP/ESR  •  Extra-articular manifestations  •  Failure of early DMARD therapy",
       size=13, color=RGBColor(0x55,0x00,0x00), italic=True, wrap=True)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 16 – NURSING CONSIDERATIONS (Part 1)
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Nursing Considerations", "Part 1: Assessment & Medication Management")
footer(s); slide_number(s, 16)

add_tb(s, 0.4, 1.6, 5.8, 0.32, "PAIN & SYMPTOM ASSESSMENT", size=14,
       bold=True, color=NAVY, margin=False)
bullet_block(s, 0.4, 2.0, 6.0, 2.0, [
    "Use NRS/VAS pain scales at every visit",
    "Document duration of morning stiffness (disease activity marker)",
    "Assess joint swelling, warmth, and range of motion",
    "Monitor functional status (ADL performance)",
    "Track fatigue and sleep quality",
], size=13)

add_tb(s, 0.4, 4.1, 5.8, 0.32, "MEDICATION MONITORING", size=14,
       bold=True, color=NAVY, margin=False)
bullet_block(s, 0.4, 4.5, 6.0, 2.65, [
    ("MTX", "LFTs + FBC every 3 months; ensure folic acid 5 mg/week"),
    ("Hydroxychloroquine", "annual ophthalmology review"),
    ("Glucocorticoids", "blood glucose, BP, weight, bone density"),
    ("Biologics", "screen TB (IGRA) + Hep B before starting; monitor for infections"),
    ("NSAIDs", "renal function, BP, stool for blood"),
], size=13)

add_tb(s, 6.9, 1.6, 5.8, 0.32, "INFECTION SURVEILLANCE", size=14,
       bold=True, color=NAVY, margin=False)
bullet_block(s, 6.8, 2.0, 6.0, 2.0, [
    "Patients on immunosuppressants have HIGH infection risk",
    "Educate: report fever, unusual fatigue, cough, redness immediately",
    "Ensure vaccinations are up to date:",
    "   • Influenza (annual)",
    "   • Pneumococcal",
    "   • COVID-19",
    "Live vaccines are CONTRAINDICATED while on biologics/JAKi",
], size=13)

add_tb(s, 6.9, 4.1, 5.8, 0.32, "FALL PREVENTION", size=14,
       bold=True, color=NAVY, margin=False)
bullet_block(s, 6.8, 4.5, 6.0, 2.65, [
    "Assess joint instability, muscle weakness, and balance",
    "Arrange physiotherapy for strengthening exercises",
    "Recommend appropriate footwear and mobility aids",
    "Warn of cervical instability — critical before anaesthesia",
    "Check for peripheral neuropathy (carpal/tarsal tunnel)",
], size=13)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 17 – NURSING CONSIDERATIONS (Part 2)
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Nursing Considerations", "Part 2: Education, Psychosocial & Surgical Care")
footer(s); slide_number(s, 17)

cards2 = [
    ("Patient Education", NAVY, [
        "Explain disease process in plain language",
        "Importance of DMARD adherence — never stop abruptly",
        "Joint protection: avoid high-impact activities during flares",
        "Energy conservation techniques",
        "How to recognise & report a flare",
        "Regular follow-up with rheumatologist",
    ]),
    ("Psychosocial Support", BLUE, [
        "Screen for depression and anxiety (PHQ-9, GAD-7)",
        "RA has major impact on employment, relationships, QoL",
        "Refer to psychologist / social worker when needed",
        "Connect to RA support groups and patient organisations",
        "Acknowledge and validate patient's emotional experience",
        "Assess coping strategies and social support network",
    ]),
    ("Pre-operative Nursing", TEAL, [
        "Withhold biologics perioperatively per protocol",
        "Assess and document cervical spine stability before GA",
        "Inform anaesthetist of C1-C2 involvement",
        "Screen for anaemia pre-operatively",
        "Ensure glucocorticoid 'stress-dosing' if on steroids",
        "Monitor wound healing — impaired in immunosuppressed patients",
    ]),
]
for i, (title, color, items) in enumerate(cards2):
    x = 0.4 + i * 4.27
    add_rect(s, x, 1.58, 4.0, 5.6, fill_rgb=WHITE,
             line_rgb=RGBColor(0xBB,0xCC,0xDD), line_width_pt=0.7)
    add_rect(s, x, 1.58, 4.0, 0.6, fill_rgb=color)
    add_tb(s, x+0.15, 1.63, 3.7, 0.5, title, size=14, bold=True,
           color=WHITE, margin=False)
    for j, item in enumerate(items):
        add_tb(s, x+0.15, 2.28+j*0.78, 3.7, 0.7,
               "▸  " + item, size=12, color=DARK_TEXT, wrap=True, margin=False)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 18 – CASE-BASED SUMMARY
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Clinical Scenario", "Applying RA Knowledge to Patient Care")
footer(s); slide_number(s, 18)

add_rect(s, 0.4, 1.58, 12.5, 1.6, fill_rgb=RGBColor(0xE8,0xF4,0xFD),
         line_rgb=BLUE, line_width_pt=1.2)
add_tb(s, 0.6, 1.65, 12.1, 0.3, "CLINICAL SCENARIO", size=13, bold=True,
       color=NAVY, margin=False)
add_tb(s, 0.6, 1.98, 12.1, 1.1,
       "A 38-year-old woman presents with a 3-month history of bilateral hand pain and swelling, "
       "worse in the morning for about 2 hours. She reports fatigue and mild weight loss. "
       "Examination reveals warm, swollen MCP and PIP joints bilaterally with DIP joints spared. "
       "Labs show RF positive, anti-CCP strongly positive (×5 ULN), elevated CRP and ESR.",
       size=13.5, color=DARK_TEXT, wrap=True, margin=False)

add_tb(s, 0.4, 3.3, 12.5, 0.32, "KEY CLINICAL DECISIONS:", size=14,
       bold=True, color=NAVY, margin=False)

bullet_block(s, 0.4, 3.68, 6.0, 3.5, [
    ("Diagnosis", "RA — ACR/EULAR score ≥6/10 (small joint involvement × 3pts + high ACPA × 3pts + elevated CRP × 1pt + duration ≥6wks × 1pt = 8/10)"),
    ("Imaging", "X-ray hands/feet for baseline erosions; USS or MRI if clinical doubt"),
    ("Baseline labs before treatment", "LFTs, FBC, renal function, Hep B/C, IGRA for TB"),
], size=13)

bullet_block(s, 6.8, 3.68, 6.0, 3.5, [
    ("First-line treatment", "Methotrexate 15 mg weekly + folic acid 5 mg/week; low-dose prednisolone as bridge"),
    ("Nursing role", "Educate on MTX administration, side effects, signs of infection; monthly monitoring bloods"),
    ("Escalation plan", "If inadequate response at 3–6 months → add biologic (TNF inhibitor) or JAK inhibitor"),
], size=13)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 19 – KEY TAKEAWAYS
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, LIGHT_BG)
header_bar(s, "Key Takeaways", "What Every Nursing Student Must Know")
footer(s); slide_number(s, 19)

takeaways = [
    ("1", NAVY,    "RA is a systemic autoimmune disease — not just arthritis",
     "Affects joints AND organs (heart, lungs, skin, eyes). Always think systemically."),
    ("2", BLUE,    "Symmetric small-joint synovitis + morning stiffness > 1hr = RA until proven otherwise",
     "MCP and PIP joints; DIP sparing; often bilateral and symmetric."),
    ("3", TEAL,    "Anti-CCP antibodies are the most specific test (>95%)",
     "Can be positive years before symptoms. High-titre = more aggressive disease."),
    ("4", GREEN,   "EARLY treatment is everything — start DMARDs without delay",
     "Remission is achievable in >50% of patients treated early. Methotrexate is the anchor drug."),
    ("5", AMBER,   "Screen all patients on biologics for TB and Hepatitis B before starting",
     "Live vaccines are contraindicated. Monitor for infection at every visit."),
    ("6", RGBColor(0x8B,0x00,0x00), "Nurses are central to the multidisciplinary team",
     "Patient education, drug monitoring, psychological support, and infection surveillance save lives."),
]
y = 1.6
for num, color, title, desc in takeaways:
    add_rect(s, 0.4, y, 12.5, 0.88, fill_rgb=WHITE,
             line_rgb=RGBColor(0xBB,0xCC,0xDD), line_width_pt=0.6)
    add_rect(s, 0.4, y, 0.6, 0.88, fill_rgb=color)
    add_tb(s, 0.42, y+0.2, 0.56, 0.5, num, size=18, bold=True,
           color=WHITE, align=PP_ALIGN.CENTER, margin=False)
    add_tb(s, 1.15, y+0.06, 5.5, 0.4, title, size=13.5, bold=True,
           color=NAVY, margin=False)
    add_tb(s, 1.15, y+0.46, 11.5, 0.35, desc, size=12,
           color=RGBColor(0x44,0x44,0x44), italic=True, margin=False)
    y += 0.95

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 20 – REFERENCES + THANK YOU
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(BLANK)
slide_bg(s, NAVY)

add_rect(s, 0, 0, 13.333, 7.5, fill_rgb=NAVY)
add_rect(s, 0, 0, 0.35, 7.5, fill_rgb=TEAL)

add_tb(s, 0.6, 0.25, 12.0, 0.6, "References", size=26, bold=True,
       color=WHITE, margin=False)
add_rect(s, 0.6, 0.9, 11.0, 0.06, fill_rgb=TEAL)

refs = [
    "1.  Goldman L & Schafer AI (2022). Goldman-Cecil Medicine (26th ed.), Chapter 243. Elsevier.",
    "2.  Rakel RE & Rakel DP (2016). Textbook of Family Medicine (9th ed.), Chapter 32. Elsevier.",
    "3.  Firestein GS et al. (2021). Firestein & Kelley's Textbook of Rheumatology (11th ed.). Elsevier.",
    "4.  Smolen JS et al. (2023). EULAR recommendations for management of RA — 2022 update. Ann Rheum Dis, 82(1):3–18.",
    "5.  Aletaha D et al. (2010). 2010 RA classification criteria: ACR/EULAR initiative. Arthritis Rheum, 62(9):2569–2581.",
    "6.  Sparks JA (2019). Rheumatoid Arthritis. Ann Intern Med, 170(1):ITC1–ITC16.",
    "7.  Radu AF & Bungau SG (2021). Management of RA: An overview. Cells, 10(11):2857.",
]
for i, ref in enumerate(refs):
    add_tb(s, 0.6, 1.05 + i * 0.54, 12.4, 0.5, ref, size=12,
           color=RGBColor(0xCC,0xE4,0xF8), margin=False)

add_rect(s, 0.6, 5.0, 12.0, 0.06, fill_rgb=TEAL)
add_tb(s, 0.6, 5.1, 12.0, 0.7,
       "Thank You  —  Questions Welcome",
       size=28, bold=True, color=WHITE, align=PP_ALIGN.CENTER, margin=False)
add_tb(s, 0.6, 5.85, 12.0, 0.45,
       "Rheumatoid Arthritis | Undergraduate Nursing / Health Sciences Project | July 2026",
       size=13, italic=True, color=RGBColor(0xAA,0xD4,0xF5),
       align=PP_ALIGN.CENTER, margin=False)

# ── Save ─────────────────────────────────────────────────────────────────────
out = "/tmp/workspace/rheumatoid-arthritis-project/Rheumatoid_Arthritis_Presentation.pptx"
buf = BytesIO()
prs.save(buf)
with open(out, "wb") as f:
    f.write(buf.getvalue())
print(f"Saved: {out}")
print(f"Slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace/rheumatoid-arthritis-project && python3 build_pptx.py

Editing File

~/rheumatoid-arthritis-project/build_pptx.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/rheumatoid-arthritis-project/build_pptx.py'
Running Command

cd /tmp/workspace/rheumatoid-arthritis-project && python3 build_pptx.py

Running Command

grep -n "0xFFF" /tmp/workspace/rheumatoid-arthritis-project/build_pptx.py | head -20

Running Command

grep -n "RGBColor(0xFF" /tmp/workspace/rheumatoid-arthritis-project/build_pptx.py | head -20

Editing File

~/rheumatoid-arthritis-project/build_pptx.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/rheumatoid-arthritis-project/build_pptx.py'
Running Command

cd /tmp/workspace/rheumatoid-arthritis-project && python3 build_pptx.py

Running Command

python3 -c " from pptx import Presentation prs = Presentation('/tmp/workspace/rheumatoid-arthritis-project/Rheumatoid_Arthritis_Presentation.pptx') print(f'Total slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): texts = [s.text_frame.text.strip()[:60] for s in slide.shapes if s.has_text_frame and s.text_frame.text.strip()] print(f' Slide {i}: {texts[0] if texts else \"(no text)\"}') import os size = os.path.getsize('/tmp/workspace/rheumatoid-arthritis-project/Rheumatoid_Arthritis_Presentation.pptx') print(f'File size: {size/1024:.1f} KB') "

All 20 slides built and verified. Here's your presentation:

Rheumatoid Arthritis Presentation

Presentation · PPTX


Here's what each slide contains:
SlideTitleKey Content
1Title SlideDark navy design with your name placeholder
2Overview / AgendaAll 9 topic boxes listed
3DefinitionDefinition box + 5 key characteristics
4Epidemiology & Risk Factors4 stat boxes (1-2%, 3:1, age 20-50, 70% insidious) + risk/protective factor columns
5PathophysiologyFlow diagram: Genetics → Triggers → Citrullination → ACPA/RF → Pannus; cytokine highlight box
6Clinical Features (Articular)Hallmark banner + joints affected + classic deformities (swan-neck, boutonniere, ulnar drift)
7Extra-Articular Features8 coloured system cards (skin, CV, lungs, blood, eyes, neuro, renal, bones)
8DiagnosisFull 2010 ACR/EULAR criteria table with scoring
9Labs & ImagingRF, anti-CCP, ESR/CRP, FBC, synovial fluid + X-ray, USS, MRI, DEXA
10Treatment Overview5-tier treatment pyramid from NSAIDs up to JAK inhibitors
11csDMARDsMTX, HCQ, SSZ, leflunomide, triple therapy with doses
12Biologic DMARDs4 mechanism cards (TNF-i, IL-6-i, T-cell blocker, B-cell depleter) with doses
13JAK Inhibitors + NSAIDs/SteroidsTofacitinib, baricitinib, upadacitinib + steroid risk warning box
14Non-Pharmacological6 cards: physio, OT, education, diet, psychology, surgery
15Complications & PrognosisDisease vs. drug complications + poor prognostic indicators
16Nursing (Part 1)Pain assessment, drug monitoring, infection surveillance, fall prevention
17Nursing (Part 2)Patient education, psychosocial support, pre-operative care
18Clinical ScenarioReal case applied — diagnosis scoring, labs, treatment plan
19Key Takeaways6 numbered must-know points for nursing students
20References + Thank You7 peer-reviewed citations + closing slide
The design uses a navy/teal/white colour scheme with a consistent header bar and footer on every slide. Just open and replace [Your Name] on slides 1 and 20.
This is a shared conversation. Sign in to Orris to start your own chat.