https://github.com/databek-uz/ai_hackathon_uz
Buxoro viloyati ai-hackathon.
https://github.com/databek-uz/ai_hackathon_uz
ai-hackathon hackathon python
Last synced: 2 months ago
JSON representation
Buxoro viloyati ai-hackathon.
- Host: GitHub
- URL: https://github.com/databek-uz/ai_hackathon_uz
- Owner: databek-uz
- Created: 2026-04-10T07:35:31.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-10T08:14:10.000Z (3 months ago)
- Last Synced: 2026-04-10T09:37:21.056Z (3 months ago)
- Topics: ai-hackathon, hackathon, python
- Homepage: https://databek.uz
- Size: 889 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚀 Databek — AI-Powered ETL Platform
Ma'lumotlaringizni AI yordamida avtomatik tahlil qiling va bazaga yuklang
Databek — Excel va CSV fayllarni AI yordamida avtomatik qayta ishlovchi ETL platforma. Gemini AI orqali config va parser generatsiya qiladi, ma'lumotlarni PostgreSQL ga yuklaydi va natural language (o'zbek/rus/ingliz) da savollar berib tahlil qilish imkonini beradi.
---
## 📋 Texnologiyalar
| Tarkib | Texnologiya |
|--------|------------|
| **Backend** | FastAPI (Python 3.12) |
| **Frontend** | Next.js 16 + TypeScript + Tailwind CSS |
| **Database** | PostgreSQL 16 |
| **Storage** | MinIO (S3 compatible) |
| **AI Engine** | Google Gemini 2.5 Flash (Text-to-SQL, Config/Parser generation) |
| **Charts** | Recharts (10+ chart types) |
| **Infra** | Docker + Docker Compose |
---
## ⚡ Tez boshlash (Quick Start)
### 1. Repositoryni klonlash
```bash
git clone https://github.com/databek-uz/ai_hackathon_uz.git
cd ai_hackathon_uz
```
### 2. `.env` faylini sozlash
```env
# Database (PostgreSQL)
DATABASE_SERVER=localhost
DATABASE_NAME=Databek
DATABASE_USER=postgres
DATABASE_PASSWORD=postgres
DB_PORT=5432
# MinIO (S3-compatible storage)
MINIO_HOST=localhost
MINIO_PORT=9000
MINIO_ROOT_USER=admin
MINIO_ROOT_PASSWORD=admin123
STORAGE_CONTAINER_NAME=databek-dev
# Google Gemini API
GOOGLE_API_KEY=your_gemini_api_key_here
# AI Chat
CHAT_HISTORY_LIMIT=5
GEMINI_MAX_STEPS=25
# Logging
LOG_LEVEL=INFO
```
> ⚠️ `GOOGLE_API_KEY` ni [Google AI Studio](https://aistudio.google.com/app/apikey) dan oling.
### 3. Docker Compose bilan ishga tushirish
```bash
docker compose -f infra/docker-compose.yml --env-file .env up -d
```
### 4. DB schemani yaratish
```bash
docker exec -i ai_postgres psql -U postgres -d Databek < core/config/create_tables.sql
```
### 5. Backend ishga tushirish
```bash
pip install -r backend/requirements.txt
uvicorn backend.main:app --host 0.0.0.0 --port 8000 --reload
```
Backend: http://localhost:8000 | API docs: http://localhost:8000/docs
### 6. Frontend ishga tushirish
```bash
cd frontend
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local
npm install
npm run dev
```
Frontend: http://localhost:3000
---
## 🏗️ Loyiha tuzilishi
```
ai_hackathon_uz/
├── backend/ # FastAPI backend
│ ├── main.py # App entry point
│ ├── routes/
│ │ ├── auth.py # Simple auth (demo registration)
│ │ ├── sources.py # Manbalar CRUD + fayl yuklash
│ │ ├── pipelines.py # Pipeline CRUD, config/parser, run
│ │ ├── chat.py # AI Chat + sessiya boshqaruvi
│ │ └── dashboard.py # Statistika va tarix
│ └── schemas.py # Pydantic modellari
│
├── core/ # Asosiy ETL va AI modullari
│ ├── analyst/ # AI Analyst (Text-to-SQL)
│ │ ├── engine.py # Gemini tool-calling engine
│ │ ├── tools.py # SQL toollar (getTables, getSchema, getData)
│ │ └── history.py # Chat tarixi (DB persistence)
│ ├── generators/ # AI Code Generation
│ │ ├── config_generator.py # YAML config yaratish
│ │ └── code_generator.py # Python parser yaratish
│ ├── executor/
│ │ └── runner.py # Parser ishga tushirish
│ ├── utils/
│ │ ├── sql.py # PostgreSQL helper (sync + async)
│ │ ├── data_reader.py # MinIO → fayl o'qish
│ │ ├── data_writer.py # DataFrame → PostgreSQL yozish
│ │ └── logger.py # Logging
│ ├── config/
│ │ ├── settings.py # Environment sozlamalari
│ │ ├── database.py # DB connection
│ │ └── create_tables.sql# DB schema (8 table)
│ └── prompts/ # AI promptlar
│
├── frontend/ # Next.js frontend
│ └── src/
│ ├── app/
│ │ ├── page.tsx # Landing page
│ │ └── dashboard/ # Dashboard sahifalari
│ │ ├── layout.tsx # Auth guard + sidebar
│ │ ├── page.tsx # Umumiy statistika
│ │ ├── pipelines/ # Unified Pipeline Manager
│ │ ├── history/ # Run tarixi
│ │ └── chat/ # AI Chat
│ ├── components/ # Shared UI komponentlari
│ └── lib/api.ts # Backend API client
│
├── infra/ # Docker infra
│ ├── docker-compose.yml
│ ├── Dockerfile.backend
│ └── Dockerfile.frontend
│
├── document/ # Hujjatlar
│ ├── ARCHITECTURE.md
│ ├── CORE_DESIGN.md
│ ├── RULES.md
│ └── TASKS.md
│
├── .env # Environment o'zgaruvchilari
└── README.md
```
---
## 🎯 Asosiy imkoniyatlar
### 📤 Unified Pipeline Manager (ADF-style)
- **5-bosqichli Wizard:** Manba tanlash → Fayl yuklash → AI Config → AI Parser → Auto-Run
- Drag-and-drop fayl yuklash (CSV, Excel)
- Insert mode: **Append**, **Replace**, **Upsert** (kalit ustunlar bilan)
- Target table uniqueness tekshiruvi
- Pipeline card-larda: **Run**, **Tarix**, **Config/Parser edit**, **Delete**
### 🤖 AI Pipeline
- Gemini AI orqali **config.yaml** avtomatik yaratish
- **parser.py** kodi AI tomonidan generatsiya qilinadi
- **WizardLoader** — rotating AI messages bilan chiroyli loading
- Config/Parser ni UI dan **syntax-highlighted editor** bilan tahrirlash
- Parser regeneratsiya qilish imkoniyati
### 💬 AI Chat (Text-to-SQL)
- O'zbek, rus, ingliz tillarida savol berish
- AI bazadan ma'lumot olib javob beradi
- **10+ chart turi:** Bar, Line, Area, Pie, Donut, Radar, Scatter, Treemap, Funnel, Heatmap
- Markdown render (jadvallar, ro'yxatlar, kod)
- Multi-sessiya chat tarixi
- WizardLoader uslubidagi thinking animatsiya
### 📊 Dashboard
- 8 ta statistika karta
- Muvaffaqiyat darajasi bar
- So'nggi runlar tarixi
- AI Generatsiya tarixi
### 🔐 Simple Auth
- Hackathon demo uchun oddiy ro'yxatdan o'tish formasi
- Ism, familya, telefon, email
- 48 soat amal qiladigan session token (localStorage)
- Sidebar da user info va logout
---
## 🔌 API Endpoints
### Auth
| Method | Endpoint | Tavsif |
|--------|----------|--------|
| `POST` | `/api/auth/register` | Demo ro'yxatdan o'tish |
| `GET` | `/api/auth/me?token=...` | Session tekshirish |
### Sources & Pipelines
| Method | Endpoint | Tavsif |
|--------|----------|--------|
| `POST` | `/api/sources/upload` | Yangi manba yuklash |
| `GET` | `/api/pipelines` | Pipeline-lar ro'yxati |
| `POST` | `/api/pipelines/{id}/generate` | AI config+parser yaratish |
| `POST` | `/api/pipelines/{id}/run` | Pipeline ishga tushirish |
| `GET` | `/api/pipelines/{id}/config` | Config o'qish |
| `PUT` | `/api/pipelines/{id}/config` | Config saqlash |
| `GET` | `/api/pipelines/{id}/parser` | Parser o'qish |
| `PUT` | `/api/pipelines/{id}/parser` | Parser saqlash |
| `POST` | `/api/pipelines/{id}/regenerate-parser` | Parser qayta yaratish |
| `POST` | `/api/pipelines/{id}/run-with-file` | Yangi fayl bilan run |
| `GET` | `/api/pipelines/{id}/runs` | Run tarixi |
| `GET` | `/api/pipelines/{id}/files` | MinIO fayllar |
| `DELETE` | `/api/pipelines/{id}/drop-table` | Target table o'chirish |
| `GET` | `/api/pipelines/check-table` | Table uniqueness |
### Chat & Dashboard
| Method | Endpoint | Tavsif |
|--------|----------|--------|
| `POST` | `/api/chat` | AI Chat savol yuborish |
| `GET` | `/api/chat/sessions` | Suhbatlar ro'yxati |
| `GET` | `/api/chat/sessions/{id}/messages` | Suhbat xabarlari |
| `GET` | `/api/dashboard/stats` | Statistika |
| `GET` | `/api/dashboard/recent-runs` | So'nggi runlar |
To'liq API hujjatlari: http://localhost:8000/docs
---
## 🗄️ Database Schema
| Table | Schema | Tavsif |
|-------|--------|--------|
| `file_registry` | config | Manbalar va pipeline sozlamalari |
| `processing_log` | config | Run jurnali |
| `build_history` | config | AI generatsiya tarixi |
| `query_log` | config | Text-to-SQL logi |
| `analyst_chat` | config | Chat xabarlari |
| `chat_sessions` | config | Chat sessiyalari |
| `demo_users` | config | Demo foydalanuvchilar (auth) |
---
## 🛠️ Rivojlantirish
### Backend development
```bash
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
```
### Frontend development
```bash
cd frontend
npm run dev
```
### Ma'lumotlar bazasiga kirish
```bash
docker exec -it ai_postgres psql -U postgres -d Databek
```
### MinIO admin panel
http://localhost:9001 (login: admin / admin123)
---
## 📝 Litsenziya
MIT License
---
Databek — AI bilan ma'lumotlarni boshqaring 🚀