explain the use of computers in rotine management in the hospital
use of computers in hospital routine management
| Area | Benefit |
|---|---|
| Patient safety | Drug interaction alerts, BCMA scanning, allergy checks |
| Efficiency | Faster turnaround, less paperwork, automated billing |
| Data accuracy | Legible records, standardized coding |
| Communication | Real-time sharing of results across departments |
| Cost control | Inventory automation, reduced duplication of tests |
you working as nursing suprintendent in the hospital where you have work on management of the department with the computer in ms word . enlist the main features of ms word in the context of question stated in nursing practice
MS Word features used in nursing management hospital administration
| MS Word Feature | Nursing Management Application |
|---|---|
| Formatting | SOPs, policy documents, circulars |
| Tables | Duty rosters, care plans, drug registers |
| Templates | Handover sheets, incident forms, appraisals |
| Mail Merge | Personalized letters, certificates, notices |
| Track Changes | Policy review, protocol revision |
| Headers/Footers | Official letterheads, version control |
| Spell/Grammar Check | Error-free reports and correspondence |
| Bullets/Numbering | Procedures, agendas, job descriptions |
| Images/Charts/SmartArt | Org charts, data reports, procedure visuals |
| Styles and TOC | Policy manuals, orientation handbooks |
| Password Protection | Confidential staff and patient documents |
| Find and Replace | Bulk updates across large documents |
| Rosters, minutes, certificates |
a nurse needs to quickly access a patient lab results , medication list , and previous medical history during an emergency situation . how woud the nurse efficiently and accuratly access this information using hospital computer system
nurse access patient information EHR emergency situation hospital computer system workflow
In a true emergency, some systems allow a "break-glass" or emergency override that grants immediate access to any patient record, with the action logged for later review.
| Identifier | Example |
|---|---|
| Hospital ID / MRN | Most precise - fastest result |
| Full Name | Useful if ID not known |
| Date of Birth | Used alongside name to confirm identity |
| Ward and Bed Number | Useful during ward-based emergencies |
| National ID / Passport Number | In some hospital systems |
| Tool / Feature | How It Helps in an Emergency |
|---|---|
| Patient Summary / Dashboard | Single screen with all key data - no tab-by-tab navigation needed |
| Barcode / wristband scanner | Scan the patient's wristband to instantly open their correct record |
| Mobile devices / bedside terminals | Access EHR at the bedside without leaving the patient |
| Favorites / Pinned patients | Nurses can pin their assigned patients for one-click access |
| Voice recognition | Hands-free documentation while performing emergency care |
| Offline mode / downtime procedures | Printed downtime reports kept at the nursing station in case of system failure |
| Color-coded alerts | Red = critical, yellow = warning, green = normal - instant visual triage of results |
Create a quick reference guide for accessing patient data in emergency situations0 pateints . create an excel sheet to record the medication name , dosage , time of administration , and any adverse reaction . how would you structure this sheet to complete the task
mkdir -p /home/daytona/workspace/emergency-nursing && ls /home/daytona/workspace…
~/emergency-nursing/create_emergency_sheets.py
import openpyxl
from openpyxl.styles import (
PatternFill, Font, Alignment, Border, Side, GradientFill
)
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.datavalidation import DataValidation
from openpyxl.formatting.rule import ColorScaleRule, CellIsRule, FormulaRule
from openpyxl.styles.differential import DifferentialStyle
from datetime import datetime
wb = openpyxl.Workbook()
# ─────────────────────────────────────────────
# COLOUR PALETTE
# ─────────────────────────────────────────────
RED_DARK = "C0392B"
RED_LIGHT = "FADBD8"
BLUE_DARK = "1A5276"
BLUE_MED = "2E86C1"
BLUE_LIGHT = "D6EAF8"
TEAL_DARK = "0E6655"
TEAL_LIGHT = "D1F2EB"
ORANGE_DARK = "BA4A00"
ORANGE_LIGHT= "FAE5D3"
GREY_DARK = "2C3E50"
GREY_MED = "95A5A6"
GREY_LIGHT = "ECF0F1"
WHITE = "FFFFFF"
YELLOW_WARN = "F9E79F"
GREEN_SAFE = "D5F5E3"
def thin_border(top=True, bottom=True, left=True, right=True):
s = Side(style='thin', color="AAAAAA")
n = Side(style=None)
return Border(
top=s if top else n,
bottom=s if bottom else n,
left=s if left else n,
right=s if right else n
)
def thick_border():
s = Side(style='medium', color="555555")
return Border(top=s, bottom=s, left=s, right=s)
def header_font(size=11, bold=True, color=WHITE):
return Font(name='Arial', size=size, bold=bold, color=color)
def body_font(size=10, bold=False, color="2C3E50"):
return Font(name='Arial', size=size, bold=bold, color=color)
def fill(hex_color):
return PatternFill("solid", fgColor=hex_color)
def center(wrap=False):
return Alignment(horizontal='center', vertical='center', wrap_text=wrap)
def left_align(wrap=True):
return Alignment(horizontal='left', vertical='center', wrap_text=wrap)
# ══════════════════════════════════════════════════════════════════
# SHEET 1 — QUICK REFERENCE GUIDE
# ══════════════════════════════════════════════════════════════════
ws_qrg = wb.active
ws_qrg.title = "Quick Reference Guide"
ws_qrg.sheet_view.showGridLines = False
ws_qrg.column_dimensions['A'].width = 3
ws_qrg.column_dimensions['B'].width = 28
ws_qrg.column_dimensions['C'].width = 52
ws_qrg.column_dimensions['D'].width = 3
# ── Title Banner ──────────────────────────────────────────────────
ws_qrg.row_dimensions[1].height = 8
ws_qrg.row_dimensions[2].height = 48
ws_qrg.row_dimensions[3].height = 22
ws_qrg.row_dimensions[4].height = 10
ws_qrg.merge_cells('B2:C2')
c = ws_qrg['B2']
c.value = "🏥 EMERGENCY PATIENT DATA — QUICK REFERENCE GUIDE"
c.font = Font(name='Arial', size=16, bold=True, color=WHITE)
c.fill = fill(RED_DARK)
c.alignment = center(wrap=False)
c.border = thick_border()
ws_qrg.merge_cells('B3:C3')
c = ws_qrg['B3']
c.value = "Nursing Department | Use in Emergency / Code Situations | Version 1.0 | " + datetime.today().strftime('%B %Y')
c.font = Font(name='Arial', size=9, italic=True, color=WHITE)
c.fill = fill(GREY_DARK)
c.alignment = center()
# ── Section helper ────────────────────────────────────────────────
def section_header(ws, row, title, color):
ws.row_dimensions[row].height = 24
ws.merge_cells(f'B{row}:C{row}')
c = ws[f'B{row}']
c.value = f" {title}"
c.font = Font(name='Arial', size=11, bold=True, color=WHITE)
c.fill = fill(color)
c.alignment = left_align(wrap=False)
c.border = thick_border()
def data_row(ws, row, col_b, col_c, bg=WHITE, bold_b=False):
ws.row_dimensions[row].height = 20
b = ws[f'B{row}']
b.value = col_b
b.font = Font(name='Arial', size=10, bold=bold_b, color=GREY_DARK)
b.fill = fill(bg)
b.alignment = left_align(wrap=False)
b.border = thin_border()
c = ws[f'C{row}']
c.value = col_c
c.font = body_font(size=10)
c.fill = fill(bg)
c.alignment = left_align(wrap=True)
c.border = thin_border()
def spacer(ws, row, height=8):
ws.row_dimensions[row].height = height
# ── Section 1: Login & Patient Search ─────────────────────────────
r = 5
section_header(ws_qrg, r, "STEP 1 — LOG IN TO THE EHR SYSTEM", BLUE_DARK)
rows_s1 = [
("Action", "Detail", BLUE_LIGHT, True),
("Workstation Login", "Enter Username + Password OR tap smart card / badge on reader", BLUE_LIGHT, False),
("Emergency Override", "Use 'Break-Glass' access if patient not assigned to you; action is auto-logged", YELLOW_WARN, False),
("Biometric Login", "Fingerprint scanner available at ICU, ED, and HDU terminals", BLUE_LIGHT, False),
("System Down?", "Use printed Downtime Summary Sheet from the nursing station red folder", ORANGE_LIGHT, False),
]
for col_b, col_c, bg, bold_b in rows_s1:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Section 2: Identify Patient ────────────────────────────────────
r += 1
spacer(ws_qrg, r)
r += 1
section_header(ws_qrg, r, "STEP 2 — IDENTIFY THE CORRECT PATIENT", TEAL_DARK)
rows_s2 = [
("Identifier", "Use at Least TWO to Confirm Identity", TEAL_LIGHT, True),
("Hospital MRN", "Fastest — type directly in Patient Search bar", TEAL_LIGHT, False),
("Full Name + DOB", "Name + Date of Birth — always confirm both", TEAL_LIGHT, False),
("Wristband Barcode", "Scan patient's wristband to open record instantly", GREEN_SAFE, False),
("Ward + Bed Number", "Use if MRN unknown during ward emergency", TEAL_LIGHT, False),
("⚠ NEVER act on one identifier alone", "Confirm two identifiers before accessing or acting on data", YELLOW_WARN, False),
]
for col_b, col_c, bg, bold_b in rows_s2:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Section 3: Lab Results ─────────────────────────────────────────
r += 1
spacer(ws_qrg, r)
r += 1
section_header(ws_qrg, r, "STEP 3 — ACCESS LAB RESULTS", BLUE_MED)
rows_s3 = [
("Navigation", "Patient Record → 'Results' or 'Laboratory' Tab", BLUE_LIGHT, True),
("View Latest First", "Results in reverse chronological order — newest on top", BLUE_LIGHT, False),
("Critical Value Flag", "Red highlight / alarm icon = result needs IMMEDIATE action", RED_LIGHT, False),
("Quick View Panel", "Use 'Most Recent Results' summary to avoid scrolling", BLUE_LIGHT, False),
("Key Emergency Labs", "FBC | U&E | Blood Gas | Glucose | Troponin | Coagulation | LFTs", YELLOW_WARN, False),
("Blood Gas (ABG)", "pH, pO2, pCO2, HCO3, Lactate — under 'Point of Care' tab", BLUE_LIGHT, False),
]
for col_b, col_c, bg, bold_b in rows_s3:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Section 4: Medication List ─────────────────────────────────────
r += 1
spacer(ws_qrg, r)
r += 1
section_header(ws_qrg, r, "STEP 4 — ACCESS MEDICATION LIST & ALLERGIES", ORANGE_DARK)
rows_s4 = [
("Navigation", "Patient Record → 'Medications' or 'MAR' Tab", ORANGE_LIGHT, True),
("Allergy Alert", "Red banner at TOP of patient record — check FIRST", RED_LIGHT, False),
("Active Medications", "Current drugs with dose, route, frequency, last dose time", ORANGE_LIGHT, False),
("High-Risk Drugs to Check", "Anticoagulants | Insulin | Opioids | Cardiac drugs | Steroids", YELLOW_WARN, False),
("On-Hold / Discontinued", "Marked separately — important for full clinical picture", ORANGE_LIGHT, False),
("Before Giving Anything", "Confirm drug, dose, route, time, patient identity (5 Rights)", RED_LIGHT, False),
]
for col_b, col_c, bg, bold_b in rows_s4:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Section 5: Medical History ─────────────────────────────────────
r += 1
spacer(ws_qrg, r)
r += 1
section_header(ws_qrg, r, "STEP 5 — ACCESS PREVIOUS MEDICAL HISTORY", TEAL_DARK)
rows_s5 = [
("Navigation", "Patient Record → 'Summary' or 'Problem List' or 'History' Tab", TEAL_LIGHT, True),
("One-Page Summary", "Use Patient Summary / Dashboard view — all key info on one screen", GREEN_SAFE, False),
("Active Diagnoses", "Chronic conditions relevant to emergency (DM, CCF, COPD, epilepsy)", TEAL_LIGHT, False),
("Previous Surgeries", "Especially prior cardiac, neuro, or abdominal surgery", TEAL_LIGHT, False),
("Discharge Summaries", "Under 'Documents' tab — recent hospital admissions", TEAL_LIGHT, False),
("Baseline Observations", "Compare current vitals against patient's usual baseline", YELLOW_WARN, False),
]
for col_b, col_c, bg, bold_b in rows_s5:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Section 6: Clinical Decision Support ──────────────────────────
r += 1
spacer(ws_qrg, r)
r += 1
section_header(ws_qrg, r, "STEP 6 — USE CLINICAL DECISION SUPPORT & ALERTS", GREY_DARK)
rows_s6 = [
("NEWS / EWS Score", "Auto-calculated from vitals — triggers escalation protocol", GREY_LIGHT, True),
("Drug Interaction Alert", "System warns before giving contraindicated drug combination", YELLOW_WARN, False),
("Allergy Pop-Up", "Mandatory acknowledgment before administering flagged drug", RED_LIGHT, False),
("Critical Result Push", "Lab pushes urgent results to nurse's EHR dashboard / mobile", GREY_LIGHT, False),
("Rapid Response Trigger", "Follow hospital protocol when NEWS ≥ 7 or single extreme score", RED_LIGHT, False),
]
for col_b, col_c, bg, bold_b in rows_s6:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Section 7: System Down ─────────────────────────────────────────
r += 1
spacer(ws_qrg, r)
r += 1
section_header(ws_qrg, r, "⚠ SYSTEM DOWNTIME — EMERGENCY BACKUP PROCEDURE", RED_DARK)
rows_s7 = [
("Downtime Sheets", "Printed patient summary in RED FOLDER at nursing station (updated each shift)", RED_LIGHT, True),
("Paper MAR Chart", "Manual medication chart maintained as backup — check drug cupboard folder", ORANGE_LIGHT, False),
("Lab Results", "Call lab directly: Ext. ____ | Request verbal critical results", YELLOW_WARN, False),
("Pharmacy Queries", "Call pharmacy directly: Ext. ____ | For drug info and interactions", YELLOW_WARN, False),
("Document All Actions", "Record on paper — enter retrospectively when system restored", ORANGE_LIGHT, False),
("Report Downtime", "Notify IT Help Desk immediately: Ext. ____ | Log incident number", RED_LIGHT, False),
]
for col_b, col_c, bg, bold_b in rows_s7:
r += 1
data_row(ws_qrg, r, col_b, col_c, bg, bold_b)
# ── Footer ─────────────────────────────────────────────────────────
r += 2
ws_qrg.row_dimensions[r].height = 20
ws_qrg.merge_cells(f'B{r}:C{r}')
c = ws_qrg[f'B{r}']
c.value = "Approved by: Nursing Superintendent | Review Date: " + datetime.today().strftime('%B %Y') + " | For internal clinical use only — do not distribute outside the hospital"
c.font = Font(name='Arial', size=8, italic=True, color=GREY_MED)
c.fill = fill(GREY_DARK)
c.alignment = center()
# ══════════════════════════════════════════════════════════════════
# SHEET 2 — MEDICATION ADMINISTRATION RECORD (MAR)
# ══════════════════════════════════════════════════════════════════
ws_mar = wb.create_sheet("Medication Admin Record (MAR)")
ws_mar.sheet_view.showGridLines = False
# Column widths
col_widths = {
'A': 3, # padding
'B': 6, # #
'C': 22, # Patient Name
'D': 14, # MRN
'E': 8, # Ward/Bed
'F': 24, # Medication Name
'G': 18, # Generic Name
'H': 14, # Dosage
'I': 14, # Route
'J': 14, # Date
'K': 12, # Time Given
'L': 22, # Administered By
'M': 18, # Adverse Reaction?
'N': 32, # Reaction Details
'O': 22, # Action Taken
'P': 18, # Doctor Notified
'Q': 20, # Notes
'R': 3, # padding
}
for col, width in col_widths.items():
ws_mar.column_dimensions[col].width = width
# Title banner
ws_mar.row_dimensions[1].height = 8
ws_mar.row_dimensions[2].height = 46
ws_mar.row_dimensions[3].height = 22
ws_mar.row_dimensions[4].height = 16
ws_mar.merge_cells('B2:Q2')
c = ws_mar['B2']
c.value = "🏥 EMERGENCY MEDICATION ADMINISTRATION RECORD (MAR)"
c.font = Font(name='Arial', size=15, bold=True, color=WHITE)
c.fill = fill(RED_DARK)
c.alignment = center()
c.border = thick_border()
ws_mar.merge_cells('B3:Q3')
c = ws_mar['B3']
c.value = "Ward: _________________ Date: _________________ Shift: □ Morning □ Evening □ Night Charge Nurse: _________________________"
c.font = Font(name='Arial', size=10, color=WHITE)
c.fill = fill(GREY_DARK)
c.alignment = left_align(wrap=False)
c.border = thin_border()
# ── Key Alert Box ──────────────────────────────────────────────────
ws_mar.row_dimensions[5].height = 18
ws_mar.row_dimensions[6].height = 18
ws_mar.row_dimensions[7].height = 18
ws_mar.row_dimensions[8].height = 16
alerts = [
('B5:H5', "⚠ ALLERGY CHECK: Confirm allergy status BEFORE administering any drug", RED_DARK),
('I5:Q5', "⚠ 5 RIGHTS: Right Patient | Right Drug | Right Dose | Right Route | Right Time", ORANGE_DARK),
('B6:H6', "✅ Document IMMEDIATELY after administration — never pre-document", TEAL_DARK),
('I6:Q6', "🔴 Report ANY adverse reaction to doctor immediately & complete incident form", BLUE_DARK),
]
for cells, text, color in alerts:
ws_mar.merge_cells(cells)
c_ref = cells.split(':')[0]
c = ws_mar[c_ref]
c.value = text
c.font = Font(name='Arial', size=9, bold=True, color=WHITE)
c.fill = fill(color)
c.alignment = left_align(wrap=False)
c.border = thin_border()
# ── Column Headers ─────────────────────────────────────────────────
ws_mar.row_dimensions[8].height = 14
ws_mar.row_dimensions[9].height = 36
headers = [
('B', '#'),
('C', 'Patient Full Name'),
('D', 'MRN / Hospital ID'),
('E', 'Ward / Bed'),
('F', 'Medication Name\n(Brand)'),
('G', 'Generic / INN Name'),
('H', 'Dosage\n(Amount + Unit)'),
('I', 'Route\n(IV/IM/PO/SC etc.)'),
('J', 'Date\n(DD/MM/YYYY)'),
('K', 'Time Given\n(HH:MM, 24hr)'),
('L', 'Administered By\n(Name + Designation)'),
('M', 'Adverse Reaction?\n(Yes / No)'),
('N', 'Reaction Details\n(Describe symptoms)'),
('O', 'Action Taken\n(Treatment given)'),
('P', 'Doctor Notified?\n(Name + Time)'),
('Q', 'Additional Notes'),
]
header_colors = {
'B': GREY_DARK, 'C': BLUE_DARK, 'D': BLUE_DARK, 'E': BLUE_DARK,
'F': TEAL_DARK, 'G': TEAL_DARK, 'H': TEAL_DARK, 'I': TEAL_DARK,
'J': BLUE_MED, 'K': BLUE_MED, 'L': BLUE_MED,
'M': RED_DARK, 'N': RED_DARK, 'O': RED_DARK, 'P': RED_DARK,
'Q': GREY_DARK,
}
for col, title in headers:
c = ws_mar[f'{col}9']
c.value = title
c.font = Font(name='Arial', size=9, bold=True, color=WHITE)
c.fill = fill(header_colors[col])
c.alignment = center(wrap=True)
c.border = thin_border()
# ── Sub-header row (column group labels) ──────────────────────────
ws_mar.row_dimensions[8].height = 16
group_labels = [
('C8:E8', 'PATIENT IDENTIFICATION', BLUE_DARK),
('F8:I8', 'MEDICATION DETAILS', TEAL_DARK),
('J8:L8', 'ADMINISTRATION', BLUE_MED),
('M8:P8', 'ADVERSE REACTION MONITORING', RED_DARK),
('Q8:Q8', 'NOTES', GREY_DARK),
]
for cells, label, color in group_labels:
ws_mar.merge_cells(cells)
start = cells.split(':')[0]
c = ws_mar[start]
c.value = label
c.font = Font(name='Arial', size=8, bold=True, color=WHITE)
c.fill = fill(color)
c.alignment = center(wrap=False)
c.border = thin_border()
# ── Sample data rows ───────────────────────────────────────────────
sample_data = [
(1, "Ahmed Hassan", "MRN-001234", "ER-01", "Adrenaline (Epinephrine)", "Epinephrine", "0.5 mg", "IM", "12/07/2026", "08:15", "Sr. Nurse Fatima A.", "No", "", "", "", "Given for anaphylaxis — 2nd dose at 08:30 if no response"),
(2, "Samira Al-Rashid", "MRN-002567", "ER-02", "Morphine Sulphate", "Morphine", "5 mg", "IV", "12/07/2026", "09:00", "Sr. Nurse Layla M.", "Yes", "Nausea, vomiting — onset 10 min", "IV ondansetron 4 mg", "Dr. Khan — 09:12", "Vitals monitored q15min post-dose"),
(3, "James Owusu", "MRN-003891", "ICU-3", "Noradrenaline", "Norepinephrine", "0.1 mcg/kg/min","IV infusion","12/07/2026","10:30","RN Thomas B.", "No", "", "", "", "Septic shock — titrate per MAP target 65 mmHg"),
(4, "Priya Sharma", "MRN-004102", "HDU-2", "Metoprolol", "Metoprolol", "5 mg", "IV", "12/07/2026", "11:00", "Sr. Nurse Rina P.", "Yes", "Bradycardia — HR dropped to 42 bpm","IV Atropine 0.6 mg", "Dr. Mehta — 11:08", "ECG monitoring commenced; cardiologist paged"),
(5, "Mohammed Al-Farsi", "MRN-005345", "ER-04", "Dextrose 50%", "Glucose", "50 mL", "IV bolus","12/07/2026","11:45","RN Ayesha K.", "No", "", "", "", "BGL 1.8 mmol/L — hypoglycaemia protocol activated"),
(6, "Chen Wei", "MRN-006678", "ER-05", "Amiodarone", "Amiodarone HCl", "300 mg", "IV", "12/07/2026", "12:00", "Sr. Nurse David O.", "Yes", "Hypotension — BP 78/42 mmHg", "IV fluid bolus 500 mL","Dr. Singh — 12:07", "VF arrest — given during resuscitation"),
(7, "Fatima Al-Zahra", "MRN-007901", "ICU-1", "Furosemide", "Furosemide", "80 mg", "IV", "12/07/2026", "13:30", "RN Mariam S.", "No", "", "", "", "Fluid overload — urine output monitoring hourly"),
(8, "Robert Mensah", "MRN-008234", "HDU-4", "Heparin", "Unfractionated Heparin","5000 IU","SC","12/07/2026","14:00","Sr. Nurse Grace A.", "No", "", "", "", "DVT prophylaxis — check platelets before next dose"),
(9, "Nour Abdallah", "MRN-009567", "ER-06", "Ceftriaxone", "Ceftriaxone sodium","2 g", "IV", "12/07/2026", "14:30", "RN Hassan Y.", "Yes", "Rash — urticarial rash on trunk", "Antihistamine given", "Dr. Ali — 14:38", "Possible beta-lactam sensitivity — allergy flag updated"),
(10, "Leila Nasser", "MRN-010890", "ICU-2", "Propofol", "Propofol", "50 mg/hr", "IV infusion","12/07/2026","15:00","RN Zainab F.", "No", "", "", "", "Sedation — BIS monitoring; daily wake-up trial at 08:00"),
]
row_fills_normal = [BLUE_LIGHT, WHITE]
for i, row_data in enumerate(sample_data):
r = 10 + i
ws_mar.row_dimensions[r].height = 22
bg = row_fills_normal[i % 2]
cols = ['B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q']
for j, col in enumerate(cols):
c = ws_mar[f'{col}{r}']
c.value = row_data[j]
c.font = body_font(size=9)
c.fill = fill(RED_LIGHT if row_data[12] == "Yes" and col in ['M','N','O','P'] else bg)
c.alignment = left_align(wrap=True)
c.border = thin_border()
# ── 10 blank input rows ────────────────────────────────────────────
for i in range(10):
r = 20 + i
ws_mar.row_dimensions[r].height = 22
bg = row_fills_normal[i % 2]
for j, col in enumerate(['B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q']):
c = ws_mar[f'{col}{r}']
c.value = (i + 11) if col == 'B' else ""
c.font = body_font(size=9)
c.fill = fill(bg)
c.alignment = left_align(wrap=True)
c.border = thin_border()
# ── Data Validation — Adverse Reaction column (M) ─────────────────
dv_yn = DataValidation(type="list", formula1='"Yes,No,Pending"', allow_blank=True)
dv_yn.sqref = "M10:M29"
ws_mar.add_data_validation(dv_yn)
# ── Data Validation — Route column (I) ────────────────────────────
dv_route = DataValidation(type="list", formula1='"IV,IM,SC,PO,SL,PR,INH,Topical,IV infusion,NG,Other"', allow_blank=True)
dv_route.sqref = "I10:I29"
ws_mar.add_data_validation(dv_route)
# ── Conditional formatting — highlight "Yes" adverse reactions ─────
from openpyxl.formatting.rule import CellIsRule
red_fill_cf = PatternFill("solid", fgColor=RED_LIGHT)
red_font_cf = Font(name='Arial', size=9, bold=True, color=RED_DARK)
ds = DifferentialStyle(fill=red_fill_cf, font=red_font_cf)
rule = CellIsRule(operator='equal', formula=['"Yes"'], stopIfTrue=True, dxf=ds)
ws_mar.conditional_formatting.add('M10:M29', rule)
# ── Freeze panes ───────────────────────────────────────────────────
ws_mar.freeze_panes = 'C10'
# ── Summary / Totals row ───────────────────────────────────────────
summary_r = 30
ws_mar.row_dimensions[summary_r].height = 20
ws_mar.merge_cells(f'B{summary_r}:K{summary_r}')
c = ws_mar[f'B{summary_r}']
c.value = f"SHIFT SUMMARY — Total Administrations: {len(sample_data)} Adverse Reactions: {sum(1 for d in sample_data if d[12]=='Yes')} Incidents Reported: {sum(1 for d in sample_data if d[12]=='Yes')}"
c.font = Font(name='Arial', size=10, bold=True, color=WHITE)
c.fill = fill(GREY_DARK)
c.alignment = left_align(wrap=False)
c.border = thick_border()
ws_mar.merge_cells(f'L{summary_r}:Q{summary_r}')
c = ws_mar[f'L{summary_r}']
c.value = "Charge Nurse Signature: _________________________ Time Completed: ____________"
c.font = Font(name='Arial', size=9, bold=False, color=WHITE)
c.fill = fill(GREY_DARK)
c.alignment = left_align(wrap=False)
c.border = thick_border()
# ══════════════════════════════════════════════════════════════════
# SHEET 3 — ADVERSE REACTION TRACKER
# ══════════════════════════════════════════════════════════════════
ws_adr = wb.create_sheet("Adverse Reaction Tracker")
ws_adr.sheet_view.showGridLines = False
adr_cols = {
'A': 3, 'B': 6, 'C': 20, 'D': 14, 'E': 22,
'F': 14, 'G': 28, 'H': 18, 'I': 14,
'J': 28, 'K': 22, 'L': 18, 'M': 3
}
for col, width in adr_cols.items():
ws_adr.column_dimensions[col].width = width
ws_adr.row_dimensions[1].height = 8
ws_adr.row_dimensions[2].height = 44
ws_adr.row_dimensions[3].height = 20
ws_adr.merge_cells('B2:L2')
c = ws_adr['B2']
c.value = "🔴 ADVERSE DRUG REACTION (ADR) TRACKER — Emergency Department"
c.font = Font(name='Arial', size=14, bold=True, color=WHITE)
c.fill = fill(RED_DARK)
c.alignment = center()
c.border = thick_border()
ws_adr.merge_cells('B3:L3')
c = ws_adr['B3']
c.value = "All adverse reactions MUST be documented here AND reported to the doctor AND an incident form submitted to the pharmacy within 24 hours"
c.font = Font(name='Arial', size=9, italic=True, color=WHITE)
c.fill = fill(ORANGE_DARK)
c.alignment = center()
adr_headers = [
('B', '#', RED_DARK),
('C', 'Patient Name', RED_DARK),
('D', 'MRN', RED_DARK),
('E', 'Drug Implicated', RED_DARK),
('F', 'Dose Given', RED_DARK),
('G', 'Reaction Description\n(Signs & Symptoms)', RED_DARK),
('H', 'Onset Time\n(Time reaction appeared)', RED_DARK),
('I', 'Severity\n(Mild/Moderate/Severe)', RED_DARK),
('J', 'Management\n(Treatment given)', RED_DARK),
('K', 'Doctor Notified\n(Name & Time)', RED_DARK),
('L', 'Incident Form Submitted?\n(Yes/No + Ref No.)', RED_DARK),
]
ws_adr.row_dimensions[5].height = 36
for col, title, color in adr_headers:
c = ws_adr[f'{col}5']
c.value = title
c.font = Font(name='Arial', size=9, bold=True, color=WHITE)
c.fill = fill(color)
c.alignment = center(wrap=True)
c.border = thin_border()
# Sample ADR data (from MAR reactions)
adr_data = [
(1, "Samira Al-Rashid", "MRN-002567", "Morphine Sulphate 5 mg IV", "5 mg IV", "Nausea and vomiting — onset ~10 min after administration. No respiratory depression. SpO2 98%.", "09:10", "Mild", "IV Ondansetron 4mg administered. Vitals monitored every 15 min. Drug not discontinued.", "Dr. Khan — 09:12", "Yes — IR-2026-0712-001"),
(2, "Priya Sharma", "MRN-004102", "Metoprolol 5 mg IV", "5 mg IV", "Severe bradycardia — HR dropped to 42 bpm. BP stable at 110/70. Patient conscious.", "11:05", "Severe", "IV Atropine 0.6 mg given stat. ECG monitoring commenced. Cardiology team paged.", "Dr. Mehta — 11:08", "Yes — IR-2026-0712-002"),
(3, "Chen Wei", "MRN-006678", "Amiodarone 300 mg IV", "300 mg IV", "Hypotension — BP dropped to 78/42 mmHg during infusion. Given in cardiac arrest context.", "12:04", "Severe", "IV fluid bolus 500 mL NaCl 0.9% given. Infusion rate reviewed. ROSC achieved.", "Dr. Singh — 12:07", "Yes — IR-2026-0712-003"),
(4, "Nour Abdallah", "MRN-009567", "Ceftriaxone 2g IV", "2 g IV", "Urticarial rash across trunk and arms — onset within 20 min of infusion. No anaphylaxis signs.", "14:50", "Moderate", "Infusion stopped. IV chlorphenamine 10 mg given. Adrenaline on standby. Rash resolved.", "Dr. Ali — 14:38", "Yes — IR-2026-0712-004"),
]
for i, row_data in enumerate(adr_data):
r = 6 + i
ws_adr.row_dimensions[r].height = 40
bg = RED_LIGHT if i % 2 == 0 else ORANGE_LIGHT
for j, col in enumerate(['B','C','D','E','F','G','H','I','J','K','L']):
c = ws_adr[f'{col}{r}']
c.value = row_data[j]
c.font = Font(name='Arial', size=9, color=GREY_DARK,
bold=(col in ['I'] and row_data[8] == 'Severe'))
c.fill = fill(bg)
c.alignment = left_align(wrap=True)
c.border = thin_border()
# Blank rows
for i in range(6):
r = 10 + i
ws_adr.row_dimensions[r].height = 30
bg = row_fills_normal[i % 2]
for col in ['B','C','D','E','F','G','H','I','J','K','L']:
c = ws_adr[f'{col}{r}']
c.value = (len(adr_data) + i + 1) if col == 'B' else ""
c.font = body_font(size=9)
c.fill = fill(bg)
c.alignment = left_align(wrap=True)
c.border = thin_border()
ws_adr.freeze_panes = 'C6'
# ══════════════════════════════════════════════════════════════════
# SAVE
# ══════════════════════════════════════════════════════════════════
output_path = "/home/daytona/workspace/emergency-nursing/Emergency_Patient_Data_MAR.xlsx"
wb.save(output_path)
print(f"Saved: {output_path}")
cd /home/daytona/workspace/emergency-nursing && python create_emergency_sheets.p…
~/emergency-nursing/create_emergency_sheets.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/emergency-nursing/create_emergency_sheets.py'
cd /home/daytona/workspace/emergency-nursing && python create_emergency_sheets.p…
python3 -c "import openpyxl; wb = openpyxl.Workbook(); ws = wb.active; ws['A1'] …
python3 -c "import xlsxwriter; wb = xlsxwriter.Workbook('/home/daytona/workspace…
pip install --user xlsxwriter -q && python3 -c "import xlsxwriter; print('xlsxwr…
~/emergency-nursing/create_emergency_xlsxwriter.py
import xlsxwriter
from datetime import datetime
OUTPUT = "/home/daytona/workspace/emergency-nursing/Emergency_Patient_Data_MAR.xlsx"
wb = xlsxwriter.Workbook(OUTPUT)
# ──────────────────────────────────────────────────────────────────
# COLOUR PALETTE
# ──────────────────────────────────────────────────────────────────
C = {
'red_dark': '#C0392B', 'red_light': '#FADBD8',
'blue_dark': '#1A5276', 'blue_med': '#2E86C1', 'blue_light': '#D6EAF8',
'teal_dark': '#0E6655', 'teal_light': '#D1F2EB',
'orange_dark': '#BA4A00', 'orange_light': '#FAE5D3',
'grey_dark': '#2C3E50', 'grey_light': '#ECF0F1',
'yellow': '#F9E79F', 'green': '#D5F5E3',
'white': '#FFFFFF',
}
def fmt(wb, bg, fc='#2C3E50', bold=False, sz=10, wrap=True, align='left', border=1, italic=False):
f = wb.add_format({
'bg_color': bg, 'font_color': fc, 'bold': bold,
'font_name': 'Arial', 'font_size': sz,
'text_wrap': wrap, 'valign': 'vcenter', 'align': align,
'border': border, 'border_color': '#AAAAAA',
'italic': italic,
})
return f
# ══════════════════════════════════════════════════════════════════
# SHEET 1 — QUICK REFERENCE GUIDE
# ══════════════════════════════════════════════════════════════════
ws1 = wb.add_worksheet("Quick Reference Guide")
ws1.hide_gridlines(2)
ws1.set_column('A:A', 2)
ws1.set_column('B:B', 28)
ws1.set_column('C:C', 52)
ws1.set_column('D:D', 2)
# Title
ws1.set_row(0, 8)
ws1.set_row(1, 46)
ws1.set_row(2, 22)
ws1.set_row(3, 10)
title_fmt = fmt(wb, C['red_dark'], fc='#FFFFFF', bold=True, sz=16, align='center', wrap=False)
sub_fmt = fmt(wb, C['grey_dark'], fc='#FFFFFF', sz=9, align='center', italic=True, wrap=False)
ws1.merge_range('B2:C2', "🏥 EMERGENCY PATIENT DATA — QUICK REFERENCE GUIDE", title_fmt)
ws1.merge_range('B3:C3',
f"Nursing Department | Use in Emergency / Code Situations | Version 1.0 | {datetime.today().strftime('%B %Y')}",
sub_fmt)
def sec_hdr(ws, row, title, color, wb=wb):
ws.set_row(row-1, 24)
f = fmt(wb, color, fc='#FFFFFF', bold=True, sz=11, align='left', wrap=False)
ws.merge_range(f'B{row}:C{row}', f" {title}", f)
def qrg_row(ws, row, col_b, col_c, bg, bold_b=False, wb=wb):
ws.set_row(row-1, 20)
fb = fmt(wb, bg, bold=bold_b, sz=10, align='left')
fc = fmt(wb, bg, sz=10, align='left', wrap=True)
ws.write(f'B{row}', col_b, fb)
ws.write(f'C{row}', col_c, fc)
def space(ws, row, h=8):
ws.set_row(row-1, h)
f_empty = fmt(wb, C['white'], border=0)
ws.merge_range(f'B{row}:C{row}', '', f_empty)
# Section 1
sec_hdr(ws1, 5, "STEP 1 — LOG IN TO THE EHR SYSTEM", C['blue_dark'])
qrg_row(ws1, 6, "Action", "Detail", C['blue_light'], True)
qrg_row(ws1, 7, "Workstation Login", "Enter Username + Password OR tap smart card / badge on reader", C['blue_light'])
qrg_row(ws1, 8, "Emergency Override","Use 'Break-Glass' access if patient not assigned to you; auto-logged", C['yellow'])
qrg_row(ws1, 9, "Biometric Login", "Fingerprint scanner available at ICU, ED, and HDU terminals", C['blue_light'])
qrg_row(ws1, 10, "System Down?", "Use printed Downtime Summary Sheet from nursing station red folder",C['orange_light'])
space(ws1, 11)
sec_hdr(ws1, 12, "STEP 2 — IDENTIFY THE CORRECT PATIENT", C['teal_dark'])
qrg_row(ws1, 13, "Identifier", "Use at Least TWO to Confirm Identity", C['teal_light'], True)
qrg_row(ws1, 14, "Hospital MRN", "Fastest — type directly in Patient Search bar", C['teal_light'])
qrg_row(ws1, 15, "Full Name + DOB", "Name + Date of Birth — always confirm both", C['teal_light'])
qrg_row(ws1, 16, "Wristband Barcode", "Scan patient's wristband to open record instantly", C['green'])
qrg_row(ws1, 17, "Ward + Bed Number", "Use if MRN unknown during ward emergency", C['teal_light'])
qrg_row(ws1, 18, "⚠ Never One Identifier","Confirm TWO identifiers before accessing or acting on data", C['yellow'])
space(ws1, 19)
sec_hdr(ws1, 20, "STEP 3 — ACCESS LAB RESULTS", C['blue_med'])
qrg_row(ws1, 21, "Navigation", "Patient Record → 'Results' or 'Laboratory' Tab", C['blue_light'], True)
qrg_row(ws1, 22, "View Latest First","Results in reverse chronological order — newest on top", C['blue_light'])
qrg_row(ws1, 23, "Critical Value", "Red highlight / alarm icon = result needs IMMEDIATE action", C['red_light'])
qrg_row(ws1, 24, "Quick View Panel", "Use 'Most Recent Results' summary to avoid scrolling", C['blue_light'])
qrg_row(ws1, 25, "Key Emergency Labs","FBC | U&E | Blood Gas | Glucose | Troponin | Coagulation | LFTs", C['yellow'])
qrg_row(ws1, 26, "Blood Gas (ABG)", "pH, pO2, pCO2, HCO3, Lactate — under 'Point of Care' tab", C['blue_light'])
space(ws1, 27)
sec_hdr(ws1, 28, "STEP 4 — ACCESS MEDICATION LIST & ALLERGIES", C['orange_dark'])
qrg_row(ws1, 29, "Navigation", "Patient Record → 'Medications' or 'MAR' Tab", C['orange_light'], True)
qrg_row(ws1, 30, "Allergy Alert", "Red banner at TOP of patient record — check FIRST", C['red_light'])
qrg_row(ws1, 31, "Active Medications", "Current drugs with dose, route, frequency, last dose time", C['orange_light'])
qrg_row(ws1, 32, "High-Risk Drugs", "Anticoagulants | Insulin | Opioids | Cardiac drugs | Steroids", C['yellow'])
qrg_row(ws1, 33, "On-Hold/Discontinued","Marked separately — important for full clinical picture", C['orange_light'])
qrg_row(ws1, 34, "Before Giving Anything","Confirm: Right Patient | Right Drug | Right Dose | Right Route | Right Time", C['red_light'])
space(ws1, 35)
sec_hdr(ws1, 36, "STEP 5 — ACCESS PREVIOUS MEDICAL HISTORY", C['teal_dark'])
qrg_row(ws1, 37, "Navigation", "Patient Record → 'Summary' or 'Problem List' or 'History' Tab", C['teal_light'], True)
qrg_row(ws1, 38, "One-Page Summary", "Use Patient Summary / Dashboard — all key info on one screen", C['green'])
qrg_row(ws1, 39, "Active Diagnoses", "Chronic conditions relevant to emergency (DM, CCF, COPD, epilepsy)",C['teal_light'])
qrg_row(ws1, 40, "Previous Surgeries", "Prior cardiac, neuro, or abdominal surgery especially important", C['teal_light'])
qrg_row(ws1, 41, "Discharge Summaries","Under 'Documents' tab — recent hospital admissions", C['teal_light'])
qrg_row(ws1, 42, "Baseline Vitals", "Compare current vitals against patient's usual baseline", C['yellow'])
space(ws1, 43)
sec_hdr(ws1, 44, "STEP 6 — CLINICAL DECISION SUPPORT & ALERTS", C['grey_dark'])
qrg_row(ws1, 45, "NEWS / EWS Score", "Auto-calculated from vitals — triggers escalation protocol", C['grey_light'], True)
qrg_row(ws1, 46, "Drug Interaction Alert","System warns before giving contraindicated drug combination", C['yellow'])
qrg_row(ws1, 47, "Allergy Pop-Up", "Mandatory acknowledgment before administering flagged drug", C['red_light'])
qrg_row(ws1, 48, "Critical Result Push", "Lab pushes urgent results to nurse's EHR dashboard / mobile", C['grey_light'])
qrg_row(ws1, 49, "Rapid Response Trigger","Follow hospital protocol when NEWS >= 7 or single extreme score",C['red_light'])
space(ws1, 50)
sec_hdr(ws1, 51, "⚠ SYSTEM DOWNTIME — EMERGENCY BACKUP PROCEDURE", C['red_dark'])
qrg_row(ws1, 52, "Downtime Sheets", "Printed patient summary in RED FOLDER at nursing station (updated each shift)", C['red_light'], True)
qrg_row(ws1, 53, "Paper MAR Chart", "Manual medication chart maintained as backup — check drug cupboard folder", C['orange_light'])
qrg_row(ws1, 54, "Lab Results", "Call lab directly: Ext. ____ | Request verbal critical results", C['yellow'])
qrg_row(ws1, 55, "Pharmacy Queries", "Call pharmacy directly: Ext. ____ | For drug info and interactions", C['yellow'])
qrg_row(ws1, 56, "Document Actions", "Record on paper — enter retrospectively when system is restored", C['orange_light'])
qrg_row(ws1, 57, "Report Downtime", "Notify IT Help Desk immediately: Ext. ____ | Log incident number", C['red_light'])
space(ws1, 58)
ws1.set_row(58, 20)
footer_fmt = fmt(wb, C['grey_dark'], fc='#95A5A6', sz=8, italic=True, align='center', wrap=False)
ws1.merge_range('B59:C59',
f"Approved by: Nursing Superintendent | Review Date: {datetime.today().strftime('%B %Y')} | For internal clinical use only",
footer_fmt)
# ══════════════════════════════════════════════════════════════════
# SHEET 2 — MEDICATION ADMINISTRATION RECORD (MAR)
# ══════════════════════════════════════════════════════════════════
ws2 = wb.add_worksheet("Medication Admin Record (MAR)")
ws2.hide_gridlines(2)
# Column widths
ws2.set_column('A:A', 2)
ws2.set_column('B:B', 5) # #
ws2.set_column('C:C', 22) # Patient Name
ws2.set_column('D:D', 13) # MRN
ws2.set_column('E:E', 8) # Ward/Bed
ws2.set_column('F:F', 24) # Medication
ws2.set_column('G:G', 18) # Generic
ws2.set_column('H:H', 13) # Dosage
ws2.set_column('I:I', 13) # Route
ws2.set_column('J:J', 13) # Date
ws2.set_column('K:K', 11) # Time
ws2.set_column('L:L', 22) # Administered By
ws2.set_column('M:M', 16) # Adverse Reaction
ws2.set_column('N:N', 30) # Reaction Details
ws2.set_column('O:O', 22) # Action Taken
ws2.set_column('P:P', 20) # Doctor Notified
ws2.set_column('Q:Q', 22) # Notes
ws2.set_column('R:R', 2)
# Row heights
ws2.set_row(0, 8)
ws2.set_row(1, 46)
ws2.set_row(2, 22)
ws2.set_row(3, 18)
ws2.set_row(4, 18)
ws2.set_row(5, 18)
ws2.set_row(6, 14)
ws2.set_row(7, 36)
# Title
title2 = fmt(wb, C['red_dark'], fc='#FFFFFF', bold=True, sz=15, align='center', wrap=False)
sub2 = fmt(wb, C['grey_dark'], fc='#FFFFFF', sz=9, align='left', wrap=False)
ws2.merge_range('B2:Q2', "🏥 EMERGENCY MEDICATION ADMINISTRATION RECORD (MAR)", title2)
ws2.merge_range('B3:Q3',
"Ward: _________________ Date: _________________ Shift: □ Morning □ Evening □ Night Charge Nurse: _________________________",
sub2)
# Alert banners
alert_data = [
('B4:H4', "⚠ ALLERGY CHECK: Confirm allergy status BEFORE administering any drug", C['red_dark']),
('I4:Q4', "⚠ 5 RIGHTS: Right Patient | Right Drug | Right Dose | Right Route | Right Time", C['orange_dark']),
('B5:H5', "✅ Document IMMEDIATELY after administration — never pre-document", C['teal_dark']),
('I5:Q5', "🔴 Report ANY adverse reaction to the doctor and complete an incident form", C['blue_dark']),
]
for cells, text, color in alert_data:
ws2.merge_range(cells, text, fmt(wb, color, fc='#FFFFFF', bold=True, sz=9, align='left', wrap=False))
# Column group labels (row 7)
groups = [
('C7:E7', 'PATIENT IDENTIFICATION', C['blue_dark']),
('F7:I7', 'MEDICATION DETAILS', C['teal_dark']),
('J7:L7', 'ADMINISTRATION', C['blue_med']),
('M7:P7', 'ADVERSE REACTION MONITORING', C['red_dark']),
('Q7:Q7', 'NOTES', C['grey_dark']),
]
for cells, label, color in groups:
ws2.merge_range(cells, label, fmt(wb, color, fc='#FFFFFF', bold=True, sz=8, align='center', wrap=False))
# Column headers (row 8)
hdrs = [
('B8', '#', C['grey_dark']),
('C8', 'Patient Full Name', C['blue_dark']),
('D8', 'MRN / Hospital ID', C['blue_dark']),
('E8', 'Ward / Bed', C['blue_dark']),
('F8', 'Medication Name\n(Brand)', C['teal_dark']),
('G8', 'Generic / INN Name', C['teal_dark']),
('H8', 'Dosage\n(Amount + Unit)', C['teal_dark']),
('I8', 'Route\n(IV/IM/PO/SC etc.)', C['teal_dark']),
('J8', 'Date\n(DD/MM/YYYY)', C['blue_med']),
('K8', 'Time Given\n(HH:MM 24hr)', C['blue_med']),
('L8', 'Administered By\n(Name + Designation)', C['blue_med']),
('M8', 'Adverse\nReaction?\n(Yes/No)', C['red_dark']),
('N8', 'Reaction Details\n(Signs & Symptoms)', C['red_dark']),
('O8', 'Action Taken\n(Treatment given)', C['red_dark']),
('P8', 'Doctor Notified?\n(Name + Time)', C['red_dark']),
('Q8', 'Additional Notes', C['grey_dark']),
]
for cell, title, color in hdrs:
ws2.write(cell, title, fmt(wb, color, fc='#FFFFFF', bold=True, sz=9, align='center', wrap=True))
# Data rows
sample_data = [
(1, "Ahmed Hassan", "MRN-001234","ER-01","Adrenaline (Epinephrine)","Epinephrine", "0.5 mg", "IM", "12/07/2026","08:15","Sr. Nurse Fatima A.","No", "", "", "", "Given for anaphylaxis — 2nd dose at 08:30 if no response"),
(2, "Samira Al-Rashid", "MRN-002567","ER-02","Morphine Sulphate", "Morphine", "5 mg", "IV", "12/07/2026","09:00","Sr. Nurse Layla M.", "Yes","Nausea, vomiting — onset 10 min", "IV Ondansetron 4 mg", "Dr. Khan — 09:12", "Vitals monitored q15min post-dose"),
(3, "James Owusu", "MRN-003891","ICU-3","Noradrenaline", "Norepinephrine", "0.1 mcg/kg/min", "IV infusion","12/07/2026","10:30","RN Thomas B.", "No", "", "", "", "Septic shock — titrate per MAP target 65 mmHg"),
(4, "Priya Sharma", "MRN-004102","HDU-2","Metoprolol", "Metoprolol", "5 mg", "IV", "12/07/2026","11:00","Sr. Nurse Rina P.", "Yes","Bradycardia — HR dropped to 42 bpm", "IV Atropine 0.6 mg", "Dr. Mehta — 11:08", "ECG monitoring commenced; cardiologist paged"),
(5, "Mohammed Al-Farsi", "MRN-005345","ER-04","Dextrose 50%", "Glucose", "50 mL", "IV bolus", "12/07/2026","11:45","RN Ayesha K.", "No", "", "", "", "BGL 1.8 mmol/L — hypoglycaemia protocol activated"),
(6, "Chen Wei", "MRN-006678","ER-05","Amiodarone", "Amiodarone HCl", "300 mg", "IV", "12/07/2026","12:00","Sr. Nurse David O.", "Yes","Hypotension — BP 78/42 mmHg", "IV fluid bolus 500 mL","Dr. Singh — 12:07", "VF arrest — given during resuscitation"),
(7, "Fatima Al-Zahra", "MRN-007901","ICU-1","Furosemide", "Furosemide", "80 mg", "IV", "12/07/2026","13:30","RN Mariam S.", "No", "", "", "", "Fluid overload — urine output monitoring hourly"),
(8, "Robert Mensah", "MRN-008234","HDU-4","Heparin", "Unfractionated Heparin","5000 IU","SC", "12/07/2026","14:00","Sr. Nurse Grace A.", "No", "", "", "", "DVT prophylaxis — check platelets before next dose"),
(9, "Nour Abdallah", "MRN-009567","ER-06","Ceftriaxone", "Ceftriaxone sodium","2 g", "IV", "12/07/2026","14:30","RN Hassan Y.", "Yes","Urticarial rash on trunk — onset 20 min","Antihistamine IV", "Dr. Ali — 14:38", "Possible beta-lactam sensitivity — allergy flag updated"),
(10, "Leila Nasser", "MRN-010890","ICU-2","Propofol", "Propofol", "50 mg/hr", "IV infusion","12/07/2026","15:00","RN Zainab F.", "No", "", "", "", "Sedation — BIS monitoring; daily wake-up trial at 08:00"),
]
for i, row in enumerate(sample_data):
r = 8 + i # 0-indexed row number (row 9 in Excel = index 8)
ws2.set_row(r, 22)
bg = C['blue_light'] if i % 2 == 0 else C['white']
is_reaction = row[11] == "Yes"
cols = ['B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q']
for j, col in enumerate(cols):
cell_bg = C['red_light'] if (is_reaction and col in ['M','N','O','P']) else bg
ws2.write(f'{col}{r+1}', row[j],
fmt(wb, cell_bg, sz=9, align='left', wrap=True,
bold=(col == 'M' and is_reaction)))
# 10 blank input rows
for i in range(10):
r = 18 + i
ws2.set_row(r, 22)
bg = C['blue_light'] if i % 2 == 0 else C['white']
for j, col in enumerate(['B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q']):
ws2.write(f'{col}{r+1}',
(i + 11) if col == 'B' else "",
fmt(wb, bg, sz=9, align='left', wrap=True))
# Data validation: Adverse Reaction (M column), rows 9-28
ws2.data_validation('M9:M28', {
'validate': 'list',
'source': ['Yes', 'No', 'Pending'],
'input_title': 'Adverse Reaction?',
'input_message': 'Select Yes, No, or Pending',
})
# Data validation: Route (I column), rows 9-28
ws2.data_validation('I9:I28', {
'validate': 'list',
'source': ['IV', 'IM', 'SC', 'PO', 'SL', 'PR', 'INH', 'Topical', 'IV infusion', 'NG', 'Other'],
'input_title': 'Route',
'input_message': 'Select the administration route',
})
# Conditional formatting — highlight Yes in red
ws2.conditional_format('M9:M28', {
'type': 'cell', 'criteria': '==', 'value': '"Yes"',
'format': fmt(wb, C['red_light'], fc=C['red_dark'], bold=True, sz=9),
})
# Freeze panes
ws2.freeze_panes(8, 2) # Freeze row 9 and columns A-B
# Summary row
ws2.set_row(28, 22)
reactions = sum(1 for d in sample_data if d[11] == 'Yes')
ws2.merge_range('B29:L29',
f"SHIFT SUMMARY — Total Administrations: {len(sample_data)} Adverse Reactions: {reactions} Incidents Reported: {reactions}",
fmt(wb, C['grey_dark'], fc='#FFFFFF', bold=True, sz=10, align='left', wrap=False))
ws2.merge_range('M29:Q29',
"Charge Nurse Signature: _________________________ Time: ____________",
fmt(wb, C['grey_dark'], fc='#FFFFFF', sz=9, align='left', wrap=False))
# ══════════════════════════════════════════════════════════════════
# SHEET 3 — ADVERSE REACTION TRACKER
# ══════════════════════════════════════════════════════════════════
ws3 = wb.add_worksheet("Adverse Reaction Tracker")
ws3.hide_gridlines(2)
ws3.set_column('A:A', 2)
ws3.set_column('B:B', 5)
ws3.set_column('C:C', 20)
ws3.set_column('D:D', 14)
ws3.set_column('E:E', 22)
ws3.set_column('F:F', 14)
ws3.set_column('G:G', 30)
ws3.set_column('H:H', 14)
ws3.set_column('I:I', 14)
ws3.set_column('J:J', 30)
ws3.set_column('K:K', 22)
ws3.set_column('L:L', 20)
ws3.set_column('M:M', 2)
ws3.set_row(0, 8)
ws3.set_row(1, 44)
ws3.set_row(2, 20)
ws3.set_row(3, 10)
ws3.set_row(4, 36)
ws3.merge_range('B2:L2',
"🔴 ADVERSE DRUG REACTION (ADR) TRACKER — Emergency Department",
fmt(wb, C['red_dark'], fc='#FFFFFF', bold=True, sz=14, align='center', wrap=False))
ws3.merge_range('B3:L3',
"All adverse reactions MUST be documented here, reported to the doctor, and an incident form submitted to pharmacy within 24 hours",
fmt(wb, C['orange_dark'], fc='#FFFFFF', sz=9, italic=True, align='center', wrap=False))
adr_hdrs = [
('B5', '#', C['red_dark']),
('C5', 'Patient Name', C['red_dark']),
('D5', 'MRN', C['red_dark']),
('E5', 'Drug Implicated', C['red_dark']),
('F5', 'Dose Given', C['red_dark']),
('G5', 'Reaction Description\n(Signs & Symptoms)',C['red_dark']),
('H5', 'Onset Time\n(When reaction appeared)', C['red_dark']),
('I5', 'Severity\n(Mild/Moderate/Severe)', C['red_dark']),
('J5', 'Management\n(Treatment given)', C['red_dark']),
('K5', 'Doctor Notified\n(Name & Time)', C['red_dark']),
('L5', 'Incident Form?\n(Yes/No + Ref No.)', C['red_dark']),
]
for cell, title, color in adr_hdrs:
ws3.write(cell, title, fmt(wb, color, fc='#FFFFFF', bold=True, sz=9, align='center', wrap=True))
adr_data = [
(1, "Samira Al-Rashid","MRN-002567","Morphine Sulphate 5 mg IV","5 mg IV",
"Nausea and vomiting — onset ~10 min. No respiratory depression. SpO2 98%.",
"09:10","Mild","IV Ondansetron 4mg. Vitals q15min. Drug not discontinued.","Dr. Khan — 09:12","Yes — IR-2026-0712-001"),
(2, "Priya Sharma", "MRN-004102","Metoprolol 5 mg IV", "5 mg IV",
"Severe bradycardia — HR 42 bpm. BP stable 110/70. Patient conscious.",
"11:05","Severe","IV Atropine 0.6mg stat. ECG commenced. Cardiology paged.","Dr. Mehta — 11:08","Yes — IR-2026-0712-002"),
(3, "Chen Wei", "MRN-006678","Amiodarone 300 mg IV", "300 mg IV",
"Hypotension — BP 78/42 mmHg during infusion. Cardiac arrest context.",
"12:04","Severe","IV fluid bolus 500 mL NaCl 0.9%. Infusion rate reviewed. ROSC achieved.","Dr. Singh — 12:07","Yes — IR-2026-0712-003"),
(4, "Nour Abdallah", "MRN-009567","Ceftriaxone 2g IV", "2 g IV",
"Urticarial rash across trunk and arms — onset 20 min. No anaphylaxis signs.",
"14:50","Moderate","Infusion stopped. IV chlorphenamine 10mg. Adrenaline on standby. Resolved.","Dr. Ali — 14:38","Yes — IR-2026-0712-004"),
]
for i, row in enumerate(adr_data):
r = 5 + i
ws3.set_row(r, 40)
bg = C['red_light'] if i % 2 == 0 else C['orange_light']
for j, col in enumerate(['B','C','D','E','F','G','H','I','J','K','L']):
is_severe = row[7] == 'Severe'
ws3.write(f'{col}{r+1}', row[j],
fmt(wb, bg, sz=9, align='left', wrap=True,
bold=(col == 'I' and is_severe), fc='#C0392B' if (col == 'I' and is_severe) else '#2C3E50'))
# Blank rows
for i in range(6):
r = 9 + i
ws3.set_row(r, 30)
bg = C['white'] if i % 2 == 0 else C['grey_light']
for j, col in enumerate(['B','C','D','E','F','G','H','I','J','K','L']):
ws3.write(f'{col}{r+1}',
(len(adr_data) + i + 1) if col == 'B' else "",
fmt(wb, bg, sz=9, align='left', wrap=True))
# Severity validation
ws3.data_validation('I6:I14', {
'validate': 'list',
'source': ['Mild', 'Moderate', 'Severe', 'Life-threatening'],
'input_title': 'Reaction Severity',
'input_message': 'Select severity level',
})
ws3.freeze_panes(5, 2)
# ══════════════════════════════════════════════════════════════════
# SAVE
# ══════════════════════════════════════════════════════════════════
wb.close()
print(f"Saved to: {OUTPUT}")
cd /home/daytona/workspace/emergency-nursing && python create_emergency_xlsxwrit…
# Test if the issue is with the target path - try /tmp first python3 -c " import…
# Write to /tmp first then copy to workspace sed -i 's|OUTPUT = "/home/daytona/w…
# Write a clean script using /tmp as output then copy python3 << 'PYEOF' import …
cp /tmp/Emergency_Patient_Data_MAR.xlsx /home/daytona/workspace/emergency-nursin…
Emergency Patient Data MAR
Spreadsheet · XLSX
| Step | Content |
|---|---|
| Step 1 | Log in to EHR (password, badge, biometric, break-glass) |
| Step 2 | Identify the patient (MRN, DOB, wristband scan, 2-identifier rule) |
| Step 3 | Access Lab Results (navigation, critical value flags, key emergency panels) |
| Step 4 | Access Medication List & Allergies (allergy banner, high-risk drugs, 5 Rights) |
| Step 5 | Access Medical History (one-page summary, diagnoses, discharge summaries) |
| Step 6 | Clinical Decision Support Alerts (NEWS score, drug interaction pop-ups) |
| Downtime | Backup procedure when the system is unavailable |
| Group | Columns | Colour |
|---|---|---|
| Patient Identification | Patient Name, MRN, Ward/Bed | Blue |
| Medication Details | Drug Name, Generic Name, Dosage, Route | Teal |
| Administration | Date, Time Given, Administered By | Medium Blue |
| Adverse Reaction Monitoring | Reaction? (Yes/No), Details, Action, Doctor Notified | Red |
MAR_ER_12072026_Morning.xlsx)a nurse needs to track medication administration for 20 pateints create an excel sheet to record the medication name , dosage , time of administration , and any adverse reaction . how would you structure this sheet to complete the task
python3 << 'PYEOF' import xlsxwriter from datetime import datetime OUTPUT = "/t…
pip install --user xlsxwriter -q 2>/dev/null; python3 -c "import xlsxwriter; pri…
/tmp/build_mar20.py
import xlsxwriter
from datetime import datetime
OUTPUT = "/tmp/Medication_Administration_Record_20Patients.xlsx"
wb = xlsxwriter.Workbook(OUTPUT)
C = {
'red_dark':'#C0392B','red_light':'#FADBD8',
'blue_dark':'#1B4F72','blue_med':'#2E86C1','blue_light':'#D6EAF8',
'teal_dark':'#0E6655','teal_light':'#D1F2EB',
'orange_dark':'#BA4A00','orange_light':'#FAE5D3',
'green_dark':'#1E8449','green_light':'#D5F5E3',
'grey_dark':'#2C3E50','grey_light':'#F2F3F4',
'yellow':'#FEF9E7','white':'#FFFFFF',
}
def F(bg,fc='#2C3E50',bold=False,sz=10,wrap=True,align='left',border=1,italic=False):
return wb.add_format({'bg_color':bg,'font_color':fc,'bold':bold,'font_name':'Arial',
'font_size':sz,'text_wrap':wrap,'valign':'vcenter','align':align,
'border':border,'border_color':'#BDC3C7','italic':italic})
# ─────────────────────────────────────────────────────────────────
# SHEET 1 — MAR (20 Patients)
# ─────────────────────────────────────────────────────────────────
ws = wb.add_worksheet("MAR — 20 Patients")
ws.hide_gridlines(2)
ws.set_zoom(85)
ws.set_column('A:A',2); ws.set_column('B:B',4); ws.set_column('C:C',18)
ws.set_column('D:D',12);ws.set_column('E:E',7); ws.set_column('F:F',22)
ws.set_column('G:G',16);ws.set_column('H:H',12); ws.set_column('I:I',12)
ws.set_column('J:J',14);ws.set_column('K:K',12); ws.set_column('L:L',10)
ws.set_column('M:M',20);ws.set_column('N:N',13); ws.set_column('O:O',28)
ws.set_column('P:P',20);ws.set_column('Q:Q',18); ws.set_column('R:R',20)
ws.set_column('S:S',2)
ws.set_row(0,8); ws.set_row(1,50); ws.set_row(2,22)
ws.set_row(3,18); ws.set_row(4,18); ws.set_row(5,14); ws.set_row(6,38)
ws.merge_range('B2:R2',
"🏥 NURSING MEDICATION ADMINISTRATION RECORD (MAR) — WARD: _________________",
F(C['blue_dark'],fc='#FFFFFF',bold=True,sz=16,align='center',wrap=False))
ws.merge_range('B3:R3',
"Date: ___________ Shift: □ Morning □ Evening □ Night Charge Nurse: _________________________ Total Patients: 20",
F(C['grey_dark'],fc='#FFFFFF',sz=9,align='left',wrap=False))
ws.merge_range('B4:I4',"⚠ ALLERGY CHECK: Confirm allergy status BEFORE every administration",
F(C['red_dark'],fc='#FFFFFF',bold=True,sz=9,align='left',wrap=False))
ws.merge_range('J4:R4',"⚠ 5 RIGHTS: Right Patient | Right Drug | Right Dose | Right Route | Right Time",
F(C['orange_dark'],fc='#FFFFFF',bold=True,sz=9,align='left',wrap=False))
ws.merge_range('B5:I5',"✅ Document IMMEDIATELY after administration — NEVER pre-document",
F(C['teal_dark'],fc='#FFFFFF',bold=True,sz=9,align='left',wrap=False))
ws.merge_range('J5:R5',"🔴 ANY adverse reaction → stop drug, notify doctor, complete incident form within 1 hour",
F(C['red_dark'],fc='#FFFFFF',bold=True,sz=9,align='left',wrap=False))
# Group labels row 6
ws.merge_range('B6:E6','PATIENT IDENTIFICATION',F(C['blue_dark'],fc='#FFFFFF',bold=True,sz=8,align='center',wrap=False))
ws.merge_range('F6:J6','PRESCRIBED MEDICATION',F(C['teal_dark'],fc='#FFFFFF',bold=True,sz=8,align='center',wrap=False))
ws.merge_range('K6:M6','ADMINISTRATION RECORD',F(C['blue_med'],fc='#FFFFFF',bold=True,sz=8,align='center',wrap=False))
ws.merge_range('N6:Q6','ADVERSE REACTION MONITORING',F(C['red_dark'],fc='#FFFFFF',bold=True,sz=8,align='center',wrap=False))
ws.write('R6','NOTES',F(C['grey_dark'],fc='#FFFFFF',bold=True,sz=8,align='center',wrap=False))
# Column headers row 7
hcols = [
('B7','#',C['blue_dark']),
('C7','Patient Full Name',C['blue_dark']),
('D7','MRN / Hospital ID',C['blue_dark']),
('E7','Bed',C['blue_dark']),
('F7','Medication Name\n(Brand)',C['teal_dark']),
('G7','Generic / INN Name',C['teal_dark']),
('H7','Dosage\n(Amount + Unit)',C['teal_dark']),
('I7','Route\n(IV/IM/PO etc.)',C['teal_dark']),
('J7','Prescribed\nFrequency',C['teal_dark']),
('K7','Date\n(DD/MM/YYYY)',C['blue_med']),
('L7','Time Given\n(HH:MM)',C['blue_med']),
('M7','Administered By\n(Name + Role)',C['blue_med']),
('N7','Adverse\nReaction?\n(Yes / No)',C['red_dark']),
('O7','Reaction Details\n(Signs & Symptoms)',C['red_dark']),
('P7','Action Taken\n(Treatment given)',C['red_dark']),
('Q7','Doctor Notified?\n(Name + Time)',C['red_dark']),
('R7','Notes /\nSpecial Instructions',C['grey_dark']),
]
for cell,title,color in hcols:
ws.write(cell,title,F(color,fc='#FFFFFF',bold=True,sz=9,align='center',wrap=True))
# 20 patient rows
patients = [
(1, "Ahmed Hassan", "MRN-0001","B-01","Metformin", "Metformin HCl", "500 mg", "PO", "BD", "12/07/2026","08:00","Sr. Nurse Aisha K.", "No","","","","Diabetes — give with food"),
(2, "Samira Al-Rashid", "MRN-0002","B-02","Augmentin", "Amoxicillin-Clavulanate","625 mg", "PO", "TDS", "12/07/2026","08:00","RN Layla M.", "No","","","","Renal dose adjusted — check eGFR"),
(3, "James Owusu", "MRN-0003","B-03","Losartan", "Losartan Potassium", "50 mg", "PO", "OD", "12/07/2026","08:00","RN Thomas B.", "No","","","","Hold if SBP < 90 mmHg"),
(4, "Priya Sharma", "MRN-0004","B-04","Morphine Sulphate", "Morphine", "5 mg", "IV", "PRN (4 hrly)","12/07/2026","09:15","Sr. Nurse Rina P.", "Yes","Nausea and vomiting — onset 10 min post-dose","IV Ondansetron 4 mg given","Dr. Mehta — 09:28","Monitor SpO2 and RR q30min"),
(5, "Mohammed Al-Farsi", "MRN-0005","B-05","Amlodipine", "Amlodipine Besylate", "10 mg", "PO", "OD", "12/07/2026","08:00","RN Ayesha K.", "No","","","","Ankle oedema noted — document"),
(6, "Chen Wei", "MRN-0006","B-06","Furosemide", "Furosemide", "40 mg", "IV", "BD", "12/07/2026","08:00","Sr. Nurse David O.", "No","","","","Strict fluid balance — urine output hourly"),
(7, "Fatima Al-Zahra", "MRN-0007","B-07","Warfarin", "Warfarin Sodium", "3 mg", "PO", "OD (18:00)", "12/07/2026","18:00","RN Mariam S.", "No","","","","Check INR before giving — target 2-3"),
(8, "Robert Mensah", "MRN-0008","B-08","Ceftriaxone", "Ceftriaxone Sodium", "1 g", "IV", "OD", "12/07/2026","10:00","Sr. Nurse Grace A.", "Yes","Urticarial rash on trunk and arms — onset 15 min","Infusion stopped. IV Chlorphenamine 10mg given","Dr. Ali — 10:18","Allergy flag updated in EHR"),
(9, "Nour Abdallah", "MRN-0009","B-09","Heparin (LMWH)", "Enoxaparin", "40 mg", "SC", "OD", "12/07/2026","08:00","RN Hassan Y.", "No","","","","Rotate injection sites — record site used"),
(10,"Leila Nasser", "MRN-0010","B-10","Metoprolol", "Metoprolol Tartrate", "25 mg", "PO", "BD", "12/07/2026","08:00","RN Zainab F.", "No","","","","Hold if HR < 55 bpm or SBP < 90 mmHg"),
(11,"Daniel Osei", "MRN-0011","B-11","Insulin Actrapid", "Insulin Regular", "6 units", "SC", "With meals", "12/07/2026","08:00","Sr. Nurse Joy A.", "No","","","","BGL 8.4 pre-dose — check BGL 2 hrs post"),
(12,"Amira Hussain", "MRN-0012","B-12","Prednisolone", "Prednisolone", "30 mg", "PO", "OD (morning)","12/07/2026","08:00","RN Sana M.", "No","","","","Give with food — monitor BGL — taper as ordered"),
(13,"Emmanuel Asante", "MRN-0013","B-13","Digoxin", "Digoxin", "0.125 mg", "PO", "OD", "12/07/2026","08:00","RN Peter K.", "No","","","","Check apical pulse first — hold if HR < 60"),
(14,"Sofia Karimov", "MRN-0014","B-14","Pantoprazole", "Pantoprazole Sodium", "40 mg", "IV", "BD", "12/07/2026","08:00","Sr. Nurse Nadia B.", "No","","","","Give 30 min before meal"),
(15,"Kwame Asante", "MRN-0015","B-15","Vancomycin", "Vancomycin HCl", "1.5 g", "IV infusion","BD", "12/07/2026","08:00","RN Felix O.", "Yes","Red Man Syndrome — flushing face and neck","Infusion slowed to 2 hr; IV antihistamine given","Dr. Patel — 08:22","Pre-medicate antihistamine future doses"),
(16,"Hana Saleh", "MRN-0016","B-16","Atorvastatin", "Atorvastatin Calcium", "40 mg", "PO", "OD (night)", "12/07/2026","22:00","RN Lina R.", "No","","","","Give at night — monitor LFTs"),
(17,"Isaac Boateng", "MRN-0017","B-17","Salbutamol Neb", "Salbutamol", "2.5 mg", "INH (neb)","QDS", "12/07/2026","08:00","Sr. Nurse Mary A.", "No","","","","SpO2 pre/post nebs — document peak flow"),
(18,"Yasmin Farouk", "MRN-0018","B-18","Clexane", "Enoxaparin", "60 mg", "SC", "BD", "12/07/2026","08:00","RN Sara H.", "No","","","","Treatment dose DVT — check anti-Xa level"),
(19,"Marcus Silva", "MRN-0019","B-19","Phenytoin", "Phenytoin Sodium", "300 mg", "PO", "OD (night)", "12/07/2026","22:00","RN Carlos M.", "No","","","","Monitor drug level — narrow therapeutic index"),
(20,"Zara Ahmed", "MRN-0020","B-20","Dexamethasone", "Dexamethasone", "8 mg", "IV", "BD", "12/07/2026","08:00","Sr. Nurse Hana F.", "No","","","","Anti-emesis — monitor BGL"),
]
for i,p in enumerate(patients):
r = 7+i
ws.set_row(r,22)
bg = C['blue_light'] if i%2==0 else C['white']
is_rx = p[12]=="Yes"
for j in range(17):
col_letter = chr(66+j)
if is_rx and col_letter in ['N','O','P','Q']:
cbg = C['red_light']
cfc = C['red_dark'] if col_letter=='N' else '#2C3E50'
bld = col_letter=='N'
else:
cbg,cfc,bld = bg,'#2C3E50',False
ws.write(r,j+1,p[j],F(cbg,fc=cfc,sz=9,wrap=True,bold=bld,align='left'))
# Dropdown: Adverse Reaction (col N = col index 13, data rows 8-27 = row index 7-26)
ws.data_validation(7,13,26,13,{
'validate':'list','source':['Yes','No','Pending'],
'input_title':'Adverse Reaction?','input_message':'Select Yes, No, or Pending',
})
# Dropdown: Route (col I = index 8)
ws.data_validation(7,8,26,8,{
'validate':'list',
'source':['IV','IM','SC','PO','SL','PR','INH (neb)','IV infusion','NG','Topical','Other'],
'input_title':'Route','input_message':'Select administration route',
})
# Conditional formatting
ws.conditional_format(7,13,26,13,{'type':'cell','criteria':'==','value':'"Yes"',
'format':F(C['red_light'],fc=C['red_dark'],bold=True,sz=9)})
ws.conditional_format(7,13,26,13,{'type':'cell','criteria':'==','value':'"No"',
'format':F(C['green_light'],fc=C['green_dark'],sz=9)})
ws.freeze_panes(7,2)
# Summary row
rxcount = sum(1 for p in patients if p[12]=="Yes")
ws.set_row(27,24)
ws.merge_range('B28:L28',
f"SHIFT SUMMARY | Patients: 20 | Administrations: {len(patients)} | Adverse Reactions: {rxcount} | Incidents Filed: {rxcount}",
F(C['grey_dark'],fc='#FFFFFF',bold=True,sz=10,align='left',wrap=False))
ws.merge_range('M28:R28',
"Charge Nurse Signature: _________________________ Time: ____________",
F(C['grey_dark'],fc='#FFFFFF',sz=9,align='left',wrap=False))
# ─────────────────────────────────────────────────────────────────
# SHEET 2 — ADVERSE REACTION LOG
# ─────────────────────────────────────────────────────────────────
ws2 = wb.add_worksheet("Adverse Reaction Log")
ws2.hide_gridlines(2)
ws2.set_column('A:A',2); ws2.set_column('B:B',4); ws2.set_column('C:C',18)
ws2.set_column('D:D',13); ws2.set_column('E:E',22); ws2.set_column('F:F',13)
ws2.set_column('G:G',30); ws2.set_column('H:H',12); ws2.set_column('I:I',15)
ws2.set_column('J:J',30); ws2.set_column('K:K',22); ws2.set_column('L:L',22)
ws2.set_row(0,8); ws2.set_row(1,44); ws2.set_row(2,20); ws2.set_row(3,10); ws2.set_row(4,36)
ws2.merge_range('B2:L2',
"🔴 ADVERSE DRUG REACTION LOG — " + datetime.today().strftime('%d %B %Y'),
F(C['red_dark'],fc='#FFFFFF',bold=True,sz=14,align='center',wrap=False))
ws2.merge_range('B3:L3',
"Complete within 1 hour of reaction | Notify doctor immediately | Submit incident form to pharmacy within 24 hours",
F(C['orange_dark'],fc='#FFFFFF',sz=9,italic=True,align='center',wrap=False))
adr_hdrs = ['#','Patient Name','MRN','Drug Implicated','Dose',
'Reaction (Signs & Symptoms)','Onset Time','Severity','Management / Action Taken',
'Doctor Notified (Name & Time)','Incident Form No.']
for j,h in enumerate(adr_hdrs):
ws2.write(4,j+1,h,F(C['red_dark'],fc='#FFFFFF',bold=True,sz=9,align='center',wrap=True))
adr_rows = [
(1,"Priya Sharma","MRN-0004","Morphine Sulphate 5mg IV","5 mg IV",
"Nausea and vomiting — onset 10 min post-dose. SpO2 98%. No respiratory depression.","09:25","Mild",
"IV Ondansetron 4mg given. Vitals monitored q30min. Morphine not discontinued.","Dr. Mehta — 09:28","IR-20260712-001"),
(2,"Robert Mensah","MRN-0008","Ceftriaxone 1g IV","1 g IV",
"Urticarial rash on trunk and arms — onset 15 min. No anaphylaxis features. BP stable.","10:15","Moderate",
"Infusion stopped. IV Chlorphenamine 10mg. Adrenaline on standby. Rash resolved in 40 min.","Dr. Ali — 10:18","IR-20260712-002"),
(3,"Kwame Asante","MRN-0015","Vancomycin 1.5g IV","1.5 g IV",
"Red Man Syndrome — flushing of face and neck during infusion. BP 105/68 mmHg.","08:20","Moderate",
"Infusion rate reduced to 2 hrs. IV antihistamine given. Pre-medicate for all future doses.","Dr. Patel — 08:22","IR-20260712-003"),
]
for i,row in enumerate(adr_rows):
r=5+i; ws2.set_row(r,40)
bg=C['red_light'] if i%2==0 else C['orange_light']
for j,val in enumerate(row):
is_sev = row[7]=='Severe'
ws2.write(r,j+1,val,F(bg,sz=9,wrap=True,
bold=(j==7 and is_sev),fc='#C0392B' if (j==7 and is_sev) else '#2C3E50'))
for i in range(7):
r=8+i; ws2.set_row(r,28)
bg=C['white'] if i%2==0 else C['grey_light']
for j in range(11):
ws2.write(r,j+1,len(adr_rows)+i+1 if j==0 else "",F(bg,sz=9,wrap=True))
ws2.data_validation(5,8,14,8,{'validate':'list',
'source':['Mild','Moderate','Severe','Life-threatening'],
'input_title':'Severity','input_message':'Select severity level'})
ws2.freeze_panes(5,2)
# ─────────────────────────────────────────────────────────────────
# SHEET 3 — PATIENT ALLERGY SUMMARY
# ─────────────────────────────────────────────────────────────────
ws3 = wb.add_worksheet("Patient Allergy Summary")
ws3.hide_gridlines(2)
ws3.set_column('A:A',2); ws3.set_column('B:B',4); ws3.set_column('C:C',20)
ws3.set_column('D:D',12); ws3.set_column('E:E',7); ws3.set_column('F:F',28)
ws3.set_column('G:G',22); ws3.set_column('H:H',22); ws3.set_column('I:I',2)
ws3.set_row(0,8); ws3.set_row(1,44); ws3.set_row(2,20); ws3.set_row(3,10)
ws3.merge_range('B2:H2',
"⚠ PATIENT ALLERGY & HIGH-RISK MEDICATION SUMMARY — Check Before Every Administration",
F(C['red_dark'],fc='#FFFFFF',bold=True,sz=13,align='center',wrap=False))
ws3.merge_range('B3:H3',
"Update this sheet immediately when any new allergy is identified. Flag in EHR as well.",
F(C['orange_dark'],fc='#FFFFFF',sz=9,italic=True,align='center',wrap=False))
al_hdrs=[('#',C['red_dark']),('Patient Name',C['red_dark']),('MRN',C['red_dark']),
('Bed',C['red_dark']),('Known Allergies / Adverse Reactions',C['red_dark']),
('Current High-Risk Medications',C['red_dark']),('Special Precautions',C['red_dark'])]
ws3.set_row(4,30)
for j,(h,hc) in enumerate(al_hdrs):
ws3.write(4,j+1,h,F(hc,fc='#FFFFFF',bold=True,sz=9,align='center',wrap=True))
allergy_data=[
(1,"Ahmed Hassan", "MRN-0001","B-01","NKDA", "Metformin","Renal monitoring — eGFR monthly"),
(2,"Samira Al-Rashid", "MRN-0002","B-02","NKDA", "Augmentin","Renal dose adjustment required"),
(3,"James Owusu", "MRN-0003","B-03","ACE Inhibitors (dry cough)", "Losartan","Hold if SBP < 90 mmHg"),
(4,"Priya Sharma", "MRN-0004","B-04","Codeine (nausea)", "Morphine (PRN)","Opioid-sensitive — lowest effective dose"),
(5,"Mohammed Al-Farsi","MRN-0005","B-05","NKDA", "Amlodipine","Document ankle oedema daily"),
(6,"Chen Wei", "MRN-0006","B-06","NSAIDs (GI bleed)", "Furosemide IV","Fluid balance — hourly urine output"),
(7,"Fatima Al-Zahra", "MRN-0007","B-07","NKDA", "Warfarin","INR before each dose — target 2-3"),
(8,"Robert Mensah", "MRN-0008","B-08","** CEFTRIAXONE (urticaria)","Ceftriaxone STOPPED","Avoid ALL cephalosporins — EHR flagged"),
(9,"Nour Abdallah", "MRN-0009","B-09","NKDA", "Enoxaparin SC","Rotate sites — document location"),
(10,"Leila Nasser", "MRN-0010","B-10","Sulphonamides", "Metoprolol","Hold if HR < 55 bpm"),
(11,"Daniel Osei", "MRN-0011","B-11","NKDA", "Insulin sliding scale","BGL pre/post meals — hypoglycaemia protocol"),
(12,"Amira Hussain", "MRN-0012","B-12","NKDA", "Prednisolone","Monitor BGL — taper as prescribed"),
(13,"Emmanuel Asante", "MRN-0013","B-13","NKDA", "Digoxin","Apical pulse before dose — hold if HR < 60"),
(14,"Sofia Karimov", "MRN-0014","B-14","NKDA", "Pantoprazole IV","Give 30 min before first meal"),
(15,"Kwame Asante", "MRN-0015","B-15","** VANCOMYCIN (Red Man)", "Vancomycin (slow infusion)","Pre-medicate antihistamine — infuse over 2 hrs"),
(16,"Hana Saleh", "MRN-0016","B-16","NKDA", "Atorvastatin","Give at night — monitor LFTs"),
(17,"Isaac Boateng", "MRN-0017","B-17","NKDA", "Salbutamol nebuliser","SpO2 and peak flow pre/post nebs"),
(18,"Yasmin Farouk", "MRN-0018","B-18","NKDA", "Enoxaparin BD (treatment)","Anti-Xa level — check 4 hrs post morning dose"),
(19,"Marcus Silva", "MRN-0019","B-19","NKDA", "Phenytoin","Monitor drug level — narrow therapeutic index"),
(20,"Zara Ahmed", "MRN-0020","B-20","NKDA", "Dexamethasone IV","Monitor BGL — document oral intake"),
]
for i,row in enumerate(allergy_data):
r=5+i; ws3.set_row(r,22)
has_alert = '**' in str(row[4])
bg=C['red_light'] if has_alert else (C['blue_light'] if i%2==0 else C['white'])
for j,val in enumerate(row):
ws3.write(r,j+1,val,F(bg,sz=9,wrap=True,bold=has_alert,
fc='#C0392B' if (has_alert and j==4) else '#2C3E50'))
ws3.freeze_panes(5,3)
wb.close()
print("Saved:",OUTPUT)
python3 /tmp/build_mar20.py && cp /tmp/Medication_Administration_Record_20Patien…
Medication Administration Record 20Patients
Spreadsheet · XLSX
| Group | Columns | Colour | Contents |
|---|---|---|---|
| Patient ID | #, Name, MRN, Bed | Blue | Who the patient is |
| Prescribed Medication | Drug Name, Generic, Dosage, Route, Frequency | Teal | What was ordered |
| Administration Record | Date, Time Given, Administered By | Medium Blue | When and who gave it |
| Adverse Reaction Monitoring | Reaction (Yes/No), Details, Action, Doctor Notified | Red | Safety tracking |
| Notes | Special Instructions | Grey | Clinical reminders |
MAR_Ward4_12072026_Morning.xlsx)