Event Monitor is a system for monitoring and analyzing events from VK (VKontakte) groups. It automatically collects posts, classifies them as event announcements, and extracts structured event information.
- Automatic monitoring of VK group posts
- Event announcement classification using AI
- Event information extraction (date, time, location, etc.)
- RESTful API for accessing event data
- Modern web interface with real-time filtering
- SQLite/PostgreSQL database support
- Containerized deployment with Docker
The system consists of four main microservices:
- Parser Service: Periodically fetches posts from configured VK groups
- Classifier Service: Uses AI to identify event announcements
- Analyzer Service: Extracts structured event information from classified posts
- API Service: Provides RESTful access and web interface to the collected data
Система построена на принципах микросервисной архитектуры со следующими правилами:
-
Единая точка доступа к данным:
- Все взаимодействие с базой данных происходит ТОЛЬКО через API Service
- Остальные сервисы (Parser, Classifier, Analyzer) работают с данными исключительно через REST API
- Прямой доступ к базе данных из сервисов, кроме API Service, запрещен
-
Изоляция сервисов:
- Каждый сервис работает независимо и не имеет прямого доступа к ресурсам других сервисов
- Все взаимодействие происходит через четко определенные REST эндпоинты
- Сервисы могут быть развернуты и масштабированы независимо
-
Обработка ошибок:
- Каждый сервис должен корректно обрабатывать ошибки API
- При недоступности API сервис должен логировать ошибку и продолжать работу
- Реализована стратегия повторных попыток для критичных операций
-
Логирование:
- Каждый сервис ведет собственное логирование
- Взаимодействия с внешними API (VK, Novita.ai) логируются через API Service
- Все значимые события и ошибки фиксируются в логах
- Docker and Docker Compose
- Python 3.9 or higher (for local development)
- VK API access token
- Novita.ai API key
- UV package manager (recommended installation via
curl -LsSf https://astral.sh/uv/install.sh | sh
)
-
Clone the repository:
git clone https://github.com/yourusername/event-monitor.git cd event-monitor
-
Copy the example environment file and configure your settings:
cp .env.example .env
-
Edit
.env
with your configuration:- Set your VK API access token
- Configure your Novita.ai API key
- Adjust other settings as needed
-
Build and start the services:
docker-compose up -d
-
Install UV package manager:
# Using PowerShell (Run as Administrator) iwr -useb https://astral.sh/uv/install.ps1 | iex
Alternatively, you can download the latest release manually from: https://github.com/astral-sh/uv/releases
-
Create a virtual environment:
# Create new virtual environment uv venv .venv # Activate the virtual environment .venv\Scripts\activate
-
Install dependencies:
# Generate requirements.txt with all dependencies (including dev) uv pip compile --all-extras pyproject.toml > requirements.txt # Install dependencies from requirements.txt uv sync requirements.txt
-
Configure environment:
# Copy example environment file Copy-Item .env.example .env # Edit .env file with your settings notepad .env
-
Create a virtual environment:
uv venv .venv source .venv/bin/activate
-
Install dependencies:
# Generate requirements.txt with all dependencies uv pip compile --all-extras pyproject.toml > requirements.txt # Install dependencies from requirements.txt uv sync requirements.txt
The web interface provides a modern, responsive dashboard for managing and monitoring events:
- Real-time filtering of posts by:
- Processing stage (Parsed, Classified, Analyzed, Not Events)
- Group
- Time period
- Instant updates without page reloads
- Responsive design for all screen sizes
- Bootstrap 5 UI components
- Loading indicators for better UX
- Error handling with toast notifications
- Dashboard: Overview of system statistics and recent activity
- Posts: Real-time post management with filters
- Events: Event listing and details
- Groups: Group management interface
The API documentation is available at http://localhost:8000/docs
when the API service is running.
GET /groups
: List all monitored groupsGET /groups/{group_id}/posts
: Get posts from a specific groupGET /events
: List all extracted eventsGET /events/{event_id}
: Get details of a specific eventPOST /llm_interactions
: Log LLM API interactionsGET /llm_interactions
: Get logged LLM interactions
Key environment variables:
VK_ACCESS_TOKEN
: Your VK API access tokenVK_API_VERSION
: VK API version (default: 5.131)NOVITA_API_KEY
: Your Novita.ai API keyNOVITA_API_URL
: Novita.ai API URLPARSER_INTERVAL_MINUTES
: How often to check for new posts (default: 15)DATABASE_URI
: Database connection string (SQLite or PostgreSQL)API_PORT
: Port for the API service (default: 8000)
See .env.example
for all available configuration options.
UV is used for fast, reliable Python package management. Key commands:
# Create and activate virtual environment
uv venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Generate and install dependencies
uv pip compile --all-extras pyproject.toml > requirements.txt
uv sync requirements.txt
# Update dependencies
uv pip compile --upgrade pyproject.toml > requirements.txt
uv sync requirements.txt
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.