Skip to content

Add document table extraction (PDF/DOCX/PPTX) and integrate with CLI & Web UI#40

Merged
rad1092 merged 1 commit into
mainfrom
codex/add-document-parser-module-to-bitnet_tools
Feb 15, 2026
Merged

Add document table extraction (PDF/DOCX/PPTX) and integrate with CLI & Web UI#40
rad1092 merged 1 commit into
mainfrom
codex/add-document-parser-module-to-bitnet_tools

Conversation

@rad1092
Copy link
Copy Markdown
Owner

@rad1092 rad1092 commented Feb 15, 2026

Motivation

  • 문서(.pdf/.docx/.pptx)에서 표를 추출해 기존 CSV 기반 분석 파이프라인으로 연결하려는 요구에 대응합니다.
  • 표별 메타(행/열 수, 헤더 추정, 누락률)와 신뢰도(confidence)를 계산해 사용자가 직접 테이블을 선택하도록 지원해야 합니다.
  • 추출 실패 원인을 명확히(암호화/스캔 이미지/표 없음) 반환해 후속 처리 흐름에서 적절히 대응할 수 있도록 합니다.

Description

  • 추가: bitnet_tools/document_extract.py를 추가해 pdf/docx/pptx에 대한 통합 표 추출 인터페이스와 ExtractedTable/DocumentExtractResult 타입을 구현했습니다.
  • 추출 로직은 DOCX/PPTX의 XML 파싱과 간단한 PDF 텍스트 후보 스캔을 사용하며, 각 테이블에 대해 row_count, column_count, header_inferred, missing_ratio, confidence를 계산해 반환합니다.
  • CLI analyze 흐름을 확장해 문서 입력을 허용하고 --list-tables로 목록 확인, --table-index로 특정 테이블을 선택해 기존 build_analysis_payload 파이프라인으로 전달하도록 연결했습니다.
  • Web API에 /api/document/extract 엔드포인트를 추가하고 /api/analyzeinput_type=document + table_index 처리를 추가했으며 내부 함수 _coerce_csv_text_from_file_payload가 문서 페이로드를 CSV 텍스트로 정규화하도록 통합했습니다.
  • UI 변경: 입력 타입에 document 옵션 추가, 파일 선택 시 문서의 표 목록과 신뢰도 표시 및 선택된 인덱스를 서버로 전달하도록 app.js/index.html을 업데이트했고 멀티파일 업로드에서도 문서 처리를 지원합니다.
  • 테스트 추가: 문서 추출 유닛 테스트(tests/test_document_extract.py), 웹의 문서 페이로드 정규화 테스트와 CLI 문서 명령 테스트를 포함해 관련 테스트를 추가/수정했습니다.

Testing

  • 컴파일 검사: python -m py_compile bitnet_tools/web.py bitnet_tools/cli.py bitnet_tools/document_extract.py 실행(성공).
  • 단위/통합 테스트: pytest -q tests/test_document_extract.py tests/test_web.py tests/test_cli.py 실행 결과 성공(해당 모듈 테스트들 통과).
  • 전체 테스트 스위트: pytest -q 실행 결과 전체 테스트 통과 (35 passed).
  • 수동 UI 스모크: 로컬 서버 실행(python -m bitnet_tools.cli ui) 및 Playwright로 페이지 렌더링/스크린샷 캡처 확인(성공).

Codex Task

@rad1092 rad1092 merged commit 8fd0b31 into main Feb 15, 2026
4 checks passed
@rad1092 rad1092 deleted the codex/add-document-parser-module-to-bitnet_tools branch February 15, 2026 04:21
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13207286f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bitnet_tools/ui/app.js
if (inputType !== 'excel') {
appState.detectedInputType = 'csv';
if (UI.sheetSelect) UI.sheetSelect.innerHTML = '<option value="">CSV는 시트 선택이 필요 없습니다.</option>';
const fileBase64 = await readFileAsBase64(file);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip base64 conversion for non-binary file selection

fetchSheetsForFile now base64-encodes every selected file before checking inputType, but the CSV path never uses that value. For large CSV uploads this does an unnecessary full-file copy plus base64 expansion on each file-change/refresh action, which can noticeably freeze the UI or hit browser memory limits even though no sheet/table lookup is needed.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant