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.