import { Entity, Column, PrimaryGeneratedColumn, Index, CreateDateColumn } from 'typeorm'; /** * Candidate Road Entity - طرق مرشحة مكتشفة من بيانات التتبع * * Stores potential new roads discovered from telemetry data where * multiple drivers traveled off-road in a consistent linear pattern. */ @Entity('candidate_roads') export class CandidateRoad { @PrimaryGeneratedColumn('uuid') id: string; // GeoJSON LineString representing the discovered road path // خط يمثل المسار المكتشف @Column({ type: 'geography', spatialFeatureType: 'LineString', srid: 4326, nullable: false, }) @Index({ spatial: true }) geometry: any; // Number of unique drivers who used this path // عدد السائقين الفريدين الذين استخدموا هذا المسار @Column('int', { default: 0 }) uniqueDriverCount: number; // Total telemetry points that contributed to this candidate // عدد النقاط الإجمالي المساهم في اكتشاف هذا المسار @Column('int', { default: 0 }) totalPoints: number; // Average speed observed on this candidate road (km/h) // متوسط السرعة المسجلة (كم/ساعة) @Column('float', { default: 0 }) averageSpeed: number; // Estimated length in meters // الطول التقريبي بالمتر @Column('float', { default: 0 }) lengthMeters: number; // Confidence score (0-1): higher = more likely a real road // درجة الثقة (0-1): كلما زادت كلما كان احتمال كونها طريق حقيقي أعلى @Column('float', { default: 0 }) confidence: number; // Review status: 'pending', 'approved', 'rejected' // حالة المراجعة: pending=بانتظار المراجعة، approved=تمت الموافقة، rejected=مرفوض @Column({ default: 'pending' }) status: string; // Where this candidate came from: 'telemetry' (driver traces) or 'overture' (map diff) // مصدر الاقتراح: من تتبع السائقين أو من مقارنة بيانات Overture @Column({ default: 'telemetry' }) source: string; // Road name, when known (Overture provides these; telemetry candidates are unnamed) // اسم الطريق إن وُجد (يأتي من Overture) @Column({ type: 'varchar', length: 255, nullable: true }) name: string; // OSM highway class carried from Overture, applied on approval // تصنيف الطريق المنقول من Overture ويُطبَّق عند الموافقة @Column({ type: 'varchar', length: 32, nullable: true }) highway: string; @CreateDateColumn() discoveredAt: Date; @Column({ type: 'timestamp', nullable: true }) reviewedAt: Date; }