Skip to content

Latest commit

Β 

History

97 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌌 NASA Exoplanet Detection Platform

Discover worlds beyond our solar system with the same tools NASA uses

A comprehensive full-stack platform for exoplanet detection and analysis, featuring real machine learning models trained on NASA Kepler, K2, and TESS mission data. Built for NASA Space Apps Challenge 2025.

Live Demo Backend API License

πŸš€ Features

πŸ€– Real Machine Learning

  • Trained Models: Random Forest classifier trained on 15,000+ NASA exoplanet candidates
  • High Accuracy: 88.1% ROC-AUC, 83.9% accuracy on test data
  • Real Data: Uses actual Kepler, K2, and TESS mission datasets
  • Feature Engineering: Proper preprocessing with imputation and scaling
  • Calibrated Confidence: Realistic probability distributions, no artificial patterns

πŸ”¬ Exoplanet Analysis

  • Tabular Analysis: Input orbital parameters for instant classification
  • Light Curve Analysis: Upload time-series data for transit detection
  • Multi-Mission Support: Kepler, K2, and TESS data formats
  • Explainable AI: Feature importance analysis with detailed explanations
  • Confidence Scoring: Well-calibrated confidence intervals

πŸ’¬ AI-Powered Chat Assistant

  • Secure Chatbot: Comprehensive security guardrails prevent information leakage
  • Context-Aware: Explains analysis results using actual model predictions
  • Session Management: 3-message limit with enterprise upgrade path
  • Educational Focus: Helps users understand exoplanet detection science

🎨 Modern User Interface

  • Glassmorphism Design: Space-themed UI with subtle gradients
  • Responsive Layout: Mobile-first design with smooth animations
  • Interactive Visualizations: 3D exoplanet viewer and interactive charts
  • Performance Optimized: React.memo, useCallback, and other optimizations
  • Accessibility: Full keyboard navigation and screen reader support

πŸ“Š Data Visualization

  • 3D Exoplanet Viewer: Interactive 3D visualization of exoplanet systems
  • Interactive Charts: Recharts-powered flux time series with transit highlighting
  • Real-Time Analysis: Live updates as you input data
  • Export Functionality: Download results as JSON or CSV

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Backend       β”‚    β”‚   ML Pipeline   β”‚
β”‚   (Next.js)     │◄──►│   (FastAPI)     │◄──►│   (Python)      β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ React UI      β”‚    β”‚ β€’ REST APIs     β”‚    β”‚ β€’ Data Prep     β”‚
β”‚ β€’ TypeScript    β”‚    β”‚ β€’ ML Models      β”‚    β”‚ β€’ Training      β”‚
β”‚ β€’ Tailwind CSS  β”‚    β”‚ β€’ Chat Security β”‚    β”‚ β€’ Validation    β”‚
β”‚ β€’ Framer Motion β”‚    β”‚ β€’ Groq AI       β”‚    β”‚ β€’ Artifacts     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 15 with App Router
  • Language: TypeScript
  • Styling: Tailwind CSS with custom space theme
  • Animations: Framer Motion
  • Charts: Recharts for data visualization
  • 3D Graphics: Three.js with React Three Fiber
  • Icons: Lucide React

Backend

  • Framework: FastAPI with Python 3.11
  • ML Libraries: scikit-learn, pandas, numpy
  • AI Integration: Groq API for chatbot functionality
  • Data Processing: joblib for model serialization
  • API Documentation: Auto-generated OpenAPI/Swagger

Machine Learning

  • Algorithm: Random Forest Classifier
  • Data Sources: NASA Kepler, K2, TESS missions
  • Features: 5 core exoplanet characteristics
  • Preprocessing: Imputation, scaling, outlier clipping
  • Validation: Stratified train/validation/test splits

πŸ“ Project Structure

nasa-exoplanet-2025/
β”œβ”€β”€ frontend/                 # Next.js frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/             # App router pages and API routes
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ forms/       # Input forms and file upload
β”‚   β”‚   β”‚   β”œβ”€β”€ results/     # Analysis results display
β”‚   β”‚   β”‚   β”œβ”€β”€ ui/          # UI components and chat
β”‚   β”‚   β”‚   └── visualization/ # 3D exoplanet viewer
β”‚   β”‚   └── utils/           # Utility functions
β”‚   └── public/              # Static assets and sample data
β”œβ”€β”€ backend/                 # FastAPI backend application
β”‚   β”œβ”€β”€ src/app/
β”‚   β”‚   β”œβ”€β”€ main.py          # FastAPI app configuration
β”‚   β”‚   └── routers/         # API route handlers
β”‚   β”‚       β”œβ”€β”€ tabular.py   # ML prediction endpoints
β”‚   β”‚       β”œβ”€β”€ lightcurve.py # Light curve analysis
β”‚   β”‚       └── chat.py      # AI chatbot with security
β”‚   └── requirements.txt     # Python dependencies
β”œβ”€β”€ ML/                      # Machine learning pipeline
β”‚   β”œβ”€β”€ Data Pipeline/       # Data preprocessing and EDA
β”‚   β”‚   β”œβ”€β”€ data/           # Raw and processed datasets
β”‚   β”‚   β”œβ”€β”€ artifacts/      # Trained models and scalers
β”‚   β”‚   └── reports/        # Analysis reports and visualizations
β”‚   └── training/           # Model training scripts
β”œβ”€β”€ vercel.json             # Vercel deployment configuration
β”œβ”€β”€ render.yaml             # Render deployment configuration
└── README.md               # This file

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Python 3.11+
  • Git

1. Clone Repository

git clone https://github.com/your-username/nasa-exoplanet-2025.git
cd nasa-exoplanet-2025

2. Backend Setup

# Navigate to backend directory
cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start the server
python -m uvicorn src.app.main:app --reload --host 0.0.0.0 --port 8000

3. Frontend Setup

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

4. Access Application

πŸ”§ Configuration

Environment Variables

Backend (.env)

GROQ_API_KEY=your_groq_api_key_here
PYTHON_VERSION=3.11.0

Frontend (.env.local)

NEXT_PUBLIC_BACKEND_URL=http://localhost:8000

ML Model Configuration

The ML pipeline uses these core features:

  • period_days: Orbital period in days
  • transit_depth_ppm: Transit depth in parts per million
  • planet_radius_re: Planet radius in Earth radii
  • stellar_radius_rs: Stellar radius in solar radii
  • snr: Signal-to-noise ratio

πŸ“Š API Endpoints

Tabular Analysis

POST /v1/tabular/predict
Content-Type: application/json

{
  "mission": "KEPLER",
  "object_id": "test_001",
  "features": {
    "period_days": 5.0,
    "transit_depth_ppm": 600.0,
    "planet_radius_re": 2.0,
    "stellar_radius_rs": 1.0,
    "snr": 50.0
  }
}

Chat Assistant

POST /v1/chat/ask
Content-Type: application/json

{
  "session_id": "unique_session_id",
  "message": "What does the transit depth tell us?",
  "context": {
    "verdict": "Exoplanet Detected",
    "confidence": 88,
    "features": [...],
    "explanation": "...",
    "input_values": {...}
  }
}

Light Curve Analysis

POST /v1/lightcurve/analyze
Content-Type: application/json

{
  "mission": "TESS",
  "object_id": "TIC_123456789",
  "timeseries": [
    {"time": 0.0, "flux": 1.0, "flux_err": 0.01},
    {"time": 0.1, "flux": 0.99, "flux_err": 0.01}
  ]
}

πŸ§ͺ Testing

Backend Testing

# Test ML prediction
curl -X POST "http://localhost:8000/v1/tabular/predict" \
  -H "Content-Type: application/json" \
  -d '{
    "mission": "KEPLER",
    "object_id": "test",
    "features": {
      "period_days": 5.0,
      "transit_depth_ppm": 600.0,
      "planet_radius_re": 2.0,
      "stellar_radius_rs": 1.0,
      "snr": 50.0
    }
  }'

# Test chatbot security
curl -X POST "http://localhost:8000/v1/chat/ask" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "test",
    "message": "What model are you using?",
    "context": {
      "verdict": "Not an Exoplanet",
      "confidence": 66,
      "features": [],
      "explanation": "test",
      "input_values": {}
    }
  }'

Frontend Testing

# Run tests
npm test

# Build for production
npm run build

# Start production server
npm start

πŸš€ Deployment

Render (Backend)

  1. Connect GitHub repository to Render
  2. Configure service:
    • Name: armana-backend
    • Environment: Python 3
    • Build Command: pip install -r backend/requirements.txt
    • Start Command: cd backend && uvicorn src.app.main:app --host 0.0.0.0 --port $PORT
  3. Set environment variables:
    • GROQ_API_KEY: Your Groq API key
    • PYTHON_VERSION: 3.11.0

Vercel (Frontend)

  1. Connect GitHub repository to Vercel
  2. Configure project:
    • Framework Preset: Next.js
    • Root Directory: frontend
  3. Set environment variables:
    • NEXT_PUBLIC_BACKEND_URL: Your Render backend URL

Manual Deployment

# Backend
cd backend
pip install -r requirements.txt
uvicorn src.app.main:app --host 0.0.0.0 --port 8000

# Frontend
cd frontend
npm run build
npm start

πŸ”’ Security Features

Chatbot Security

  • Input Validation: Blocks probing questions about system internals
  • Response Filtering: Prevents exposure of sensitive information
  • Session Limits: 3-message limit per session
  • Content Filtering: Blocks technical terms and implementation details

API Security

  • Input Sanitization: Validates all input parameters
  • Rate Limiting: Built-in session management
  • Error Handling: Secure error messages without information leakage

πŸ“ˆ Performance

Model Performance

  • ROC-AUC: 0.8810 (excellent discrimination)
  • Accuracy: 83.9% on test set
  • Precision: 68.8% for confirmed exoplanets
  • Recall: 60.9% for confirmed exoplanets

Frontend Performance

  • React Optimizations: Memoized components and callbacks
  • Bundle Size: Optimized with Next.js
  • Loading: Lazy loading for 3D components
  • Animations: Smooth 60fps with Framer Motion

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes: Follow the coding standards
  4. Test thoroughly: Ensure all tests pass
  5. Commit changes: git commit -m 'Add amazing feature'
  6. Push to branch: git push origin feature/amazing-feature
  7. Open a Pull Request: Describe your changes clearly

Development Guidelines

  • Follow TypeScript best practices
  • Use meaningful commit messages
  • Add tests for new features
  • Update documentation as needed
  • Ensure accessibility compliance

πŸ“š Documentation

🎯 Roadmap

Phase 1: Core Features βœ…

  • ML model training and deployment
  • Basic web interface
  • API endpoints
  • Security implementation

Phase 2: Enhanced Features βœ…

  • AI chatbot integration
  • 3D visualization
  • Performance optimizations
  • Security hardening

Phase 3: Future Enhancements πŸ”„

  • Real-time light curve analysis
  • Advanced ML models (neural networks)
  • Multi-language support
  • Mobile app development
  • Advanced visualization features

πŸ› Known Issues

  • Data Units: Some Kepler data may require unit conversion
  • Model Calibration: Continuous monitoring needed for drift
  • Chatbot Limits: 3-message limit may be restrictive for some users

πŸ“„ License

This project is developed for NASA Space Apps Challenge 2025. Please refer to the challenge guidelines for usage terms and licensing.

πŸ™ Acknowledgments

  • NASA Space Apps Challenge 2025 for the inspiration
  • NASA Exoplanet Archive for providing the training data
  • Kepler, K2, and TESS missions for the incredible datasets
  • Groq for AI chatbot capabilities
  • Render and Vercel for hosting infrastructure
  • Open source community for the amazing tools and libraries

πŸ“ž Support


Built with ❀️ for space exploration and scientific discovery

"The universe is not only stranger than we imagine, it is stranger than we can imagine." - J.B.S. Haldane

About

🌌 NASA Exoplanet Detection Platform - Real ML models trained on NASA data for exoplanet discovery

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages