4ort KG Trending Viewer - terminal dashboard

This commit is contained in:
Ryan Fortin 2026-06-13 00:54:14 +00:00
commit 54bea2707c

36
view.js Normal file
View File

@ -0,0 +1,36 @@
const { execSync } = require('child_process');
const BLOCK_TYPES = ['Person', 'Intangible'];
const BLOCK_DOMAINS = ['human', 'political_party', 'politician', 'election', 'military_conflict', 'crime', 'disease', 'religious_organization'];
function fetchTrending() {
try {
const raw = execSync('4ort kg trending --json', { timeout: 15000, encoding: 'utf8' });
return JSON.parse(raw);
} catch (e) { console.error('Failed:', e.message); process.exit(1); }
}
function isSafe(e) {
if (BLOCK_TYPES.includes(e.type)) return false;
if (BLOCK_DOMAINS.some(d => (e.domain || '').includes(d))) return false;
return !e.is_chronically_popular;
}
function main() {
const data = fetchTrending();
const all = data.entities || [];
const rising = all.filter(isSafe).sort((a, b) => (b.velocity_score||0) - (a.velocity_score||0));
console.log('\n\x1b[35m 4ort KG Trending Viewer - Rising Entities Only\x1b[0m\n');
if (!rising.length) { console.log(' No safe rising entities found.\n'); return; }
const mx = rising[0].velocity_score || 1;
console.log(' ' + rising.length + ' rising entities (' + all.length + ' total, filtered)\n');
rising.slice(0, 15).forEach((e, i) => {
const s = e.velocity_score || 0;
const c = s > 200 ? '\x1b[31m' : s > 50 ? '\x1b[33m' : s > 10 ? '\x1b[36m' : '\x1b[37m';
const w = Math.min(Math.round((s/mx)*30), 30);
const bar = '\u2588'.repeat(w) + '\u2591'.repeat(30-w);
const views = ((e.views_in_window||0)/1000).toFixed(0) + 'K';
console.log(' ' + String(i+1).padStart(2) + '. ' + c + e.name + '\x1b[0m ' + (s.toFixed(1)+'x').padStart(10) + ' ' + bar + ' ' + views);
});
console.log('\n \x1b[90m\x1b[31mexplosive\x1b[0m \x1b[33mhot\x1b[0m \x1b[36mwarm\x1b[0m \x1b[90mmild\x1b[0m\n');
}
main();