# VIMS - Visual Infrastructure Monitoring System ## Overview Production-ready AI-driven visual monitoring for critical infrastructure. Detects anomalies and changes in ATMs, charging stations, parking meters, and more. ## Quick Start ```bash # Clone and setup git clone https://github.com/landvex/vims-backend.git cd vims-backend # Run setup script ./scripts/setup.sh # Start services docker-compose up -d # Run tests npm test # Start development npm run dev ``` ## Architecture ``` ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ quiXzoom │────→│ VIMS API │────→│ PostgreSQL │ │ App │ │ (3450) │ │ (Database) │ └─────────────┘ └──────┬──────┘ └─────────────┘ │ ┌──────▼──────┐ │ Redis │ │ (Queue) │ └──────┬──────┘ │ ┌────────────┼────────────┐ ▼ ▼ ▼ ┌─────────┐ ┌──────────┐ ┌──────────┐ │ Object │ │ Change │ │ Risk │ │Detection│ │Detection │ │Classifier│ └─────────┘ └──────────┘ └──────────┘ ``` ## Features - **Object Detection**: YOLO-based component detection (card readers, PIN pads, etc.) - **Change Detection**: Compare observations with baseline images - **Risk Classification**: Green/Yellow/Orange/Red levels - **Real-time Alerts**: Email, SMS, webhook, push notifications - **Dashboard**: Map view, timeline, statistics - **API**: RESTful API with JWT authentication ## API Endpoints ### Authentication - `POST /api/v1/auth/register` - Register new user - `POST /api/v1/auth/login` - Login - `POST /api/v1/auth/refresh` - Refresh token - `GET /api/v1/auth/me` - Get current user ### Objects - `GET /api/v1/objects` - List monitored objects - `POST /api/v1/objects` - Create new object - `GET /api/v1/objects/:id` - Get object details - `POST /api/v1/objects/:id/baseline` - Set baseline images ### Observations - `POST /api/v1/observations` - Upload observation images - `GET /api/v1/observations/:id` - Get observation - `POST /api/v1/observations/:id/process` - Reprocess observation ### Detections - `GET /api/v1/detections` - List AI detections - `POST /api/v1/detections/:id/verify` - Verify detection ### Alerts - `GET /api/v1/alerts` - List alerts - `PUT /api/v1/alerts/:id/status` - Update alert status - `POST /api/v1/alerts/:id/escalate` - Escalate alert ### Dashboard - `GET /api/v1/dashboard/overview` - Dashboard statistics - `GET /api/v1/dashboard/objects` - Objects for map view - `GET /api/v1/dashboard/timeline` - Activity timeline ## AI Training ### Data Collection ```bash # Generate synthetic training data node src/training/data-collection.js atm 1000 # Validate dataset node src/training/data-collection.js atm --validate ``` ### Model Training ```bash # Install Python dependencies pip install ultralytics # Train YOLO model python src/training/train-yolo.py atm --epochs 100 # Validate model python src/training/train-yolo.py atm --validate ``` ## Deployment ### Docker Compose (Development) ```bash docker-compose up -d ``` ### Kubernetes (Production) ```bash # Apply configurations kubectl apply -f k8s/ # Check status kubectl get pods -n vims ``` ### AWS ```bash # Setup AWS infrastructure ./scripts/setup-aws.sh # Deploy ./scripts/deploy-aws.sh ``` ## Configuration ### Environment Variables | Variable | Required | Default | Description | |----------|----------|---------|-------------| | `NODE_ENV` | Yes | development | Environment mode | | `PORT` | No | 3450 | API port | | `DB_HOST` | Yes | - | PostgreSQL host | | `DB_PASSWORD` | Yes | - | Database password | | `REDIS_HOST` | Yes | - | Redis host | | `JWT_SECRET` | Yes | - | Secret for JWT tokens | | `S3_BUCKET` | Yes | - | S3 bucket for images | | `AWS_ACCESS_KEY_ID` | Yes | - | AWS access key | | `AWS_SECRET_ACCESS_KEY` | Yes | - | AWS secret key | See `.env.example` for all options. ## Testing ```bash # Run all tests npm test # Run with coverage npm run test:coverage # Run specific test npm test -- objectDetection.test.js ``` ## Monitoring ### Health Checks - `GET /health` - Basic health - `GET /health/ready` - Readiness probe - `GET /health/live` - Liveness probe ### Metrics - Prometheus metrics at `/metrics` - Grafana dashboards - CloudWatch integration ## Documentation - [API Documentation](docs/API.md) - [Deployment Guide](docs/DEPLOYMENT.md) - [Production Plan](docs/PRODUCTION_PLAN.md) ## Support - Email: support@landvex.com - Documentation: https://docs.landvex.com/vims - Issues: https://github.com/landvex/vims/issues ## License Proprietary - Landvex AB