This are my father report analyse it
cd "/tmp/workspace/attachments/a5baf6ce-a60e-44d3-999e-9f6fb9ede446/" && python3 -c " import pdfplumber with pdfplumber.open('Mr.MOHAMMAD HANIEF KHAYAM-1.pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): print(f'\n--- PAGE {i+1} ---') text = page.extract_text() if text: print(text) tables = page.extract_tables() if tables: for t_idx, table in enumerate(tables): print(f'[TABLE {t_idx+1}]') for row in table: print(row) "
| Test | Result | Normal Range | Status |
|---|---|---|---|
| Haemoglobin | 11.6 g/dL | 13.0β17.0 | π΄ LOW |
| RBC | 4.22 million/cmm | 4.5β5.5 | π΄ LOW |
| HCT (Haematocrit) | 35.7% | 40β50% | π΄ LOW |
| Platelet Count | 14 thou/Β΅L | 150β410 | π¨ CRITICALLY LOW |
| PCT | 0.01% | 0.10β0.28% | π΄ LOW |
| RDW-CV | 17.1% | 11.6β14.0% | π΄ HIGH |
| ESR | 32 mm/Hr | 0β15 | π΄ HIGH |
| Test | Result | Normal Range | Status |
|---|---|---|---|
| SGOT (AST) | 63.9 IU/L | 0β40 | π΄ HIGH |
| SGPT (ALT) | 75.6 IU/L | 0β41 | π΄ HIGH |
| Conjugated Bilirubin | 0.37 mg/dL | 0.0β0.3 | π‘ MILDLY HIGH |
| Unconjugated Bilirubin | 0.75 mg/dL | 0.2β0.7 | π‘ MILDLY HIGH |
| Test | Result | Normal Range | Status |
|---|---|---|---|
| Uric Acid | 7.28 mg/dL | 3.4β7.0 | π‘ HIGH |
| Test | Result | Normal Range | Status |
|---|---|---|---|
| Triglycerides | 165 mg/dL | <150 | π‘ BORDERLINE HIGH |
| Test | Result | Status |
|---|---|---|
| Fasting Blood Sugar | 95 mg/dL | β Normal (No diabetes) |
| T3 / T4 / TSH (Thyroid) | All Normal | β Normal thyroid function |
| Kidney Panel (Creatinine, Urea, BUN) | All Normal | β Kidneys working well |
| eGFR | 88.06 mL/min | β Good kidney filtration |
| Sodium, Potassium, Chloride, Calcium | All Normal | β Electrolytes balanced |
| White Blood Cells (TLC) | 5.33 th/cumm | β Normal |
| Albumin, Total Protein | Normal | β Liver making proteins well |
| Priority | Finding | Action Needed |
|---|---|---|
| π¨ URGENT | Platelets = 14,000 | See a doctor/haematologist TODAY. Risk of serious bleeding. |
| π΄ HIGH | Anaemia (Hb 11.6) | Iron studies (serum ferritin, serum iron, TIBC) to confirm IDA. Start iron supplements if confirmed. |
| π΄ HIGH | Elevated SGOT/SGPT | Hepatitis B & C serology, liver ultrasound. Avoid alcohol & liver-toxic medications. |
| π‘ MODERATE | High Uric Acid | Dietary changes; consult doctor if joint pain is present. |
| π‘ LOW | Borderline Triglycerides | Diet and lifestyle modification. |
Important: The critically low platelet count of 14,000 is the most urgent concern. Causes can include viral infections (dengue, hepatitis), immune thrombocytopenia (ITP), bone marrow issues, or medications. Please take your father to a physician or emergency department as soon as possible for evaluation. Do not delay this.
Create a summary document to share with your father's doctor
mkdir -p /tmp/workspace/hanief-report && python3 << 'EOF' from docx import Document from docx.shared import Pt, Inches, RGBColor from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement import datetime doc = Document() # --- Page margins --- from docx.shared import Cm section = doc.sections[0] section.top_margin = Cm(2) section.bottom_margin = Cm(2) section.left_margin = Cm(2.5) section.right_margin = Cm(2.5) # --- Default font --- style = doc.styles['Normal'] style.font.name = 'Arial' style.font.size = Pt(11) # Helper: add a colored heading def add_heading(doc, text, level=1, color=None): p = doc.add_heading(text, level=level) if color: for run in p.runs: run.font.color.rgb = RGBColor(*color) return p # Helper: add a table with header row def add_table(doc, headers, rows, header_color=(31, 73, 125)): table = doc.add_table(rows=1 + len(rows), cols=len(headers)) table.style = 'Table Grid' # Header row hdr_cells = table.rows[0].cells for i, h in enumerate(headers): hdr_cells[i].text = h run = hdr_cells[i].paragraphs[0].runs[0] run.bold = True run.font.color.rgb = RGBColor(255, 255, 255) # Background color tc = hdr_cells[i]._tc tcPr = tc.get_or_add_tcPr() shd = OxmlElement('w:shd') shd.set(qn('w:val'), 'clear') shd.set(qn('w:color'), 'auto') r, g, b = header_color shd.set(qn('w:fill'), f'{r:02X}{g:02X}{b:02X}') tcPr.append(shd) # Data rows for r_idx, row_data in enumerate(rows): row_cells = table.rows[r_idx + 1].cells for c_idx, cell_text in enumerate(row_data): row_cells[c_idx].text = str(cell_text) # Color status column (last col) if it has flags if c_idx == len(row_data) - 1: run = row_cells[c_idx].paragraphs[0].runs txt = str(cell_text) if run: if 'CRITICAL' in txt or 'URGENT' in txt: run[0].font.color.rgb = RGBColor(192, 0, 0) run[0].bold = True elif 'HIGH' in txt or 'LOW' in txt or 'ABNORMAL' in txt: run[0].font.color.rgb = RGBColor(192, 0, 0) elif 'BORDERLINE' in txt or 'MILDLY' in txt: run[0].font.color.rgb = RGBColor(197, 90, 17) elif 'NORMAL' in txt: run[0].font.color.rgb = RGBColor(0, 112, 0) return table def shade_row(table, row_idx, hex_color): for cell in table.rows[row_idx].cells: tc = cell._tc tcPr = tc.get_or_add_tcPr() shd = OxmlElement('w:shd') shd.set(qn('w:val'), 'clear') shd.set(qn('w:color'), 'auto') shd.set(qn('w:fill'), hex_color) tcPr.append(shd) # ===================== DOCUMENT STARTS ===================== # --- Title Block --- title = doc.add_paragraph() title.alignment = WD_ALIGN_PARAGRAPH.CENTER run = title.add_run('PATIENT LAB REPORT SUMMARY') run.bold = True run.font.size = Pt(16) run.font.color.rgb = RGBColor(31, 73, 125) sub = doc.add_paragraph() sub.alignment = WD_ALIGN_PARAGRAPH.CENTER run2 = sub.add_run('Prepared for Physician Review') run2.font.size = Pt(11) run2.italic = True run2.font.color.rgb = RGBColor(89, 89, 89) doc.add_paragraph() # --- Patient Info Table --- add_heading(doc, 'Patient Information', level=2, color=(31, 73, 125)) info_table = doc.add_table(rows=5, cols=2) info_table.style = 'Table Grid' info_data = [ ('Patient Name', 'Mr. Mohammad Hanief Khayam'), ('Age / Gender', '57 Years / Male'), ('Lab Number', 'SRI2608050552'), ('Sample Collected', '05 August 2026'), ('Report Date', '06 August 2026'), ] for i, (label, value) in enumerate(info_data): info_table.rows[i].cells[0].text = label info_table.rows[i].cells[1].text = value r = info_table.rows[i].cells[0].paragraphs[0].runs if r: r[0].bold = True doc.add_paragraph() # ===================== ABNORMAL FINDINGS ===================== add_heading(doc, 'ABNORMAL FINDINGS', level=1, color=(192, 0, 0)) # --- 1. CRITICAL: Platelets --- add_heading(doc, '1. CRITICALLY LOW Platelet Count β URGENT', level=2, color=(192, 0, 0)) p = doc.add_paragraph() p.add_run('Result: ').bold = True p.add_run('14,000 /Β΅L ') r = p.add_run('(Normal: 150,000 β 410,000 /Β΅L)') r.font.color.rgb = RGBColor(89, 89, 89) bullet_points = [ 'This is approximately 10x below the lower limit of normal.', 'A count below 20,000 /Β΅L carries a HIGH RISK of spontaneous bleeding (gums, nose, skin bruising, or internal haemorrhage).', 'Urgent haematology evaluation is recommended.', 'Possible causes to investigate: Dengue fever, ITP (Immune Thrombocytopenic Purpura), Hepatitis B/C, bone marrow pathology, drug-induced thrombocytopenia.', 'Additional tests suggested: Peripheral blood smear, repeat platelet count (manual), Dengue NS1/IgM, bone marrow biopsy if indicated.', ] for bp in bullet_points: p2 = doc.add_paragraph(bp, style='List Bullet') p2.runs[0].font.size = Pt(10.5) doc.add_paragraph() # --- 2. Anaemia --- add_heading(doc, '2. Anaemia (Iron Deficiency Pattern)', level=2, color=(192, 0, 0)) cbc_rows = [ ('Haemoglobin', '11.6 g/dL', '13.0 β 17.0', 'LOW'), ('RBC Count', '4.22 million/cmm', '4.5 β 5.5', 'LOW'), ('Haematocrit (HCT)', '35.7 %', '40 β 50%', 'LOW'), ('RDW-CV', '17.1 %', '11.6 β 14.0%', 'HIGH'), ('ESR (Westergren)', '32 mm/Hr', '0 β 15', 'HIGH'), ] add_table(doc, ['Parameter', 'Result', 'Reference Range', 'Status'], cbc_rows) doc.add_paragraph() p = doc.add_paragraph('Interpretation: ') p.runs[0].bold = True p.add_run( 'The anaemia indices (Mentzer Index 20.05 > 13; RDWI 342.81 > 220) are consistent with ' 'Iron Deficiency Anaemia (IDA). Thalassemia trait is less likely. ' 'The elevated ESR (32 mm/Hr) suggests background inflammation.' ) doc.add_paragraph() p = doc.add_paragraph('Suggested investigations: ') p.runs[0].bold = True p.add_run('Serum Ferritin, Serum Iron, TIBC, Reticulocyte count, Vitamin B12 & Folate levels.') doc.add_paragraph() # --- 3. LFT --- add_heading(doc, '3. Liver Function β Mildly Elevated Enzymes', level=2, color=(192, 0, 0)) lft_rows = [ ('SGOT (AST)', '63.9 IU/L', '0 β 40 IU/L', 'HIGH (1.6x ULN)'), ('SGPT (ALT)', '75.6 IU/L', '0 β 41 IU/L', 'HIGH (1.8x ULN)'), ('Conjugated Bilirubin', '0.37 mg/dL', '0.0 β 0.3', 'MILDLY HIGH'), ('Unconjugated Bilirubin', '0.75 mg/dL', '0.2 β 0.7', 'MILDLY HIGH'), ('SGOT/SGPT Ratio', '0.85', '< 1', 'Normal pattern'), ] add_table(doc, ['Parameter', 'Result', 'Reference Range', 'Status'], lft_rows) doc.add_paragraph() p = doc.add_paragraph('Interpretation: ') p.runs[0].bold = True p.add_run( 'Mild hepatocellular injury pattern. SGOT/SGPT ratio < 1 favours non-alcoholic fatty liver disease (NAFLD) ' 'or viral hepatitis over alcoholic liver disease. All other liver parameters (Albumin, Total Protein, ' 'Alk. Phosphatase, GGT) are within normal limits, indicating preserved synthetic function.' ) doc.add_paragraph() p = doc.add_paragraph('Suggested investigations: ') p.runs[0].bold = True p.add_run('Hepatitis B surface antigen (HBsAg), Anti-HCV, Liver ultrasound, Fasting lipid repeat in 3 months.') doc.add_paragraph() # --- 4. Uric Acid --- add_heading(doc, '4. Elevated Uric Acid (Hyperuricaemia)', level=2, color=(197, 90, 17)) ua_rows = [ ('Uric Acid', '7.28 mg/dL', '3.4 β 7.0 mg/dL', 'BORDERLINE HIGH'), ] add_table(doc, ['Parameter', 'Result', 'Reference Range', 'Status'], ua_rows) doc.add_paragraph() p = doc.add_paragraph('Clinical note: ') p.runs[0].bold = True p.add_run( 'Mildly elevated. Risk factor for gout. Please enquire about joint pain episodes (especially big toe, ' 'ankles, knees). Dietary advice: reduce red meat, organ meats, shellfish, fructose-rich beverages, alcohol.' ) doc.add_paragraph() # --- 5. Triglycerides --- add_heading(doc, '5. Borderline High Triglycerides', level=2, color=(197, 90, 17)) trig_rows = [ ('Triglycerides', '165 mg/dL', '< 150 mg/dL', 'BORDERLINE HIGH'), ('Total Cholesterol', '162 mg/dL', '< 200 mg/dL', 'NORMAL'), ('HDL Cholesterol', '45.6 mg/dL', '40 β 60 mg/dL', 'NORMAL'), ('LDL Cholesterol', '83.4 mg/dL', '0 β 100 mg/dL', 'NORMAL'), ] add_table(doc, ['Parameter', 'Result', 'Reference Range', 'Status'], trig_rows) doc.add_paragraph() p = doc.add_paragraph('Clinical note: ') p.runs[0].bold = True p.add_run('Overall cardiac risk is low based on lipid profile. Triglycerides slightly elevated; dietary modifications advised.') doc.add_paragraph() # ===================== NORMAL FINDINGS ===================== add_heading(doc, 'NORMAL / REASSURING FINDINGS', level=1, color=(0, 112, 0)) normal_rows = [ ('Fasting Blood Sugar', '95 mg/dL', '70 β 100', 'NORMAL', 'No diabetes'), ('TSH (Thyroid)', '1.40 uIU/mL', '0.13 β 6.33', 'NORMAL', 'Euthyroid'), ('T3 / T4', 'Normal', 'Normal', 'NORMAL', 'Normal thyroid'), ('Serum Creatinine', '0.94 mg/dL', '0.7 β 1.2', 'NORMAL', 'Good kidney function'), ('eGFR', '88.06 mL/min/1.73mΒ²', '> 60', 'NORMAL', 'CKD Stage G2 or better'), ('Blood Urea / BUN', 'Normal', 'Normal', 'NORMAL', ''), ('Electrolytes (Na/K/Cl/Ca)', 'All Normal', 'Normal', 'NORMAL', 'Balanced'), ('WBC (TLC)', '5.33 th/cumm', '4.0 β 10.0', 'NORMAL', 'No infection marker'), ('Serum Albumin', '4.32 g/dL', '3.5 β 5.2', 'NORMAL', 'Good protein synthesis'), ] add_table(doc, ['Test', 'Result', 'Reference', 'Status', 'Note'], normal_rows, header_color=(0, 112, 0)) doc.add_paragraph() # ===================== PRIORITY ACTIONS ===================== add_heading(doc, 'RECOMMENDED ACTIONS FOR PHYSICIAN', level=1, color=(31, 73, 125)) action_rows = [ ('π¨ URGENT', 'Platelet count = 14,000 /Β΅L', 'Haematology referral, peripheral smear, Dengue/HBV/HCV workup, consider bone marrow evaluation'), ('π΄ HIGH', 'Anaemia (Hb 11.6)', 'Iron studies (Ferritin, Serum Iron, TIBC), B12, Folate, Reticulocyte count'), ('π΄ HIGH', 'Elevated AST/ALT (~2x ULN)', 'HBsAg, Anti-HCV antibody, Liver ultrasound'), ('π‘ MODERATE', 'Uric Acid 7.28 mg/dL', 'Clinical correlation for gout symptoms; dietary advice; consider urate-lowering therapy if symptomatic'), ('π‘ LOW', 'Triglycerides 165 mg/dL', 'Dietary/lifestyle modification; recheck lipids in 3 months'), ] add_table(doc, ['Priority', 'Finding', 'Recommended Action'], action_rows, header_color=(31, 73, 125)) doc.add_paragraph() # Shade the urgent row red-ish shade_row(doc.tables[-1], 1, 'FFE0E0') # ===================== FOOTER NOTE ===================== doc.add_paragraph() hr = doc.add_paragraph('β' * 80) hr.runs[0].font.size = Pt(8) hr.runs[0].font.color.rgb = RGBColor(150, 150, 150) note = doc.add_paragraph() note.add_run('Laboratory: ').bold = True note.add_run('Accuprobe Diagnostics, Shah Complex, Main Chowk, Karan Nagar, Srinagar | M: 9205882054\n') note.add_run('Ref. Range Source: ').bold = True note.add_run('Practical Haematology by Dacie & Lewis, 12th Ed. | NCEP ATP III (Lipids) | ADA (Glucose) | NKF MDRD (eGFR)\n') note.add_run('Document prepared: ').bold = True note.add_run('06 August 2026 | This summary is intended to assist clinical consultation and does not replace physician judgment.') note.runs[-1].font.size = Pt(9) note.runs[-1].italic = True note.runs[-1].font.color.rgb = RGBColor(100, 100, 100) # Save out_path = '/tmp/workspace/hanief-report/Mohammad_Hanief_Khayam_Lab_Summary.docx' doc.save(out_path) print(f'Saved: {out_path}') EOF
Mohammad Hanief Khayam Lab Summary
Word Document Β· DOCX