- 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.
3.8 KiB
3.8 KiB
PDF Парсер судебных документов
Скрипт для извлечения структурированных данных из PDF файлов судебных документов.
Файлы
pdf_court_parser.py- основной скрипт для парсинга PDFcourt_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
- Загрузите PDF файл в n8n (например, через HTTP Request)
- Сохраните файл во временную папку
- Создайте SSH node с командой:
python3 /var/www/fastuser/data/www/crm.clientright.ru/crm_extensions/pdf_court_parser.py "{{ $json.file_path }}" - Получите структурированные данные в следующем узле
Поддерживаемые методы извлечения текста
- pdftotext (poppler-utils) - основной метод
- pdfplumber - резервный метод
- PyPDF2 - дополнительный метод
Требования
- Python 3.6+
- poppler-utils (рекомендуется)
- pdfplumber (установлен)
- Стандартные библиотеки Python
Преимущества PDF парсинга
- ✅ Нет проблем с экранированием кавычек
- ✅ Сохраняется форматирование текста
- ✅ Работает с любыми PDF документами
- ✅ Простая интеграция с n8n
- ✅ Надежное извлечение текста