52 lines
2.1 KiB
Python
52 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Reusable DB cross-reference checker for the exotic vehicle database.
|
|
Usage: Copy to /tmp/check_db.py, edit the `checks` dict, then run:
|
|
python3 /tmp/check_db.py
|
|
|
|
DB path: /root/portal-mockup/vehicles.json
|
|
DB structure: {Make: {Model: {Year: HP, ...}, ...}, ...}
|
|
"""
|
|
import json
|
|
|
|
DB_PATH = "/root/portal-mockup/vehicles.json"
|
|
|
|
v = json.load(open(DB_PATH))
|
|
|
|
# Add vehicles to check here. Format:
|
|
# "Label": ("Make", "Model substring to search for")
|
|
# For new makes, use ("Make", None) — reports whether the make exists at all.
|
|
checks = {
|
|
# --- EXAMPLES (replace with current checks) ---
|
|
# "Ferrari 12Cilindri": ("Ferrari", "12Cilindri"),
|
|
# "Kimera K39": ("Kimera", None),
|
|
# "Lamborghini Urus SE": ("Lamborghini", "Urus SE"),
|
|
}
|
|
|
|
for label, (make, model_hint) in checks.items():
|
|
if make in v:
|
|
if model_hint:
|
|
matches = [m for m in v[make].keys() if model_hint.lower() in m.lower()]
|
|
if matches:
|
|
yrs_2025 = []
|
|
for m in matches:
|
|
yr_list = sorted([int(y) for y in v[make][m].keys() if y.isdigit()])
|
|
recent = [y for y in yr_list if y >= 2025]
|
|
if recent:
|
|
yrs_2025.append((m, recent, {str(y): v[make][m][str(y)] for y in recent}))
|
|
if yrs_2025:
|
|
print(f"{label}: ✅ IN DB (2025+ yrs) - {yrs_2025}")
|
|
else:
|
|
print(f"{label}: ⚠️ IN DB but no 2025+ years - {[(m, sorted(v[make][m].keys())) for m in matches]}")
|
|
else:
|
|
print(f"{label}: ❌ MISSING (make '{make}' exists but model not found)")
|
|
similar = [m for m in v[make].keys() if any(w in m.lower() for w in model_hint.lower().split())]
|
|
if similar:
|
|
print(f" Similar: {similar}")
|
|
else:
|
|
print(f"{label}: ✅ MAKE exists — models: {sorted(v[make].keys())[:15]}")
|
|
else:
|
|
print(f"{label}: ❌ MAKE '{make}' not in DB")
|
|
|
|
print(f"\nDB stats — {len(v)} makes, {sum(len(models) for models in v.values())} models")
|