Files
crm.clientright.ru/crm_extensions/README_pdf_parser.md
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- Added comprehensive AI Assistant system (aiassist/ directory):
  * Vector search and embedding capabilities
  * Typebot proxy integration
  * Elastic search functionality
  * Message classification and chat history
  * MCP proxy for external integrations

- Implemented Court Status API (GetCourtStatus.php):
  * Real-time court document status checking
  * Integration with external court systems
  * Comprehensive error handling and logging

- Enhanced S3 integration:
  * Improved file backup system with metadata
  * Batch processing capabilities
  * Enhanced error logging and recovery
  * Copy operations with URL fixing

- Added Telegram contact creation API
- Improved error logging across all modules
- Enhanced callback system for AI responses
- Extensive backup file storage with timestamps
- Updated documentation and README files

- File storage improvements:
  * Thousands of backup files with proper metadata
  * Fix operations for broken file references
  * Project-specific backup and recovery systems
  * Comprehensive file integrity checking

Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
2025-10-16 11:17:21 +03:00

3.8 KiB
Raw Permalink Blame History

PDF Парсер судебных документов

Скрипт для извлечения структурированных данных из PDF файлов судебных документов.

Файлы

  • pdf_court_parser.py - основной скрипт для парсинга PDF
  • court_document_parser.py - парсер текста (используется внутри)

Установка зависимостей

# Установка poppler-utils (рекомендуется)
sudo apt-get install poppler-utils

# Установка Python библиотек
pip3 install pdfplumber

Использование

1. Прямой вызов скрипта

# Парсинг PDF файла
python3 pdf_court_parser.py "/path/to/document.pdf"

2. Вызов из n8n через SSH

# Команда для SSH node в n8n:
python3 /var/www/fastuser/data/www/crm.clientright.ru/crm_extensions/pdf_court_parser.py "{{ $json.pdf_path }}"

Формат входных данных

В n8n передайте путь к PDF файлу:

{
  "pdf_path": "/tmp/document.pdf"
}

Формат выходных данных

[
  {
    "case_number": "М-5071/2025",
    "execution_number": null,
    "uid": "50RS0052-01-2025-007323-70",
    "court": "Щелковский городской суд",
    "plaintiff": "Соколов Александр Владимирович",
    "defendant": "ООО СКИЛБОКС",
    "document_type": "ОПРЕДЕЛЕНИЕ",
    "document_date": "26 августа 2025 г.",
    "judge": "Пикулева Т.И.",
    "pdf_file": "/tmp/document.pdf",
    "extracted_text_length": 1234,
    "raw_text": "Извлеченный текст...",
    "extraction_timestamp": "2025-09-30T16:08:33.294637"
  }
]

Извлекаемые поля

  • case_number - номер дела
  • execution_number - номер исполнительного листа
  • uid - уникальный идентификатор (УИД)
  • court - название суда
  • plaintiff - ФИО истца
  • defendant - ФИО/название ответчика
  • document_type - тип документа (ОПРЕДЕЛЕНИЕ, РЕШЕНИЕ, и т.д.)
  • document_date - дата документа
  • judge - ФИО судьи
  • pdf_file - путь к исходному PDF файлу
  • extracted_text_length - длина извлеченного текста

Пример использования в n8n

  1. Загрузите PDF файл в n8n (например, через HTTP Request)
  2. Сохраните файл во временную папку
  3. Создайте SSH node с командой:
    python3 /var/www/fastuser/data/www/crm.clientright.ru/crm_extensions/pdf_court_parser.py "{{ $json.file_path }}"
    
  4. Получите структурированные данные в следующем узле

Поддерживаемые методы извлечения текста

  1. pdftotext (poppler-utils) - основной метод
  2. pdfplumber - резервный метод
  3. PyPDF2 - дополнительный метод

Требования

  • Python 3.6+
  • poppler-utils (рекомендуется)
  • pdfplumber (установлен)
  • Стандартные библиотеки Python

Преимущества PDF парсинга

  • Нет проблем с экранированием кавычек
  • Сохраняется форматирование текста
  • Работает с любыми PDF документами
  • Простая интеграция с n8n
  • Надежное извлечение текста