AI Assistant aed2a86ba8 fix: Fix claim_id and unified_id display in confirmation form
Problem:
- Claim ID and Unified ID showing as 'не указан' in confirmation form
- transformDraftToClaimPlanFormat was returning array instead of object
- StepClaimConfirmation was not correctly extracting IDs from claimPlanData

Solution:
1. Changed transformDraftToClaimPlanFormat return type:
   - Changed from array [{ propertyName, ... }] to object { propertyName, ... }
   - This matches what StepClaimConfirmation expects

2. Enhanced ID extraction in StepClaimConfirmation:
   - Added explicit claimId and unifiedId variables
   - Better fallback chain: claimPlanData.claim_id -> propertyName.meta.claim_id
   - Same for unified_id

3. Added comprehensive logging:
   - Log claimPlanData structure on component mount
   - Log extracted IDs before form generation
   - Log transformDraftToClaimPlanFormat input/output
   - Log claim.unified_id from API response

4. Improved data flow:
   - claim.unified_id from API -> transformDraftToClaimPlanFormat -> StepClaimConfirmation
   - Fallback to currentFormData.unified_id if claim.unified_id missing

Files:
- frontend/src/pages/ClaimForm.tsx: Changed return type, added logging
- frontend/src/components/form/StepClaimConfirmation.tsx: Enhanced ID extraction, added logging
2025-11-24 15:16:46 +03:00

🚀 Ticket Form Intake Platform

Платформа цифровой приёмки обращений для other.clientright.ru

  • Backend: Python FastAPI (async)
  • Frontend: React 18 + TypeScript
  • Database: PostgreSQL + MySQL + Redis
  • Queue: RabbitMQ
  • Storage: S3 Timeweb Cloud

🎯 Быстрый старт

📍 Визуальный доступ:

После запуска доступны по адресам:

Frontend (форма):
http://147.45.146.17:5175/

Backend API:
http://147.45.146.17:8200/

API Документация (Swagger UI):
http://147.45.146.17:8200/docs  ← Интерактивная!

Gitea (Git репозиторий):
http://147.45.146.17:3002/

🔧 Установка и запуск

Backend (FastAPI):

cd backend

# Создаём виртуальное окружение
python3 -m venv venv
source venv/bin/activate

# Устанавливаем зависимости
pip install -r requirements.txt

# Запускаем сервер
uvicorn app.main:app --reload --host 0.0.0.0 --port 8200

Frontend (React):

cd frontend

# Устанавливаем зависимости
npm install

# Запускаем dev сервер
npm run dev -- --host 0.0.0.0 --port 5175

📊 Архитектура

Поток данных:

React (5175) → FastAPI (8200) → [Redis, RabbitMQ, PostgreSQL]
                              ↓
                        OCR Service (8001)
                        OpenRouter AI
                        FlightAware API
                              ↓
                        PHP Bridge → Vtiger CRM

Что НЕ трогаем:

CRM Vtiger (работает как работала)
MySQL полисы (только READ)
Существующий PHP код


🗄️ Базы данных

База Назначение Хост
PostgreSQL Логи, метрики, новые данные 147.45.189.234:5432
MySQL Проверка полисов (READ) localhost:3306
Redis Кеш, Rate Limiting localhost:6379

📁 Структура проекта

ticket_form/
├─ backend/        ← Python FastAPI
│   ├─ app/
│   │   ├─ main.py
│   │   ├─ api/
│   │   ├─ services/
│   │   └─ models/
│   └─ requirements.txt
│
├─ frontend/       ← React TypeScript
│   ├─ src/
│   │   ├─ components/
│   │   ├─ pages/
│   │   └─ api/
│   └─ package.json
│
└─ .env           ← Конфигурация

🔌 API Endpoints

Документы:

  • POST /api/v1/documents/upload - Загрузка в S3
  • POST /api/v1/documents/scan - OCR + Vision

Рейсы:

  • GET /api/v1/flights/check - Проверка статуса

Обращения:

  • POST /api/v1/claims/submit - Создание обращения

Полисы:

  • GET /api/v1/policies/verify - Проверка полиса

🐛 Отладка

Логи:

# FastAPI
tail -f backend/logs/app.log

# PostgreSQL логи
SELECT * FROM logs ORDER BY created_at DESC LIMIT 50;

📝 Git

# Репозиторий
http://147.45.146.17:3002/negodiy/erv-platform

# Клонирование
git clone http://147.45.146.17:3002/negodiy/erv-platform.git

# Push изменений
git add .
git commit -m "Your message"
git push origin main

Автор: AI Assistant + Фёдор
Дата: 24.10.2025

Description
AI Form - Production версия формы заявки с автоматическим мониторингом n8n workflow
Readme 2 MiB
Languages
TypeScript 57.4%
Python 37%
Shell 1.9%
CSS 1.6%
PLpgSQL 1%
Other 0.9%