Installation Guide¶
This guide will help you set up the Event Discovery application with MongoDB integration from scratch.
๐ Quick Start¶
# 1. Clone the repository
git clone https://github.com/Reetika12795/Rewind.git
cd inttrest
# 2. Install dependencies
uv sync
# 3. Configure environment
cp .env.example .env
# Edit .env with your credentials
# 4. Test the setup
python test_mongo.py
๐ Prerequisites¶
System Requirements¶
graph TB
subgraph "Required"
REQ1[Python 3.8+]
REQ2[uv package manager]
REQ3[Git]
REQ4[MongoDB Atlas account]
end
subgraph "Optional"
OPT1[Node.js 18+ for MCP]
OPT2[Docker for containers]
OPT3[Google Maps API key]
end
style REQ1 fill:#ffebee
style OPT1 fill:#e8f5e8
Check Your System¶
# Check Python version
python --version
# Should output: Python 3.8.x or higher
# Check if uv is installed
uv --version
# Should output: uv x.x.x
# Install uv if not present
curl -LsSf https://astral.sh/uv/install.sh | sh
๐ง Installation Steps¶
Step 1: Repository Setup¶
# Clone the repository
git clone https://github.com/Reetika12795/Rewind.git
# Navigate to the project directory
cd Rewind/inttrest
# Check the project structure
ls -la
Expected structure:
inttrest/
โโโ mongo_connector.py # MongoDB interface
โโโ geocoder.py # Geocoding service
โโโ save_events.py # Event processing
โโโ test_mongo.py # Database tests
โโโ pyproject.toml # Project configuration
โโโ requirements.txt # Dependencies
โโโ docs/ # Documentation
Step 2: Dependencies Installation¶
# Install Python dependencies using uv
uv sync
# Alternative: Using pip (if uv fails)
pip install -r requirements.txt
Expected output:
Step 3: Environment Configuration¶
# Create environment file from template
cp .env.example .env
# Edit the environment file
nano .env # or use your preferred editor
Required environment variables:
# MongoDB Atlas Configuration
MONGODB_PASSWORD=your_mongodb_atlas_password
# Optional: Geocoding API keys
GOOGLE_GEOCODING_API_KEY=your_google_api_key
# Optional: MCP Server URLs
EVENTBRITE_MCP_URL=http://localhost:3001
MEETUP_MCP_URL=http://localhost:3002
LINKEDIN_MCP_URL=http://localhost:3003
๐๏ธ MongoDB Atlas Setup¶
Step 1: Create MongoDB Atlas Account¶
- Visit MongoDB Atlas
- Sign up for a free account
- Create a new project named "Event Discovery"
- Deploy a free cluster (M0 Sandbox)
Step 2: Configure Database Access¶
sequenceDiagram
participant You
participant Atlas as MongoDB Atlas
participant App as Your Application
You->>Atlas: Create Database User
Atlas-->>You: Username/Password
You->>Atlas: Add IP to Access List
Atlas-->>You: Network Access Granted
You->>Atlas: Get Connection String
Atlas-->>You: Connection URI
You->>App: Configure with credentials
App->>Atlas: Test Connection
Atlas-->>App: Connection Successful
Create Database User¶
- Navigate to
Database AccessโAdd New Database User - Authentication Method: Password
- Username:
event_user(or your choice) - Password: Generate secure password
- Database User Privileges: Read and write to any database
- Click
Add User
Configure Network Access¶
- Navigate to
Network AccessโAdd IP Address - Access List Entry:
- For development:
0.0.0.0/0(allow from anywhere) - For production: Your specific IP address
- Click
Confirm
Get Connection String¶
- Navigate to
ClustersโConnect - Choose
Connect your application - Driver: Python, Version 3.6+
- Copy the connection string
- Replace
<password>with your actual password
Example connection string:
Step 3: Test Database Connection¶
# Activate virtual environment
source .venv/bin/activate # Linux/Mac
# or
.venv\Scripts\activate # Windows
# Test the connection
python test_mongo.py
Expected output:
โ
Connected to MongoDB!
โ
Event inserted: Test Event
โ
Inserted 2 events
๐ Finding events...
- Test Event in Paris
- Batch Event 1 in Paris
๐ Total events in database: 3
๐ MongoDB connection closed
๐งช Testing Your Setup¶
Basic Functionality Test¶
# Create test file: test_setup.py
from mongo_connector import MongoConnector
from geocoder import geocoder
import os
def test_complete_setup():
"""Test all components are working"""
print("๐งช Testing complete setup...")
# 1. Test MongoDB connection
try:
password = os.getenv("MONGODB_PASSWORD")
if not password:
password = input("Enter MongoDB password: ")
mongo = MongoConnector(password)
print("โ
MongoDB connection successful")
# Test basic operations
count = mongo.count_events()
print(f"๐ Current events in database: {count}")
mongo.close()
except Exception as e:
print(f"โ MongoDB test failed: {e}")
return False
# 2. Test geocoding service
try:
test_address = "15 rue de milan, paris"
coords = geocoder.geocode(test_address)
if coords:
print(f"โ
Geocoding successful: {coords}")
else:
print("โ ๏ธ Geocoding returned no results")
except Exception as e:
print(f"โ Geocoding test failed: {e}")
return False
# 3. Test event processing
try:
from save_events import save_mcp_events
# Mock event data
mock_events = [{
"id": "test_setup_001",
"title": "Setup Test Event",
"location": "Paris, France",
"category": "Technology"
}]
saved_count = save_mcp_events(mock_events, "test", password)
print(f"โ
Event processing successful: {saved_count} events saved")
except Exception as e:
print(f"โ Event processing test failed: {e}")
return False
print("๐ All tests passed! Setup is complete.")
return True
if __name__ == "__main__":
test_complete_setup()
Run the Comprehensive Test¶
๐ Troubleshooting¶
Common Issues and Solutions¶
Issue: ModuleNotFoundError: No module named 'pymongo'¶
Solution:
# Ensure you're in the correct environment
source .venv/bin/activate
# Reinstall dependencies
uv sync
# Or force reinstall
pip install --force-reinstall pymongo
Issue: MongoDB connection fails¶
Solutions:
-
Check credentials:
-
Check network access:
- Ensure your IP is in the MongoDB Atlas access list
-
Try
0.0.0.0/0for testing (not recommended for production) -
Check connection string:
Issue: Geocoding not working¶
Solutions:
-
Check internet connection:
-
Check rate limiting:
-
Try alternative address formats:
Issue: uv command not found¶
Solution:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Restart terminal or source profile
source ~/.bashrc # or ~/.zshrc
# Verify installation
uv --version
Issue: Permission errors on macOS/Linux¶
Solution:
# Fix permissions
chmod +x setup_scripts/*.sh
# Use sudo if needed for system-wide installation
sudo pip install -r requirements.txt
๐ Next Steps¶
After successful installation:¶
-
๐ Read the documentation:
-
๐งโ๐ป Set up colleague access:
-
๐ Configure MCP servers (optional):
-
๐จ Set up frontend (optional):
Development Workflow¶
graph LR
A[Code Changes] --> B[Test Locally]
B --> C[Run Tests]
C --> D[Update Docs]
D --> E[Commit & Push]
style A fill:#e3f2fd
style C fill:#e8f5e8
style E fill:#fff3e0
๐ Additional Resources¶
- MongoDB Atlas Documentation
- uv Package Manager Guide
- OpenStreetMap Nominatim API
- MkDocs Material Theme
๐ Getting Help¶
If you encounter issues:
- Check the logs for error details
- Review this troubleshooting section
- Search existing issues on GitHub
- Create a new issue with detailed error information
Issue Template:
## Environment
- OS: [e.g., macOS 12.0]
- Python: [e.g., 3.9.7]
- uv: [e.g., 0.1.0]
## Error Description
[Describe what you were trying to do]
## Error Output
Your setup should now be complete and ready for development! ๐