STABLE: Final schema sync, optimized gitignore

This commit is contained in:
Kincses
2026-02-26 08:19:25 +01:00
parent 893f39fa15
commit 505543330a
203 changed files with 11590 additions and 9542 deletions

View File

@@ -1,5 +1,7 @@
# /opt/docker/dev/service_finder/backend/app/services/recon_bot.py
import asyncio
import logging
from datetime import datetime, timezone
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from app.models.asset import Asset, AssetCatalog, AssetTelemetry
@@ -10,42 +12,38 @@ async def run_vehicle_recon(db: AsyncSession, asset_id: str):
"""
VIN alapján megkeresi a mélységi adatokat és frissíti a Digitális Ikert.
"""
# 1. Lekérjük a járművet és a katalógusát
stmt = select(Asset).where(Asset.id == asset_id)
result = await db.execute(stmt)
asset = result.scalar_one_or_none()
asset = (await db.execute(stmt)).scalar_one_or_none()
if not asset or not asset.catalog_id:
return False
logger.info(f"🤖 Robot indul: {asset.vin} felderítése...")
# 2. SZIMULÁLT ADATGYŰJTÉS (Itt hívnánk meg az API-kat: NHTSA, autodna stb.)
await asyncio.sleep(2) # Időigényes keresés szimulálása
# --- LOGIKA MEGŐRIZVE: Szimulált mélységi adatgyűjtés ---
await asyncio.sleep(2)
deep_data = {
"assembly_plant": "Fremont, California",
"drive_unit": "Dual Motor - Raven type",
"onboard_charger": "11 kW",
"supercharging_max": "250 kW",
"safety_rating": "5-star EuroNCAP"
"safety_rating": "5-star EuroNCAP",
"recon_timestamp": datetime.now(timezone.utc).isoformat()
}
# 3. Katalógus frissítése
catalog_stmt = select(AssetCatalog).where(AssetCatalog.id == asset.catalog_id)
catalog = (await db.execute(catalog_stmt)).scalar_one_or_none()
# 3. Katalógus frissítése (MDM elv)
catalog = (await db.execute(select(AssetCatalog).where(AssetCatalog.id == asset.catalog_id))).scalar_one_or_none()
if catalog:
current_data = catalog.factory_data or {}
current_data.update(deep_data)
catalog.factory_data = current_data
# 4. Telemetria frissítése (A robot talált egy visszahívást, VQI csökken kicsit)
telemetry_stmt = select(AssetTelemetry).where(AssetTelemetry.asset_id == asset_id)
telemetry = (await db.execute(telemetry_stmt)).scalar_one_or_none()
# 4. Telemetria frissítése (VQI score csökkentése a logika szerint)
telemetry = (await db.execute(select(AssetTelemetry).where(AssetTelemetry.asset_id == asset.id))).scalar_one_or_none()
if telemetry:
telemetry.vqi_score = 99.2 # Robot frissített állapota
telemetry.vqi_score = 99.2
await db.commit()
logger.info(f"✨ Robot végzett: {asset.license_plate} felokosítva.")
logger.info(f"✨ Robot végzett: {asset.license_plate or asset.vin} felokosítva.")
return True