How anmol-bhatta/pubmed works
Project Type and Purpose
• This is a full-stack web application (“ResearchLens”) for searching and summarizing PubMed papers.
• Frontend: React + TypeScript (Vite) with real-time filters and dark mode.
• Backend: Python Flask service providing search, caching, summarization (using BART or similar transformer models).
File Structure Analysis
• Top-level:
• backend/ – Python Flask service, model orchestration, local SQLite DB, caching
• frontend/ – Vite-powered React app (TSX), styling, assets, ESLint and TS config
• backend/ key files:
• app.py – Flask entrypoint, HTTP API endpoints
• pubmed.py – PubMed query logic (external REST API)
• cache_manager.py – local caching of PubMed results (articles.db)
• summarizer.py – transformer model wrapper (BART)
• frontend/ key files:
• src/App.tsx – main React component, API client calls
• components/ArticleList.tsx – list & filter UI
• assets/, public/ – static resources
• Config & deployment hints: Procfile (Heroku), requirements.txt, package.json, Vite config, TS configs
README Insights
• Describes component roles (search, summarize, progressive loading)
• Lists tech stack (Python 3.8+, Node 16+, transformer model)
• Deployment targets (Vercel, Heroku, etc.)
• Mentions updating frontend API URL for separate deployments
Main Components
a. Frontend (React + Vite)
b. Backend API (Flask app)
c. PubMed External Service (REST API)
d. Summarization Service (Transformer model runtime)
e. Local SQLite Database (articles.db for caching)
f. Optional GPU (if available for model inference)
Relationships and Data Flow
• User → Frontend: UI interactions (search criteria, filters)
• Frontend ↔ Backend: JSON over HTTP (search requests, summary requests)
• Backend → PubMed API: fetch paper metadata & abstracts
• Backend ↔ SQLite DB: read/write cached query results
• Backend → Summarizer: feed abstracts to ML model → return summaries
• Backend → Frontend: return search results + summaries
Architectural Patterns & Principles
• Separation of concerns: UI vs. data/model logic
• Stateless frontend, stateful backend with caching layer
• Single HTTP API layer for all client interactions
• Modular Python services (pubmed, cache, summarizer) behind Flask
• Progressive loading: stream or batch results to UI
Technology Highlights
• Frontend: React, TypeScript, Vite, CSS modules, ESLint
• Backend: Flask, Python 3.8+, SQLite, Hugging Face transformers (BART)
• Deployment: Procfile (Heroku), optional GPU for faster ML