A comprehensive ETL (Extract, Transform, Load) pipeline for processing research papers, extracting text and charts, and providing a searchable interface.
- Text Extraction: Uses PaddleOCR for accurate text extraction from PDFs
- Chart Detection: OpenCV-based chart detection and analysis
- NLP Processing: SpaCy integration for entity recognition and text analysis
- Vector Search: FAISS implementation for semantic search capabilities
- REST API: FastAPI-powered API for data access
- Interactive UI: Streamlit-based frontend for visualization
- OCR Engine: PaddleOCR
- Image Processing: OpenCV
- NLP: SpaCy, Sentence Transformers
- Vector Search: FAISS
- Database: PostgreSQL
- API: FastAPI
- Frontend: Streamlit
- Language: Python 3.8+
- Python 3.8 or higher
- PostgreSQL 12 or higher
- Virtual environment (recommended)
- Clone the repository:
mkdir research-paper-etl
cd research-paper-etl
git clone https://github.com/siabang35/PaddleOCRForPDF.git- Create and activate a virtual environment:
python -m venv env
source env/bin/activate #On Linux:
env\Scripts\activate #On Windows: - Install dependencies:
pip install -r requirements.txt
python -m spacy download en_core_web_sm- Set up environment variables:
Create a
.envfile with your database credentials:
DATABASE_URL=your_supabasedb
- Initialize the database:
psql -U postgres -f database/db.sql- Extract text and charts:
python pipeline/extract.py- Transform and process data:
python pipeline/transform.py- Load data into database:
python pipeline/load.py- Start the API server:
uvicorn backend.api.main:app --reload --port 8000- Launch the frontend:
streamlit run frontend/app.pyresearch-paper-etl/
βββ api/ # FastAPI application
β βββ main.py # API endpoints
β βββ models.py # Pydantic models
β βββ db.py # Database operations
βββ pipeline/ # ETL pipeline components
β βββ extract.py # Text and chart extraction
β βββ transform.py # Data processing
β βββ load.py # Database loading
βββ logger.py
βββ config.py
βββ frontend/ # Streamlit frontend
β βββ app.py # UI implementation
βββ data/ # Data storage
β βββ input/ # Input PDFs
β βββ processed/ # Processed data
βββ database/ # Database scripts
β βββ db.sql # Database initialization
βββ requirements.txt # Python dependencies
GET /: API health checkGET /documents/{doc_id}: Retrieve document by IDPOST /search: Search documents
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.