{"id":27455535,"url":"https://github.com/yar0slave/statictics_service","last_synced_at":"2026-05-07T04:37:42.592Z","repository":{"id":287710275,"uuid":"965557052","full_name":"yar0slave/statictics_service","owner":"yar0slave","description":"A FastAPI-based service for collecting, storing, and analyzing statistics from devices. Test task for Gazprom.","archived":false,"fork":false,"pushed_at":"2025-04-13T12:53:22.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T13:37:02.490Z","etag":null,"topics":["alembic","fastapi","locust","postgresql","python","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yar0slave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-13T12:32:14.000Z","updated_at":"2025-04-13T12:53:26.000Z","dependencies_parsed_at":"2025-04-13T13:47:16.057Z","dependency_job_id":null,"html_url":"https://github.com/yar0slave/statictics_service","commit_stats":null,"previous_names":["yar0slave/statictics_service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yar0slave%2Fstatictics_service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yar0slave%2Fstatictics_service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yar0slave%2Fstatictics_service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yar0slave%2Fstatictics_service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yar0slave","download_url":"https://codeload.github.com/yar0slave/statictics_service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249110797,"owners_count":21214403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alembic","fastapi","locust","postgresql","python","sqlalchemy"],"created_at":"2025-04-15T16:43:59.399Z","updated_at":"2025-10-06T13:26:59.746Z","avatar_url":"https://github.com/yar0slave.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Device Statistics Service\n\nA FastAPI-based service for collecting, storing, and analyzing statistics from devices.\n\n## Features\n\n- Device registration and management\n- User management with device associations\n- Collection of device statistics (x, y, z coordinates)\n- Statistical analysis of device data:\n  - Minimum value\n  - Maximum value\n  - Count\n  - Sum\n  - Median\n- Time-based filtering for data analysis\n- User-based aggregation of statistics across multiple devices\n- Containerized deployment with Docker Compose\n- Load testing with Locust\n\n## System Architecture\n\n- **FastAPI**: High-performance web framework for building APIs\n- **PostgreSQL**: Relational database for storing device data and statistics\n- **SQLAlchemy**: ORM for database operations\n- **Docker \u0026 Docker Compose**: Containerization for easy deployment\n- **Locust**: Load testing tool for performance evaluation\n\n## Prerequisites\n\n- Docker and Docker Compose\n\n## Development\n\n### Project Structure\n\n```\ndevice-stats-service/\n│\n├── app/                  # Application code\n│   ├── models/           # Database models\n│   ├── schemas/          # Pydantic schemas\n│   ├── routers/          # API endpoints\n│   └── services/         # Business logic\n├── locust/               # Load testing configuration\n└── alembic/              # Database migrations\n```\n\n\n## Getting Started\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/yar0slave/statictics_service/\ncd statictics_service\n```\n\n2. Start the services using Docker Compose:\n\n```bash\ndocker-compose up -d\n```\n\nThis will start:\n- The FastAPI application on port 8000\n- The PostgreSQL database on port 5432\n- The Locust load testing interface on port 8089\n\n3. Access the API documentation at http://localhost:8000/docs\n\n## API Endpoints\n\n### Users\n\n- `GET /api/v1/users/` - List all users\n- `POST /api/v1/users/` - Create a new user\n- `GET /api/v1/users/{user_id}` - Get user details with associated devices\n- `PUT /api/v1/users/{user_id}` - Update user details\n- `DELETE /api/v1/users/{user_id}` - Delete a user\n\n### Devices\n\n- `GET /api/v1/devices/` - List all devices\n- `POST /api/v1/devices/` - Register a new device\n- `GET /api/v1/devices/{device_id}` - Get device details\n- `PUT /api/v1/devices/{device_id}` - Update device details\n- `DELETE /api/v1/devices/{device_id}` - Delete a device\n\n### Statistics\n\n- `POST /api/v1/stats/devices/{device_id}` - Submit statistics for a device\n- `GET /api/v1/stats/devices/{device_id}` - Get statistics for a device\n- `POST /api/v1/stats/devices/{device_id}/analyze` - Analyze statistics for a device\n- `POST /api/v1/stats/users/{user_id}/analyze` - Analyze statistics for all devices of a user\n\n\n\n## Load Testing\n\nThe service includes a Locust configuration for load testing. Access the Locust web interface at http://localhost:8089 to configure and run load tests.\n\n\n![img.png](img.png)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyar0slave%2Fstatictics_service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyar0slave%2Fstatictics_service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyar0slave%2Fstatictics_service/lists"}