Chore: rename api->camera-management-api and web->management-dashboard-web-app; update compose, ignore, README references

This commit is contained in:
Alireza Vaezi
2025-08-07 22:07:25 -04:00
parent 28dab3a366
commit fc2da16728
281 changed files with 19 additions and 19 deletions

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""
Time verification script for USDA Vision Camera System
Checks if system time is properly synchronized
"""
import datetime
import pytz
import requests
import json
def check_system_time():
"""Check system time against multiple sources"""
print("🕐 USDA Vision Camera System - Time Verification")
print("=" * 50)
# Get local time
local_time = datetime.datetime.now()
utc_time = datetime.datetime.utcnow()
# Get Atlanta timezone
atlanta_tz = pytz.timezone('America/New_York')
atlanta_time = datetime.datetime.now(atlanta_tz)
print(f"Local system time: {local_time}")
print(f"UTC time: {utc_time}")
print(f"Atlanta time: {atlanta_time}")
print(f"Timezone: {atlanta_time.tzname()}")
# Check against multiple time APIs for reliability
time_apis = [
{
"name": "WorldTimeAPI",
"url": "http://worldtimeapi.org/api/timezone/America/New_York",
"parser": lambda data: datetime.datetime.fromisoformat(data['datetime'].replace('Z', '+00:00'))
},
{
"name": "WorldClockAPI",
"url": "http://worldclockapi.com/api/json/est/now",
"parser": lambda data: datetime.datetime.fromisoformat(data['currentDateTime'])
}
]
for api in time_apis:
try:
print(f"\n🌐 Checking against {api['name']}...")
response = requests.get(api['url'], timeout=5)
if response.status_code == 200:
data = response.json()
api_time = api['parser'](data)
# Compare times (allow 5 second difference)
time_diff = abs((atlanta_time.replace(tzinfo=None) - api_time.replace(tzinfo=None)).total_seconds())
print(f"API time: {api_time}")
print(f"Time difference: {time_diff:.2f} seconds")
if time_diff < 5:
print("✅ Time is synchronized (within 5 seconds)")
return True
else:
print("❌ Time is NOT synchronized (difference > 5 seconds)")
return False
else:
print(f"⚠️ {api['name']} returned status {response.status_code}")
continue
except Exception as e:
print(f"⚠️ Error checking {api['name']}: {e}")
continue
print("⚠️ Could not reach any time API services")
print("⚠️ This may be due to network connectivity issues")
print("⚠️ System will continue but time synchronization cannot be verified")
return None
if __name__ == "__main__":
check_system_time()

View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Test timezone functionality for the USDA Vision Camera System.
"""
import sys
import os
# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from usda_vision_system.core.timezone_utils import (
now_atlanta, format_atlanta_timestamp, format_filename_timestamp,
check_time_sync, log_time_info
)
import logging
def test_timezone_functions():
"""Test timezone utility functions"""
print("🕐 Testing USDA Vision Camera System Timezone Functions")
print("=" * 60)
# Test current time functions
atlanta_time = now_atlanta()
print(f"Current Atlanta time: {atlanta_time}")
print(f"Timezone: {atlanta_time.tzname()}")
print(f"UTC offset: {atlanta_time.strftime('%z')}")
# Test timestamp formatting
timestamp_str = format_atlanta_timestamp()
filename_str = format_filename_timestamp()
print(f"\nTimestamp formats:")
print(f" Display format: {timestamp_str}")
print(f" Filename format: {filename_str}")
# Test time sync
print(f"\n🔄 Testing time synchronization...")
sync_info = check_time_sync()
print(f"Sync status: {sync_info['sync_status']}")
if sync_info.get('time_diff_seconds') is not None:
print(f"Time difference: {sync_info['time_diff_seconds']:.2f} seconds")
# Test logging
print(f"\n📝 Testing time logging...")
logging.basicConfig(level=logging.INFO)
log_time_info()
print(f"\n✅ All timezone tests completed successfully!")
# Show example filename that would be generated
example_filename = f"camera1_recording_{filename_str}.avi"
print(f"\nExample recording filename: {example_filename}")
if __name__ == "__main__":
test_timezone_functions()