Files
hotels/test_rkn_fix.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

54 lines
1.5 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
"""
Тестовый скрипт для проверки РКН колонок
"""
import psycopg2
import json
from urllib.parse import unquote
# Конфигурация БД
DB_CONFIG = {
'host': '147.45.189.234',
'port': 5432,
'database': 'hotels_db',
'user': 'gen_user',
'password': unquote('gen_user%40password')
}
def test_rkn_data():
"""Тестируем РКН данные"""
try:
conn = psycopg2.connect(**DB_CONFIG)
cursor = conn.cursor()
# Получаем данные отеля с РКН
cursor.execute("""
SELECT id, full_name, rkn_registry_status, rkn_registry_number, rkn_registry_date
FROM hotel_main
WHERE region_name = 'Чукотский автономный округ'
LIMIT 1
""")
result = cursor.fetchone()
if result:
print(f"Отель: {result[1]}")
print(f"РКН статус: {result[2]}")
print(f"РКН номер: {result[3]}")
print(f"РКН дата: {result[4]}")
# Проверяем логику
rkn_status = result[2]
rkn_in_registry = "ДА" if rkn_status and rkn_status.lower() == 'found' else "НЕТ"
print(f"Результат: {rkn_in_registry}")
cursor.close()
conn.close()
except Exception as e:
print(f"Ошибка: {e}")
if __name__ == "__main__":
test_rkn_data()