This is a monorepo containing both the frontend React application and the backend Python Flask API for monitoring cellular tower anomalies.
.
├── package.json # Monorepo configuration
├── backend/ # Python Flask API
│ ├── app.py # Main Flask application
│ ├── requirements.txt # Python dependencies
│ ├── .env # Environment variables
│ └── logs/ # Telecom anomaly logs
│ └── telco_anomalies.log # Sample telecom log file
└── cellular-tower-map/ # React frontend application
├── src/
│ └── App.js # Main React component
└── ...
GET /api/towers
Returns all cellular towers with their current status and disfunctionality information derived from telecom logs.
PUT /api/towers/{tower_id}
Updates the status and disfunctionality of a specific tower (manual override).
GET /api/towers/{tower_id}/status
Returns the status and disfunctionality of a specific tower.
GET /api/logs/analyze
Returns the parsed telecom log data for analysis purposes.
The backend reads from logs/telco_anomalies.log
which follows telecom standards with the format:
timestamp|tower_id|component|severity|description
Severity levels (in order of impact):
- INFO: No operational impact
- WARNING: Minor issues, yellow marker
- ERROR: Significant issues, red marker
- CRITICAL: Major issues, red marker
- Interactive map showing cellular tower locations
- Color-coded markers based on tower status (green=operational, yellow=warning, red=offline)
- Detailed information window for each tower showing disfunctionality
- Real-time data from telecom log analysis
- Manual status update capability for towers
- Python Flask: Web framework for building RESTful APIs
- Flask-CORS: Enables Cross-Origin Resource Sharing
- python-dotenv: For managing environment variables
- React: JavaScript library for building user interfaces
- @react-google-maps/api: Google Maps integration
- React Scripts: Build toolchain for React applications
- Node.js (v14 or higher)
- Python 3.8 or higher
- npm (v6 or higher) or yarn
-
Navigate to the backend directory:
cd backend
-
Install Python dependencies:
pip install -r requirements.txt
-
Start the backend server:
python app.py
-
Navigate to the frontend directory:
cd cellular-tower-map
-
Install JavaScript dependencies:
npm install
-
Start the development server:
npm start
You can start both the backend and frontend servers simultaneously using:
npm run start:all
This command uses concurrently to run both applications at the same time.
FLASK_ENV=development
: Sets the Flask environment to developmentPORT=5000
: Specifies the port for the Flask server
The telecom log file (logs/telco_anomalies.log
) follows this format:
timestamp|tower_id|component|severity|description
Example:
2023-01-01 10:00:00|1|Power Supply|WARNING|Voltage fluctuation detected
2023-01-01 11:00:00|2|Antenna|ERROR|Signal degradation
- The Flask app exposes RESTful endpoints for tower data and log analysis
- The application parses telecom logs to determine tower status
- Tower status is determined by the most recent log entry's severity level
- The application includes mock data for tower locations (hardcoded in app.py)
- The React application integrates with Google Maps API
- Tower data is fetched from the backend API endpoint
- Interactive markers display tower status and allow manual status updates
- Status update functionality is implemented via PUT requests to the backend
- The application can be tested by sending HTTP requests to the defined endpoints
- Log parsing functionality is tested with sample log entries
- Tower status determination logic is validated through different severity levels
- Unit tests can be run using
npm test
- Manual testing of the map interface and interactivity is recommended
- Integration testing between frontend and backend should verify data flow
- The Flask application can be deployed to any Python-compatible hosting platform
- Consider using Gunicorn or similar WSGI servers for production deployment
- Build the application with
npm run build
- Deploy the contents of the
build
folder to any static web hosting service - Ensure the API endpoint URLs are configured correctly for production
-
Missing Google Maps API Key:
- Add your Google Maps API key to
.env
file in the frontend - Set
REACT_APP_GOOGLE_MAPS_API_KEY
environment variable
- Add your Google Maps API key to
-
Backend Server Not Starting:
- Ensure Python dependencies are installed (
pip install -r requirements.txt
) - Verify the log file path exists and is accessible
- Ensure Python dependencies are installed (
-
Frontend Not Loading:
- Make sure the backend server is running before starting the frontend
- Check browser console for CORS-related errors