Files
hotels/check_audit_records.py
Фёдор 0cf3297290 Проект аудита отелей: основные скрипты и документация
- Краулеры: smart_crawler.py, regional_crawler.py
- Аудит: audit_orel_to_excel.py, audit_chukotka_to_excel.py
- РКН проверка: check_rkn_registry.py, recheck_unclear_rkn.py
- Отчёты: create_orel_horizontal_report.py
- Обработка: process_all_hotels_embeddings.py
- Документация: README.md, DB_SCHEMA_REFERENCE.md
2025-10-16 10:52:09 +03:00

57 lines
2.0 KiB
Python
Raw 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()