Tb and pre existing liver disease full details for md exam answer 15 marks from this pdf
python3 << 'EOF' import pdfplumber # Search for TB and liver disease content in both PDFs pdf1_path = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" pdf2_path = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf" # First, check total pages with pdfplumber.open(pdf1_path) as pdf: print(f"Sharma Mohan PDF - Total pages: {len(pdf.pages)}") with pdfplumber.open(pdf2_path) as pdf: print(f"Tomans TB WHO PDF - Total pages: {len(pdf.pages)}") EOF
Extract ALL text content about "TB and pre-existing liver disease" from two PDF textbooks. PDF 1 (Sharma Mohan - 1003 pages): /home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf PDF 2 (Tomans TB WHO - 352 pages): /home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf Your task: 1. Search both PDFs for pages containing keywords: "liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "hepatitis", "liver failure", "jaundice", "liver function", "pre-existing liver", "DILI", "drug-induced liver" 2. Extract the FULL text of all relevant pages/sections from BOTH PDFs 3. Return ALL extracted text verbatim so it can be used to write a comprehensive MD exam answer Use this Python approach: ```python import pdfplumber def search_pdf(path, keywords): results = [] with pdfplumber.open(path) as pdf: for i, page in enumerate(pdf.pages): text = page.extract_text() if text: text_lower = text.lower() if any(kw.lower() in text_lower for kw in keywords): results.append((i+1, text)) return results keywords = ["liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "hepatitis", "liver failure", "jaundice", "liver function", "pre-existing liver", "DILI", "drug-induced liver", "liver disorder", "antituberculosis", "anti-tuberculosis", "isoniazid", "rifampicin", "pyrazinamide", "PZA", "INH", "RIF"] pdf1 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" pdf2 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf" results1 = search_pdf(pdf1, ["liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "pre-existing liver", "DILI"]) results2 = search_pdf(pdf2, ["liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "pre-existing liver", "DILI"]) ``` Focus especially on: - Sections titled "TB with liver disease", "Pre-existing liver disease", "Hepatotoxicity of anti-TB drugs" - Drug-induced liver injury (DILI) from TB drugs (INH, Rifampicin, Pyrazinamide, Ethambutol) - Management protocols, monitoring, alternative regimens - Clinical guidelines for treating TB in patients with liver disease Return ALL extracted text from relevant pages, clearly labeled with page numbers and which PDF they came from. Do NOT summarize - return the raw extracted text.
python3 << 'EOF' import pdfplumber keywords = [ "liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "hepatitis", "liver failure", "jaundice", "liver function", "pre-existing liver", "DILI", "drug-induced liver", "liver disorder", "antituberculosis", "anti-tuberculosis", "isoniazid", "rifampicin", "pyrazinamide", "PZA", "INH", "RIF" ] pdf1 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" results1 = [] with pdfplumber.open(pdf1) as pdf: total = len(pdf.pages) print(f"PDF1 total pages: {total}") for i, page in enumerate(pdf.pages): text = page.extract_text() if text: text_lower = text.lower() if any(kw.lower() in text_lower for kw in keywords): results1.append((i+1, text)) print(f"PDF1 matching pages: {len(results1)}") print("Page numbers:", [r[0] for r in results1]) EOF
python3 << 'EOF' import pdfplumber, sys keywords = [ "liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "hepatitis", "liver failure", "jaundice", "liver function", "pre-existing liver", "DILI", "drug-induced liver", "liver disorder", "antituberculosis", "anti-tuberculosis", "isoniazid", "rifampicin", "pyrazinamide", "PZA", "INH", "RIF" ] pdf1 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" matching_pages = [] with pdfplumber.open(pdf1) as pdf: total = len(pdf.pages) print(f"PDF1 total pages: {total}", flush=True) # Process in chunks to avoid memory issues for i, page in enumerate(pdf.pages): try: text = page.extract_text() if text: text_lower = text.lower() if any(kw.lower() in text_lower for kw in keywords): matching_pages.append(i+1) except Exception as e: pass if (i+1) % 100 == 0: print(f" Processed {i+1}/{total} pages, matches so far: {len(matching_pages)}", flush=True) sys.stdout.flush() print(f"PDF1 matching pages total: {len(matching_pages)}") print("Pages:", matching_pages) EOF
python3 << 'EOF' import pdfplumber, gc keywords = [ "liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "hepatitis", "liver failure", "jaundice", "liver function", "pre-existing liver", "DILI", "drug-induced liver", "liver disorder", "antituberculosis", "anti-tuberculosis", "isoniazid", "rifampicin", "pyrazinamide", "PZA", "INH", "RIF" ] pdf1 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" # Only scan pages 1-200 first matching_pages = [] with pdfplumber.open(pdf1) as pdf: total = len(pdf.pages) print(f"Scanning pages 1-200 of {total}", flush=True) for i in range(min(200, total)): try: text = pdf.pages[i].extract_text() if text: text_lower = text.lower() if any(kw.lower() in text_lower for kw in keywords): matching_pages.append(i+1) except: pass gc.collect() print(f"Pages 1-200 matches: {len(matching_pages)}") print("Pages:", matching_pages) EOF
# Try pdftotext command-line approach instead - much more memory efficient pdf1="/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" # Extract text from first 100 pages pdftotext -f 1 -l 100 "$pdf1" /tmp/sharma_1_100.txt 2>&1 echo "Exit: $?" wc -l /tmp/sharma_1_100.txt
pdf1="/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" # Extract in batches of 200 pages pdftotext -f 101 -l 300 "$pdf1" /tmp/sharma_101_300.txt 2>&1 && echo "Done 101-300" pdftotext -f 301 -l 500 "$pdf1" /tmp/sharma_301_500.txt 2>&1 && echo "Done 301-500"
pdf1="/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" pdftotext -f 501 -l 700 "$pdf1" /tmp/sharma_501_700.txt 2>&1 && echo "Done 501-700" pdftotext -f 701 -l 900 "$pdf1" /tmp/sharma_701_900.txt 2>&1 && echo "Done 701-900" pdftotext -f 901 -l 1003 "$pdf1" /tmp/sharma_901_1003.txt 2>&1 && echo "Done 901-1003"
pdf2="/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf" pdftotext "$pdf2" /tmp/tomans_full.txt 2>&1 && echo "Done Tomans" wc -l /tmp/tomans_full.txt
python3 << 'PYEOF' import re keywords = [ "liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "hepatitis", "liver failure", "jaundice", "liver function", "pre-existing liver", "dili", "drug-induced liver", "liver disorder", "antituberculosis", "anti-tuberculosis", "isoniazid", "rifampicin", "pyrazinamide", "pza", "inh", "rif" ] def find_matching_pages_in_file(filepath, page_offset=0): """ pdftotext with -layout or default separates pages with form feed \x0c """ with open(filepath, 'r', encoding='utf-8', errors='replace') as f: content = f.read() pages = content.split('\x0c') matching = [] for i, page_text in enumerate(pages): if not page_text.strip(): continue text_lower = page_text.lower() matched_kws = [kw for kw in keywords if kw in text_lower] if matched_kws: matching.append((page_offset + i + 1, page_text, matched_kws)) return matching # Process Sharma Mohan batches batches = [ ('/tmp/sharma_1_100.txt', 0), ('/tmp/sharma_101_300.txt', 100), ('/tmp/sharma_301_500.txt', 300), ('/tmp/sharma_501_700.txt', 500), ('/tmp/sharma_701_900.txt', 700), ('/tmp/sharma_901_1003.txt', 900), ] all_sharma = [] for fpath, offset in batches: results = find_matching_pages_in_file(fpath, offset) all_sharma.extend(results) print(f" {fpath}: {len(results)} matching pages") print(f"\nTotal Sharma matching pages: {len(all_sharma)}") print("Page numbers:", [r[0] for r in all_sharma]) # Process Tomans all_tomans = find_matching_pages_in_file('/tmp/tomans_full.txt', 0) print(f"\nTotal Tomans matching pages: {len(all_tomans)}") print("Page numbers:", [r[0] for r in all_tomans]) # Save results with open('/tmp/sharma_results.txt', 'w', encoding='utf-8') as f: for pg, text, kws in all_sharma: f.write(f"\n{'='*80}\n") f.write(f"[SHARMA MOHAN - PAGE {pg}] | Keywords: {', '.join(kws)}\n") f.write(f"{'='*80}\n") f.write(text) f.write('\n') with open('/tmp/tomans_results.txt', 'w', encoding='utf-8') as f: for pg, text, kws in all_tomans: f.write(f"\n{'='*80}\n") f.write(f"[TOMANS TB WHO - PAGE {pg}] | Keywords: {', '.join(kws)}\n") f.write(f"{'='*80}\n") f.write(text) f.write('\n') print("\nFiles saved.") PYEOF
# Now do a more focused search - specifically on liver disease/hepatotoxicity sections # Using tighter keywords to find the most relevant pages python3 << 'PYEOF' import re # Focused keywords for TB + liver disease specifically focused_keywords = [ "liver disease", "hepatotoxicity", "chronic liver", "cirrhosis", "liver failure", "liver function", "pre-existing liver", "dili", "drug-induced liver", "liver disorder", "pre-existing hepatic", "hepatic disease", "underlying liver", "underlying hepatic" ] def find_focused_pages(filepath, page_offset=0): with open(filepath, 'r', encoding='utf-8', errors='replace') as f: content = f.read() pages = content.split('\x0c') matching = [] for i, page_text in enumerate(pages): if not page_text.strip(): continue text_lower = page_text.lower() matched_kws = [kw for kw in focused_keywords if kw in text_lower] if matched_kws: matching.append((page_offset + i + 1, page_text, matched_kws)) return matching # Process Sharma Mohan batches batches = [ ('/tmp/sharma_1_100.txt', 0), ('/tmp/sharma_101_300.txt', 100), ('/tmp/sharma_301_500.txt', 300), ('/tmp/sharma_501_700.txt', 500), ('/tmp/sharma_701_900.txt', 700), ('/tmp/sharma_901_1003.txt', 900), ] all_sharma_focused = [] for fpath, offset in batches: results = find_focused_pages(fpath, offset) all_sharma_focused.extend(results) print(f"Sharma focused pages: {len(all_sharma_focused)}") print("Page numbers:", [r[0] for r in all_sharma_focused]) # Tomans focused all_tomans_focused = find_focused_pages('/tmp/tomans_full.txt', 0) print(f"\nTomans focused pages: {len(all_tomans_focused)}") print("Page numbers:", [r[0] for r in all_tomans_focused]) # Save with open('/tmp/sharma_focused.txt', 'w', encoding='utf-8') as f: for pg, text, kws in all_sharma_focused: f.write(f"\n{'='*80}\n") f.write(f"[SHARMA MOHAN - PAGE {pg}] | Keywords: {', '.join(kws)}\n") f.write(f"{'='*80}\n") f.write(text) f.write('\n') with open('/tmp/tomans_focused.txt', 'w', encoding='utf-8') as f: for pg, text, kws in all_tomans_focused: f.write(f"\n{'='*80}\n") f.write(f"[TOMANS TB WHO - PAGE {pg}] | Keywords: {', '.join(kws)}\n") f.write(f"{'='*80}\n") f.write(text) f.write('\n') print("Saved focused results.") PYEOF
wc -l /tmp/sharma_focused.txt /tmp/tomans_focused.txt
# Let's get the table of contents sections for liver/hepatic to understand chapter structure # Search specifically for section headings python3 << 'PYEOF' import re def find_toc_and_headings(filepath, page_offset=0): with open(filepath, 'r', encoding='utf-8', errors='replace') as f: content = f.read() pages = content.split('\x0c') results = [] # Look for lines that appear to be headings (short, capitalized lines) heading_patterns = [ r'liver\s+disease', r'hepatotoxic', r'hepatic', r'jaundice', r'cirrhosis', r'liver\s+function', r'dili', r'drug.induced\s+liver' ] for i, page_text in enumerate(pages): if not page_text.strip(): continue text_lower = page_text.lower() for pattern in heading_patterns: for line in page_text.split('\n'): if re.search(pattern, line, re.IGNORECASE) and len(line.strip()) < 120: pg_num = page_offset + i + 1 results.append((pg_num, line.strip())) break return results batches = [ ('/tmp/sharma_1_100.txt', 0), ('/tmp/sharma_101_300.txt', 100), ('/tmp/sharma_301_500.txt', 300), ('/tmp/sharma_501_700.txt', 500), ('/tmp/sharma_701_900.txt', 700), ('/tmp/sharma_901_1003.txt', 900), ] print("=== SHARMA MOHAN: Pages with liver/hepatic headings/lines ===") for fpath, offset in batches: results = find_toc_and_headings(fpath, offset) for pg, line in results: print(f" p.{pg}: {line}") print("\n=== TOMANS: Pages with liver/hepatic headings/lines ===") tomans = find_toc_and_headings('/tmp/tomans_full.txt', 0) for pg, line in tomans: print(f" p.{pg}: {line}") PYEOF
# Now let's identify the most important pages - specifically those discussing TB + liver disease management # Key Sharma pages appear to be around 660-668 (Chapter 45 on Hepatotoxicity) and scattered others # Let's extract those in detail python3 << 'PYEOF' import re def get_pages_from_file(filepath, page_offset, page_numbers): """Extract specific pages from a text file""" with open(filepath, 'r', encoding='utf-8', errors='replace') as f: content = f.read() pages = content.split('\x0c') results = {} for i, page_text in enumerate(pages): pg_num = page_offset + i + 1 if pg_num in page_numbers: results[pg_num] = page_text return results # Key pages from Sharma Mohan - focused on liver disease and hepatotoxicity # Pages around 660-668 seem to be THE chapter on hepatotoxicity sharma_key_pages = [ # Chapter on TB with liver disease / Hepatotoxicity 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, # Hepatotoxicity chapter pages 539, 540, 541, 543, 544, 557, 558, 560, 561, 562, 563, 564, # Main hepatotoxicity chapter 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, # Special situations - liver disease 499, 500, 501, 502, # Drug profiles 617, 618, 619, 620, 621, 622, 623, # Index refs to confirm page locations 982, 983, 984, 985, 986, 987, # HIV/liver 374, 375, 376, 377, 378, # Other 105, 114, 262, 276, 280, 460, 461 ] batches = [ ('/tmp/sharma_1_100.txt', 0, range(1,101)), ('/tmp/sharma_101_300.txt', 100, range(101,301)), ('/tmp/sharma_301_500.txt', 300, range(301,501)), ('/tmp/sharma_501_700.txt', 500, range(501,701)), ('/tmp/sharma_701_900.txt', 700, range(701,901)), ('/tmp/sharma_901_1003.txt', 900, range(901,1004)), ] sharma_pages_text = {} for fpath, offset, page_range in batches: needed = [p for p in sharma_key_pages if p in page_range] if needed: extracted = get_pages_from_file(fpath, offset, needed) sharma_pages_text.update(extracted) print(f"Extracted {len(sharma_pages_text)} key pages from Sharma") # Save verbatim with open('/tmp/sharma_key_pages.txt', 'w', encoding='utf-8') as f: for pg in sorted(sharma_pages_text.keys()): f.write(f"\n{'='*80}\n") f.write(f"[SHARMA MOHAN - PAGE {pg}]\n") f.write(f"{'='*80}\n") f.write(sharma_pages_text[pg]) f.write('\n') print("Sharma key pages saved.") # Tomans key pages tomans_key_pages = [7, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 173, 174, 175, 176, 177, 178, 179, 180, 181, 187, 188, 189, 190, 241, 242, 243, 244, 245] def get_tomans_pages(filepath, page_numbers): with open(filepath, 'r', encoding='utf-8', errors='replace') as f: content = f.read() pages = content.split('\x0c') results = {} for i, page_text in enumerate(pages): pg_num = i + 1 if pg_num in page_numbers: results[pg_num] = page_text return results tomans_pages_text = get_tomans_pages('/tmp/tomans_full.txt', tomans_key_pages) print(f"Extracted {len(tomans_pages_text)} key pages from Tomans") with open('/tmp/tomans_key_pages.txt', 'w', encoding='utf-8') as f: for pg in sorted(tomans_pages_text.keys()): f.write(f"\n{'='*80}\n") f.write(f"[TOMANS TB WHO - PAGE {pg}]\n") f.write(f"{'='*80}\n") f.write(tomans_pages_text[pg]) f.write('\n') print("Tomans key pages saved.") PYEOF
wc -l /tmp/sharma_key_pages.txt /tmp/tomans_key_pages.txt
# Find exact line ranges for the key sections in sharma_key_pages.txt python3 << 'PYEOF' with open('/tmp/sharma_key_pages.txt', 'r', encoding='utf-8', errors='replace') as f: lines = f.readlines() # Find all section headers for i, line in enumerate(lines): if '=== ' in line or '[SHARMA MOHAN - PAGE' in line: print(f"Line {i+1}: {line.rstrip()}") PYEOF
An error occurred (validationException) when calling the ConverseStream operation: The model returned the following errors: Output blocked by content filtering policy
We encountered an error while processing your request. Please try again or reach out to us for help.
Can u get answer plz
python3 << 'EOF' import pdfplumber pdf1 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf" pdf2 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf" keywords = ["liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "pre-existing liver", "DILI", "drug-induced liver", "liver disorder", "liver failure", "hepatitis b", "hepatitis c", "liver function test", "jaundice"] def search_pdf(path, keywords): results = [] with pdfplumber.open(path) as pdf: for i, page in enumerate(pdf.pages): text = page.extract_text() if text: text_lower = text.lower() if any(kw.lower() in text_lower for kw in keywords): results.append((i+1, text)) return results print("Searching Sharma Mohan...") r1 = search_pdf(pdf1, keywords) print(f"Found {len(r1)} pages in Sharma Mohan") for pg, txt in r1[:30]: print(f"\n=== SHARMA MOHAN PAGE {pg} ===") print(txt[:3000]) EOF
python3 << 'EOF' import pdfplumber # Search only Toman's (smaller, 352 pages) first - faster pdf2 = "/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf" keywords = ["liver disease", "hepatic", "hepatotoxicity", "chronic liver", "cirrhosis", "pre-existing liver", "DILI", "drug-induced liver", "liver failure"] results = [] with pdfplumber.open(pdf2) as pdf: for i, page in enumerate(pdf.pages): text = page.extract_text() if text: text_lower = text.lower() if any(kw.lower() in text_lower for kw in keywords): results.append((i+1, text)) print(f"Found {len(results)} pages in Toman's TB") for pg, txt in results: print(f"\n=== TOMAN PAGE {pg} ===") print(txt) EOF
python3 -c " import pdfplumber pdf2 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf' results = [] with pdfplumber.open(pdf2) as pdf: total = len(pdf.pages) for i in range(min(50, total)): text = pdf.pages[i].extract_text() or '' if 'liver' in text.lower() or 'hepat' in text.lower(): results.append(i+1) print('Pages with liver content (first 50):', results) " 2>&1 | head -20
python3 -c " import pdfplumber pdf2 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf' # Search pages 51-200 results = [] with pdfplumber.open(pdf2) as pdf: for i in range(50, 200): text = pdf.pages[i].extract_text() or '' if 'liver' in text.lower() or 'hepat' in text.lower(): results.append(i+1) print('Pages 51-200 with liver content:', results) " 2>&1
python3 -c " import pdfplumber pdf2 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf' # Read key pages - focus on 129-141 (likely TB treatment complications) and 172-188 pages_to_read = [128,129,130,131,132,133,134,135,136,137,138,139,140,141] with pdfplumber.open(pdf2) as pdf: for i in pages_to_read: text = pdf.pages[i].extract_text() or '' print(f'=== TOMAN PAGE {i+1} ===') print(text[:2000]) print() " 2>&1
python3 -c " import pdfplumber pdf2 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Tomans TB who.pdf' # Read pages 172-188 - these had liver keywords too pages_to_read = list(range(171, 189)) with pdfplumber.open(pdf2) as pdf: for i in pages_to_read: text = pdf.pages[i].extract_text() or '' if 'liver' in text.lower() or 'hepat' in text.lower(): print(f'=== TOMAN PAGE {i+1} ===') print(text) print() " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Search pages 1-200 for liver content results = [] with pdfplumber.open(pdf1) as pdf: for i in range(0, 200): text = pdf.pages[i].extract_text() or '' if 'liver disease' in text.lower() or 'hepatotox' in text.lower() or 'pre-existing liver' in text.lower() or 'chronic liver' in text.lower(): results.append(i+1) print('Sharma Mohan pages 1-200 with liver content:', results) " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' results = [] with pdfplumber.open(pdf1) as pdf: for i in range(0, 100): try: text = pdf.pages[i].extract_text() or '' if 'liver' in text.lower() or 'hepat' in text.lower(): results.append(i+1) except: pass print('Pages 1-100:', results) " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Read pages most likely to have TB + liver disease (pages around 56-75, 83, 99) pages_to_read = [55,56,57,58,64,65,66,67,72,73,74,75,82,83,98,99] with pdfplumber.open(pdf1) as pdf: for i in pages_to_read: try: text = pdf.pages[i].extract_text() or '' if 'liver' in text.lower() or 'hepat' in text.lower(): print(f'=== SHARMA MOHAN PAGE {i+1} ===') print(text[:3000]) print() except Exception as e: print(f'Error page {i+1}: {e}') " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Search pages 400-700 for TB treatment + liver disease results = [] with pdfplumber.open(pdf1) as pdf: for i in range(400, 600): try: text = pdf.pages[i].extract_text() or '' if ('liver disease' in text.lower() or 'hepatotox' in text.lower() or 'pre-existing liver' in text.lower() or 'chronic liver' in text.lower() or 'dili' in text.lower()): results.append(i+1) except: pass print('Pages 400-600 with specific liver content:', results) " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' results = [] with pdfplumber.open(pdf1) as pdf: for i in range(400, 480): try: text = pdf.pages[i].extract_text() or '' if 'liver' in text.lower() or 'hepat' in text.lower(): results.append(i+1) except: pass print('Pages 400-480:', results) " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Read pages around 406-470 - look for treatment with liver disease content target_pages = [405,406,407,408,409,410,411,412,416,417,418,419,420,421,422,424,425,427,428,429,430,431,432,433,434] with pdfplumber.open(pdf1) as pdf: for i in target_pages: try: text = pdf.pages[i].extract_text() or '' if ('liver disease' in text.lower() or 'hepatotox' in text.lower() or 'pre-existing' in text.lower() or 'chronic liver' in text.lower()): print(f'=== SHARMA MOHAN PAGE {i+1} ===') print(text[:3500]) print() except Exception as e: print(f'Error page {i+1}: {e}') " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Search for chapter on TB and liver disease - likely in 450-700 range results = [] with pdfplumber.open(pdf1) as pdf: for i in range(450, 530): try: text = pdf.pages[i].extract_text() or '' if 'liver disease' in text.lower() or 'pre-existing liver' in text.lower() or 'chronic liver disease' in text.lower(): results.append(i+1) except: pass print('Pages 450-530 with liver disease:', results) " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Read pages 458-465 and 497-502 - these have liver disease content target_pages = list(range(456, 470)) + list(range(496, 504)) with pdfplumber.open(pdf1) as pdf: for i in target_pages: try: text = pdf.pages[i].extract_text() or '' print(f'=== SHARMA MOHAN PAGE {i+1} ===') print(text[:4000]) print() except Exception as e: print(f'Error page {i+1}: {e}') " 2>&1
python3 -c " import pdfplumber pdf1 = '/home/daytona/workspace/attachments/b6aded86-f634-4998-b7e1-309ba621e7ca/Sharma mohan latest_compressed-compressed (1).pdf' # Search pages 530-750 for TB + liver disease chapter results = [] with pdfplumber.open(pdf1) as pdf: for i in range(530, 750): try: text = pdf.pages[i].extract_text() or '' if 'liver disease' in text.lower() or 'pre-existing liver' in text.lower() or 'chronic liver' in text.lower() or 'hepatotoxic' in text.lower(): results.append(i+1) except: pass print('Pages 530-750 with liver content:', results) " 2>&1
| Day | Drug and Dose |
|---|---|
| 1 | Isoniazid 50 mg |
| 2 | Isoniazid 300 mg |
| 3 | RH (half tablet) |
| 4 | RH (one tablet) |
| 5 | RH full dose |
| 6 | Day 5 + Pyrazinamide (half tablet) |
| 7 | Day 5 + Pyrazinamide (one tablet) |
| 8 | Day 5 + Pyrazinamide (full dose) |
| 9 | Day 8 + Ethambutol (half tablet) |
| 10 | Day 8 + Ethambutol (one tablet) |
| 11 | Day 8 + Ethambutol (full dose) |
| 12 | Full dose HRZE |
| Regimen | Details | Duration |
|---|---|---|
| 2HRE/6HE | INH + RIF + Ethambutol (2 months) → INH + Ethambutol (6 months) | 8 months |
| 2HRES/6HE | INH + RIF + Ethambutol + Streptomycin → INH + Ethambutol | 8 months |
| Regimen | Details | Duration |
|---|---|---|
| 2HSE/10HE | INH + Streptomycin + Ethambutol (2 months) → INH + Ethambutol (10 months) | 12 months |
| Severity of Liver Disease | Regimen | Duration | Hepatotoxic Drugs Used |
|---|---|---|---|
| Mild / compensated | Standard 2HRZE/4HR | 6 months | 3 (H, R, Z) |
| Established chronic liver disease | 2HRE/6HE or 2HRES/6HE | 8 months | 2 (H, R) — No PZA |
| Severe (ascites, portal HTN) | 2HSE/10HE | 12 months | 1 (H only) — No R, No PZA |
| Acute viral hepatitis — mild TB | Defer TB treatment | Until hepatitis resolves | None |
| Acute viral hepatitis — severe TB | 3 months SE → 6HR | 9 months | Only after hepatitis resolves |
| Acute liver failure (DILI) | SE ± fluoroquinolone (non-hepatotoxic bridge) | Until LFTs normalise | None |