Dstb and drtb in pregnancy full details for md exam answer 15 marks from this pdf only
Extract ALL content related to "TB in pregnancy", "tuberculosis in pregnancy", "DSTB in pregnancy", "DRTB in pregnancy", "drug sensitive TB", "drug resistant TB", "pregnant", "pregnancy" from three files: 1. PDF file at: /home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf 2. PPTX file at: /home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/PMDT Guidelines_March 2025.pptx 3. PPTX file at: /home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/PMDT 2021.pptx For the PDF: Use pdfplumber to extract text from ALL pages. Search for pages containing "pregnan" (case insensitive) and extract those full pages plus surrounding pages. Also look for any tables/content about TB drugs in pregnancy. For the PPTX files: Use python-pptx to extract all slide text, then find slides mentioning "pregnan" (case insensitive). Here is Python code approach: ```python import pdfplumber import re pdf_path = "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf" with pdfplumber.open(pdf_path) as pdf: total = len(pdf.pages) print(f"Total pages: {total}") for i, page in enumerate(pdf.pages): text = page.extract_text() or "" if re.search(r'pregnan', text, re.IGNORECASE): print(f"\n=== PAGE {i+1} ===") print(text) # Also print tables if any tables = page.extract_tables() for t in tables: print("TABLE:", t) ``` For PPTX: ```python from pptx import Presentation for pptx_path in [ "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/PMDT Guidelines_March 2025.pptx", "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/PMDT 2021.pptx" ]: prs = Presentation(pptx_path) print(f"\n\n=== FILE: {pptx_path} ===") for i, slide in enumerate(prs.slides): slide_text = "" for shape in slide.shapes: if shape.has_text_frame: for para in shape.text_frame.paragraphs: slide_text += para.text + "\n" if re.search(r'pregnan', slide_text, re.IGNORECASE): print(f"\n--- SLIDE {i+1} ---") print(slide_text) ``` Execute this code. Return the COMPLETE extracted text from all pregnancy-related pages and slides. Do not truncate or summarize - return the raw text verbatim so it can be used for a medical exam answer. Also, for the PDF, search ALL pages from page 1 to the last page - include any page with "TB" AND "pregnant/pregnancy" on it. Additionally extract any pages about "drug resistant" TB management, dosing tables, treatment regimens for pregnancy.
cd /home/daytona && python3 << 'EOF' import pdfplumber import re pdf_path = "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf" with pdfplumber.open(pdf_path) as pdf: total = len(pdf.pages) print(f"Total pages: {total}") pregnan_pages = [] drug_resistant_pages = [] for i, page in enumerate(pdf.pages): text = page.extract_text() or "" if re.search(r'pregnan', text, re.IGNORECASE): pregnan_pages.append(i+1) if re.search(r'drug.?resist', text, re.IGNORECASE): drug_resistant_pages.append(i+1) print(f"Pages with 'pregnan': {pregnan_pages}") print(f"Pages with 'drug resist': {drug_resistant_pages}") EOF
python3 -c " import pdfplumber, re pdf_path = \"/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf\" with pdfplumber.open(pdf_path) as pdf: total = len(pdf.pages) print(f'Total pages: {total}') pregnan_pages = [] for i, page in enumerate(pdf.pages): text = page.extract_text() or '' if re.search(r'pregnan', text, re.IGNORECASE): pregnan_pages.append(i+1) print(f'Pages with pregnan: {pregnan_pages}') "
ls "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/" && echo "---" && python3 -c "import pdfplumber; print('pdfplumber ok')" && python3 -c "from pptx import Presentation; print('pptx ok')"
pip install python-pptx -q && python3 -c "from pptx import Presentation; print('pptx ok')"
python3 -c " import pdfplumber, re pdf_path = \"/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf\" pregnan_pages = [] drug_pages = [] with pdfplumber.open(pdf_path) as pdf: total = len(pdf.pages) print('Total pages:', total) for i in range(total): page = pdf.pages[i] text = page.extract_text() or '' if re.search(r'pregnan', text, re.IGNORECASE): pregnan_pages.append(i+1) if re.search(r'drug.?resist', text, re.IGNORECASE): drug_pages.append(i+1) print('Pregnan pages:', pregnan_pages) print('Drug-resist pages:', drug_pages) " 2>&1
python3 -c " from pypdf import PdfReader import re pdf_path = \"/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf\" reader = PdfReader(pdf_path) total = len(reader.pages) print('Total pages:', total) "
python3 -c " from pypdf import PdfReader import re pdf_path = \"/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf\" reader = PdfReader(pdf_path) total = len(reader.pages) pregnan_pages = [] for i in range(total): text = reader.pages[i].extract_text() or '' if re.search(r'pregnan', text, re.IGNORECASE): pregnan_pages.append(i+1) print('Pregnan pages:', pregnan_pages) " 2>&1
python3 -c " from pypdf import PdfReader import re pdf_path = \"/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf\" reader = PdfReader(pdf_path) total = len(reader.pages) drug_pages = [] for i in range(total): text = reader.pages[i].extract_text() or '' if re.search(r'drug.?resist', text, re.IGNORECASE): drug_pages.append(i+1) print('Drug-resist pages:', drug_pages) " 2>&1
python3 -c " pregnan = [23, 56, 181, 190, 191, 197, 249, 262, 314, 344, 371, 372, 373, 374, 375, 376, 377, 378, 380, 390, 392, 419, 436, 460, 464, 497, 498, 499, 506, 558, 560, 616, 618, 619, 622, 630, 652, 653, 657, 664, 753, 815, 818, 951, 967, 968, 982, 989, 990, 992, 1000, 1001] drug = set([14, 16, 24, 30, 34, 35, 36, 37, 38, 40, 42, 44, 46, 47, 48, 49, 73, 80, 81, 82, 83, 88, 89, 92, 95, 97, 106, 114, 129, 131, 132, 133, 135, 153, 154, 167, 169, 170, 192, 199, 213, 214, 224, 234, 244, 246, 255, 256, 261, 263, 272, 273, 276, 293, 335, 337, 347, 348, 358, 365, 366, 370, 372, 373, 375, 377, 379, 388, 392, 451, 455, 456, 482, 484, 489, 490, 495, 498, 501, 502, 505, 507, 511, 513, 514, 516, 517, 519, 520, 538, 539, 543, 544, 547, 552, 553, 559, 596, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 669, 672, 673, 677, 678, 679, 680, 681, 683, 684, 685, 686, 687, 691, 692, 693, 695, 696, 697, 698, 700, 702, 704, 710, 711, 722, 729, 730, 732, 734, 736, 740, 742, 743, 744, 745, 748, 751, 752, 753, 757, 761, 768, 769, 771, 778, 783, 786, 790, 791, 792, 795, 797, 799, 801, 802, 807, 810, 812, 813, 814, 815, 816, 819, 915, 916, 919, 921, 925, 926, 928, 939, 940, 944, 948, 952, 974, 979, 989, 994, 995, 996, 1001, 1002, 1003]) both = [p for p in pregnan if p in drug] print('Both pregnan AND drug-resist:', both) "
python3 << 'PYEOF' from pypdf import PdfReader import re pdf_path = "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf" reader = PdfReader(pdf_path) pregnan_pages = [23, 56, 181, 190, 191, 197, 249, 262, 314, 344, 371, 372, 373, 374, 375, 376, 377, 378, 380, 390, 392, 419, 436, 460, 464, 497, 498, 499, 506, 558, 560, 616, 618, 619, 622, 630, 652, 653, 657, 664, 753, 815, 818, 951, 967, 968, 982, 989, 990, 992, 1000, 1001] output = [] for pg in pregnan_pages: text = reader.pages[pg-1].extract_text() or "" output.append(f"\n{'='*60}\n=== PAGE {pg} ===\n{'='*60}\n{text}") result = "\n".join(output) print(result[:50000]) PYEOF
python3 << 'PYEOF' from pypdf import PdfReader import re pdf_path = "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf" reader = PdfReader(pdf_path) # Get the core pregnancy chapter pages (371-380, 390, 392) and surrounding core_pages = [371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392] for pg in core_pages: text = reader.pages[pg-1].extract_text() or "" if re.search(r'pregnan|TB|tubercul', text, re.IGNORECASE): print(f"\n{'='*60}\n=== PAGE {pg} ===\n{'='*60}\n{text}") PYEOF
python3 << 'PYEOF' from pypdf import PdfReader import re pdf_path = "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/Sharma mohan latest_compressed-compressed (1).pdf" reader = PdfReader(pdf_path) # Remaining pregnan pages not yet extracted remaining_pages = [419, 436, 460, 464, 497, 498, 499, 506, 558, 560, 616, 618, 619, 622, 630, 652, 653, 657, 664, 753, 815, 818, 951, 967, 968, 982, 989, 990, 992, 1000, 1001] for pg in remaining_pages: text = reader.pages[pg-1].extract_text() or "" print(f"\n{'='*60}\n=== PAGE {pg} ===\n{'='*60}\n{text}") PYEOF
python3 << 'PYEOF' from pptx import Presentation import re pptx_path = "/home/daytona/workspace/attachments/94b62c8a-ece6-4265-869c-7cae5980c78b/PMDT Guidelines_March 2025.pptx" prs = Presentation(pptx_path) print(f"=== FILE: PMDT Guidelines_March 2025.pptx ===") print(f"Total slides: {len(prs.slides)}") # First pass: find all slides with 'pregnan' pregnan_slides = [] for i, slide in enumerate(prs.slides): slide_text = "" for shape in slide.shapes: if shape.has_text_frame: for para in shape.text_frame.paragraphs: slide_text += para.text + "\n" if re.search(r'pregnan', slide_text, re.IGNORECASE): pregnan_slides.append(i+1) print(f"Slides with 'pregnan': {pregnan_slides}") PYEOF