This is list of drugs give me indications , side effects of common condition for rural people to give medication in pdf format
mkdir -p /tmp/workspace/rural-drug-guide && ls /tmp/workspace/
~/rural-drug-guide/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
TableStyle, HRFlowable, PageBreak)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import KeepTogether
# ── Drug data ──────────────────────────────────────────────────────────────
drugs = [
# (SR, Name, Category, Indications, Side Effects)
(1, "Tab Paracetamol 500 mg", "Analgesic / Antipyretic",
"Fever, mild-to-moderate pain (headache, body ache, toothache, post-vaccination fever)",
"Rash; overdose causes serious liver damage — do NOT exceed 4 g/day in adults"),
(2, "Tab Salbutamol 4 mg", "Bronchodilator (Beta-2 agonist)",
"Asthma, wheezing, COPD, bronchospasm",
"Tremor of hands, fast heartbeat (palpitations), headache, low blood potassium with high doses"),
(3, "Tab Diazepam", "Benzodiazepine / Sedative",
"Anxiety, seizures/epilepsy, muscle spasm, alcohol withdrawal, pre-procedure sedation",
"Drowsiness, dizziness, confusion; risk of dependence with long-term use; avoid in pregnancy"),
(4, "Tab Ondansetron 10 mg", "Antiemetic (5-HT3 blocker)",
"Nausea and vomiting (post-operative, chemotherapy, gastroenteritis)",
"Constipation, headache, flushing; rarely abnormal heart rhythm (QT prolongation)"),
(5, "Cap Doxycycline 100 mg", "Antibiotic (Tetracycline)",
"Malaria (with chloroquine/artesunate), leptospirosis, typhus, chlamydia, acne, cholera",
"Stomach upset (take with food/water), sensitivity to sunlight, oesophageal irritation; avoid in children < 8 yrs and pregnancy"),
(6, "Tab Metronidazole 400 mg", "Antibiotic / Antiprotozoal",
"Amoebic dysentery, giardiasis, trichomonas infection, anaerobic bacterial infections, dental infections",
"Metallic taste, nausea, vomiting, headache; avoid alcohol (causes severe flushing/vomiting)"),
(7, "Cap Amoxicillin 250 mg / 500 mg", "Antibiotic (Penicillin group)",
"Throat/ear/chest/urinary tract infections, typhoid (as adjunct), skin infections",
"Skin rash (may indicate allergy — stop immediately), diarrhoea, nausea; rare: anaphylaxis"),
(8, "Tab Cetirizine 10 mg", "Antihistamine (non-sedating)",
"Allergic rhinitis (runny nose/sneezing), urticaria (hives), allergic skin reactions, insect bites",
"Mild drowsiness, dry mouth, headache; generally well-tolerated"),
(9, "Tab Metformin 500 mg", "Antidiabetic (Biguanide)",
"Type 2 diabetes mellitus (first-line), pre-diabetes",
"Nausea, diarrhoea, stomach pain (take with food); rare but serious: lactic acidosis; avoid in kidney disease"),
(10, "Tab Amlodipine 5 mg", "Antihypertensive (Calcium channel blocker)",
"High blood pressure (hypertension), stable angina (chest pain)",
"Ankle/foot swelling, flushing, headache, dizziness, palpitations"),
(11, "Tab Glimepiride 2 mg / 1 mg", "Antidiabetic (Sulphonylurea)",
"Type 2 diabetes mellitus (when diet + metformin insufficient)",
"Low blood sugar (hypoglycaemia) — patient must eat on time; weight gain, nausea"),
(12, "Tab Iron Folic Acid (60 mg + 0.5 mg)", "Haematinic",
"Iron-deficiency anaemia, pregnancy (routine supplementation), malnutrition",
"Constipation, black stools (normal), stomach cramps, nausea; take after meals"),
(13, "Tab Losartan", "Antihypertensive (ARB)",
"High blood pressure, diabetic kidney disease, heart failure",
"Dizziness, high blood potassium; rare: kidney function worsening; avoid in pregnancy"),
(14, "Tab Etophylline + Theophylline", "Bronchodilator (Xanthine)",
"Asthma, COPD, chronic bronchitis",
"Nausea, vomiting, headache, fast heartbeat, insomnia; narrow therapeutic window — avoid overdose"),
(15, "Tab Vitamin B Complex", "Vitamin supplement",
"B-vitamin deficiency, neuropathy, mouth ulcers, malnutrition, supplement during pregnancy",
"Generally very safe; harmless yellow discolouration of urine"),
(16, "Tab Calcium + Vitamin D3", "Mineral / Vitamin supplement",
"Calcium deficiency, osteoporosis, rickets, pregnancy, post-menopausal bone loss",
"Constipation, bloating, stomach pain; high doses may cause kidney stones"),
(17, "Tab Cefpodoxime", "Antibiotic (3rd-gen Cephalosporin)",
"Throat, ear, chest, urinary tract infections; skin infections; sinusitis",
"Diarrhoea, stomach pain, rash; rare allergy (especially in penicillin-allergic patients)"),
(18, "Tab Albendazole", "Anthelmintic (Deworming)",
"Intestinal worms (roundworm, hookworm, tapeworm), Giardia, hydatid disease",
"Nausea, headache, stomach pain; usually single dose — safe and well-tolerated"),
(19, "Tab Telmisartan 40 mg", "Antihypertensive (ARB)",
"High blood pressure, cardiovascular risk reduction, diabetic kidney protection",
"Dizziness, high blood potassium; avoid in pregnancy; monitor kidney function"),
(20, "Tab Atorvastatin 10 mg", "Lipid-lowering (Statin)",
"High cholesterol, prevention of heart attack and stroke in high-risk patients",
"Muscle pain/weakness (myopathy — stop and report), liver enzyme rise; avoid in pregnancy"),
(21, "Cap Amoxicillin 500 mg", "Antibiotic (Penicillin group)",
"Same as #7 — higher dose for severe infections",
"Same as #7 — rash, diarrhoea, nausea; watch for allergy"),
(22, "ORS (Oral Rehydration Salts)", "Rehydration solution",
"Diarrhoea, vomiting, dehydration, cholera, gastroenteritis",
"No side effects; excessive intake may rarely cause sodium overload in kidney disease"),
(23, "Oint Clotrimazole", "Antifungal (topical)",
"Fungal skin infections (ringworm, athlete's foot, candida, nappy rash)",
"Mild local burning or itching; rarely skin rash"),
(24, "Silver Sulphadiazine Cream", "Topical antibacterial",
"Burns (first and second degree), infected wounds, skin ulcers — to prevent/treat infection",
"Local burning, rash; silver can cause grey-blue skin discolouration with prolonged use"),
(25, "Normal Saline Nasal Drop", "Nasal decongestant / saline",
"Blocked nose, rhinitis, sinusitis, nasal dryness, common cold (nasal congestion in infants)",
"Essentially no side effects; safe for all ages including newborns"),
(26, "Oint Miconazole", "Antifungal (topical)",
"Fungal and yeast skin infections, oral thrush (miconazole oral gel form)",
"Mild burning, itching, or redness at application site"),
(27, "Syrup Ibuprofen", "NSAID / Antipyretic / Analgesic",
"Fever, pain, inflammation in children; ear pain, dental pain",
"Stomach upset/pain (give after food), nausea; avoid in children < 6 months, kidney disease, dehydration"),
(28, "Tab Amoxiclav 375 mg (Amoxicillin + Clavulanate)", "Antibiotic (broad-spectrum)",
"Respiratory, ear, urinary, skin, dental infections resistant to amoxicillin alone; animal bites",
"Diarrhoea, nausea, stomach pain; rash (allergy risk — same as penicillin)"),
(29, "Tab Norfloxacin 400 mg", "Antibiotic (Fluoroquinolone)",
"Urinary tract infections, traveller's diarrhoea, uncomplicated gonorrhoea",
"Nausea, dizziness, headache; rare: tendon damage (especially Achilles tendon); avoid in children and pregnancy"),
(30, "Tab Zinc Sulphate 20 mg", "Mineral supplement",
"Diarrhoea in children (WHO protocol — reduces severity and duration), zinc deficiency, wound healing",
"Nausea, vomiting, stomach cramps; take after food"),
(31, "Tab Isosorbide Dinitrate 5 mg", "Nitrate / Anti-anginal",
"Angina (chest pain), heart failure (as vasodilator)",
"Headache (very common), dizziness, low blood pressure, flushing; do NOT use with sildenafil"),
(32, "Tab Cefixime 200 mg", "Antibiotic (3rd-gen Cephalosporin)",
"Typhoid fever, UTI, gonorrhoea, throat/ear/chest infections",
"Diarrhoea, stomach pain, nausea; rare allergy"),
(33, "Tab Ciprofloxacin 250 mg", "Antibiotic (Fluoroquinolone)",
"UTI, typhoid, diarrhoea, respiratory/skin infections",
"Nausea, diarrhoea, headache, dizziness; tendon damage risk; avoid in children, pregnancy, epileptics"),
(34, "Tab Ciprofloxacin 500 mg", "Antibiotic (Fluoroquinolone)",
"Same as #33 — higher dose for more severe infections",
"Same as #33"),
(35, "Tab Clotrimazole Vaginal Pessaries", "Antifungal (vaginal)",
"Vaginal thrush (candidiasis), vaginal itching/discharge due to fungal infection",
"Local burning, vaginal irritation, mild rash; generally well-tolerated"),
(36, "Tab Chlorthalidone 6.25 mg", "Antihypertensive (Diuretic/Thiazide)",
"High blood pressure, oedema (swelling), heart failure",
"Low blood potassium (muscle weakness, cramps), frequent urination, dizziness, increased blood sugar"),
(37, "Tab Ibuprofen 400 mg", "NSAID / Analgesic / Anti-inflammatory",
"Pain (headache, dental, musculoskeletal), fever, arthritis, dysmenorrhoea",
"Stomach pain/ulcer risk (take with food), nausea; avoid in kidney disease, asthma, pregnancy 3rd trimester"),
(38, "Xylo-Metazoline Nasal Drop", "Nasal decongestant (topical)",
"Acute nasal congestion, sinusitis, common cold — blocked nose",
"Rebound congestion with >3-5 days use (rhinitis medicamentosa), burning in nose, dryness; avoid in hypertension"),
(39, "Clotrimazole Dusting Powder", "Antifungal (topical)",
"Fungal infections of skin folds, groin, feet (tinea, intertrigo)",
"Very rare local irritation; safe for routine use"),
(40, "Clotrimazole Mouth Paint", "Antifungal (topical oral)",
"Oral thrush (candidiasis), white patches in mouth, angular cheilitis",
"Mild mouth irritation or burning; avoid swallowing"),
(41, "Syrup Cital (Citric Acid + Sodium Citrate)", "Urinary alkaliniser",
"UTI (as adjunct), burning urination, kidney stones (uric acid type)",
"Nausea, stomach discomfort; use with caution in kidney disease and heart failure"),
(42, "Syrup Amoxicillin", "Antibiotic (Penicillin group — paediatric)",
"Ear, throat, chest, UTI infections in children",
"Diarrhoea, rash, nausea; watch for allergy — same risk as tab form"),
(43, "Syrup Paracetamol", "Analgesic / Antipyretic (paediatric)",
"Fever and pain in children (teething, ear pain, post-vaccination)",
"Safe at correct dose; overdose causes liver damage — use weight-based dosing"),
(44, "Syrup Albendazole", "Anthelmintic (paediatric)",
"Intestinal worm infestation in children",
"Nausea, stomach pain, diarrhoea; safe and well-tolerated"),
(45, "Syrup Cotrimoxazole (Trimethoprim + Sulphamethoxazole)", "Antibiotic",
"UTI, ear infections, pneumocystis pneumonia (PCP), whooping cough, typhoid",
"Rash (including severe Stevens-Johnson syndrome — stop immediately), nausea, blood disorders; avoid in sulfa allergy"),
(46, "Syrup Calcium with D3 Drop", "Mineral supplement (paediatric)",
"Rickets, calcium deficiency, teething problems, bone development in infants",
"Generally safe at prescribed doses; excess causes constipation and kidney stones"),
(47, "Tab Azithromycin 250 mg / 500 mg", "Antibiotic (Macrolide)",
"Respiratory infections, typhoid, STIs (chlamydia, gonorrhoea), community-acquired pneumonia, trachoma",
"Nausea, diarrhoea, abdominal pain; QT prolongation risk (cardiac); generally well-tolerated"),
(48, "Paracetamol Drop (paediatric)", "Analgesic / Antipyretic",
"Fever and pain in infants and very young children",
"Safe at correct dose; use weight-based dosing; overdose risks liver damage"),
(49, "Syrup Amoxiclav (Amox + Clavulanate)", "Antibiotic (broad-spectrum)",
"Respiratory, ear, skin, UTI in children — where plain amoxicillin may be insufficient",
"Diarrhoea (common), nausea; allergy risk same as penicillin"),
(50, "Syrup Metronidazole", "Antibiotic / Antiprotozoal (paediatric)",
"Amoebic dysentery, giardiasis, anaerobic infections in children",
"Metallic taste, nausea, vomiting; avoid alcohol"),
(51, "Syrup Salbutamol", "Bronchodilator (paediatric)",
"Asthma, wheezing, croup, bronchiolitis in children",
"Tremor, fast heartbeat, restlessness, irritability in children"),
(52, "Cipro Eye Drop (Ciprofloxacin eye drop)", "Antibiotic (topical ophthalmic)",
"Bacterial conjunctivitis (red eye), corneal ulcer, eye infections",
"Temporary burning/stinging on instillation, mild redness; generally well-tolerated"),
(53, "Benzyl Benzoate Lotion", "Antiparasitic (topical)",
"Scabies, lice infestation",
"Skin irritation, burning, rash; avoid face and mucous membranes; use with caution in children < 2 yrs"),
(54, "Povidone Iodine Ointment", "Antiseptic (topical)",
"Wound cleaning, infected cuts/burns/ulcers, surgical site antisepsis",
"Skin irritation, allergic rash; long-term use may affect thyroid; do not use in deep wounds"),
(55, "Lactulose Syrup", "Laxative (osmotic)",
"Constipation, hepatic encephalopathy (high ammonia in liver disease)",
"Bloating, gas, cramping, diarrhoea with excess dose; safe for long-term use"),
(56, "Tab Folic Acid", "Vitamin supplement",
"Folic acid deficiency anaemia, pregnancy (prevents neural tube defects), megaloblastic anaemia",
"Very safe; extremely rare allergy; masks B12 deficiency if given alone"),
(57, "Clobetasol Cream", "Corticosteroid (potent topical)",
"Severe eczema, psoriasis, lichen planus, contact dermatitis not responding to milder steroids",
"Skin thinning (atrophy), stretch marks, easy bruising with prolonged use; do NOT use on face or groin long-term"),
(58, "Eberconazole Cream", "Antifungal (topical)",
"Fungal skin infections (tinea corporis/cruris/pedis), candidal intertrigo",
"Mild burning, itching, redness at site; rare contact dermatitis"),
(59, "Tab Cefuroxime Dispersible", "Antibiotic (2nd-gen Cephalosporin)",
"Respiratory, ear, skin, UTI, Lyme disease",
"Diarrhoea, nausea, headache; allergy risk (cross-react with penicillin)"),
(60, "Tab Phenytoin Sodium", "Antiepileptic",
"Epilepsy (tonic-clonic and focal seizures), status epilepticus, trigeminal neuralgia",
"Drowsiness, dizziness, gum overgrowth, rash, ataxia (unsteady walking); narrow margin — monitor levels"),
(61, "Tab Amoxicillin 250 mg (Amax 250)", "Antibiotic (Penicillin group)",
"Same as #7 — ear, throat, chest, UTI infections",
"Rash, diarrhoea, nausea; anaphylaxis risk in allergic patients"),
(62, "Tab Azithromycin 250/500 mg", "Antibiotic (Macrolide)",
"Same as #47 — respiratory, typhoid, STIs",
"Nausea, diarrhoea, abdominal pain; QT prolongation"),
(63, "Benzyl Benzoate Lotion (duplicate)", "Antiparasitic (topical)",
"Same as #53 — Scabies, lice",
"Same as #53 — skin irritation, burning"),
(64, "Tab Itraconazole", "Antifungal (oral systemic)",
"Systemic fungal infections, severe ringworm, fungal nail infection (onychomycosis), aspergillosis",
"Nausea, stomach pain, liver toxicity (monitor LFTs); many drug interactions — check carefully"),
(65, "Tab Furazolidone", "Antiprotozoal / Antibacterial",
"Giardiasis, traveller's diarrhoea, cholera",
"Nausea, vomiting, headache; avoid alcohol (disulfiram-like reaction); may cause haemolysis in G6PD deficiency"),
(66, "Tab Diclofenac", "NSAID / Analgesic / Anti-inflammatory",
"Musculoskeletal pain, arthritis, post-op pain, dysmenorrhoea, renal colic (with antispasmodic)",
"Stomach pain/ulcer, nausea; may increase blood pressure; avoid in kidney disease, heart failure, pregnancy"),
(67, "Tab Atenolol 50 mg", "Antihypertensive / Anti-anginal (Beta-blocker)",
"High blood pressure, angina, fast heart rate (tachycardia), after heart attack",
"Slow heart rate (bradycardia), fatigue, cold hands/feet, dizziness; do NOT stop abruptly; avoid in asthma"),
(68, "Tab Pantoprazole 40 mg", "Proton pump inhibitor (PPI) / Antacid",
"Acid peptic disease, GERD, peptic ulcer, H. pylori eradication (with antibiotics), NSAID-induced ulcer prevention",
"Headache, diarrhoea, nausea; long-term: low magnesium, B12 deficiency, C. difficile risk"),
(69, "Tab Lorazepam 2 mg", "Benzodiazepine / Sedative-Anxiolytic",
"Anxiety, acute seizures, pre-procedural sedation, insomnia (short-term)",
"Drowsiness, dizziness, confusion; dependence with prolonged use; avoid in elderly, COPD, pregnancy"),
(70, "Tab Escitalopram 5/10 mg", "Antidepressant (SSRI)",
"Depression, generalised anxiety disorder, panic disorder, OCD",
"Nausea (first 1-2 weeks), headache, insomnia, sexual dysfunction; do NOT stop abruptly; takes 2-4 weeks to work"),
(71, "Tab Olanzapine 5/10 mg", "Antipsychotic (atypical)",
"Schizophrenia, bipolar disorder (acute mania), agitation",
"Weight gain, drowsiness, dizziness, increased blood sugar; prolonged QT; metabolic syndrome"),
(72, "Tab Clonazepam", "Benzodiazepine / Antiepileptic",
"Epilepsy (absence seizures, myoclonic), panic disorder, anxiety",
"Drowsiness, dizziness, incoordination, depression; dependence and withdrawal risk"),
(73, "Tab Imipramine", "Antidepressant (TCA)",
"Depression, bedwetting (enuresis) in children, neuropathic pain, panic disorder",
"Dry mouth, constipation, blurred vision, drowsiness, fast heartbeat; dangerous in overdose — cardiac arrhythmia"),
(74, "Tab Phenobarbitone", "Antiepileptic / Sedative",
"Epilepsy (first-line in resource-limited settings), febrile seizures, status epilepticus",
"Drowsiness, cognitive slowing (especially in children), hyperactivity in children, dependence; do NOT stop abruptly"),
(75, "Tab Sodium Valproate 200/500 mg", "Antiepileptic / Mood stabiliser",
"Epilepsy (all seizure types), bipolar disorder, migraine prevention",
"Weight gain, hair loss, tremor, liver toxicity (especially < 2 yrs); HIGHLY teratogenic — avoid in pregnancy"),
(76, "Tab Bisacodyl Phosphate", "Laxative (stimulant)",
"Constipation, bowel preparation before procedures/surgery",
"Abdominal cramping, diarrhoea; do NOT use long-term — may cause dependence; take at night"),
(77, "Tab Carbamazepine", "Antiepileptic / Mood stabiliser",
"Epilepsy (focal/tonic-clonic), trigeminal neuralgia, bipolar disorder",
"Dizziness, drowsiness, rash (including severe Stevens-Johnson), low sodium (hyponatraemia); many drug interactions"),
(78, "Tab Cefpodoxime (duplicate)", "Antibiotic (3rd-gen Cephalosporin)",
"Same as #17 — respiratory, ear, UTI, skin infections",
"Same as #17 — diarrhoea, stomach pain, rash"),
(79, "Tab Amoxiclav 625/375 mg", "Antibiotic (broad-spectrum)",
"Severe respiratory, ear, dental, skin, UTI, bite wounds — higher dose than #28",
"Diarrhoea (common), nausea; allergy risk same as penicillin"),
(80, "Tab Alprazolam", "Benzodiazepine / Anxiolytic",
"Anxiety disorders, panic disorder, short-term insomnia",
"Drowsiness, dizziness, dependence (high abuse potential); do NOT stop abruptly; avoid in COPD, elderly"),
(81, "Soframycin Cream (Framycetin)", "Antibiotic (topical)",
"Infected skin wounds, cuts, burns, infected eczema, impetigo",
"Local irritation, rare allergic contact dermatitis; do NOT use over large areas or long-term"),
(82, "Tab Tranexamic Acid", "Haemostatic / Antifibrinolytic",
"Heavy menstrual bleeding, post-partum haemorrhage, trauma bleeding, dental bleeding",
"Nausea, diarrhoea, headache; rare: blood clots (DVT/PE) — avoid in thromboembolic disease"),
(83, "Diclo Gel (Diclofenac topical)", "NSAID (topical anti-inflammatory)",
"Local musculoskeletal pain, arthritis, sprains, strains, sports injuries",
"Local skin redness, rash, burning; systemic absorption is low but avoid on broken skin"),
# Clotrimazole / Miconazole cream (last entry without number)
(84, "Clotrimazole / Miconazole Cream", "Antifungal (topical combined)",
"Fungal skin infections (ringworm, candida, tinea), groin infections, nappy rash",
"Mild burning, itching, or redness at application site; rare contact allergy"),
]
# ── PDF generation ──────────────────────────────────────────────────────────
OUTPUT = "/tmp/workspace/rural-drug-guide/Rural_Drug_Reference_Guide.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.5*cm,
leftMargin=1.5*cm,
topMargin=2*cm,
bottomMargin=1.5*cm,
title="Rural Hospital Drug Reference Guide",
author="Rural Hospital Murud",
)
styles = getSampleStyleSheet()
# Custom styles
TITLE_STYLE = ParagraphStyle(
"TitleStyle",
parent=styles["Title"],
fontSize=18,
textColor=colors.HexColor("#1a3a6b"),
spaceAfter=4,
alignment=TA_CENTER,
fontName="Helvetica-Bold",
)
SUBTITLE_STYLE = ParagraphStyle(
"SubTitle",
parent=styles["Normal"],
fontSize=11,
textColor=colors.HexColor("#4a4a4a"),
spaceAfter=2,
alignment=TA_CENTER,
fontName="Helvetica",
)
DATE_STYLE = ParagraphStyle(
"DateStyle",
parent=styles["Normal"],
fontSize=9,
textColor=colors.HexColor("#888888"),
spaceAfter=14,
alignment=TA_CENTER,
fontName="Helvetica-Oblique",
)
DRUG_NAME_STYLE = ParagraphStyle(
"DrugName",
parent=styles["Normal"],
fontSize=10.5,
textColor=colors.HexColor("#1a3a6b"),
fontName="Helvetica-Bold",
leading=13,
)
CATEGORY_STYLE = ParagraphStyle(
"Category",
parent=styles["Normal"],
fontSize=8.5,
textColor=colors.HexColor("#0066aa"),
fontName="Helvetica-Oblique",
leading=11,
)
LABEL_STYLE = ParagraphStyle(
"Label",
parent=styles["Normal"],
fontSize=8,
textColor=colors.HexColor("#333333"),
fontName="Helvetica-Bold",
leading=10,
)
CONTENT_STYLE = ParagraphStyle(
"Content",
parent=styles["Normal"],
fontSize=8,
textColor=colors.HexColor("#111111"),
fontName="Helvetica",
leading=11,
spaceAfter=2,
)
NOTE_STYLE = ParagraphStyle(
"Note",
parent=styles["Normal"],
fontSize=7.5,
textColor=colors.HexColor("#cc4400"),
fontName="Helvetica-Oblique",
leading=10,
)
SECTION_HDR_STYLE = ParagraphStyle(
"SectionHdr",
parent=styles["Normal"],
fontSize=12,
textColor=colors.white,
fontName="Helvetica-Bold",
alignment=TA_CENTER,
leading=16,
)
HEADER_BG = colors.HexColor("#1a3a6b")
ROW_EVEN = colors.HexColor("#eef3fb")
ROW_ODD = colors.white
BORDER_CLR = colors.HexColor("#c0cce0")
RED_WARN = colors.HexColor("#cc4400")
story = []
# ── Cover / Header ──────────────────────────────────────────────────────────
story.append(Spacer(1, 0.4*cm))
story.append(Paragraph("RURAL HOSPITAL MURUD", TITLE_STYLE))
story.append(Paragraph("Essential Drug Reference Guide", SUBTITLE_STYLE))
story.append(Paragraph("Indications & Key Side Effects for All Available Medicines", SUBTITLE_STYLE))
story.append(Paragraph("Formulary Date: 16 June 2026 | Compiled: July 2026", DATE_STYLE))
story.append(HRFlowable(width="100%", thickness=2, color=HEADER_BG, spaceAfter=8))
# ── Safety note box ──────────────────────────────────────────────────────────
safety_data = [[
Paragraph(
"<b>⚠ Important Safety Notice:</b> This guide is for trained healthcare providers. "
"Always verify dose, allergy history, and contraindications before dispensing. "
"For paediatric doses, calculate by weight. Highlighted side effects in "
"<font color='#cc4400'><b>red/orange</b></font> require immediate attention.",
ParagraphStyle("SafetyNote", parent=styles["Normal"], fontSize=8,
textColor=colors.HexColor("#7a3300"), fontName="Helvetica",
leading=11)
)
]]
safety_tbl = Table(safety_data, colWidths=[17*cm])
safety_tbl.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), colors.HexColor("#fff3e0")),
("BOX", (0, 0), (-1, -1), 1, colors.HexColor("#e07000")),
("PADDING", (0, 0), (-1, -1), 7),
]))
story.append(safety_tbl)
story.append(Spacer(1, 0.5*cm))
# ── Group drugs by category for section headers ──────────────────────────────
categories = {
"Analgesics, Antipyretics & NSAIDs": [1, 2, 27, 37, 48, 66, 83],
"Antibiotics & Antimicrobials": [5, 6, 7, 17, 21, 28, 29, 32, 33, 34, 42, 45, 47, 49, 59, 61, 62, 64, 78, 79],
"Antifungals": [23, 26, 35, 39, 40, 58, 63, 84],
"Antiparasitic / Anthelmintic / Antiprotozoal": [18, 44, 53, 65],
"Antihypertensives & Cardiac Drugs": [10, 13, 19, 31, 36, 67],
"Antidiabetics": [9, 11],
"Bronchodilators & Respiratory": [2, 14, 51],
"Neurological / Psychiatric": [3, 4, 60, 69, 70, 71, 72, 73, 74, 75, 77, 80],
"Vitamins, Minerals & Supplements": [12, 15, 16, 30, 46, 56],
"Gastrointestinal & Liver": [22, 55, 68, 76],
"Lipid-Lowering": [20],
"Topical Antibacterials & Antiseptics": [24, 52, 54, 81],
"Haemostatics & Women's Health": [41, 82],
"Nasal / ENT Preparations": [25, 38],
"Ophthalmic": [52],
}
# Build main table — all drugs in order
col_widths = [1.0*cm, 3.9*cm, 1.6*cm, 5.5*cm, 5.5*cm]
# Header row
header_row = [
Paragraph("<font color='white'><b>SR</b></font>", ParagraphStyle("TH", parent=styles["Normal"], fontSize=9, fontName="Helvetica-Bold", alignment=TA_CENTER)),
Paragraph("<font color='white'><b>Drug Name</b></font>", ParagraphStyle("TH", parent=styles["Normal"], fontSize=9, fontName="Helvetica-Bold")),
Paragraph("<font color='white'><b>Category</b></font>", ParagraphStyle("TH", parent=styles["Normal"], fontSize=9, fontName="Helvetica-Bold")),
Paragraph("<font color='white'><b>Indications (Uses)</b></font>", ParagraphStyle("TH", parent=styles["Normal"], fontSize=9, fontName="Helvetica-Bold")),
Paragraph("<font color='white'><b>Key Side Effects</b></font>", ParagraphStyle("TH", parent=styles["Normal"], fontSize=9, fontName="Helvetica-Bold")),
]
table_data = [header_row]
row_styles = []
HIGHLIGHT_DRUGS = {9, 11, 20, 60, 74, 75, 77, 3, 69, 72, 73, 80} # drugs needing extra caution
for idx, (sr, name, cat, ind, se) in enumerate(drugs):
row_num = idx + 1
bg = ROW_EVEN if idx % 2 == 0 else ROW_ODD
sr_para = Paragraph(f"<b>{sr}</b>", ParagraphStyle("SRcell", parent=styles["Normal"],
fontSize=9, fontName="Helvetica-Bold", alignment=TA_CENTER,
textColor=colors.HexColor("#1a3a6b")))
name_para = Paragraph(f"<b>{name}</b>",
ParagraphStyle("Namecell", parent=styles["Normal"], fontSize=9,
fontName="Helvetica-Bold",
textColor=colors.HexColor("#1a3a6b"), leading=12))
cat_para = Paragraph(f"<i>{cat}</i>",
ParagraphStyle("Catcell", parent=styles["Normal"], fontSize=7.5,
fontName="Helvetica-Oblique",
textColor=colors.HexColor("#0055aa"), leading=10))
ind_para = Paragraph(ind,
ParagraphStyle("IndCell", parent=styles["Normal"], fontSize=8,
fontName="Helvetica", leading=11))
se_para = Paragraph(se,
ParagraphStyle("SEcell", parent=styles["Normal"], fontSize=8,
fontName="Helvetica", leading=11,
textColor=colors.HexColor("#5a1000") if sr in HIGHLIGHT_DRUGS else colors.black))
table_data.append([sr_para, name_para, cat_para, ind_para, se_para])
drug_table = Table(table_data, colWidths=col_widths, repeatRows=1)
ts = TableStyle([
# Header
("BACKGROUND", (0, 0), (-1, 0), HEADER_BG),
("TEXTCOLOR", (0, 0), (-1, 0), colors.white),
("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
("FONTSIZE", (0, 0), (-1, 0), 9),
("ROWBACKGROUND",(0, 1), (-1, -1), [ROW_ODD, ROW_EVEN]),
("GRID", (0, 0), (-1, -1), 0.4, BORDER_CLR),
("VALIGN", (0, 0), (-1, -1), "TOP"),
("TOPPADDING", (0, 0), (-1, -1), 4),
("BOTTOMPADDING",(0, 0), (-1, -1), 4),
("LEFTPADDING", (0, 0), (-1, -1), 5),
("RIGHTPADDING", (0, 0), (-1, -1), 5),
("ALIGN", (0, 0), (0, -1), "CENTER"),
])
# Alternating row backgrounds
for i in range(1, len(table_data)):
bg = ROW_EVEN if i % 2 == 0 else ROW_ODD
ts.add("BACKGROUND", (0, i), (-1, i), bg)
# Special warning highlight for high-risk drugs
for i, (sr, *_) in enumerate(drugs):
if sr in HIGHLIGHT_DRUGS:
ts.add("BACKGROUND", (4, i+1), (4, i+1), colors.HexColor("#fff0ee"))
drug_table.setStyle(ts)
story.append(drug_table)
# ── Quick-reference notes page ──────────────────────────────────────────────
story.append(PageBreak())
story.append(Paragraph("QUICK REFERENCE — IMPORTANT PRECAUTIONS", TITLE_STYLE))
story.append(HRFlowable(width="100%", thickness=1.5, color=HEADER_BG, spaceAfter=8))
precautions = [
("Pregnancy — AVOID / USE WITH CAUTION",
"Avoid: Metronidazole (1st trimester), Ciprofloxacin, Norfloxacin, Doxycycline, "
"Ibuprofen (3rd trimester), Diclofenac (3rd trimester), Atenolol (growth restriction), "
"Losartan/Telmisartan (teratogenic), Sodium Valproate (neural tube defects — HIGH RISK), "
"Itraconazole, Alprazolam. Safe: Paracetamol, Amoxicillin, Cefpodoxime, ORS, Folic Acid."),
("Children — DO NOT USE",
"Ciprofloxacin/Norfloxacin (< 12 yrs — affects cartilage), Doxycycline (< 8 yrs — stains teeth), "
"Aspirin (Reye syndrome), Ibuprofen (< 6 months), Metformin (< 10 yrs without specialist advice)."),
("Allergy Alert — STOP IMMEDIATELY",
"Any drug causing rash, swelling of face/lips/tongue, difficulty breathing = anaphylaxis. "
"Give IM Adrenaline if available. Penicillin allergy: avoid all penicillins (Amoxicillin, Amoxiclav). "
"Sulfa allergy: avoid Cotrimoxazole, Chlorthalidone."),
("Alcohol Interactions",
"Metronidazole + alcohol → severe nausea/vomiting/flushing (disulfiram reaction). "
"Furazolidone + alcohol → same reaction. "
"All benzodiazepines (Diazepam, Lorazepam, Alprazolam, Clonazepam) + alcohol → dangerous sedation."),
("Kidney Disease — Use with Caution",
"Metformin (lactic acidosis risk — avoid if eGFR < 30), NSAIDs (Ibuprofen/Diclofenac — worsen kidney function), "
"Losartan/Telmisartan (monitor potassium and creatinine), Ciprofloxacin (reduce dose)."),
("Antiepileptic Drug Cautions",
"NEVER stop Phenytoin, Phenobarbitone, Carbamazepine, Valproate, Clonazepam abruptly — can precipitate status epilepticus. "
"Carbamazepine has many drug interactions (reduces effect of other drugs). "
"Sodium Valproate: check LFTs regularly; teratogenic."),
("Antidepressant / Antipsychotic Notes",
"Escitalopram takes 2-4 weeks to work — counsel patients not to stop early. "
"Do NOT stop SSRIs abruptly. "
"Olanzapine: monitor blood sugar and weight. "
"Imipramine overdose is dangerous — cardiac arrhythmia."),
("ORS — Correct Preparation",
"1 ORS sachet in 1 litre of clean water. Give small amounts frequently. "
"Continue breastfeeding. If vomiting, wait 10 min then restart slowly. "
"For cholera/severe diarrhoea — IV fluids if oral intake not possible."),
]
for heading, content in precautions:
prec_data = [[
Paragraph(f"<b>{heading}</b>",
ParagraphStyle("PrecHdr", parent=styles["Normal"], fontSize=9,
fontName="Helvetica-Bold", textColor=colors.HexColor("#cc2200"))),
Paragraph(content,
ParagraphStyle("PrecBody", parent=styles["Normal"], fontSize=8.5,
fontName="Helvetica", leading=12))
]]
prec_tbl = Table(prec_data, colWidths=[4.5*cm, 13*cm])
prec_tbl.setStyle(TableStyle([
("VALIGN", (0, 0), (-1, -1), "TOP"),
("BACKGROUND", (0, 0), (0, -1), colors.HexColor("#fff3f0")),
("BACKGROUND", (1, 0), (1, -1), colors.HexColor("#fafafa")),
("BOX", (0, 0), (-1, -1), 0.5, BORDER_CLR),
("INNERGRID", (0, 0), (-1, -1), 0.3, BORDER_CLR),
("LEFTPADDING", (0, 0), (-1, -1), 6),
("RIGHTPADDING", (0, 0), (-1, -1), 6),
("TOPPADDING", (0, 0), (-1, -1), 5),
("BOTTOMPADDING",(0, 0), (-1, -1), 5),
]))
story.append(prec_tbl)
story.append(Spacer(1, 0.25*cm))
# ── Footer note ──────────────────────────────────────────────────────────────
story.append(Spacer(1, 0.5*cm))
story.append(HRFlowable(width="100%", thickness=1, color=HEADER_BG, spaceAfter=4))
story.append(Paragraph(
"This reference guide was compiled for Rural Hospital Murud (formulary dated 16 June 2026). "
"It is intended for use by trained healthcare professionals only. "
"Always follow standard treatment guidelines and consult a senior clinician when in doubt.",
ParagraphStyle("Footer", parent=styles["Normal"], fontSize=7.5,
textColor=colors.HexColor("#888888"), fontName="Helvetica-Oblique",
alignment=TA_CENTER, leading=10)
))
# ── Build ────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF saved to: {OUTPUT}")
cd /tmp/workspace/rural-drug-guide && python generate_pdf.py 2>&1
ls -lh /tmp/workspace/rural-drug-guide/Rural_Drug_Reference_Guide.pdf
Rural Drug Reference Guide
PDF Document · PDF
| Column | What it shows |
|---|---|
| SR No. | Matches the hospital formulary number |
| Drug Name | Exact name as on the list |
| Category | Drug class (antibiotic, NSAID, antifungal, etc.) |
| Indications | Common conditions it treats, written in plain language |
| Side Effects | Key adverse effects, with high-risk ones highlighted |