UN Motion Analysis Guide
October 30, 2025 ยท View on GitHub
Quick reference for running and understanding UN motion analyses.
Quick Start
1. Run a Motion Simulation
# Full simulation (all countries)
python3 scripts/run_motion.py 01_gaza_ceasefire_resolution
# Test with sample
python3 scripts/run_motion.py 01_gaza_ceasefire_resolution --sample 5
Output: tasks/reactions/01_gaza_ceasefire_resolution_latest.json
2. Analyze Bilateral Impact (Israel)
# Analyze Israel's bilateral relationships
python3 scripts/analyze_israel_bilateral_impact.py 01_gaza_ceasefire_resolution
Outputs:
- JSON:
tasks/analysis/01_gaza_ceasefire_resolution_israel_bilateral_impact_latest.json - CSV:
tasks/analysis/01_gaza_ceasefire_resolution_israel_bilateral_impact.csv
3. Generate PDF Report
# From JSON analysis
python3 scripts/generate_simple_pdf.py tasks/analysis/01_gaza_ceasefire_resolution_israel_bilateral_impact_latest.json
# From markdown analysis
python3 scripts/generate_simple_pdf.py analysis/01_gaza_ceasefire_resolution_analysis_REVISED.md
Output: tasks/analysis/pdf/{filename}.pdf
Analysis Types
Bilateral Impact Analysis
Purpose: Understand how votes affect country-to-country relationships
Categories:
- ๐ Strengthened Significantly - Major improvement
- ๐ข Strengthened Moderately - Noticeable improvement
- ๐ก Strengthened Slightly - Minor improvement
- โช Neutral - No meaningful change
- ๐ Strained Slightly - Minor tension
- ๐ด Strained Moderately - Noticeable tension
- ๐ฅ Strained Significantly - Major deterioration
Factors Considered:
- Historical relationship baseline
- Vote alignment/divergence
- Diplomatic tone in statement
- Strategic implications
- Regional dynamics
- Economic/security ties
JSON Schema - Bilateral Impact
{
"motion_id": "01_gaza_ceasefire_resolution",
"timestamp": "2025-10-09T12:04:11",
"model": "claude-3-5-haiku-20241022",
"total_analyzed": 195,
"impact_summary": {
"strengthened_significantly": 5,
"strengthened_moderately": 15,
"strengthened_slightly": 45,
"neutral": 100,
"strained_slightly": 20,
"strained_moderately": 8,
"strained_significantly": 2
},
"analyses": [
{
"country": "Country Name",
"vote": "yes|no|abstain",
"statement": "Official voting statement...",
"impact_analysis": {
"impact_category": "neutral",
"reasoning": "Brief 2-3 sentence analysis of impact",
"confidence": "high|medium|low",
"key_factors": [
"Factor 1 affecting relationship",
"Factor 2 affecting relationship"
]
}
}
]
}
Performance
Speed Comparison (195 countries)
| Model | Time | Cost | Quality |
|---|---|---|---|
| Claude 3.5 Haiku | 6-10 min | $2-4 | Good |
| Claude 3.5 Sonnet | 20-30 min | $20-40 | Excellent |
| Claude Opus | 40-60 min | $80-160 | Best |
Recommendation: Use Haiku for speed, Sonnet for production reports
Common Workflows
Workflow 1: Full Analysis Pipeline
# 1. Run motion (if not done)
python3 scripts/run_motion.py 01_gaza_ceasefire_resolution
# 2. Analyze bilateral impact
python3 scripts/analyze_israel_bilateral_impact.py 01_gaza_ceasefire_resolution
# 3. Generate PDF report
python3 scripts/generate_simple_pdf.py tasks/analysis/01_gaza_ceasefire_resolution_israel_bilateral_impact_latest.json
# 4. View results
open tasks/analysis/pdf/01_gaza_ceasefire_resolution_israel_bilateral_impact_latest.pdf
Workflow 2: Quick Test
# Test with 10 countries
python3 scripts/run_motion.py 01_gaza_ceasefire_resolution --sample 10
python3 scripts/analyze_israel_bilateral_impact.py 01_gaza_ceasefire_resolution --sample 10
Workflow 3: CSV Analysis
# Generate analysis
python3 scripts/analyze_israel_bilateral_impact.py 01_gaza_ceasefire_resolution
# Open in spreadsheet
# CSV location: tasks/analysis/01_gaza_ceasefire_resolution_israel_bilateral_impact.csv
File Locations
AI-Agent-UN/
โโโ tasks/
โ โโโ motions/ # Input: resolution texts
โ โ โโโ 01_gaza_ceasefire_resolution.md
โ โโโ reactions/ # Output: voting results
โ โ โโโ 01_gaza_ceasefire_resolution_latest.json
โ โโโ analysis/ # Output: analyses
โ โโโ pdf/ # PDF reports
โ โโโ *_israel_bilateral_impact_latest.json
โ โโโ *_israel_bilateral_impact.csv
โโโ scripts/
โ โโโ run_motion.py # Run voting simulation
โ โโโ analyze_israel_bilateral_impact.py
โ โโโ generate_simple_pdf.py # PDF generator
โ โโโ generate_pdf_report.py # Alternative PDF
โโโ analysis/
โโโ 01_gaza_ceasefire_resolution_analysis_REVISED.md
Troubleshooting
Missing API Key
export ANTHROPIC_API_KEY="your-key-here"
Or create .env file:
ANTHROPIC_API_KEY=your-key-here
Python Environment Issues
# Use system Python
python3 scripts/analyze_israel_bilateral_impact.py ...
# Or fix virtual environment
rm -rf .venv
python3 -m venv .venv
source .venv/bin/activate
pip install anthropic python-dotenv reportlab
PDF Generation Fails
# Install reportlab
pip install --break-system-packages reportlab
# Or use simple PDF generator
python3 scripts/generate_simple_pdf.py <input_file>
Next Steps
- โ Run bilateral impact analysis
- โ Generate PDF reports
- ๐ Create visualizations (charts, graphs)
- ๐ Regional bloc analysis
- ๐ Time series tracking
- ๐ Multi-country relationship networks