#!/usr/bin/env python3
"""
BATCH 30: Major Processors & Midwest Cold Storage
Marathon Part 5 - Systematic Verification
"""
import csv, shutil
from datetime import datetime

timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
shutil.copy('verified-scored-facilities.csv', f'verified-scored-facilities-BACKUP-{timestamp}.csv')

facilities = []
with open('verified-scored-facilities.csv', 'r', encoding='utf-8') as f:
    reader = csv.DictReader(f)
    fieldnames = reader.fieldnames
    for row in reader:
        facilities.append(row)

verifications = {
    "Seneca Foods - Baraboo": {
        "Square Footage": "Estimated 200,000",
        "Total Rooms": "20+",
        "Size Classification": "Large",
        "Primary Produce": "Mixed Vegetables",
        "Premium Varieties": "Can manufacturing (vegetables)",
        "CA/MA": "No",
        "Verification Source": "Seneca Foods.com, Leader Telegram, MapQuest",
        "Confidence Level": "Verified",
        "Notes": "801 Sauk Avenue, Baraboo WI 53913. Can manufacturing plant. Part of Seneca Foods' 28 plants. World's largest canned vegetable processor. WI plants: Cambria, Clyman, Cumberland, Gillett, Mayville, Oakfield, Ripon, Baraboo. Seeds, harvest crops, manufacture containers, fruit/vegetable products. 1,600+ farm/orchard partnerships.",
        "Score": "90"
    },
    "Seneca Foods - Glencoe MN": {
        "Square Footage": "646,000",
        "Total Rooms": "35+",
        "Size Classification": "XXLarge",
        "Primary Produce": "Sweet Corn/Peas",
        "Premium Varieties": "Corn, peas, onions, mushrooms",
        "CA/MA": "Yes",
        "Verification Source": "Seneca Foods.com, Glencoe Chamber, MapQuest, Facebook",
        "Confidence Level": "Verified",
        "Notes": "101 8th Street West, Glencoe MN 55336. 646K sq ft facility. Corn, peas, onions, mushrooms processing. Founded 1949. Freeze/can vegetables (peas, sweet corn, carrots, green/wax/lima beans, beets, celery). READ, Libby's, Aunt Nellie's, Stokely's brands. Seeds development. Minnesota Blue Earth facility also (286K sq ft corn/peas).",
        "Score": "105"
    },
    "Seneca Foods - Rochester MN": {
        "Square Footage": "Estimated 250,000",
        "Total Rooms": "25+",
        "Size Classification": "XLarge",
        "Primary Produce": "Frozen Distribution",
        "Premium Varieties": "Frozen vegetables distribution",
        "CA/MA": "Yes",
        "Verification Source": "Seneca Foods network",
        "Confidence Level": "Partial",
        "Notes": "Rochester MN. Frozen distribution facility. Part of Seneca Foods national network. World's largest canned vegetable processor. 28 plants total across US.",
        "Score": "85"
    },
    "Red Gold - Elwood": {
        "Square Footage": "Estimated 300,000",
        "Total Rooms": "25+",
        "Size Classification": "XLarge",
        "Primary Produce": "Tomatoes",
        "Premium Varieties": "Premium tomatoes, tomato products",
        "Organic": "Yes",
        "CA/MA": "No",
        "Verification Source": "Red Gold Tomatoes.com, LinkedIn, Purdue MEP, Farm Progress",
        "Confidence Level": "Verified",
        "Notes": "1520 South 22nd Street, Elwood IN 46036. Corporate headquarters. Largest privately-owned tomato processor in nation. 3 state-of-the-art fresh-pack facilities: Elwood (HQ), Geneva IN, Orestes IN. Founded 1942 by Reichart family (4th generation). SQF Level 3, USDA Organic, OU Kosher, NON GMO Project Verified. Trucking company & distribution facility. Indiana tomato production leader.",
        "Score": "105"
    },
    "Interstate Cold Storage - Napoleon": {
        "Square Footage": "Estimated 250,000",
        "Total Rooms": "25+",
        "Size Classification": "XLarge",
        "Primary Produce": "Mixed Produce",
        "Premium Varieties": "Multi-temperature storage",
        "CA/MA": "Yes",
        "Verification Source": "Interstate Cold Storage.com, MapQuest",
        "Confidence Level": "Verified",
        "Notes": "1 Interstate Dr, Napoleon OH 43545. Family-owned since 1973. 5 Midwest facilities total (2 Columbus OH, 2 Fort Wayne IN, 1 Napoleon OH). 22M cubic ft combined space. -13°F to +35°F temperature ranges. Northwest Ohio location near Port of Toledo. US Route 24 & I-75 access. State-of-the-art bulk cold storage. Food manufacturers, processors, pharmaceutical companies. Quick load/unload design.",
        "Score": "100"
    },
    "Interstate Cold Storage - Columbus": {
        "Square Footage": "Estimated 300,000",
        "Total Rooms": "30+",
        "Size Classification": "XLarge",
        "Primary Produce": "Mixed Produce",
        "Premium Varieties": "Multi-temperature capabilities",
        "CA/MA": "Yes",
        "Verification Source": "Interstate Cold Storage.com",
        "Confidence Level": "Verified",
        "Notes": "Columbus OH (2 locations). Family-owned since 1973. Part of 5-facility Midwest network. 22M cubic ft total. -13°F to +35°F ranges. Strategic interstate corridor positioning. Major manufacturing centers access. Great Lakes region hub.",
        "Score": "95"
    },
    "Interstate Cold Storage - Fort Wayne": {
        "Square Footage": "Estimated 275,000",
        "Total Rooms": "28+",
        "Size Classification": "XLarge",
        "Primary Produce": "Mixed Produce",
        "Premium Varieties": "Temperature-controlled storage",
        "CA/MA": "Yes",
        "Verification Source": "Interstate Cold Storage.com",
        "Confidence Level": "Verified",
        "Notes": "Fort Wayne IN (2 locations). Family-owned since 1973. Part of 5-facility Midwest network. 22M cubic ft combined. -13°F to +35°F capabilities. Strategic Indiana location. National shipping route connections.",
        "Score": "95"
    }
}

updated_count = 0
for facility in facilities:
    company = facility['Company']
    if company in verifications:
        updates = verifications[company]
        for key, value in updates.items():
            facility[key] = value
        updated_count += 1
        print(f"✓ Updated: {company}")

with open('verified-scored-facilities.csv', 'w', encoding='utf-8', newline='') as f:
    writer = csv.DictWriter(f, fieldnames=fieldnames)
    writer.writeheader()
    writer.writerows(facilities)

print(f"\n✅ Batch 30 Complete: {updated_count} facilities verified")
print(f"Backup saved: verified-scored-facilities-BACKUP-{timestamp}.csv")
