No description
Find a file
mezhennikov 82002dbd6a feat(receipt-scanner): optimize image processing and enhance contour detection
- Reduced maximum image size from 640 to 480 for better performance.
- Improved contour detection scoring by adding elongation preference for receipts.
- Decreased padding calculations for edge detection methods to enhance accuracy.
- Updated documentation to reflect changes in OpenCV initialization settings.

feat(ocr-service): refine language settings for OCR engines

- Changed default language setting from "ru|latin" to "ru" in OCREngine and PaddleOcrProvider.
- Updated OCR provider language retrieval to align with new defaults.

docs: update scan tuning knobs documentation

- Corrected OpenCV initialization setting in documentation from false to true.

docs: add scan optimization plan

- Created a comprehensive plan for improving the receipt scanning flow, focusing on responsiveness, stability, and user experience.

test(scan-session): add tests for segment replacement logic

- Implemented tests to ensure that existing segments are replaced correctly when a new segment is uploaded for the same index.

feat(scanner-crop-review): implement crop review modal for scanned images

- Developed a new component for reviewing and adjusting the crop of scanned images before final submission.

docs: create UI/UX debug plan for receipt scanner

- Drafted a detailed plan for debugging and improving the UI/UX of the receipt scanner, outlining key performance indicators and testing strategies.
2026-03-06 23:47:51 +03:00
.gigaide fix branch 2026-01-28 01:30:55 +03:00
.idea fix branch 2026-01-28 01:30:55 +03:00
app feat(receipt-scanner): optimize image processing and enhance contour detection 2026-03-06 23:47:51 +03:00
docs feat(receipt-scanner): optimize image processing and enhance contour detection 2026-03-06 23:47:51 +03:00
infra/docker feat: stabilize receipt scanning flow, polish UI, enable GD in backend Docker, and update docs 2026-02-17 00:26:45 +03:00
storage Update manual receipt defaults, UI styling, and docs 2026-01-27 00:58:55 +03:00
.gitignore updated receipt scanner 2026-01-30 12:45:33 +03:00
justfile Receipt scanning improvements 2026-02-22 01:43:48 +03:00
package-lock.json updated receipt scanner 2026-01-30 12:45:33 +03:00
README.md docs: add link to tasks directory for ongoing sessions 2026-01-24 04:59:37 +03:00
SCAN_OPTIMIZE.md feat(receipt-scanner): optimize image processing and enhance contour detection 2026-03-06 23:47:51 +03:00

ЧекАпп — монорепозиторий

Это скелет проекта для сервиса анализа чеков.

Структура

  • app/backend — Laravel 12 API (Sanctum; PostgreSQL по умолчанию, Redis — позже)
  • app/frontend — Ionic Vue app (Vite + Vue 3) + Capacitor (Android)
  • app/ocr-service — Python-сервис с PaddleOCR
  • infra/docker — Docker Compose, конфиги nginx, MinIO и т.д.
  • storage — файлы чеков и датасеты (не коммитить в git)
  • docs — документация (архитектура, roadmap, заметки)
  • .github/workflows — CI/CD пайплайны

Дальше ты наполняешь эти директории реальным кодом (Laravel, Vue + Ionic, Python).

Документация (docs/)

Требования и установка (Ubuntu Server)

Минимум для запуска через Docker:

  • Ubuntu Server 22.04/24.04 LTS
  • Docker Engine + Docker Compose plugin
  • just (task runner)
  • git, curl, unzip, ca-certificates

Быстрая установка минимального набора:

sudo apt update
sudo apt install -y git curl unzip ca-certificates docker.io docker-compose-plugin just
sudo usermod -aG docker $USER

Если запускаешь без Docker (локально на сервере), дополнительно нужно:

  • PHP 8.2+ и расширения: mbstring, xml, curl, zip, pgsql, sqlite3, bcmath, intl
  • Composer 2.x
  • PostgreSQL 14+ и Redis 6+ (или их контейнеры)
  • Node.js 18+ и npm (для фронтенда)

OCR-сервис по умолчанию запускается в Docker и не требует Python на хосте.

Запуск (рекомендации)

Инфраструктура через Docker

Поднимает PostgreSQL/Redis/MinIO/nginx/OCR:

just up

Полезные порты (Docker Compose): 20000 (frontend placeholder), 20001 (PostgreSQL), 20003 (Redis), 20004 (MinIO S3), 20005 (MinIO console), 20006 (nginx), 20007 (OCR).

Backend (Laravel) локально

Минимальный запуск с PostgreSQL (по умолчанию в .env.example):

cd app/backend
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
php artisan serve --host=0.0.0.0 --port=8000

Альтернатива: just backend-dev.

Если нужен быстрый локальный запуск без Postgres, можно временно переключиться на SQLite: DB_CONNECTION=sqlite и DB_DATABASE=database/database.sqlite.

Для фоновых задач (OCR job-заглушка) нужен воркер очереди:

cd app/backend
php artisan queue:listen --tries=1

Для получения Bearer-токена нужен пользователь в БД (можно создать через tinker):

cd app/backend
php artisan tinker
>>> \App\Models\User::factory()->create(['email' => 'demo@example.com', 'password' => bcrypt('secret')]);

Далее получить токен:

curl -X POST http://localhost:8000/api/auth/token \
  -H "Content-Type: application/json" \
  -d '{"email":"demo@example.com","password":"secret","device_name":"local"}'

Загрузка чека (multipart) и проверка статуса:

curl -X POST http://localhost:8000/api/receipt-imports \
  -H "Authorization: Bearer <token>" \
  -F "file=@/path/to/receipt.jpg"

curl -X GET http://localhost:8000/api/receipt-imports/<id> \
  -H "Authorization: Bearer <token>"

Postman

Коллекция запросов лежит в docs/postman/checkapp.postman_collection.json. Базовый адрес в коллекции по умолчанию: http://localhost:20006 (Docker Compose + nginx). Для локального backend замени переменную baseUrl на http://localhost:8000.

Frontend (Ionic Vue) локально

cd app/frontend
npm install
npm run dev

Альтернатива: just frontend-dev (нужен @ionic/cli, можно через npx ionic serve).

Адреса:

  • UI dev-сервер: http://localhost:8100
  • Hot reload (Vite HMR): ws://localhost:8100
  • API (локальный backend через php artisan serve): http://localhost:8000/api
  • API (Docker Compose + nginx): http://localhost:20006/api

Frontend build через just

just build-frontend

Билд сохраняется в app/frontend/dist. При запущенном nginx из Docker Compose: http://localhost:20006.

OCR (ручной запуск)

just ocr-run sample.png

Файл должен лежать в storage/receipts.

OCR-сервис

  • Зависимости и PaddleOCR упакованы в app/ocr-service/Dockerfile. При запуске just up Docker Compose соберет образ ocr-service, так что Python-виртуальное окружение на хосте не требуется.
  • Хранилище чеков примонтировано в контейнер в /data/receipts, поэтому любая загруженная картинка становится доступна для обработки.
  • Для ручного теста можно выполнить docker compose -f infra/docker/docker-compose.yml run --rm ocr-service python main.py --image /data/receipts/sample.png (подставь нужный путь к файлу).