|
1 | 1 | # pei-nwdaf-data-storage |
2 | | -Data storage service |
3 | 2 |
|
| 3 | +> Project for PEI evaluation 25/26 |
| 4 | +
|
| 5 | +## Overview |
| 6 | + |
| 7 | +Data storage service providing dual-database persistence layer for the NWDAF platform. Consumes processed network data from Kafka and stores it in both time-series (InfluxDB) and analytical (ClickHouse) databases, while exposing REST APIs for data retrieval. |
| 8 | + |
| 9 | +## Technologies |
| 10 | + |
| 11 | +- **Python** 3.13 |
| 12 | +- **FastAPI** - REST API framework |
| 13 | +- **InfluxDB** - Time-series database for metrics |
| 14 | +- **ClickHouse** - Columnar analytical database |
| 15 | +- **Apache Kafka** (confluent_kafka) - Message streaming consumer |
| 16 | +- **Docker & Docker Compose** - Containerization |
| 17 | +- **uvicorn** - ASGI server |
| 18 | +- **pytest** - Testing framework |
| 19 | + |
| 20 | +## Architecture |
| 21 | + |
| 22 | +**Dual Database Strategy**: |
| 23 | +- **InfluxDB**: Optimized for time-series queries, network metrics storage, fast writes |
| 24 | +- **ClickHouse**: Optimized for analytical queries, aggregations, OLAP workloads |
| 25 | + |
| 26 | +## Key Features |
| 27 | + |
| 28 | +- **Kafka consumer**: Subscribes to `network.data.processed` topic |
| 29 | +- **Dual writes**: Simultaneously stores data in InfluxDB and ClickHouse |
| 30 | +- **REST API endpoints**: Query historical network data |
| 31 | + - Cell metadata retrieval |
| 32 | + - Time-range queries |
| 33 | + - Latency data access |
| 34 | + - Batch pagination support |
| 35 | +- **Data models**: Network performance metrics (RSRP, SINR, RSRQ, latency, CQI, datarate) |
| 36 | +- **Integration**: Provides data to ML service for training and processor for metadata |
| 37 | + |
| 38 | +## Quick Start |
| 39 | + |
| 40 | +```bash |
| 41 | +docker-compose up -d |
| 42 | +``` |
| 43 | + |
| 44 | +## Database Connections |
| 45 | + |
| 46 | +- **InfluxDB**: Port 8086 |
| 47 | +- **ClickHouse**: Port 8123 (HTTP), Port 9000 (TCP) |
| 48 | + |
| 49 | +## API Endpoints (Examples) |
| 50 | + |
| 51 | +- `/cells` - List all cells |
| 52 | +- `/cells/{cell_id}` - Get cell metadata |
| 53 | +- `/latency` - Query latency data |
| 54 | +- `/metrics` - Retrieve network metrics |
| 55 | + |
| 56 | +## Data Flow |
| 57 | + |
| 58 | +``` |
| 59 | +Kafka (network.data.processed) → |
| 60 | +Storage Service → |
| 61 | +├── InfluxDB (time-series metrics) |
| 62 | +└── ClickHouse (analytical queries) |
| 63 | +``` |
| 64 | + |
| 65 | +## Use Cases |
| 66 | + |
| 67 | +- Historical network performance analysis |
| 68 | +- Training data for ML models |
| 69 | +- Cell metadata for processor windowing |
| 70 | +- Time-range queries for analytics |
| 71 | +- Real-time metrics dashboards |
| 72 | + |
| 73 | +## Environment Variables |
| 74 | + |
| 75 | +Configure via `.env`: |
| 76 | +- Database connection strings |
| 77 | +- Kafka broker URLs |
| 78 | +- Service ports |
| 79 | +- Retention policies |
| 80 | + |
| 81 | +## Testing |
4 | 82 |
|
5 | | -## To run |
6 | 83 | ```bash |
7 | | -docker-compose up -d |
| 84 | +pytest tests/ |
8 | 85 | ``` |
0 commit comments