How hariomgupta70427/medical-ai-platform works
Project Type and Purpose
• This is a full-stack web application (“MediAI Discovery Platform”) built with Next.js (React + Node) on the front- and back-end, coupled with a small Python/Flask microservice for RDKit chemistry operations.
• Purpose: provide pharmaceutical researchers with an AI-driven interface for molecular visualization, drug-modification suggestions, retrosynthesis planning, and interactive chat.
File Structure
• Top-level folders:
• app/ — Next.js “app router” (pages, server & client components, API routes)
• components/ — shared React UI modules
• lib/ — backend service wrappers (OpenAI, PubChem, IBM RXN, DeepSeek, etc.)
• hooks/ — shared React hooks
• public/, styles/, types/ — static assets, CSS, and TS definitions
• Key API route folders under app/api/:
• chat, drug-modifications, molecule, pubchem, retrosynthesis, explanation, rdkit (with embedded Python service in app/api/rdkit/python/)
• Configuration & deployment files: next.config.mjs, Dockerfile for RDKit service, .env references in README.
README for Additional Insights
• Architecture notes: Next.js dev server + optional Dockerized Python RDKit service
• Environment toggles: ENABLE_PYTHON_RDKIT, RDKIT_SERVICE_URL
• External integrations: PubChem, IBM RXN, SwissADME, OpenAI
a. Main Components
• Client Browser (React pages + components)
• Next.js Frontend / SSR Server (Node.js + TypeScript)
• Next.js API Layer (app/api/* routes)
• Python RDKit Microservice (Flask + RDKit, containerizable)
• External 3rd-party APIs: PubChem, IBM RXN, SwissADME, OpenAI
b. Relationships and Data Flows
1. User → Browser loads React pages (SSR or CSR)
2. Browser → calls Next.js API endpoints (e.g., /api/chat, /api/pubchem)
3. Next.js API route → invokes lib/* service functions
4. Service functions → call external HTTP APIs (PubChem, IBM RXN, OpenAI) or forward to RDKit microservice
5. RDKit Python service ↔ Next.js API (over HTTP at RDKIT_SERVICE_URL)
6. Aggregated response → Next.js API → Browser UI
c. Architectural Patterns & Principles
• “App router” separation of pages vs. API routes in Next.js
• Microservice for chemistry-heavy workloads (RDKit)
• Service-wrapper pattern in lib/ for external integrations
• Environment-driven feature toggles (.env for RDKit, debug, base URLs)
d. Key Technologies
• Frontend: Next.js 13+, React, Tailwind CSS, TypeScript
• Backend: Node.js, TypeScript, Next.js API routes
• Microservice: Python 3.9+, Flask, RDKit, Docker
• External: PubChem PUG-REST, IBM RXN API, OpenAI GPT, SwissADME wrapper