We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/trose/ice-locator-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
HEATMAP_IMPLEMENTATION_SUMMARY.md•4.37 kB
# Heatmap Feature Implementation Summary
## Overview
The heatmap feature provides visualization of ICE facility locations and detainee counts through both web and mobile applications. This implementation enables users to quickly understand the distribution of detainees across different facilities.
## Components Implemented
### 1. Backend API
- **File**: [src/ice_locator_mcp/api/heatmap_api.py](file:///Users/trose/src/locator-mcp/src/ice_locator_mcp/api/heatmap_api.py)
- **Technology**: FastAPI with Uvicorn
- **Endpoints**:
- `GET /` - API root with endpoint information
- `GET /api/facilities` - All facilities with GPS coordinates
- `GET /api/facility/{id}/current-detainees` - Specific facility data
- `GET /api/heatmap-data` - Aggregated data for heatmap visualization
- **Features**:
- Database integration with PostgreSQL
- Fallback to mock database when PostgreSQL is unavailable
- Error handling with proper HTTP status codes
- JSON responses for easy consumption
- CORS support for web app integration
### 2. Database Layer
- **Files**:
- [src/ice_locator_mcp/database/manager.py](file:///Users/trose/src/locator-mcp/src/ice_locator_mcp/database/manager.py) - PostgreSQL database manager
- [src/ice_locator_mcp/database/mock_manager.py](file:///Users/trose/src/locator-mcp/src/ice_locator_mcp/database/mock_manager.py) - Mock database for testing
- **Schema**:
- Facilities table with GPS coordinates
- Detainee location history tracking
- Relationships between detainees and facilities
### 3. Web Application
- **File**: [web-app/src/App.tsx](file:///Users/trose/src/locator-mcp/web-app/src/App.tsx)
- **Technology**: React with TypeScript and Leaflet.js
- **Features**:
- Interactive map visualization
- Facility markers with detainee counts
- Responsive facility list
- Loading and error states
- Real API integration (replaced mock data)
### 4. Mobile Application
- **Files**:
- [mobile-app/src/heatmap/HeatmapAPI.ts](file:///Users/trose/src/locator-mcp/mobile-app/src/heatmap/HeatmapAPI.ts) - API client
- [mobile-app/src/heatmap/HeatmapView.tsx](file:///Users/trose/src/locator-mcp/mobile-app/src/heatmap/HeatmapView.tsx) - UI component
- **Technology**: React Native
- **Features**:
- Singleton API client pattern
- In-memory caching (5-minute TTL)
- Map view with facility markers
- Color-coded markers based on detainee counts
- Facility list with current detainee counts
### 5. Testing and Demo
- **Files**:
- [mock_heatmap_api.py](file:///Users/trose/src/locator-mcp/mock_heatmap_api.py) - Standalone mock API server
- [test_heatmap_api_integration.py](file:///Users/trose/src/locator-mcp/test_heatmap_api_integration.py) - Integration test script
- [demo_heatmap_api.py](file:///Users/trose/src/locator-mcp/demo_heatmap_api.py) - Implementation demo script
- **Features**:
- Standalone mock server for testing
- Integration tests for all endpoints
- Implementation demonstration
## Key Features
### Cross-Platform Support
- Web application using React and Leaflet.js
- Mobile application using React Native
- Shared API backend
### Performance Optimizations
- Client-side caching in mobile app (5-minute TTL)
- Database indexing for faster queries
- Efficient data aggregation in API endpoints
### Robustness
- Database connection fallback to mock data
- Comprehensive error handling
- Type safety with TypeScript
### Security
- CORS middleware configuration
- Input validation
- Secure database connections
## Deployment
- Standalone server on port 8082
- Integration with existing MCP infrastructure
- Container-ready for cloud deployment
## API Endpoints
- `GET /` - API root with endpoint information
- `GET /docs` - Interactive API documentation
- `GET /openapi.json` - OpenAPI specification
- `GET /api/facilities` - All facilities with GPS coordinates
- `GET /api/facility/{id}/current-detainees` - Specific facility data
- `GET /api/heatmap-data` - Aggregated data for heatmap visualization
## Testing
The implementation includes comprehensive testing:
- Unit tests for database operations
- Integration tests for API endpoints
- Client-side testing for web and mobile apps
- Mock server for isolated testing
## Future Enhancements
- Rate limiting for API endpoints
- Advanced caching strategies
- Real-time data updates
- Enhanced visualization options