Make a proper analysis of all the exam paper of all the PDF I sent to you and tell me the topics which are repeated and all the topic that comes in this paper and make a proper PDF explaining each topic in detail. So that I cannot miss even a single question from that topic. Analysis all these PDF, please, and do it for me and make a PDF so that I can learn all those topics and, uh, can never miss a single question from the upcoming CMS exams.
cd /tmp/workspace && mkdir -p cms_analysis && python3 << 'EOF' import pdfplumber import os pdf_files = { "2021": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2021.pdf", "2022": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/UPSC_CMS_2022_GS_Paper_II_8e16805fbe7101e05cbdc78dc177b4a7.pdf", "2023": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2023.pdf", "2024": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/CMSE-24-PAPER-II-SURGERY-GYAE-OBST-PREVENT-SOCIAL-MEDCN-150724.pdf", "2025_1": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2025.pdf", "2025_2": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/20251.pdf", } for year, path in pdf_files.items(): try: with pdfplumber.open(path) as pdf: text = "" for page in pdf.pages: t = page.extract_text() if t: text += t + "\n" out_path = f"/tmp/workspace/cms_analysis/{year}.txt" with open(out_path, "w") as f: f.write(text) print(f"{year}: {len(pdf.pages)} pages, {len(text)} chars extracted -> {out_path}") except Exception as e: print(f"{year}: ERROR - {e}") EOF
python3 << 'EOF' from pypdf import PdfReader pdf_files = { "2021": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2021.pdf", "2022": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/UPSC_CMS_2022_GS_Paper_II_8e16805fbe7101e05cbdc78dc177b4a7.pdf", "2023": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2023.pdf", "2024": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/CMSE-24-PAPER-II-SURGERY-GYAE-OBST-PREVENT-SOCIAL-MEDCN-150724.pdf", "2025_1": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2025.pdf", "2025_2": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/20251.pdf", } for year, path in pdf_files.items(): reader = PdfReader(path) text = "" for page in reader.pages: t = page.extract_text() if t: text += t + "\n" if text.strip(): with open(f"/tmp/workspace/cms_analysis/{year}_pypdf.txt", "w") as f: f.write(text) print(f"{year}: {len(text)} chars") else: print(f"{year}: NO TEXT (likely scanned image PDF)") # Check if there are images for i, page in enumerate(reader.pages[:2]): imgs = page.images print(f" Page {i+1}: {len(imgs)} images") EOF
python3 << 'EOF' # Extract images from scanned PDFs to PNG files so we can read them from pypdf import PdfReader import io, os pdf_files = { "2022": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/UPSC_CMS_2022_GS_Paper_II_8e16805fbe7101e05cbdc78dc177b4a7.pdf", "2023": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2023.pdf", "2024": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/CMSE-24-PAPER-II-SURGERY-GYAE-OBST-PREVENT-SOCIAL-MEDCN-150724.pdf", "2021": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2021.pdf", } os.makedirs("/tmp/workspace/cms_analysis/images", exist_ok=True) for year, path in pdf_files.items(): reader = PdfReader(path) print(f"\n{year}: {len(reader.pages)} pages") for i, page in enumerate(reader.pages): for j, img in enumerate(page.images): img_path = f"/tmp/workspace/cms_analysis/images/{year}_p{i+1:02d}_img{j}.{img.name.split('.')[-1] if '.' in img.name else 'png'}" with open(img_path, 'wb') as f: f.write(img.data) size = os.path.getsize(img_path) print(f" Page {i+1} img{j}: {img.name} ({size} bytes) -> {img_path}") if i >= 4: # Show first 5 pages only print(f" ... (showing first 5 pages, total {len(reader.pages)})") break EOF
UPSC CMS 2021 2022 2023 2024 paper II questions topics surgery gynecology preventive medicine
python3 << 'EOF' # Try to use markitdown or other tools to extract text # Also try PIL + pytesseract import subprocess result = subprocess.run(['pip', 'show', 'pytesseract'], capture_output=True, text=True) print("pytesseract:", result.stdout[:200] if result.stdout else "NOT FOUND") result2 = subprocess.run(['pip', 'show', 'markitdown'], capture_output=True, text=True) print("markitdown:", result2.stdout[:200] if result2.stdout else "NOT FOUND") result3 = subprocess.run(['which', 'tesseract'], capture_output=True, text=True) print("tesseract binary:", result3.stdout if result3.stdout else "NOT FOUND") # Try pdf2image result4 = subprocess.run(['pip', 'show', 'pdf2image'], capture_output=True, text=True) print("pdf2image:", result4.stdout[:200] if result4.stdout else "NOT FOUND") EOF
https://enmeder.com/upsc-cms-exam-preparation-and-previous-y…
python3 << 'EOF' # Try markitdown on PDFs from markitdown import MarkItDown import os md = MarkItDown() pdf_files = { "2025_1": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/2025.pdf", "2024": "/tmp/workspace/attachments/fd90d641-70bf-41fa-8259-1adf6efc091b/CMSE-24-PAPER-II-SURGERY-GYAE-OBST-PREVENT-SOCIAL-MEDCN-150724.pdf", } for year, path in pdf_files.items(): try: result = md.convert(path) text = result.text_content if text and len(text.strip()) > 100: with open(f"/tmp/workspace/cms_analysis/{year}_md.txt", "w") as f: f.write(text) print(f"{year}: {len(text)} chars extracted via markitdown") print(text[:500]) else: print(f"{year}: markitdown returned minimal text: '{text[:200]}'") except Exception as e: print(f"{year}: ERROR - {e}") EOF
How much more time will you take to make the pdf?
How much more time
ls /tmp/workspace/cms_analysis/ 2>/dev/null && echo "EXISTS" || echo "MISSING"
mkdir -p /tmp/workspace/cms_analysis && ls /tmp/workspace/attachments/
find /tmp -name "*.pdf" 2>/dev/null | head -20