#!/usr/bin/env python3
"""
Test Custom Data Integration
Quick test to verify the custom data formatting works correctly
"""

import json
from format_custom_data_for_gpt import format_custom_data_for_prompt

# Load a sample property with custom criteria
with open('enriched_data.json', 'r') as f:
    properties = json.load(f)

# Find a property with custom score > 0
sample_property = None
for prop in properties:
    if prop.get('custom_score', 0) > 0:
        sample_property = prop
        break

if not sample_property:
    print("❌ No properties with custom scores found")
    exit(1)

print("=" * 70)
print("TESTING CUSTOM DATA INTEGRATION")
print("=" * 70)
print()

print(f"Property: {sample_property['url']}")
print(f"Custom Score: {sample_property.get('custom_score', 0):.2f}/5.0")
print(f"GPT Score: {sample_property.get('gpt_score', 0):.2f}/5.0")
print()

print("=" * 70)
print("FORMATTED CUSTOM DATA FOR GPT PROMPT:")
print("=" * 70)
print()

formatted = format_custom_data_for_prompt(sample_property)
print(formatted)
print()

print("=" * 70)
print("✅ TEST COMPLETE")
print("=" * 70)
print()
print("The formatted data above will be inserted into the GPT prompt at:")
print("  {custom_criteria_data}")
print()
print("This allows GPT to make informed decisions based on objective data:")
print("  • Rainfall and temperature for market garden assessment")
print("  • Airport distance for guest accommodation scoring")
print("  • Population density for local market evaluation")
