Upload 4 files
Browse files
utils/__pycache__/anomaly_detector.cpython-312.pyc
ADDED
|
Binary file (2.22 kB). View file
|
|
|
utils/__pycache__/incident_logger.cpython-312.pyc
ADDED
|
Binary file (3.45 kB). View file
|
|
|
utils/__pycache__/seed_data.cpython-312.pyc
ADDED
|
Binary file (1.61 kB). View file
|
|
|
utils/seed_data.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Seeds the incident log CSV and ChromaDB with sample data for testing.
|
| 3 |
+
Run once: python -m utils.seed_data
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import sys, os
|
| 7 |
+
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
| 8 |
+
|
| 9 |
+
from utils.incident_logger import log_incident
|
| 10 |
+
from rag_module.vector_store import rebuild_from_csv
|
| 11 |
+
|
| 12 |
+
SAMPLE_INCIDENTS = [
|
| 13 |
+
("KA05MN1234", "car", "Gate_A", "normal", ""),
|
| 14 |
+
("MH12AB5678", "truck", "VIP_LOT", "unauthorized", "Heavy vehicle in VIP zone"),
|
| 15 |
+
("KA01XY9999", "car", "Gate_B", "flagged", "Reported stolen vehicle"),
|
| 16 |
+
("DL4CAF0001", "bus", "Gate_A", "normal", ""),
|
| 17 |
+
("TN09CD2222", "car", "COMPACT_ONLY","normal", ""),
|
| 18 |
+
("UNKNOWN", "car", "Gate_C", "flagged", "Plate unreadable"),
|
| 19 |
+
("KA05MN1234", "car", "Gate_A", "anomaly", "Same plate seen 6x in 10 min"),
|
| 20 |
+
("AP28PQ3344", "motorcycle", "Gate_B", "normal", ""),
|
| 21 |
+
("KA01XY9999", "car", "Gate_A", "unauthorized", "Blacklisted vehicle re-entry"),
|
| 22 |
+
("GJ05BK7777", "car", "Gate_A", "normal", ""),
|
| 23 |
+
]
|
| 24 |
+
|
| 25 |
+
print("Seeding incidents...")
|
| 26 |
+
for plate, cls, zone, status, notes in SAMPLE_INCIDENTS:
|
| 27 |
+
row = log_incident(plate, cls, zone, status, notes)
|
| 28 |
+
print(f" Logged: {row['id']} | {plate} | {status}")
|
| 29 |
+
|
| 30 |
+
print("\nRebuilding ChromaDB from CSV...")
|
| 31 |
+
rebuild_from_csv()
|
| 32 |
+
print("Done! You can now query the RAG pipeline.")
|