Skip to main content

scripts-strategy-visual-frameworks

#!/usr/bin/env python3 """

title: "Strategy Visual Frameworks" component_type: script version: "1.0.0" audience: contributor status: stable summary: "Strategy Visual Frameworks ==========================" keywords: ['analysis', 'frameworks', 'review', 'strategy', 'visual'] tokens: ~500 created: 2025-12-22 updated: 2025-12-22 script_name: "strategy-visual-frameworks.py" language: python executable: true usage: "python3 scripts/strategy-visual-frameworks.py [options]" python_version: "3.10+" dependencies: [] modifies_files: false network_access: false requires_auth: false

Strategy Visual Frameworks

Generate visual strategy frameworks including charts, matrices, and maps. Outputs HTML with Plotly for interactive charts, Mermaid for diagrams.

Usage: python3 scripts/strategy-visual-frameworks.py --type swot --input data.json python3 scripts/strategy-visual-frameworks.py --type positioning-map --demo python3 scripts/strategy-visual-frameworks.py --type revenue-chart --output chart.html

Framework Types: swot - SWOT Matrix (HTML/CSS) positioning-map - Competitive Positioning Map (Plotly) market-growth - Market Growth Chart (Plotly) trend-radar - Trend Impact Radar (Plotly) revenue-chart - Revenue Projections (Plotly)

Source: Adapted from ANALYZE-REVIEW/extracted-consulting/visual_frameworks.py """

import argparse import json import sys from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Any

@dataclass class CompetitorPosition: """Competitive positioning data.""" name: str autonomy_score: float compliance_score: float revenue_millions: float growth_rate: float

class VisualFrameworkGenerator: """Generate visual strategy frameworks."""

COLORS = {
'primary': '#2563eb',
'secondary': '#7c3aed',
'positive': '#10b981',
'negative': '#ef4444',
'neutral': '#6b7280',
'background': '#f9fafb'
}

@classmethod
def generate_swot_matrix_html(cls, swot: Dict[str, List[str]]) -> str:
"""Generate SWOT matrix as styled HTML."""
def format_list(items: List[str]) -> str:
return ''.join(f'<li>{item}</li>' for item in items)

return f"""
SWOT Analysis

SWOT Analysis

Strengths

    {format_list(swot.get('strengths', []))}

Weaknesses

    {format_list(swot.get('weaknesses', []))}

Opportunities

    {format_list(swot.get('opportunities', []))}

Threats

    {format_list(swot.get('threats', []))}
"""
@classmethod
def generate_positioning_map_html(cls, competitors: List[Dict]) -> str:
"""Generate competitive positioning map with Plotly."""
data_json = json.dumps(competitors)

return f"""
Competitive Positioning Map
"""
@classmethod
def generate_market_growth_chart_html(cls, years: List[int],
market_size: List[float],
industry: str) -> str:
"""Generate market growth chart with Plotly."""
if len(market_size) > 1:
cagr = (pow(market_size[-1] / market_size[0], 1/(len(market_size)-1)) - 1) * 100
else:
cagr = 0

return f"""
Market Growth - {industry}
"""
@classmethod
def generate_revenue_projections_html(cls, projections: Dict[str, List[float]],
years: List[int]) -> str:
"""Generate revenue projections with scenarios."""
return f"""
Revenue Projections
"""

def get_demo_data(framework_type: str) -> Dict[str, Any]: """Return demo data for each framework type.""" demos = { 'swot': { 'strengths': ['Strong brand recognition', 'Experienced team', 'Proprietary technology'], 'weaknesses': ['Limited market presence', 'High customer concentration', 'Legacy systems'], 'opportunities': ['AI market growth', 'Geographic expansion', 'Strategic partnerships'], 'threats': ['Intense competition', 'Regulatory changes', 'Talent shortage'] }, 'positioning-map': [ {'name': 'Competitor A', 'autonomy_score': 60, 'compliance_score': 85, 'revenue_millions': 500, 'growth_rate': 5}, {'name': 'Competitor B', 'autonomy_score': 85, 'compliance_score': 40, 'revenue_millions': 200, 'growth_rate': 25}, {'name': 'Your Company', 'autonomy_score': 90, 'compliance_score': 95, 'revenue_millions': 50, 'growth_rate': 100} ], 'market-growth': { 'years': [2024, 2025, 2026, 2027, 2028], 'market_size': [43.0, 52.0, 63.0, 76.0, 92.0], 'industry': 'AI Development Tools' }, 'revenue-chart': { 'years': [2024, 2025, 2026, 2027, 2028], 'projections': { 'optimistic': [5, 15, 35, 70, 120], 'base': [5, 12, 25, 45, 75], 'conservative': [5, 8, 15, 28, 45] } } } return demos.get(framework_type, demos['swot'])

def main(): parser = argparse.ArgumentParser( description="Generate visual strategy frameworks", formatter_class=argparse.RawDescriptionHelpFormatter ) parser.add_argument('--type', choices=['swot', 'positioning-map', 'market-growth', 'revenue-chart'], default='swot', help='Framework type') parser.add_argument('--input', help='Input JSON file') parser.add_argument('--output', help='Output HTML file') parser.add_argument('--demo', action='store_true', help='Use demo data')

args = parser.parse_args()

if args.demo:
data = get_demo_data(args.type)
elif args.input:
data = json.loads(Path(args.input).read_text())
else:
print("Provide --input file or use --demo", file=sys.stderr)
sys.exit(1)

generator = VisualFrameworkGenerator()

if args.type == 'swot':
output = generator.generate_swot_matrix_html(data)
elif args.type == 'positioning-map':
output = generator.generate_positioning_map_html(data)
elif args.type == 'market-growth':
output = generator.generate_market_growth_chart_html(
data['years'], data['market_size'], data.get('industry', 'Industry'))
elif args.type == 'revenue-chart':
output = generator.generate_revenue_projections_html(
data['projections'], data['years'])
else:
output = "Framework type not implemented"

if args.output:
Path(args.output).write_text(output)
print(f"Framework saved to: {args.output}")
else:
print(output)

if name == "main": main()