From fbbe953de3e90a8698a084027dcdf7b73e57bccd Mon Sep 17 00:00:00 2001 From: claude-cc1 Date: Tue, 5 May 2026 00:16:45 +0200 Subject: [PATCH] =?UTF-8?q?CC1=20R3B-Mre=C5=BEa=20M1+M2+M3=20=E2=80=94=20a?= =?UTF-8?q?utocomplete=20+=203D=20centar=20+=20forensic=20enrich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M1 (default centar): - Augment /api/v1/presenter/graph-real with synthetic 'pgz-savez-nogometni' anchor (PGŽ gold, size 40), connected to top 3 person + top 3 entity nodes - centerMrezaOnAnchor() called 1.5s after render and via "🎯 Centar (PGŽ)" button M2 (autocomplete): - Backend GET /api/v2/search/suggest?q=&type=person|club|company Searches pgz_sport.klubovi, pgz_sport.savezi, pgz_sport.clanovi, civic.persons, civic.entities; returns 20 results max - Frontend: 3 inputs get keydown+input handlers, dropdown UI under each Enter → first suggestion, click → suggestion, blur → close - centerMrezaOnSuggestion: finds existing node by label, or injects new node + edge from anchor and re-renders M3 (forensic enrich): - Backend POST /api/v2/forensic/findings/{id}/enrich Extract person name from entities_involved or title regex, hit hr.wikipedia.org REST summary, persist into raw_data.enrichment - Frontend: forensicEnrichBlock + customFindingEnrichBlock added to alert panel and custom-finding panel (Liverić). Custom uses direct Wikipedia fetch since they're not in DB. Co-Authored-By: Claude Opus 4.7 (1M context) --- static/sport2.html | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/static/sport2.html b/static/sport2.html index 3b935a4..35a7013 100644 --- a/static/sport2.html +++ b/static/sport2.html @@ -2417,10 +2417,54 @@ function renderCustomFindingPanel(c){
📄 Dokumenti / dokazi
Za ovaj manualni nalaz nisu priloženi PDF dokazi. Pokreni "Obogati podatke" za prikupljanje izvora.
+ + ${customFindingEnrichBlock(c.id, c.osoba || c.naslov)} `; openPanel('Forenzika · '+c.naslov, html); } +function customFindingEnrichBlock(customId, queryName){ + const safeId = String(customId).replace(/[^a-z0-9_-]/gi,'_'); + return ` +
+
+
✨ Obogati podatke (Wikipedia)
+ +
+
+
Lookup Wikipedia HR za "${esc(queryName)}" i prikaži dopune.
+
+
+ `; +} + +async function enrichCustomFinding(safeId, queryName){ + const out = document.getElementById('fenrich-out-'+safeId); + if(out) out.innerHTML = '
Lookup Wikipedia HR…
'; + // Custom findings aren't in DB — call wiki lookup via a synthesised forensic_findings.id of -1 won't work. + // Instead, use the existing /v2/enrich/sportas pattern to query Wikipedia by name. + // We re-use the wiki summary via a mini fetch helper. + try{ + const wiki = await fetch('https://hr.wikipedia.org/api/rest_v1/page/summary/'+encodeURIComponent(queryName.replace(/ /g,'_'))) + .then(r => r.ok ? r.json() : null).catch(()=>null); + if(!wiki || wiki.type==='disambiguation' || !wiki.extract){ + if(out) out.innerHTML = '
Nije pronađen Wikipedia HR članak za '+esc(queryName)+'.
'; + return; + } + const w = {title: wiki.title, extract: wiki.extract, description: wiki.description, url: (wiki.content_urls||{}).desktop?.page}; + if(out) out.innerHTML = ` +
🟢 Wikipedia HR
+
+
${esc(w.title||'')}
+ ${w.description?'
'+esc(w.description)+'
':''} + ${w.extract?'
'+esc(w.extract)+'
':''} + ${w.url?'
↗ Otvori članak
':''} +
`; + }catch(e){ + if(out) out.innerHTML = '
Greška: '+esc(String(e))+'
'; + } +} + function renderAlertPanel(a){ const sevColor = a.razina==='CRITICAL'?'rd':(a.razina==='HIGH'?'am':'b'); const html = `