python3 -c " import pdfplumber with pdfplumber.open('/home/daytona/workspace/attachments/13104d22-753f-47b8-bb46-c052c726c443/CHANDER SHARMA.pdf') as pdf: print(f'Pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): text = page.extract_text() print(f'--- PAGE {i+1} ---') print(text) "
| Parameter | Result | Normal Range | Status |
|---|---|---|---|
| Colour | Yellowish | Yellowish Brown | Within range |
| Consistency | Soft | Semi Solid | Within range |
| Mucus | Absent | Absent | Normal |
| Blood | Absent | Absent | Normal |
| Odour | Fecal | Fecal | Normal |
| Cysts | Not Detected | Not Detected | Normal |
| Trophozoites | Not Detected | Not Detected | Normal |
| Charcot-Leyden Crystals | Not Detected | Not Detected | Normal |
| Ova (parasitic eggs) | Not Detected | Not Detected | Normal |
| Adult Parasites | Not Detected | Not Detected | Normal |
| RBC | Not Detected | Not Detected | Normal |
| Pus Cells | 0-1 /hpf | 0-5 /hpf | Normal |
| Result | Status |
|---|---|
| Not Detected | Normal |
| Result | Status |
|---|---|
| No pathogenic organism grown after 48 hrs of aerobic incubation | Normal - No infection detected |
Generate a quick reference PDF explaining what these stool tests detect
mkdir -p /home/daytona/workspace/stool-report && python3 << 'EOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import mm from reportlab.platypus import ( SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable ) from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY OUTPUT = "/home/daytona/workspace/stool-report/Stool_Tests_Quick_Reference.pdf" doc = SimpleDocTemplate( OUTPUT, pagesize=A4, leftMargin=18*mm, rightMargin=18*mm, topMargin=18*mm, bottomMargin=18*mm ) # ── Colour palette ────────────────────────────────────────────────────────── TEAL = colors.HexColor("#0B6E72") TEAL_LIGHT = colors.HexColor("#E0F4F5") AMBER = colors.HexColor("#E07B00") AMBER_LIGHT= colors.HexColor("#FFF3E0") GREEN = colors.HexColor("#2E7D32") GREEN_LIGHT= colors.HexColor("#E8F5E9") GREY = colors.HexColor("#F5F5F5") DARK = colors.HexColor("#212121") MID = colors.HexColor("#555555") WHITE = colors.white # ── Styles ─────────────────────────────────────────────────────────────────── styles = getSampleStyleSheet() def style(name, parent="Normal", **kw): s = ParagraphStyle(name, parent=styles[parent], **kw) return s title_s = style("Title2", fontSize=20, textColor=WHITE, alignment=TA_CENTER, leading=26, fontName="Helvetica-Bold") subtitle_s = style("Sub2", fontSize=10, textColor=colors.HexColor("#B2EBF2"), alignment=TA_CENTER, leading=14, fontName="Helvetica") sec_s = style("Sec", fontSize=12, textColor=WHITE, fontName="Helvetica-Bold", leading=16) body_s = style("Body2", fontSize=9, textColor=DARK, leading=13, fontName="Helvetica", alignment=TA_JUSTIFY) bold_s = style("Bold2", fontSize=9, textColor=DARK, fontName="Helvetica-Bold", leading=13) small_s = style("Small", fontSize=8, textColor=MID, leading=11, fontName="Helvetica") note_s = style("Note", fontSize=8, textColor=colors.HexColor("#5D4037"), fontName="Helvetica-Oblique", leading=11, alignment=TA_JUSTIFY) footer_s = style("Footer", fontSize=7.5, textColor=MID, alignment=TA_CENTER, fontName="Helvetica") W = A4[0] - 36*mm # usable width story = [] # ══════════════════════════════════════════════════════════════════════════════ # HEADER BANNER # ══════════════════════════════════════════════════════════════════════════════ header_data = [[ Paragraph("Quick Reference Guide", title_s), Paragraph("Stool / Fecal Laboratory Tests", title_s), ]] # Use a single-row table as coloured banner banner = Table( [[Paragraph("<b>Stool Laboratory Tests</b><br/>Quick Reference Guide", title_s)]], colWidths=[W] ) banner.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), TEAL), ("ALIGN", (0,0), (-1,-1), "CENTER"), ("VALIGN", (0,0), (-1,-1), "MIDDLE"), ("TOPPADDING", (0,0),(-1,-1), 12), ("BOTTOMPADDING", (0,0),(-1,-1), 12), ("ROUNDEDCORNERS", [6]), ])) story.append(banner) story.append(Paragraph( "A plain-language explanation of what each test in a routine stool panel detects, " "why it is ordered, and how to read the result.", style("SubHead", fontSize=9, textColor=MID, alignment=TA_CENTER, leading=13, fontName="Helvetica-Oblique", spaceAfter=2) )) story.append(Spacer(1, 6)) story.append(HRFlowable(width=W, thickness=1.2, color=TEAL)) story.append(Spacer(1, 8)) # ══════════════════════════════════════════════════════════════════════════════ # SECTION HELPER # ══════════════════════════════════════════════════════════════════════════════ def section_header(title, colour=TEAL): tbl = Table([[Paragraph(title, sec_s)]], colWidths=[W]) tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), colour), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 8), ("ROUNDEDCORNERS", [4]), ])) return tbl def two_col_row(label, value, label_w=52*mm): return [Paragraph(f"<b>{label}</b>", bold_s), Paragraph(value, body_s)] def info_table(rows, label_w=52*mm): tbl = Table(rows, colWidths=[label_w, W - label_w]) tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), GREY), ("ROWBACKGROUNDS",(0,0), (-1,-1), [WHITE, GREY]), ("TOPPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 4), ("LEFTPADDING", (0,0), (-1,-1), 6), ("RIGHTPADDING", (0,0), (-1,-1), 6), ("VALIGN", (0,0), (-1,-1), "TOP"), ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")), ])) return tbl # ══════════════════════════════════════════════════════════════════════════════ # TEST 1 – STOOL ROUTINE & MICROSCOPIC EXAMINATION # ══════════════════════════════════════════════════════════════════════════════ story.append(section_header("TEST 1 — Stool Routine & Microscopic Examination")) story.append(Spacer(1, 4)) story.append(Paragraph( "This test has two parts: a <b>macroscopic (physical)</b> examination of the stool sample " "and a <b>microscopic</b> examination under a microscope. Together they screen for infections, " "parasites, and signs of gut inflammation.", body_s )) story.append(Spacer(1, 6)) # -- Physical Parameters sub-table story.append(Paragraph("<b>Part A: Physical (Macroscopic) Parameters</b>", bold_s)) story.append(Spacer(1, 3)) phys_rows = [ [Paragraph("<b>Parameter</b>", bold_s), Paragraph("<b>What it detects</b>", bold_s), Paragraph("<b>Normal</b>", bold_s)], [Paragraph("Colour", bold_s), Paragraph("Diet, bile, or bleeding affect stool colour. Black/tarry = upper GI bleed; " "red = lower GI bleed; pale/clay = bile duct blockage; yellow/green can be " "rapid transit or infection.", body_s), Paragraph("Yellowish brown", small_s)], [Paragraph("Consistency", bold_s), Paragraph("Reflects water content and bowel transit time. Very loose/watery suggests " "infection, malabsorption, or IBS-D. Hard pellets suggest constipation.", body_s), Paragraph("Semi-solid / formed", small_s)], [Paragraph("Mucus", bold_s), Paragraph("Excess mucus points to inflammation of the intestinal lining — seen in " "irritable bowel syndrome (IBS), Crohn's disease, ulcerative colitis, or " "bacterial infection.", body_s), Paragraph("Absent", small_s)], [Paragraph("Blood (visible)", bold_s), Paragraph("Visible red blood indicates lower GI bleeding — haemorrhoids, fissures, " "colitis, polyps, or colorectal cancer.", body_s), Paragraph("Absent", small_s)], [Paragraph("Odour", bold_s), Paragraph("Unusually foul odour can suggest malabsorption (e.g. fat malabsorption, " "coeliac disease) or certain infections.", body_s), Paragraph("Normal fecal", small_s)], ] phys_tbl = Table(phys_rows, colWidths=[28*mm, W - 28*mm - 25*mm, 25*mm]) phys_tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,0), TEAL_LIGHT), ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY]), ("TOPPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 4), ("LEFTPADDING", (0,0), (-1,-1), 5), ("RIGHTPADDING", (0,0), (-1,-1), 5), ("VALIGN", (0,0), (-1,-1), "TOP"), ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")), ("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"), ])) story.append(phys_tbl) story.append(Spacer(1, 7)) # -- Microscopic Parameters sub-table story.append(Paragraph("<b>Part B: Microscopic Parameters</b>", bold_s)) story.append(Spacer(1, 3)) micro_rows = [ [Paragraph("<b>Parameter</b>", bold_s), Paragraph("<b>What it detects</b>", bold_s), Paragraph("<b>Normal</b>", bold_s)], [Paragraph("Cysts", bold_s), Paragraph("Dormant (inactive) forms of intestinal protozoa. Entamoeba histolytica " "cysts cause amoebic dysentery; Giardia lamblia cysts cause giardiasis " "(chronic diarrhoea, bloating).", body_s), Paragraph("Not detected", small_s)], [Paragraph("Trophozoites", bold_s), Paragraph("Active, feeding forms of protozoa — their presence confirms active infection. " "Seen in amoebic dysentery and giardiasis.", body_s), Paragraph("Not detected", small_s)], [Paragraph("Charcot-Leyden Crystals", bold_s), Paragraph("Protein crystals released when eosinophil (allergy/immune cells) break down. " "Their presence suggests intestinal parasitic infection or allergic bowel disease.", body_s), Paragraph("Not detected", small_s)], [Paragraph("Ova (eggs)", bold_s), Paragraph("Eggs of intestinal worms (helminths). Detects roundworm (Ascaris), hookworm, " "whipworm (Trichuris), tapeworm, etc. Confirms helminthic infestation.", body_s), Paragraph("Not detected", small_s)], [Paragraph("Adult Parasite", bold_s), Paragraph("Visible worm segments or whole worms passed in stool — confirms heavy " "infestation with tapeworm, roundworm, or pinworm.", body_s), Paragraph("Not detected", small_s)], [Paragraph("RBC (Red Blood Cells)", bold_s), Paragraph("Blood cells in stool indicate active bleeding or invasion of the gut lining — " "seen in amoebic dysentery, ulcerative colitis, and colorectal cancer.", body_s), Paragraph("Not detected", small_s)], [Paragraph("Pus Cells (WBC/hpf)", bold_s), Paragraph("White blood cells in stool signal active bowel inflammation or bacterial " "infection. Elevated counts seen in Shigella, Salmonella, Campylobacter " "infections, and inflammatory bowel disease.", body_s), Paragraph("0–5 /hpf", small_s)], ] micro_tbl = Table(micro_rows, colWidths=[35*mm, W - 35*mm - 25*mm, 25*mm]) micro_tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,0), TEAL_LIGHT), ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY]), ("TOPPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 4), ("LEFTPADDING", (0,0), (-1,-1), 5), ("RIGHTPADDING", (0,0), (-1,-1), 5), ("VALIGN", (0,0), (-1,-1), "TOP"), ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")), ("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"), ])) story.append(micro_tbl) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # TEST 2 – STOOL OCCULT BLOOD # ══════════════════════════════════════════════════════════════════════════════ story.append(section_header("TEST 2 — Stool Occult Blood (Guaiac Method)", colour=AMBER)) story.append(Spacer(1, 4)) sob_rows = [ two_col_row("Purpose:", "Detects hidden (invisible) blood in stool — blood not visible to the naked eye " "but present due to slow/minor bleeding anywhere along the gastrointestinal tract."), two_col_row("Method:", "Guaiac-based chemical test. A chemical reaction turns blue in the presence of " "haemoglobin (blood protein). Does not tell WHERE the bleeding is coming from."), two_col_row("What it can detect:", "Colorectal cancer (early screening), stomach/gastric cancer, colon polyps or adenomas, " "diverticular disease, haemorrhoids (piles), inflammatory bowel disease (Crohn's / ulcerative colitis), " "gastric ulcers, angiodysplasia (abnormal blood vessels in the gut), sickle cell anaemia (rare)."), two_col_row("Important note:", "A negative result does NOT rule out cancer — tumours may bleed intermittently. " "A positive result needs follow-up investigations (colonoscopy, endoscopy) to find the source."), two_col_row("Normal result:", "Not Detected"), ] story.append(info_table(sob_rows)) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # TEST 3 – STOOL CULTURE # ══════════════════════════════════════════════════════════════════════════════ story.append(section_header("TEST 3 — Stool Culture (Aerobic Bacterial Culture)", colour=GREEN)) story.append(Spacer(1, 4)) sc_rows = [ two_col_row("Purpose:", "Identifies harmful (pathogenic) bacteria causing gut infection — diarrhoea, " "food poisoning, dysentery, or gastroenteritis."), two_col_row("Method:", "Stool sample is placed on special growth media and incubated at 37°C (body temperature) " "for 48 hours under aerobic (oxygen-rich) conditions. Any bacteria that grow are " "identified by their colony characteristics and biochemical tests (Phoenix M50 system)."), two_col_row("Bacteria it can detect:", "Salmonella (typhoid/food poisoning), Shigella (bacillary dysentery), " "Campylobacter jejuni, Escherichia coli O157:H7 (food poisoning), " "Vibrio cholerae (cholera), Yersinia enterocolitica, Staphylococcus aureus."), two_col_row("Antibiotic Sensitivity:", "If a pathogen is found, the lab also tests which antibiotics can kill it. " "Results are reported as Sensitive (S), Intermediate (I), or Resistant (R) " "to guide the doctor in choosing the right antibiotic."), two_col_row("Limitation:", "This test only grows aerobic bacteria. Anaerobic bacteria (e.g. Clostridium difficile) " "and viruses (norovirus, rotavirus) require separate specialised tests and will NOT " "grow on routine aerobic culture."), two_col_row("Normal result:", "No pathogenic organism isolated"), ] story.append(info_table(sc_rows)) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # SUMMARY TABLE # ══════════════════════════════════════════════════════════════════════════════ story.append(HRFlowable(width=W, thickness=1, color=TEAL)) story.append(Spacer(1, 5)) story.append(Paragraph("<b>At a Glance — Summary</b>", style("SumHd", fontSize=11, textColor=TEAL, fontName="Helvetica-Bold", leading=15))) story.append(Spacer(1, 4)) sum_rows = [ [Paragraph("<b>Test</b>", bold_s), Paragraph("<b>Main Purpose</b>", bold_s), Paragraph("<b>Key Findings if Abnormal</b>", bold_s)], [Paragraph("Stool Routine &\nMicroscopic", small_s), Paragraph("Detects parasites, worms, gut inflammation", body_s), Paragraph("Parasitic infection, amoebic dysentery, helminthiasis, " "IBD flare, bacterial colitis", body_s)], [Paragraph("Stool Occult Blood", small_s), Paragraph("Detects hidden GI bleeding", body_s), Paragraph("Colorectal cancer, polyps, ulcers, IBD, diverticular disease, " "haemorrhoids", body_s)], [Paragraph("Stool Culture", small_s), Paragraph("Identifies pathogenic bacteria & antibiotic sensitivity", body_s), Paragraph("Salmonella, Shigella, E. coli, Campylobacter, Cholera, etc. — " "guides antibiotic choice", body_s)], ] sum_tbl = Table(sum_rows, colWidths=[30*mm, W//2 - 10*mm, W - 30*mm - (W//2 - 10*mm)]) sum_tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,0), TEAL), ("TEXTCOLOR", (0,0), (-1,0), WHITE), ("ROWBACKGROUNDS",(0,1), (-1,-1), [TEAL_LIGHT, WHITE]), ("TOPPADDING", (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5), ("LEFTPADDING", (0,0), (-1,-1), 6), ("RIGHTPADDING", (0,0), (-1,-1), 6), ("VALIGN", (0,0), (-1,-1), "TOP"), ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")), ("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"), ])) story.append(sum_tbl) story.append(Spacer(1, 8)) # ══════════════════════════════════════════════════════════════════════════════ # DISCLAIMER / FOOTER NOTE # ══════════════════════════════════════════════════════════════════════════════ note_box = Table( [[Paragraph( "<b>Note:</b> This quick reference is for educational purposes only. " "Lab results must always be interpreted in the context of the patient's symptoms, " "clinical history, and examination by a qualified physician. " "Do not self-diagnose or self-medicate based on this guide.", note_s )]], colWidths=[W] ) note_box.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), AMBER_LIGHT), ("LEFTPADDING", (0,0),(-1,-1), 8), ("RIGHTPADDING", (0,0),(-1,-1), 8), ("TOPPADDING", (0,0),(-1,-1), 6), ("BOTTOMPADDING", (0,0),(-1,-1), 6), ("BOX", (0,0),(-1,-1), 0.8, AMBER), ("ROUNDEDCORNERS", [4]), ])) story.append(note_box) story.append(Spacer(1, 5)) story.append(Paragraph("Generated by Orris AI | June 2026 | For Patient Education Only", footer_s)) doc.build(story) print("PDF created:", OUTPUT) EOF
Stool Tests Quick Reference
PDF Document · PDF
Create a patient-friendly summary document of Mr. Sharma's normal test results
python3 << 'EOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import mm from reportlab.platypus import ( SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, KeepTogether ) from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY, TA_RIGHT OUTPUT = "/home/daytona/workspace/stool-report/Chander_Sharma_Patient_Summary.pdf" doc = SimpleDocTemplate( OUTPUT, pagesize=A4, leftMargin=20*mm, rightMargin=20*mm, topMargin=18*mm, bottomMargin=18*mm ) W = A4[0] - 40*mm # ── Colours ────────────────────────────────────────────────────────────────── TEAL = colors.HexColor("#0B7B82") TEAL_LIGHT = colors.HexColor("#E0F5F5") TEAL_MID = colors.HexColor("#B2DFDB") GREEN = colors.HexColor("#2E7D32") GREEN_LIGHT = colors.HexColor("#E8F5E9") GREEN_MID = colors.HexColor("#A5D6A7") GREY_DARK = colors.HexColor("#424242") GREY_MID = colors.HexColor("#757575") GREY_LIGHT = colors.HexColor("#F5F5F5") AMBER = colors.HexColor("#E65100") AMBER_LIGHT = colors.HexColor("#FFF3E0") WHITE = colors.white # ── Styles ──────────────────────────────────────────────────────────────────── def S(name, **kw): base = kw.pop("parent", "Normal") from reportlab.lib.styles import getSampleStyleSheet ss = getSampleStyleSheet() return ParagraphStyle(name, parent=ss[base], **kw) title_s = S("T", fontSize=22, textColor=WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=28) name_s = S("N", fontSize=13, textColor=WHITE, fontName="Helvetica", alignment=TA_CENTER, leading=18) date_s = S("D", fontSize=9, textColor=colors.HexColor("#B2EBF2"), fontName="Helvetica", alignment=TA_CENTER, leading=12) sec_s = S("Sc", fontSize=11, textColor=WHITE, fontName="Helvetica-Bold", leading=15) body_s = S("B", fontSize=9.5,textColor=GREY_DARK, fontName="Helvetica", leading=14, alignment=TA_JUSTIFY) bold_s = S("Bo", fontSize=9.5,textColor=GREY_DARK, fontName="Helvetica-Bold", leading=14) small_s = S("Sm", fontSize=8.5,textColor=GREY_MID, fontName="Helvetica", leading=12) tick_s = S("Tk", fontSize=10, textColor=GREEN, fontName="Helvetica-Bold", leading=14) label_s = S("Lb", fontSize=8.5,textColor=GREY_MID, fontName="Helvetica-Bold", leading=12, alignment=TA_RIGHT) val_s = S("Vl", fontSize=9, textColor=GREEN, fontName="Helvetica-Bold", leading=12) note_s = S("Nt", fontSize=8.5,textColor=colors.HexColor("#4E342E"), fontName="Helvetica-Oblique", leading=12, alignment=TA_JUSTIFY) footer_s = S("Ft", fontSize=7.5,textColor=GREY_MID, fontName="Helvetica", alignment=TA_CENTER, leading=11) big_s = S("Bg", fontSize=13, textColor=GREEN, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=18) msg_s = S("Mg", fontSize=10, textColor=GREY_DARK, fontName="Helvetica", alignment=TA_CENTER, leading=15) story = [] # ══════════════════════════════════════════════════════════════════════════════ # HEADER BANNER # ══════════════════════════════════════════════════════════════════════════════ banner = Table( [[Paragraph("Your Stool Test Results", title_s)], [Paragraph("Mr. Chander Sharma | Age 60 | Male", name_s)], [Paragraph("Sample collected: 08 April 2026 | Report date: 11 April 2026\n" "Referring doctor: Dr. Devansh | Lab: Pathkind Labs, Lucknow", date_s)]], colWidths=[W] ) banner.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), TEAL), ("TOPPADDING", (0,0),(-1,-1), 10), ("BOTTOMPADDING", (0,0),(-1,-1), 8), ("LEFTPADDING", (0,0),(-1,-1), 12), ("RIGHTPADDING", (0,0),(-1,-1), 12), ])) story.append(banner) story.append(Spacer(1, 8)) # ══════════════════════════════════════════════════════════════════════════════ # OVERALL RESULT BOX # ══════════════════════════════════════════════════════════════════════════════ overall = Table( [[Paragraph("✔ All Results Are Normal", big_s)], [Paragraph( "No infection, no parasites, no hidden blood, and no harmful bacteria were found " "in your stool sample. This is a reassuring result.", msg_s)]], colWidths=[W] ) overall.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), GREEN_LIGHT), ("BOX", (0,0),(-1,-1), 1.5, GREEN), ("TOPPADDING", (0,0),(-1,-1), 8), ("BOTTOMPADDING", (0,0),(-1,-1), 8), ("LEFTPADDING", (0,0),(-1,-1), 12), ("RIGHTPADDING", (0,0),(-1,-1), 12), ])) story.append(overall) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # HELPER # ══════════════════════════════════════════════════════════════════════════════ def sec_header(text, colour=TEAL): t = Table([[Paragraph(text, sec_s)]], colWidths=[W]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), colour), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 10), ])) return t def result_row(test, result, what_it_means, tick="✔"): return [ Paragraph(f"<b>{test}</b>", bold_s), Paragraph(f'<font color="#2E7D32"><b>{tick} {result}</b></font>', bold_s), Paragraph(what_it_means, body_s), ] # ══════════════════════════════════════════════════════════════════════════════ # SECTION 1 — PHYSICAL EXAMINATION # ══════════════════════════════════════════════════════════════════════════════ story.append(sec_header("Part 1 — Physical Appearance of Your Stool Sample")) story.append(Spacer(1, 5)) story.append(Paragraph( "The laboratory first looked at your stool sample with the naked eye to check its " "colour, texture, and whether any blood or mucus was present.", body_s )) story.append(Spacer(1, 5)) phys_rows = [ [Paragraph("<b>Test</b>", bold_s), Paragraph("<b>Your Result</b>", bold_s), Paragraph("<b>What this means for you</b>", bold_s)], result_row("Colour", "Yellowish", "Your stool colour is slightly lighter than the typical yellowish-brown, " "which can be due to diet or how quickly food moved through your gut. " "There is no sign of bleeding or bile duct blockage."), result_row("Consistency", "Soft", "Your stool is soft and formed — a healthy texture that shows normal " "bowel function."), result_row("Mucus", "Absent (Normal)", "No mucus was found. Mucus in stool can be a sign of bowel inflammation " "or irritable bowel syndrome. Your result is clear."), result_row("Blood (visible)", "Absent (Normal)", "No visible blood in the sample. This means there is no obvious bleeding " "in your digestive tract that can be seen with the eye."), result_row("Odour", "Normal (Fecal)", "Normal stool odour. No unusual smell that would suggest malabsorption " "or a major infection."), ] col_w = [35*mm, 30*mm, W - 65*mm] ptbl = Table(phys_rows, colWidths=col_w) ptbl.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,0), TEAL_LIGHT), ("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, GREY_LIGHT]), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 6), ("RIGHTPADDING", (0,0),(-1,-1), 6), ("VALIGN", (0,0),(-1,-1), "TOP"), ("GRID", (0,0),(-1,-1), 0.3, colors.HexColor("#CCCCCC")), ("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"), ])) story.append(ptbl) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # SECTION 2 — MICROSCOPIC EXAMINATION # ══════════════════════════════════════════════════════════════════════════════ story.append(sec_header("Part 2 — Microscopic Examination (Under the Microscope)")) story.append(Spacer(1, 5)) story.append(Paragraph( "A small portion of the stool was examined under a microscope to check for " "parasites, worm eggs, and signs of gut inflammation.", body_s )) story.append(Spacer(1, 5)) micro_rows = [ [Paragraph("<b>Test</b>", bold_s), Paragraph("<b>Your Result</b>", bold_s), Paragraph("<b>What this means for you</b>", bold_s)], result_row("Cysts (parasite shells)", "Not Detected", "No dormant parasite shells found. This rules out infections like " "amoebic dysentery (Entamoeba) and giardiasis (Giardia)."), result_row("Trophozoites (active parasites)", "Not Detected", "No active parasites found in your stool. Your gut is free from " "protozoan infections."), result_row("Charcot-Leyden Crystals", "Not Detected", "These crystals appear when immune cells fight parasites. None were " "found, so there is no allergic or parasitic gut reaction."), result_row("Ova (worm eggs)", "Not Detected", "No worm eggs found. This rules out intestinal worm infections such " "as roundworm, hookworm, whipworm, or tapeworm."), result_row("Adult Parasites", "Not Detected", "No worms or worm segments visible. Your gut is clear of worm " "infestations."), result_row("RBC (blood cells)", "Not Detected", "No blood cells seen under the microscope. This means the gut lining " "is not being damaged or eroded by infection or disease."), result_row("Pus Cells", "0–1 per field (Normal)", "Only 0 to 1 pus cells seen, which is within the normal range (0–5). " "No significant inflammation in the gut."), ] mtbl = Table(micro_rows, colWidths=col_w) mtbl.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,0), TEAL_LIGHT), ("ROWBACKGROUNDS",(0,1),(-1,-1), [WHITE, GREY_LIGHT]), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 6), ("RIGHTPADDING", (0,0),(-1,-1), 6), ("VALIGN", (0,0),(-1,-1), "TOP"), ("GRID", (0,0),(-1,-1), 0.3, colors.HexColor("#CCCCCC")), ("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"), ])) story.append(mtbl) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # SECTION 3 — OCCULT BLOOD # ══════════════════════════════════════════════════════════════════════════════ story.append(sec_header("Part 3 — Hidden Blood in Stool (Occult Blood Test)", colour=colors.HexColor("#1565C0"))) story.append(Spacer(1, 5)) ob_data = [ [Paragraph("<b>Your Result:</b>", bold_s), Paragraph('<font color="#2E7D32"><b>✔ Not Detected — Normal</b></font>', bold_s)], [Paragraph("<b>What was tested:</b>", bold_s), Paragraph("A chemical test (Guaiac method) was used to detect very small amounts " "of blood that cannot be seen with the naked eye.", body_s)], [Paragraph("<b>What this means:</b>", bold_s), Paragraph("No hidden blood was found in your stool. This is a good sign — it means " "there is currently no detectable bleeding anywhere along your digestive " "tract (from mouth to bowel).", body_s)], [Paragraph("<b>Why this matters:</b>", bold_s), Paragraph("This test is used to screen for early signs of colorectal cancer, polyps, " "ulcers, and bowel inflammation. A negative result is reassuring, but it " "does not completely rule out these conditions on its own — regular check-ups " "with your doctor remain important.", body_s)], ] ob_tbl = Table(ob_data, colWidths=[38*mm, W - 38*mm]) ob_tbl.setStyle(TableStyle([ ("ROWBACKGROUNDS",(0,0),(-1,-1), [colors.HexColor("#E3F2FD"), WHITE]), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 7), ("RIGHTPADDING", (0,0),(-1,-1), 7), ("VALIGN", (0,0),(-1,-1), "TOP"), ("GRID", (0,0),(-1,-1), 0.3, colors.HexColor("#BBDEFB")), ])) story.append(ob_tbl) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # SECTION 4 — STOOL CULTURE # ══════════════════════════════════════════════════════════════════════════════ story.append(sec_header("Part 4 — Bacterial Culture (Germ Growth Test)", colour=colors.HexColor("#558B2F"))) story.append(Spacer(1, 5)) sc_data = [ [Paragraph("<b>Your Result:</b>", bold_s), Paragraph('<font color="#2E7D32"><b>✔ No Harmful Bacteria Found — Normal</b></font>', bold_s)], [Paragraph("<b>What was tested:</b>", bold_s), Paragraph("Your stool was placed in a warm lab environment for 48 hours to see if " "any harmful bacteria would grow.", body_s)], [Paragraph("<b>What this means:</b>", bold_s), Paragraph("No dangerous bacteria (such as Salmonella, Shigella, or E. coli) were " "detected. This means your current gut symptoms — if any — are not caused " "by a bacterial gut infection.", body_s)], [Paragraph("<b>Good to know:</b>", bold_s), Paragraph("This test checks for common bacteria that cause food poisoning, typhoid, " "or dysentery. If an infection had been found, the lab would also test " "which antibiotics could treat it. Since nothing was found, no antibiotic " "treatment is needed based on this test.", body_s)], ] sc_tbl = Table(sc_data, colWidths=[38*mm, W - 38*mm]) sc_tbl.setStyle(TableStyle([ ("ROWBACKGROUNDS",(0,0),(-1,-1), [GREEN_LIGHT, WHITE]), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 7), ("RIGHTPADDING", (0,0),(-1,-1), 7), ("VALIGN", (0,0),(-1,-1), "TOP"), ("GRID", (0,0),(-1,-1), 0.3, GREEN_MID), ])) story.append(sc_tbl) story.append(Spacer(1, 10)) # ══════════════════════════════════════════════════════════════════════════════ # WHAT TO DO NEXT # ══════════════════════════════════════════════════════════════════════════════ story.append(HRFlowable(width=W, thickness=1.2, color=TEAL)) story.append(Spacer(1, 5)) story.append(Paragraph("<b>What Should You Do Next?</b>", S("NxHd", fontSize=11, textColor=TEAL, fontName="Helvetica-Bold", leading=15))) story.append(Spacer(1, 4)) next_rows = [ ["1.", Paragraph("<b>Share this report with Dr. Devansh</b> — your referring doctor " "will review these results alongside your symptoms and medical history to give " "you a complete picture of your health.", body_s)], ["2.", Paragraph("<b>Continue any prescribed treatment</b> — a normal stool test does " "not mean all problems are resolved. Your doctor may have ordered other tests as well.", body_s)], ["3.", Paragraph("<b>Watch for warning signs</b> — if you develop blood in stools, " "severe abdominal pain, unexplained weight loss, or persistent diarrhoea, " "please contact your doctor promptly.", body_s)], ["4.", Paragraph("<b>Keep your follow-up appointment</b> — regular check-ups are " "important, especially since you are 60 years old. Stool tests and colorectal " "screening are recommended periodically for your age group.", body_s)], ] next_tbl = Table(next_rows, colWidths=[7*mm, W - 7*mm]) next_tbl.setStyle(TableStyle([ ("ROWBACKGROUNDS",(0,0),(-1,-1), [TEAL_LIGHT, WHITE]), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 6), ("VALIGN", (0,0),(-1,-1), "TOP"), ("FONTNAME", (0,0),(-1,-1), "Helvetica-Bold"), ("FONTSIZE", (0,0),(-1,-1), 10), ("TEXTCOLOR", (0,0),(0,-1), TEAL), ])) story.append(next_tbl) story.append(Spacer(1, 8)) # ══════════════════════════════════════════════════════════════════════════════ # DISCLAIMER # ══════════════════════════════════════════════════════════════════════════════ disc = Table( [[Paragraph( "<b>Important:</b> This document is a plain-language summary prepared for patient " "education only. It does not replace professional medical advice, diagnosis, or treatment. " "Always follow the guidance of your treating physician, Dr. Devansh.", note_s )]], colWidths=[W] ) disc.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), AMBER_LIGHT), ("BOX", (0,0),(-1,-1), 0.8, AMBER), ("LEFTPADDING", (0,0),(-1,-1), 8), ("RIGHTPADDING", (0,0),(-1,-1), 8), ("TOPPADDING", (0,0),(-1,-1), 6), ("BOTTOMPADDING", (0,0),(-1,-1), 6), ])) story.append(disc) story.append(Spacer(1, 5)) story.append(Paragraph( "Prepared by Orris AI | June 2026 | Based on Pathkind Labs Report — Barcode 80013419281", footer_s )) doc.build(story) print("PDF created:", OUTPUT) EOF
Chander Sharma Patient Summary
PDF Document · PDF
Restart orris
Start fresh after shutdown
Show patient records