Files
boc/vims-backend/demo/reality-alert-demo.js
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

73 lines
2.4 KiB
JavaScript

/**
* Reality Alert™ Demo
* Demonstrates the spontaneous observation pipeline
*/
const { RealityAlertService } = require('../src/services/realityAlert');
async function runDemo() {
console.log('🚨 Landvex Reality Alert™ Demo');
console.log('================================\n');
const service = new RealityAlertService();
// Simulate a Zoomer observation
const observation = {
imageUrl: 'https://example.com/photos/diesel-spill-001.jpg',
gpsLocation: {
lat: 59.3293,
lng: 18.0686,
address: 'Stureplan, Stockholm'
},
timestamp: new Date().toISOString(),
zoomerId: 'zoomer-123',
description: 'I noticed a dark liquid leaking from a pump station',
objectType: 'pump_station'
};
console.log('📸 Simulating Zoomer observation:');
console.log(` Location: ${observation.gpsLocation.address}`);
console.log(` Description: ${observation.description}`);
console.log(` Zoomer: ${observation.zoomerId}\n`);
// Process the observation
const result = await service.processObservation(observation);
if (result.status === 'verified') {
console.log('✅ Observation verified by AI!');
console.log(`\n🚨 REALITY ALERT CREATED`);
console.log(` ID: ${result.alert.id}`);
console.log(` Severity: ${result.alert.severity.toUpperCase()}`);
console.log(` Category: ${result.alert.category}`);
console.log(` Risk Score: ${result.alert.riskScore}/100`);
console.log(` Description: ${result.alert.description}`);
console.log(`\n📡 ROUTING INTELLIGENCE`);
console.log(` Primary: ${result.alert.routing.primary}`);
console.log(` Secondary: ${result.alert.routing.secondary.join(', ')}`);
console.log(` Emergency: ${result.alert.routing.emergency ? 'YES' : 'No'}`);
console.log(`\n💰 ZOOMER REWARD`);
console.log(` Amount: $${result.reward.amount}`);
console.log(` Breakdown:`, result.reward.breakdown);
console.log(`\n📊 ALERT STATS`);
const stats = service.getPendingAlerts();
console.log(` Total pending alerts: ${stats.length}`);
} else if (result.status === 'rejected') {
console.log('❌ Observation rejected:', result.message);
} else if (result.status === 'unclear') {
console.log('⚠️ Need more info:', result.message);
}
console.log('\n✅ Demo complete!');
}
// Run if called directly
if (require.main === module) {
runDemo().catch(console.error);
}
module.exports = { runDemo };