from datetime import datetime, timedelta
from typing import List, Dict
import random
import uuid
import json
class DemoDataGenerator:
"""Generate realistic sample data for demonstration purposes"""
def __init__(self):
self.sample_narratives = [
{
"id": str(uuid.uuid4()),
"title": "Iran-Israel Conflict Escalation Disinformation",
"content": "False claims about imminent nuclear strike and fabricated casualty reports to inflame tensions between Iran and Israel, spreading fear about regional war.",
"risk_score": 98,
"spread_velocity": 22.5,
"first_detected": datetime.now() - timedelta(hours=1),
"sources": ["social_media", "telegram", "fake_news_sites"],
"status": "active"
},
{
"id": str(uuid.uuid4()),
"title": "Ukraine-Russia War Propaganda Campaign",
"content": "Coordinated disinformation claiming Ukraine is planning false flag operations, with deepfake videos of officials making inflammatory statements.",
"risk_score": 95,
"spread_velocity": 19.8,
"first_detected": datetime.now() - timedelta(hours=2),
"sources": ["social_media", "alternative_news", "bot_networks"],
"status": "active"
},
{
"id": str(uuid.uuid4()),
"title": "Gaza Humanitarian Crisis Manipulation",
"content": "Fabricated images and videos claiming to show current situation in Gaza, designed to manipulate public opinion on international aid and policy.",
"risk_score": 91,
"spread_velocity": 18.3,
"first_detected": datetime.now() - timedelta(hours=3),
"sources": ["social_media", "messaging_apps", "forums"],
"status": "active"
},
{
"id": str(uuid.uuid4()),
"title": "Middle East Peace Process Sabotage",
"content": "False diplomatic communications claiming secret agreements between regional powers, designed to undermine ongoing peace negotiations.",
"risk_score": 87,
"spread_velocity": 15.7,
"first_detected": datetime.now() - timedelta(hours=4),
"sources": ["alternative_news", "social_media", "blog_posts"],
"status": "active"
},
{
"id": str(uuid.uuid4()),
"title": "NATO Expansion Fear Campaign",
"content": "Exaggerated claims about NATO military buildup and false reports of imminent Article 5 activation to increase regional tensions.",
"risk_score": 84,
"spread_velocity": 13.9,
"first_detected": datetime.now() - timedelta(hours=5),
"sources": ["social_media", "state_media", "forums"],
"status": "active"
},
{
"id": str(uuid.uuid4()),
"title": "Election Security Misinformation Campaign",
"content": "Widespread claims about voting machine vulnerabilities without evidence, targeting swing states during election period.",
"risk_score": 82,
"spread_velocity": 12.8,
"first_detected": datetime.now() - timedelta(hours=6),
"sources": ["social_media", "alternative_news", "blog_posts"],
"status": "active"
}
]
self.sample_monitoring_results = [
{
"timestamp": datetime.now().isoformat(),
"keyword": "Iran Israel war",
"title": "BREAKING: Iran Launches Nuclear Strike on Israel - WWIII STARTING",
"snippet": "Unconfirmed reports claim Iran has launched nuclear weapons at Israeli cities. Mass evacuation underway as World War 3 begins...",
"source": "breaking-news-alert.net",
"url": "https://example.com/fake-news-1",
"risk_score": 98,
"spread_velocity": 25.8,
"engine": "duckduckgo"
},
{
"timestamp": (datetime.now() - timedelta(minutes=10)).isoformat(),
"keyword": "Ukraine false flag",
"title": "EXPOSED: Ukraine Planning Massive False Flag Operation",
"snippet": "Leaked intelligence reveals Ukraine preparing fake chemical attack to blame Russia and trigger NATO intervention...",
"source": "military-insider.org",
"url": "https://example.com/fake-news-2",
"risk_score": 95,
"spread_velocity": 22.3,
"engine": "bing"
},
{
"timestamp": (datetime.now() - timedelta(minutes=20)).isoformat(),
"keyword": "Gaza genocide",
"title": "URGENT: New Evidence of Systematic Genocide in Gaza",
"snippet": "Horrific footage emerges showing deliberate targeting of civilians. International community remains silent about war crimes...",
"source": "truth-gaza.com",
"url": "https://example.com/fake-news-3",
"risk_score": 93,
"spread_velocity": 21.1,
"engine": "google"
},
{
"timestamp": (datetime.now() - timedelta(minutes=35)).isoformat(),
"keyword": "NATO Article 5",
"title": "ALERT: NATO Activates Article 5 - Global War Imminent",
"snippet": "Secret NATO meeting triggers Article 5 activation. Military sources confirm preparations for full-scale war with Russia...",
"source": "defense-watch.info",
"url": "https://example.com/fake-news-4",
"risk_score": 91,
"spread_velocity": 19.7,
"engine": "duckduckgo"
},
{
"timestamp": (datetime.now() - timedelta(minutes=50)).isoformat(),
"keyword": "Russia Ukraine ceasefire",
"title": "SECRET: Putin and Zelensky Sign Hidden Peace Deal",
"snippet": "Exclusive documents reveal secret ceasefire agreement between Putin and Zelensky. Media blackout prevents public knowledge...",
"source": "diplomatic-leaks.org",
"url": "https://example.com/fake-news-5",
"risk_score": 87,
"spread_velocity": 17.2,
"engine": "bing"
},
{
"timestamp": (datetime.now() - timedelta(hours=1)).isoformat(),
"keyword": "Middle East war",
"title": "DEVELOPING: All Middle East Powers Unite Against Common Enemy",
"snippet": "Breaking alliance between traditional enemies Iran, Israel, and Saudi Arabia against mysterious external threat...",
"source": "geopolitical-insider.net",
"url": "https://example.com/fake-news-6",
"risk_score": 84,
"spread_velocity": 15.9,
"engine": "google"
}
]
# Define real analysis links grouped by theme
self.theme_links = {
"Middle East Conflict": [
"https://www.reuters.com/world/middle-east/gaza-war-israeli-tanks-advance-deeper-rafah-artillery-fire-all-sides-2024-05-29/",
"https://www.cfr.org/global-conflict-tracker/conflict/israeli-palestinian-conflict",
"https://www.aljazeera.com/news/2024/5/29/israeli-tanks-reach-the-heart-of-rafah-witnesses-and-security-sources-say"
],
"War Propaganda": [
"https://www.nato.int/cps/en/natohq/topics_111767.htm",
"https://www.atlanticcouncil.org/blogs/ukrainealert/putins-latest-disinformation-narratives-are-failing-to-fool-the-world/",
"https://euvsdisinfo.eu/ukraine/"
],
"Humanitarian Crisis": [
"https://www.unhcr.org/emergencies",
"https://www.doctorswithoutborders.org/what-we-do/countries/sudan",
"https://www.unocha.org/sudan"
],
"Diplomatic Sabotage": [
"https://carnegieendowment.org/specialprojects/informationwars/",
"https://www.csis.org/programs/strategic-technologies-program/cybersecurity-and-governance",
"https://www.microsoft.com/en-us/security/business/security-insider/threat-trends-research"
],
"Military Alliance": [
"https://www.nato.int/cps/en/natohq/news_225444.htm",
"https://www.iiss.org/online-analysis/military-balance-plus",
"https://www.defensenews.com/global/europe/2024/02/14/what-did-allies-pledge-at-nato-for-2024-and-the-years-ahead/"
],
"Electoral Integrity": [
"https://www.cisa.gov/election-security",
"https://www.ifes.org/news/disinformation-and-election-integrity-how-foreign-interference-targets-elections",
"https://www.brennancenter.org/our-work/research-reports/election-security-2024"
],
"Economic Destabilization": [
"https://www.imf.org/en/Publications/fandd/issues/2023/12/The-global-economic-impact-of-geopolitical-fragmentation-Gita-Gopinath",
"https://www.atlanticcouncil.org/programs/geoeconomics-center/",
"https://www.weforum.org/agenda/2023/01/geopolitical-instability-is-driving-economic-fragmentation-that-will-hurt-us-all/"
],
"Public Health Misinformation": [
"https://www.who.int/teams/risk-communication/infodemic-management",
"https://www.cdc.gov/healthcommunication/infodemicmanagement.html",
"https://publichealth.jhu.edu/2022/the-danger-of-health-misinformation"
]
}
self.sample_predictions = [
{
'id': 'pred_001',
'theme': 'Middle East Conflict',
'subject': 'Gaza Humanitarian Aid',
'summary': 'Claims that humanitarian aid to Gaza is being diverted, undermining relief efforts.',
'verified': 'No',
'high_velocity_spread': 'Yes',
'action_plan': 'Coordinate with UN agencies for transparent aid tracking reports. Deploy fact-checkers.',
'counter_narrative_strategy': 'Transparency Initiative',
'narrative': 'False allegations on social media claim humanitarian aid is intercepted by militant groups, using doctored photos and statistics to erode public trust.',
'links': self.theme_links["Middle East Conflict"],
'predicted_reach': 420000, 'timeline': '24-48 hours', 'prediction_confidence': 89,
'platform': 'Twitter, Facebook, Telegram', 'target_demographic': 'Adults 25-54, Middle East interest', 'country_iso': 'PSE'
},
{
'id': 'pred_002',
'theme': 'War Propaganda',
'subject': 'NATO Defense Spending',
'summary': 'Misleading narratives about NATO spending, suggesting funds are wasted on conflicts.',
'verified': 'No',
'high_velocity_spread': 'No',
'action_plan': 'Release detailed defense budget breakdowns. Engage defense analysts for media interviews.',
'counter_narrative_strategy': 'Economic Education',
'narrative': 'Disinformation campaign targeting NATO members with false claims of defense spending inefficiency, contrasting it with domestic needs to weaken public support.',
'links': self.theme_links["War Propaganda"],
'predicted_reach': 280000, 'timeline': '1-3 days', 'prediction_confidence': 76,
'platform': 'Facebook, YouTube, Reddit', 'target_demographic': 'Adults 35-65, Political interest', 'country_iso': 'USA'
},
{
'id': 'pred_003',
'theme': 'Humanitarian Crisis',
'subject': 'Sudan Conflict Displacement',
'summary': 'Narratives downplaying the severity of the displacement crisis in Sudan.',
'verified': 'No',
'high_velocity_spread': 'Yes',
'action_plan': 'Amplify reports from NGOs on the ground. Partner with international news for coverage.',
'counter_narrative_strategy': 'Eyewitness Amplification',
'narrative': 'Reports minimizing the number of displaced persons and the scale of the humanitarian needs in Sudan, aiming to reduce international pressure and aid.',
'links': self.theme_links["Humanitarian Crisis"],
'predicted_reach': 550000, 'timeline': '48-72 hours', 'prediction_confidence': 91,
'platform': 'Facebook, WhatsApp', 'target_demographic': 'Global humanitarian aid community', 'country_iso': 'SDN'
},
{
'id': 'pred_004',
'theme': 'Diplomatic Sabotage',
'subject': 'South China Sea Tensions',
'summary': 'Fabricated reports of military incidents to escalate tensions between China and neighbors.',
'verified': 'No',
'high_velocity_spread': 'Yes',
'action_plan': 'Promote official statements from regional governments. Use track II diplomacy to de-escalate.',
'counter_narrative_strategy': 'De-escalation Dialogue',
'narrative': 'Disinformation about naval clashes and territorial incursions in the South China Sea, designed to provoke nationalist sentiment and destabilize regional diplomacy.',
'links': self.theme_links["Diplomatic Sabotage"],
'predicted_reach': 600000, 'timeline': '12-24 hours', 'prediction_confidence': 94,
'platform': 'Weibo, Twitter, Forums', 'target_demographic': 'Citizens of Southeast Asian nations', 'country_iso': 'CHN'
},
{
'id': 'pred_005',
'theme': 'Electoral Integrity',
'subject': 'Indian Election EVM Fraud',
'summary': 'Claims of electronic voting machine (EVM) tampering in the Indian general election.',
'verified': 'No',
'high_velocity_spread': 'No',
'action_plan': 'Disseminate Election Commission of India (ECI) clarifications. Create educational content on EVM security.',
'counter_narrative_strategy': 'Institutional Trust Building',
'narrative': 'Widespread social media posts alleging that EVMs are being manipulated to favor specific parties, aiming to undermine the legitimacy of the election results.',
'links': self.theme_links["Electoral Integrity"],
'predicted_reach': 1200000, 'timeline': '1-2 weeks', 'prediction_confidence': 85,
'platform': 'WhatsApp, Facebook, YouTube', 'target_demographic': 'Indian voters', 'country_iso': 'IND'
},
{
'id': 'pred_006',
'theme': 'Public Health Misinformation',
'subject': 'Avian Flu Pandemic Fearmongering',
'summary': 'Exaggerated claims about H5N1 avian flu transmission to humans to create panic.',
'verified': 'No',
'high_velocity_spread': 'Yes',
'action_plan': 'Promote WHO and CDC guidance. Host Q&A sessions with public health experts. Debunk false claims directly.',
'counter_narrative_strategy': 'Expert-Led Reassurance',
'narrative': 'Viral posts claiming a new H5N1 strain is highly contagious among humans and that a pandemic is imminent, often citing "leaked" documents or conspiracy theories.',
'links': self.theme_links["Public Health Misinformation"],
'predicted_reach': 950000, 'timeline': '48-96 hours', 'prediction_confidence': 92,
'platform': 'TikTok, Instagram, Facebook', 'target_demographic': 'General public, parents', 'country_iso': 'USA'
},
{
'id': 'pred_007',
'theme': 'Economic Destabilization',
'subject': 'Global Supply Chain Collapse',
'summary': 'Rumors of an imminent collapse of global supply chains due to geopolitical tensions.',
'verified': 'No',
'high_velocity_spread': 'No',
'action_plan': 'Share data from logistics and shipping companies showing stability. Highlight government and industry collaboration.',
'counter_narrative_strategy': 'Data-Driven Normalization',
'narrative': 'Posts claiming key shipping lanes are closing and that a global goods shortage is unavoidable, encouraging hoarding and panic-buying.',
'links': self.theme_links["Economic Destabilization"],
'predicted_reach': 750000, 'timeline': '1-2 weeks', 'prediction_confidence': 79,
'platform': 'Financial blogs, Reddit, Twitter', 'target_demographic': 'Investors, small business owners', 'country_iso': 'SGP'
},
{
'id': 'pred_008',
'theme': 'War Propaganda',
'subject': 'Russian Military Strength Exaggeration',
'summary': 'Pro-Kremlin narratives overstating the success and capabilities of the Russian military in Ukraine.',
'verified': 'Yes',
'high_velocity_spread': 'Yes',
'action_plan': 'Counter with verified visual evidence from Ukraine. Amplify reports from independent military analysts.',
'counter_narrative_strategy': 'Evidence-Based Counter',
'narrative': 'State-media controlled content showcasing advanced weaponry and claiming significant victories, often using footage from military exercises or older conflicts.',
'links': self.theme_links["War Propaganda"],
'predicted_reach': 450000, 'timeline': 'Ongoing', 'prediction_confidence': 95,
'platform': 'Telegram, VK, Twitter', 'target_demographic': 'Russian domestic audience, pro-Russian communities', 'country_iso': 'RUS'
},
{
'id': 'pred_009',
'theme': 'Humanitarian Crisis',
'subject': 'Refugee Integration Programs',
'summary': 'Positive narratives highlighting successful refugee integration and economic contributions.',
'verified': 'Yes',
'high_velocity_spread': 'No',
'action_plan': 'Amplify success stories through community leaders. Partner with local media for human interest features.',
'counter_narrative_strategy': 'Community Engagement',
'narrative': 'Authentic success stories and statistical evidence showcasing positive refugee integration outcomes, featuring testimonials from refugees and host community members.',
'links': self.theme_links["Humanitarian Crisis"],
'predicted_reach': 350000, 'timeline': '3-7 days', 'prediction_confidence': 71,
'platform': 'LinkedIn, Twitter, News websites', 'target_demographic': 'Adults 25-45, social policy interest', 'country_iso': 'DEU'
}
]
self.sample_counter_narratives = {
"fact_based_response": "Official government election data shows no evidence of systematic fraud. Multiple independent audits and recounts have confirmed the accuracy of results. Election security measures including paper trails, signature verification, and bipartisan oversight ensure integrity.",
"educational_content": "Understanding Election Security: Modern elections use multiple verification layers including voter registration databases, signature matching, paper ballot backups, and statistical audits. These systems are designed to detect and prevent fraud while maintaining voter privacy.",
"trusted_sources": [
"https://www.cisa.gov/election-security",
"https://www.eac.gov/voters/verify-voter-registration",
"https://www.brennancenter.org/our-work/research-reports/election-security"
],
"shareable_content": "🗳️ FACT CHECK: U.S. elections are among the world's most secure. Paper ballots, multiple audits, and bipartisan oversight ensure accuracy. Trust the process, trust the facts. #ElectionSecurity #FactsMatter"
}
self.sample_analysis = {
"risk_score": 89,
"factual_accuracy": 15,
"emotional_manipulation": 92,
"historical_similarity": "Similar to 2016 election disinformation campaigns",
"likely_origin": "Coordinated inauthentic behavior detected",
"intent": "Undermine election confidence",
"spread_prediction": "High probability of viral spread within 24-48 hours, estimated reach 250,000+ users across platforms",
"key_claims": [
"Voting machines compromised",
"Widespread fraud occurred",
"Official results unreliable"
]
}
# Enhanced geographical data with specific countries
self.geographical_data = {
"Middle East Conflict": {
"countries": {"Israel": {"threat_level": 90, "reach": 150000, "iso": "ISR"}, "Iran": {"threat_level": 85, "reach": 120000, "iso": "IRN"}, "Lebanon": {"threat_level": 80, "reach": 90000, "iso": "LBN"}, "United States": {"threat_level": 60, "reach": 200000, "iso": "USA"}, "Saudi Arabia": {"threat_level": 50, "reach": 100000, "iso": "SAU"}}
},
"War Propaganda": {
"countries": {"Russia": {"threat_level": 95, "reach": 300000, "iso": "RUS"}, "Ukraine": {"threat_level": 92, "reach": 280000, "iso": "UKR"}, "Germany": {"threat_level": 70, "reach": 180000, "iso": "DEU"}, "United Kingdom": {"threat_level": 65, "reach": 150000, "iso": "GBR"}, "Poland": {"threat_level": 75, "reach": 160000, "iso": "POL"}}
},
"Humanitarian Crisis": {
"countries": {"Sudan": {"threat_level": 98, "reach": 250000, "iso": "SDN"}, "Yemen": {"threat_level": 94, "reach": 220000, "iso": "YEM"}, "Afghanistan": {"threat_level": 90, "reach": 200000, "iso": "AFG"}, "Ethiopia": {"threat_level": 88, "reach": 190000, "iso": "ETH"}, "South Sudan": {"threat_level": 85, "reach": 170000, "iso": "SSD"}}
},
"Diplomatic Sabotage": {
"countries": {"China": {"threat_level": 85, "reach": 400000, "iso": "CHN"}, "Taiwan": {"threat_level": 82, "reach": 150000, "iso": "TWN"}, "Philippines": {"threat_level": 78, "reach": 120000, "iso": "PHL"}, "Vietnam": {"threat_level": 75, "reach": 110000, "iso": "VNM"}, "Japan": {"threat_level": 70, "reach": 180000, "iso": "JPN"}}
},
"Electoral Integrity": {
"countries": {"United States": {"threat_level": 88, "reach": 500000, "iso": "USA"}, "India": {"threat_level": 85, "reach": 600000, "iso": "IND"}, "Brazil": {"threat_level": 80, "reach": 350000, "iso": "BRA"}, "Mexico": {"threat_level": 78, "reach": 280000, "iso": "MEX"}, "South Africa": {"threat_level": 72, "reach": 200000, "iso": "ZAF"}}
},
"Economic Destabilization": {
"countries": {"United States": {"threat_level": 70, "reach": 450000, "iso": "USA"}, "China": {"threat_level": 68, "reach": 420000, "iso": "CHN"}, "Germany": {"threat_level": 65, "reach": 300000, "iso": "DEU"}, "Singapore": {"threat_level": 60, "reach": 150000, "iso": "SGP"}, "United Kingdom": {"threat_level": 58, "reach": 280000, "iso": "GBR"}}
},
"Public Health Misinformation": {
"countries": {"United States": {"threat_level": 80, "reach": 700000, "iso": "USA"}, "Brazil": {"threat_level": 75, "reach": 500000, "iso": "BRA"}, "India": {"threat_level": 72, "reach": 650000, "iso": "IND"}, "Russia": {"threat_level": 70, "reach": 300000, "iso": "RUS"}, "United Kingdom": {"threat_level": 65, "reach": 400000, "iso": "GBR"}}
}
}
def get_sample_narratives(self) -> List[Dict]:
"""Get sample narrative data"""
return self.sample_narratives
def get_sample_monitoring_results(self) -> List[Dict]:
"""Get sample monitoring results"""
return self.sample_monitoring_results
def get_sample_monitoring_results_with_counter_narratives(self) -> List[Dict]:
"""Get sample monitoring results with counter-narrative analysis"""
enhanced_results = []
for result in self.sample_monitoring_results:
enhanced_result = result.copy()
# Add counter-narrative based on content
if 'Iran' in result['title'] and 'nuclear' in result['title']:
enhanced_result['counter_narrative'] = (
"⚠️ FACT-CHECK: No credible evidence supports nuclear strike claims. Official sources including IAEA, UN, and government agencies have not confirmed such events.\n\n"
"📍 CONTEXT: Verify breaking news through established news organizations and official government channels."
)
enhanced_result['highlighted_concerns'] = ["nuclear strike", "WWIII", "mass evacuation", "war begins"]
elif 'false flag' in result['title']:
enhanced_result['counter_narrative'] = (
"⚠️ FACT-CHECK: Claims of false flag operations require verification through multiple independent sources. 'Leaked intelligence' claims need official confirmation.\n\n"
"📍 CONTEXT: The conflict involves complex factors. Trust established news organizations and official military sources."
)
enhanced_result['highlighted_concerns'] = ["false flag", "leaked intelligence", "chemical attack", "NATO intervention"]
elif 'genocide' in result['title']:
enhanced_result['counter_narrative'] = (
"⚠️ FACT-CHECK: Humanitarian situations require verification through UN agencies, international aid organizations, and multiple credible sources.\n\n"
"📍 CONTEXT: The Gaza situation is complex with legitimate humanitarian concerns. Trust established humanitarian organizations for accurate information."
)
enhanced_result['highlighted_concerns'] = ["genocide", "systematic", "war crimes", "deliberate targeting"]
elif 'NATO' in result['title'] and 'Article 5' in result['title']:
enhanced_result['counter_narrative'] = (
"⚠️ FACT-CHECK: NATO Article 5 activation requires public announcement and consensus among all member states. No such activation has been announced.\n\n"
"📍 CONTEXT: NATO maintains transparency in its decision-making processes. Official announcements come through verified NATO channels."
)
enhanced_result['highlighted_concerns'] = ["Article 5", "global war", "secret meeting", "imminent"]
else:
enhanced_result['counter_narrative'] = None
enhanced_result['highlighted_concerns'] = []
enhanced_results.append(enhanced_result)
return enhanced_results
def get_sample_predictions(self) -> List[Dict]:
"""Get comprehensive sample prediction data with updated format"""
return self.sample_predictions
def export_predictions_json(self) -> str:
"""Export sample predictions as JSON string for demonstration"""
return json.dumps(self.sample_predictions, indent=2, default=str)
def get_sample_counter_narrative(self) -> Dict:
"""Get sample counter-narrative"""
return self.sample_counter_narratives
def get_sample_analysis(self) -> Dict:
"""Get sample analysis results"""
return self.sample_analysis
def get_sample_alerts(self) -> List[Dict]:
"""Get sample alert data"""
return [
{
"level": "HIGH",
"title": "Critical Election Misinformation Spike",
"description": "95% risk score narrative spreading rapidly across platforms",
"timestamp": datetime.now().isoformat(),
"status": "active"
},
{
"level": "MEDIUM",
"title": "Health Misinformation Trending",
"description": "87% risk score content about medical treatments gaining traction",
"timestamp": (datetime.now() - timedelta(minutes=30)).isoformat(),
"status": "monitoring"
},
{
"level": "HIGH",
"title": "Coordinated Inauthentic Behavior Detected",
"description": "Multiple accounts spreading identical content patterns",
"timestamp": (datetime.now() - timedelta(hours=1)).isoformat(),
"status": "investigating"
}
]
def get_sample_impact_data(self) -> Dict:
"""Get sample impact measurement data"""
return {
"reach": 156000,
"engagement": 23500,
"sentiment_shift": -0.34,
"geographic_spread": ["United States", "United Kingdom", "Canada", "Australia"],
"platform_distribution": {
"Twitter": 45000,
"Facebook": 67000,
"Reddit": 28000,
"TikTok": 16000
},
"impact_score": 82,
"credibility_damage": "Moderate",
"public_trust_impact": "Significant decline in institutional trust metrics"
}
def get_trending_keywords(self) -> List[Dict]:
"""Get sample trending keywords"""
return [
{"keyword": "election fraud", "mentions": 1250, "trend_score": 125},
{"keyword": "vaccine dangers", "mentions": 890, "trend_score": 89},
{"keyword": "economic collapse", "mentions": 743, "trend_score": 74},
{"keyword": "climate hoax", "mentions": 621, "trend_score": 62},
{"keyword": "5G health risks", "mentions": 534, "trend_score": 53}
]
def get_geographical_matrix_data(self) -> Dict:
"""Get data formatted for a geographical threat matrix heatmap"""
# Collect all unique countries and themes
all_countries = set()
all_themes = list(self.geographical_data.keys())
for theme_data in self.geographical_data.values():
all_countries.update(theme_data["countries"].keys())
all_countries = sorted(list(all_countries))
# Create matrix data
matrix_data = {
"countries": all_countries,
"themes": all_themes,
"threat_levels": [],
"reach_values": [],
"hover_text": []
}
# Fill matrix with threat levels and reach values
for country in all_countries:
country_threats = []
country_reach = []
country_hover = []
for theme in all_themes:
if country in self.geographical_data[theme]["countries"]:
threat_level = self.geographical_data[theme]["countries"][country]["threat_level"]
reach = self.geographical_data[theme]["countries"][country]["reach"]
hover_text = f"{country}
Theme: {theme}
Threat Level: {threat_level}
Predicted Reach: {reach:,}"
else:
threat_level = 0
reach = 0
hover_text = f"{country}
Theme: {theme}
No threat detected"
country_threats.append(threat_level)
country_reach.append(reach)
country_hover.append(hover_text)
matrix_data["threat_levels"].append(country_threats)
matrix_data["reach_values"].append(country_reach)
matrix_data["hover_text"].append(country_hover)
return matrix_data
def get_regional_summary(self) -> Dict:
"""Get regional threat summary for overview visualization"""
regional_data = {}
for theme, data in self.geographical_data.items():
for region in data["primary_regions"]:
if region not in regional_data:
regional_data[region] = {
"themes": [],
"total_threats": 0,
"avg_threat_level": 0,
"total_reach": 0
}
# Calculate regional statistics
region_countries = [country for country, info in data["countries"].items()]
region_threat_levels = [info["threat_level"] for info in data["countries"].values()]
region_reach = [info["reach"] for info in data["countries"].values()]
regional_data[region]["themes"].append({
"theme": theme,
"countries_affected": len(region_countries),
"avg_threat_level": sum(region_threat_levels) / len(region_threat_levels) if region_threat_levels else 0,
"total_reach": sum(region_reach)
})
regional_data[region]["total_threats"] += 1
regional_data[region]["total_reach"] += sum(region_reach)
# Calculate overall regional averages
for region, data in regional_data.items():
if data["themes"]:
data["avg_threat_level"] = sum(theme["avg_threat_level"] for theme in data["themes"]) / len(data["themes"])
return regional_data
def get_action_plan_details(self, prediction_id: str) -> Dict:
"""Get detailed action plan for a specific prediction"""
action_plans = {
'pred_001': {
'title': 'Gaza Humanitarian Aid - Transparency Initiative',
'priority': 'HIGH PRIORITY',
'timeline': '24-48 hours',
'strategy': 'Transparency Initiative',
'immediate_actions': [
'Activate UN OCHA (Office for the Coordination of Humanitarian Affairs) emergency response protocol',
'Deploy real-time aid tracking dashboard accessible to public',
'Coordinate with major humanitarian organizations (UNRWA, WFP, UNICEF) for joint statement',
'Alert fact-checking organizations (Snopes, PolitiFact, BBC Reality Check) to priority-monitor claims'
],
'medium_term_actions': [
'Establish daily press briefings with aid distribution statistics',
'Create multi-language infographics showing aid delivery process',
'Partner with local journalists in Gaza for independent verification',
'Implement blockchain-based aid tracking for transparency'
],
'key_messengers': [
'UN Special Coordinator for Middle East Peace Process',
'European Union Humanitarian Aid Commissioner',
'International Committee of the Red Cross (ICRC) spokesperson',
'Major donor country foreign ministers'
],
'communication_channels': [
'Official UN social media accounts',
'Major international news outlets (BBC, Reuters, AP)',
'Diplomatic briefings and press conferences',
'NGO networks and humanitarian websites'
],
'success_metrics': [
'Reduce false claim reach by 60% within 48 hours',
'Increase verified aid delivery content visibility by 200%',
'Generate at least 10 major news corrections/clarifications',
'Maintain donor confidence levels above 85%'
],
'risk_mitigation': [
'Prepare for potential escalation of disinformation campaigns',
'Monitor for deepfake videos or sophisticated fabrications',
'Coordinate with platform moderation teams for rapid response',
'Develop contingency messaging for different scenarios'
]
},
'pred_002': {
'title': 'NATO Defense Spending - Economic Education',
'priority': 'MEDIUM PRIORITY',
'timeline': '1-3 days',
'strategy': 'Economic Education',
'immediate_actions': [
'Release NATO defense spending fact sheets with economic benefits breakdown',
'Coordinate with defense economists from think tanks for expert commentary',
'Prepare simplified infographics showing defense spending vs. social programs',
'Brief allied government spokespeople on unified messaging'
],
'medium_term_actions': [
'Organize public seminars on defense economics in major cities',
'Create educational video series featuring defense industry jobs',
'Partner with universities for academic research publications',
'Develop interactive budget tools for public exploration'
],
'key_messengers': [
'NATO Secretary General',
'Defense ministers from major allied countries',
'Independent defense economists and analysts',
'Industry leaders from defense manufacturing'
],
'communication_channels': [
'NATO official website and social media',
'National defense ministry communications',
'Think tank publications and events',
'Mainstream media economic coverage'
],
'success_metrics': [
'Increase public understanding of defense spending benefits by 40%',
'Generate 25+ expert articles supporting defense investment',
'Maintain allied government approval ratings above 60%',
'Reduce anti-NATO sentiment in key demographics by 30%'
],
'risk_mitigation': [
'Address legitimate concerns about budget priorities',
'Prepare responses for economic downturn scenarios',
'Monitor domestic political reactions in allied countries',
'Coordinate messaging to avoid contradictions'
]
},
'pred_003': {
'title': 'Refugee Integration - Community Engagement',
'priority': 'LOW PRIORITY',
'timeline': '3-7 days',
'strategy': 'Community Engagement',
'immediate_actions': [
'Compile successful integration stories from different communities',
'Connect with local media for human interest story features',
'Identify refugee entrepreneurs and community leaders for interviews',
'Prepare economic impact data showing refugee contributions'
],
'medium_term_actions': [
'Organize community integration showcases and cultural events',
'Create mentorship programs connecting refugees with local professionals',
'Develop documentary features on integration success stories',
'Establish regular community dialogue forums'
],
'key_messengers': [
'Local mayors and community leaders',
'Successful refugee entrepreneurs and professionals',
'Integration program coordinators',
'Local business owners who hired refugees'
],
'communication_channels': [
'Local newspapers and community radio',
'Community social media groups',
'Cultural festivals and public events',
'Professional networking platforms'
],
'success_metrics': [
'Increase positive sentiment towards refugees by 25%',
'Generate 50+ positive media stories about integration',
'Establish 10 new community partnership programs',
'Achieve 90% satisfaction in community dialogue sessions'
],
'risk_mitigation': [
'Address legitimate integration challenges honestly',
'Prevent exploitation of success stories',
'Monitor for backlash against featured individuals',
'Ensure diverse representation in storytelling'
]
},
'pred_004': {
'title': 'Trade Agreements - Diplomatic Transparency',
'priority': 'HIGH PRIORITY',
'timeline': '1-2 weeks',
'strategy': 'Diplomatic Transparency',
'immediate_actions': [
'Publish official trade agreement summaries in plain language',
'Schedule public Q&A sessions with chief trade negotiators',
'Release economic impact assessments from independent analysts',
'Debunk specific false claims with documented evidence'
],
'medium_term_actions': [
'Establish ongoing public consultation mechanisms',
'Create interactive tools showing trade agreement benefits',
'Partner with academic institutions for neutral analysis',
'Implement regular transparency reports on negotiation progress'
],
'key_messengers': [
'Trade ministers and chief negotiators',
'Independent economic analysts and trade experts',
'Business association leaders',
'Consumer advocacy representatives'
],
'communication_channels': [
'Government trade websites and official statements',
'Business media and economic publications',
'Public consultation platforms',
'Academic conferences and research papers'
],
'success_metrics': [
'Increase public understanding of trade benefits by 50%',
'Reduce conspiracy theory spread by 70%',
'Maintain business community support above 80%',
'Achieve successful agreement ratification'
],
'risk_mitigation': [
'Address legitimate concerns about trade impacts',
'Prepare for leaked document scenarios',
'Monitor for coordinated disinformation escalation',
'Maintain diplomatic relationships during transparency efforts'
]
},
'pred_005': {
'title': 'Military Exercises - Military Transparency',
'priority': 'LOW PRIORITY',
'timeline': '2-4 weeks',
'strategy': 'Military Transparency',
'immediate_actions': [
'Publish detailed exercise scenarios and objectives',
'Invite international media observers to selected training events',
'Release video documentation of exercise activities',
'Coordinate messaging across all participating allied nations'
],
'medium_term_actions': [
'Develop regular military transparency reporting',
'Create public education materials on defensive cooperation',
'Establish civilian-military dialogue programs',
'Document and share exercise learnings and outcomes'
],
'key_messengers': [
'Military exercise commanders and spokespersons',
'Defense ministers from participating countries',
'Military analysts and defense correspondents',
'Veteran and military family representatives'
],
'communication_channels': [
'Defense ministry official communications',
'Military and defense media outlets',
'International security conference platforms',
'Educational institutions and military academies'
],
'success_metrics': [
'Maintain public support for defensive cooperation above 70%',
'Generate positive media coverage in 15+ countries',
'Achieve 95% transparency in exercise reporting',
'Establish long-term civilian-military dialogue mechanisms'
],
'risk_mitigation': [
'Balance transparency with operational security',
'Address regional security concerns diplomatically',
'Monitor for misinterpretation of exercise objectives',
'Coordinate with non-participating nations for understanding'
]
},
'pred_006': {
'title': 'Election Security - Civic Education',
'priority': 'MEDIUM PRIORITY',
'timeline': '1-2 weeks',
'strategy': 'Civic Education',
'immediate_actions': [
'Launch comprehensive voter education campaign on election security',
'Partner with cybersecurity experts for credible technical explanations',
'Create easy-to-understand infographics on voting system protections',
'Coordinate with election officials for unified messaging'
],
'medium_term_actions': [
'Organize public demonstrations of voting system security features',
'Establish voter confidence monitoring and response protocols',
'Create multilingual educational content for diverse communities',
'Develop ongoing civic engagement programs'
],
'key_messengers': [
'State and local election officials',
'Independent cybersecurity experts',
'Civic education organizations',
'Bipartisan political leadership'
],
'communication_channels': [
'Official election websites and communications',
'Public television and educational media',
'Community organizations and libraries',
'Social media platforms with verified accounts'
],
'success_metrics': [
'Increase voter confidence in election security by 35%',
'Reduce misinformation spread about voting systems by 60%',
'Achieve 80% awareness of security measures among voters',
'Maintain election integrity perception above 75%'
],
'risk_mitigation': [
'Address legitimate security concerns transparently',
'Prepare for pre-election and post-election scenarios',
'Monitor for coordinated attacks on election confidence',
'Maintain nonpartisan approach to avoid politicization'
]
}
}
return action_plans.get(prediction_id, {
'title': 'Action Plan Not Available',
'priority': 'UNDEFINED',
'timeline': 'N/A',
'strategy': 'Generic Response',
'immediate_actions': ['Contact relevant authorities', 'Monitor situation'],
'medium_term_actions': ['Develop comprehensive response strategy'],
'key_messengers': ['Appropriate officials'],
'communication_channels': ['Official channels'],
'success_metrics': ['To be determined'],
'risk_mitigation': ['Standard protocols']
})
# Global demo data instance
demo_data = DemoDataGenerator()
def get_sample_historical_patterns() -> List[Dict]:
"""Generate sample historical disinformation patterns"""
historical_patterns = [
{
"pattern_name": "Election Fraud Claims",
"description": "Coordinated campaigns claiming election fraud without evidence",
"effectiveness_score": 0.73,
"date_range": {"start": "2020-10-01", "end": "2021-01-31"},
"geographic_data": {"primary_regions": ["US", "Brazil"], "secondary_regions": ["UK", "Germany"]},
"tags": ["election", "fraud", "voting", "democracy"]
},
{
"pattern_name": "Vaccine Misinformation Waves",
"description": "Cyclical campaigns spreading vaccine hesitancy",
"effectiveness_score": 0.68,
"date_range": {"start": "2021-01-01", "end": "2023-12-31"},
"geographic_data": {"primary_regions": ["US", "Europe"], "secondary_regions": ["Australia", "Canada"]},
"tags": ["vaccine", "health", "side-effects", "conspiracy"]
},
{
"pattern_name": "Climate Denial Resurgence",
"description": "Coordinated attacks on climate science credibility",
"effectiveness_score": 0.45,
"date_range": {"start": "2023-01-01", "end": "2024-01-01"},
"geographic_data": {"primary_regions": ["US", "Australia"], "secondary_regions": ["UK", "Canada"]},
"tags": ["climate", "science", "denial", "funding"]
}
]
return historical_patterns