Files
hotels/check_audit_records.py
Фёдор 684fada337 🚀 Full project sync: Hotels RAG & Audit System
 Major Features:
- Complete RAG system for hotel website analysis
- Hybrid audit with BGE-M3 embeddings + Natasha NER
- Universal horizontal Excel reports with dashboards
- Multi-region processing (SPb, Orel, Chukotka, Kamchatka)

📊 Completed Regions:
- Орловская область: 100% (36/36)
- Чукотский АО: 100% (4/4)
- г. Санкт-Петербург: 93% (893/960)
- Камчатский край: 87% (89/102)

🔧 Infrastructure:
- PostgreSQL with pgvector extension
- BGE-M3 embeddings API
- Browserless for web scraping
- N8N workflows for automation
- S3/Nextcloud file storage

📝 Documentation:
- Complete DB schemas
- API documentation
- Setup guides
- Status reports
2025-10-27 22:49:42 +03:00

58 lines
2.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Тестовый скрипт для проверки записей с v1.0_with_rkn
"""
import psycopg2
from urllib.parse import unquote
# Конфигурация БД
DB_CONFIG = {
'host': '147.45.189.234',
'port': 5432,
'database': 'default_db',
'user': 'gen_user',
'password': unquote('2~~9_%5EkVsU%3F2%5CS')
}
def check_audit_records():
"""Проверяем записи аудита"""
conn = psycopg2.connect(**DB_CONFIG)
cur = conn.cursor()
# Проверяем версии аудита
cur.execute('SELECT audit_version, COUNT(*) FROM hotel_audit_results GROUP BY audit_version')
versions = cur.fetchall()
print('Версии аудита:')
for version, count in versions:
print(f' {version}: {count} записей')
# Проверяем записи с v1.0_with_rkn
cur.execute("SELECT hotel_id, hotel_name, criteria_results FROM hotel_audit_results WHERE audit_version = 'v1.0_with_rkn' LIMIT 1")
row = cur.fetchone()
if row:
hotel_id, hotel_name, criteria = row
print(f'\nОтель с v1.0_with_rkn: {hotel_name}')
print(f'criteria_results type: {type(criteria)}')
print(f'criteria_results length: {len(criteria) if hasattr(criteria, "__len__") else "нет длины"}')
if isinstance(criteria, dict):
print(f'Ключи: {list(criteria.keys())[:5]}')
# Проверяем критерий 2
criterion_02 = criteria.get('criterion_02', {})
print(f'Критерий 2 found: {criterion_02.get("found")}')
print(f'Критерий 2 approval_urls: {criterion_02.get("approval_urls")}')
elif isinstance(criteria, str):
print(f'Строка: {criteria[:100]}...')
else:
print(f'Другое: {criteria}')
else:
print('\nНет записей с v1.0_with_rkn')
cur.close()
conn.close()
if __name__ == "__main__":
check_audit_records()