feat: implement geocoding evaluation scripts and enhance routing service with traffic-aware path processing

This commit is contained in:
Hamza-Ayed
2026-07-16 14:31:07 +03:00
parent 3cf87999f4
commit 3773ab56a4
20 changed files with 885 additions and 137 deletions
+36
View File
@@ -0,0 +1,36 @@
import axios from 'axios';
const API_URL = process.env.TEST_API_URL || 'http://localhost:3200/api/geocoding/autocomplete';
const API_KEY = process.env.TEST_API_KEY || 'zP9vL5mK2nQ8xR7jT4wS1yB6hG3fV0cX';
const testQueries = [
"مستش",
"شارع ال",
"جامعة",
"بنك ا",
"صيد"
];
async function testAutocomplete() {
console.log(`🚀 Testing Autocomplete Latency`);
for (const q of testQueries) {
const start = Date.now();
try {
const res = await axios.get(API_URL, {
headers: { 'x-api-key': API_KEY },
params: { q, country: 'syria' }
});
const time = Date.now() - start;
const count = res.data.results?.length || 0;
console.log(`✅ [${time}ms] Query: "${q}" -> ${count} results`);
if (count > 0) {
console.log(` First result: ${res.data.results[0].name} (${res.data.results[0].category})`);
}
} catch (e: any) {
console.log(`❌ Query: "${q}" failed:`, e.message);
}
}
}
testAutocomplete().catch(console.error);