| | 67 | |
| | 68 | '''1. Преглед на настани''' |
| | 69 | {{{ |
| | 70 | SELECT |
| | 71 | e.global_event_id, e.sql_date, e.event_code, e.goldstein_scale, |
| | 72 | e.num_mentions, e.num_sources, e.num_articles, e.avg_tone |
| | 73 | FROM events e |
| | 74 | ORDER BY e.sql_date DESC |
| | 75 | LIMIT 50; |
| | 76 | }}} |
| | 77 | |
| | 78 | '''2. Анализа на актер''' |
| | 79 | {{{ |
| | 80 | SELECT |
| | 81 | a.actor_name, e.global_event_id, e.event_code, e.sql_date, |
| | 82 | e.num_mentions, e.avg_tone |
| | 83 | FROM actors a |
| | 84 | JOIN event_details ed ON a.actor_id = ed.actor_id |
| | 85 | JOIN events e ON ed.global_event_id = e.global_event_id |
| | 86 | WHERE a.actor_id = 5003 |
| | 87 | ORDER BY e.sql_date DESC; |
| | 88 | }}} |
| | 89 | |
| | 90 | '''3. Следење на конфликти''' |
| | 91 | {{{ |
| | 92 | SELECT |
| | 93 | cr.conflict_id, a1.actor_name AS actor_1, |
| | 94 | a2.actor_name AS actor_2, cr.risk_score, |
| | 95 | cr.predicted_date, cr.description |
| | 96 | FROM conflict_risk cr |
| | 97 | JOIN actors a1 ON cr.actor1_id = a1.actor_id |
| | 98 | JOIN actors a2 ON cr.actor2_id = a2.actor_id |
| | 99 | WHERE cr.predicted_date >= CURRENT_DATE |
| | 100 | ORDER BY cr.risk_score DESC; |
| | 101 | }}} |
| | 102 | |
| | 103 | '''4. Генерирање извештаи''' |
| | 104 | {{{ |
| | 105 | SELECT |
| | 106 | p.prediction_id, e.global_event_id, a.actor_name, |
| | 107 | p.prediction_type, p.confidence_score, p.predicted_date |
| | 108 | FROM predictions p |
| | 109 | JOIN events e ON p.event_id = e.global_event_id |
| | 110 | JOIN actors a ON p.actor_id = a.actor_id |
| | 111 | WHERE p.predicted_date BETWEEN CURRENT_DATE - INTERVAL '30 days' AND CURRENT_DATE |
| | 112 | ORDER BY p.confidence_score DESC; |
| | 113 | }}} |
| | 114 | |
| | 115 | '''5. Известувања за нови настани''' |
| | 116 | {{{ |
| | 117 | SELECT |
| | 118 | n.notification_id, u.email, e.global_event_id, |
| | 119 | e.event_code, n.notification_date, n.status |
| | 120 | FROM notifications n |
| | 121 | JOIN users u ON n.user_id = u.user_id |
| | 122 | JOIN events e ON n.event_id = e.global_event_id |
| | 123 | WHERE n.notification_date >= CURRENT_DATE - INTERVAL '7 days' |
| | 124 | ORDER BY n.notification_date DESC; |
| | 125 | }}} |