Spaces:
Sleeping
Sleeping
| import os | |
| import json | |
| import pandas as pd | |
| import streamlit as st | |
| import plotly.express as px | |
| import plotly.graph_objects as go | |
| from openai import OpenAI | |
| from datetime import datetime | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| API_KEY = os.getenv("OPENAI_API_KEY") | |
| # Page configuration | |
| st.set_page_config( | |
| page_title="SoftwareGrid AI - Intelligent Software Procurement", | |
| page_icon="π―", | |
| layout="wide", | |
| initial_sidebar_state="expanded" | |
| ) | |
| # Custom CSS | |
| st.markdown(""" | |
| <style> | |
| .main-header { | |
| font-size: 2.5rem; | |
| font-weight: bold; | |
| background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| margin-bottom: 1rem; | |
| } | |
| .metric-card { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| padding: 1.5rem; | |
| border-radius: 10px; | |
| color: white; | |
| } | |
| .software-card { | |
| border: 2px solid #e0e0e0; | |
| border-radius: 10px; | |
| padding: 1.5rem; | |
| margin: 1rem 0; | |
| transition: all 0.3s; | |
| } | |
| .software-card:hover { | |
| border-color: #667eea; | |
| box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2); | |
| } | |
| .stButton>button { | |
| width: 100%; | |
| border-radius: 8px; | |
| font-weight: 600; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # Initialize session state | |
| if 'api_key' not in st.session_state: | |
| st.session_state.api_key = API_KEY # load from env automatically | |
| if 'software_database' not in st.session_state: | |
| st.session_state.software_database = [] | |
| if 'compare_list' not in st.session_state: | |
| st.session_state.compare_list = [] | |
| if 'chat_history' not in st.session_state: | |
| st.session_state.chat_history = [] | |
| if 'user_requirements' not in st.session_state: | |
| st.session_state.user_requirements = {} | |
| # Sample software database | |
| SOFTWARE_DATABASE = [ | |
| # Original 12 products (with corrected data) | |
| { | |
| "name": "Zoom", | |
| "category": "Video Conferencing", | |
| "description": "HD video conferencing and virtual meetings platform", | |
| "pricing_min": 0, | |
| "pricing_max": 19.99, | |
| "pricing_unit": "user/month", | |
| "features": ["HD Video", "Screen Sharing", "Recording", "Breakout Rooms", "Webinar Mode"], | |
| "users": "300M+", | |
| "rating": 4.5, | |
| "negotiable": True, | |
| "g2_score": 4.5, | |
| "integrations": ["Slack", "Microsoft Teams", "Salesforce", "Google Calendar"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "Slack", | |
| "category": "Team Communication", | |
| "description": "Team messaging and collaboration platform", | |
| "pricing_min": 0, | |
| "pricing_max": 12.50, | |
| "pricing_unit": "user/month", | |
| "features": ["Channels", "Direct Messages", "File Sharing", "App Integrations", "Search"], | |
| "users": "50M+", | |
| "rating": 4.6, | |
| "negotiable": True, | |
| "g2_score": 4.5, | |
| "integrations": ["Google Drive", "Zoom", "Salesforce", "Jira"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "Microsoft Teams", | |
| "category": "Video Conferencing", | |
| "description": "Chat, meetings, calls, and collaboration in Office 365", | |
| "pricing_min": 0, | |
| "pricing_max": 12.50, | |
| "pricing_unit": "user/month", | |
| "features": ["Video Calls", "Chat", "File Storage", "Office Integration", "Teams Channels"], | |
| "users": "280M+", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.3, | |
| "integrations": ["Office 365", "SharePoint", "OneDrive", "Power BI"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Google Workspace", | |
| "category": "Email & Productivity", | |
| "description": "Email, docs, drive, and collaboration suite", | |
| "pricing_min": 6, | |
| "pricing_max": 18, | |
| "pricing_unit": "user/month", | |
| "features": ["Gmail", "Drive", "Docs/Sheets", "Meet", "Calendar", "Admin Console"], | |
| "users": "3B+", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.6, | |
| "integrations": ["Slack", "Zoom", "Salesforce", "Asana"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Asana", | |
| "category": "Project Management", | |
| "description": "Work management platform for team collaboration", | |
| "pricing_min": 0, | |
| "pricing_max": 24.99, | |
| "pricing_unit": "user/month", | |
| "features": ["Task Management", "Timelines", "Workflows", "Reporting", "Portfolios"], | |
| "users": "150M+", | |
| "rating": 4.5, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Slack", "Google Drive", "Microsoft Teams", "Salesforce"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "Monday.com", | |
| "category": "Project Management", | |
| "description": "Work operating system for team productivity", | |
| "pricing_min": 8, | |
| "pricing_max": 16, | |
| "pricing_unit": "user/month", | |
| "features": ["Custom Workflows", "Dashboards", "Automations", "Time Tracking", "Forms"], | |
| "users": "180K+", | |
| "rating": 4.6, | |
| "negotiable": True, | |
| "g2_score": 4.7, | |
| "integrations": ["Slack", "Zoom", "Microsoft Teams", "Google Drive"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "Notion", | |
| "category": "Knowledge Management", | |
| "description": "All-in-one workspace for notes, docs, and wikis", | |
| "pricing_min": 0, | |
| "pricing_max": 10, | |
| "pricing_unit": "user/month", | |
| "features": ["Wiki", "Docs", "Databases", "Kanban Boards", "Templates"], | |
| "users": "30M+", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Slack", "Google Drive", "Figma", "GitHub"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Salesforce", | |
| "category": "CRM", | |
| "description": "Customer relationship management platform", | |
| "pricing_min": 25, | |
| "pricing_max": 300, | |
| "pricing_unit": "user/month", | |
| "features": ["Lead Management", "Sales Pipeline", "Analytics", "Mobile App", "Einstein AI"], | |
| "users": "150K+ companies", | |
| "rating": 4.4, | |
| "negotiable": True, | |
| "g2_score": 4.3, | |
| "integrations": ["Slack", "Google Workspace", "Microsoft 365", "Zoom"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Jira", | |
| "category": "Project Management", | |
| "description": "Issue tracking and agile project management", | |
| "pricing_min": 0, | |
| "pricing_max": 14.50, | |
| "pricing_unit": "user/month", | |
| "features": ["Scrum Boards", "Kanban", "Roadmaps", "Reports", "Automation"], | |
| "users": "65K+ companies", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.2, | |
| "integrations": ["Confluence", "Slack", "GitHub", "Microsoft Teams"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "Dropbox Business", | |
| "category": "Cloud Storage", | |
| "description": "Cloud storage and file sharing platform", | |
| "pricing_min": 12.50, | |
| "pricing_max": 20, | |
| "pricing_unit": "user/month", | |
| "features": ["Unlimited Storage", "Advanced Sharing", "Version History", "Admin Tools", "Paper"], | |
| "users": "700M+", | |
| "rating": 4.4, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Slack", "Zoom", "Microsoft Office", "Google Workspace"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Figma", | |
| "category": "Design Tools", | |
| "description": "Collaborative interface design tool", | |
| "pricing_min": 0, | |
| "pricing_max": 15, | |
| "pricing_unit": "user/month", | |
| "features": ["Design", "Prototyping", "Real-time Collaboration", "Dev Mode", "FigJam"], | |
| "users": "4M+", | |
| "rating": 4.8, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Slack", "Jira", "Notion", "Microsoft Teams"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "GitHub Enterprise", | |
| "category": "Developer Tools", | |
| "description": "Code hosting and collaboration platform", | |
| "pricing_min": 21, | |
| "pricing_max": 21, | |
| "pricing_unit": "user/month", | |
| "features": ["Version Control", "CI/CD", "Code Review", "Security Scanning", "Actions"], | |
| "users": "100M+", | |
| "rating": 4.8, | |
| "negotiable": True, | |
| "g2_score": 4.7, | |
| "integrations": ["Slack", "Jira", "Microsoft Teams", "VS Code"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| # New products (38 additional products) | |
| { | |
| "name": "Zendesk", | |
| "category": "Customer Service", | |
| "description": "Customer service and engagement platform", | |
| "pricing_min": 19, | |
| "pricing_max": 115, | |
| "pricing_unit": "user/month", | |
| "features": ["Ticketing System", "Live Chat", "Knowledge Base", "AI Automation", "Omnichannel Support"], | |
| "users": "100K+ companies", | |
| "rating": 4.3, | |
| "negotiable": True, | |
| "g2_score": 4.3, | |
| "integrations": ["Slack", "Salesforce", "Jira", "Microsoft Teams"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Intercom", | |
| "category": "Customer Service", | |
| "description": "Conversational relationship platform", | |
| "pricing_min": 74, | |
| "pricing_max": 150, | |
| "pricing_unit": "user/month", | |
| "features": ["Live Chat", "Chatbots", "Product Tours", "Email Marketing", "Help Center"], | |
| "users": "25K+ companies", | |
| "rating": 4.5, | |
| "negotiable": True, | |
| "g2_score": 4.5, | |
| "integrations": ["Slack", "Salesforce", "HubSpot", "Stripe"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "HubSpot Service Hub", | |
| "category": "Customer Service", | |
| "description": "Customer service software with CRM integration", | |
| "pricing_min": 0, | |
| "pricing_max": 100, | |
| "pricing_unit": "user/month", | |
| "features": ["Ticketing", "Live Chat", "Customer Portal", "Knowledge Base", "Automation"], | |
| "users": "228K+ companies", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.4, | |
| "integrations": ["HubSpot CRM", "Slack", "Gmail", "Salesforce"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "HubSpot Marketing Hub", | |
| "category": "Marketing Automation", | |
| "description": "Inbound marketing and automation platform", | |
| "pricing_min": 0, | |
| "pricing_max": 3600, | |
| "pricing_unit": "month", | |
| "features": ["Email Marketing", "Marketing Automation", "Lead Management", "Analytics", "SEO Tools"], | |
| "users": "228K+ companies", | |
| "rating": 4.5, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Salesforce", "WordPress", "Shopify", "Google Ads"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "Mailchimp", | |
| "category": "Marketing Automation", | |
| "description": "Email marketing and automation platform", | |
| "pricing_min": 0, | |
| "pricing_max": 350, | |
| "pricing_unit": "month", | |
| "features": ["Email Campaigns", "Marketing Automation", "Landing Pages", "Analytics", "CRM"], | |
| "users": "13M+", | |
| "rating": 4.3, | |
| "negotiable": False, | |
| "g2_score": 4.3, | |
| "integrations": ["Shopify", "WordPress", "Salesforce", "Google Analytics"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "ActiveCampaign", | |
| "category": "Marketing Automation", | |
| "description": "Customer experience automation platform", | |
| "pricing_min": 15, | |
| "pricing_max": 259, | |
| "pricing_unit": "month", | |
| "features": ["Email Marketing", "Marketing Automation", "CRM", "Sales Automation", "Machine Learning"], | |
| "users": "180K+", | |
| "rating": 4.6, | |
| "negotiable": True, | |
| "g2_score": 4.5, | |
| "integrations": ["Shopify", "WordPress", "Salesforce", "Facebook"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Marketo", | |
| "category": "Marketing Automation", | |
| "description": "Enterprise marketing automation platform", | |
| "pricing_min": 895, | |
| "pricing_max": 3195, | |
| "pricing_unit": "month", | |
| "features": ["Lead Management", "Email Marketing", "Analytics", "Account-Based Marketing", "AI"], | |
| "users": "5K+ companies", | |
| "rating": 4.1, | |
| "negotiable": True, | |
| "g2_score": 4.1, | |
| "integrations": ["Salesforce", "Microsoft Dynamics", "Adobe Experience Cloud", "Zoom"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "BambooHR", | |
| "category": "HR Software", | |
| "description": "Human resources management platform", | |
| "pricing_min": 6, | |
| "pricing_max": 12, | |
| "pricing_unit": "user/month", | |
| "features": ["Employee Records", "Time Tracking", "Onboarding", "Performance Management", "Reporting"], | |
| "users": "33K+ companies", | |
| "rating": 4.6, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Slack", "Google Workspace", "Paylocity", "ADP"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Gusto", | |
| "category": "HR Software", | |
| "description": "Payroll and HR platform for small businesses", | |
| "pricing_min": 40, | |
| "pricing_max": 80, | |
| "pricing_unit": "month", | |
| "features": ["Payroll", "Benefits", "Time Tracking", "HR Support", "Compliance"], | |
| "users": "300K+ companies", | |
| "rating": 4.6, | |
| "negotiable": False, | |
| "g2_score": 4.6, | |
| "integrations": ["QuickBooks", "Xero", "TSheets", "Slack"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Rippling", | |
| "category": "HR Software", | |
| "description": "Unified HR, IT, and finance platform", | |
| "pricing_min": 8, | |
| "pricing_max": 15, | |
| "pricing_unit": "user/month", | |
| "features": ["HR Management", "Payroll", "IT Management", "App Management", "Global Hiring"], | |
| "users": "10K+ companies", | |
| "rating": 4.9, | |
| "negotiable": True, | |
| "g2_score": 4.8, | |
| "integrations": ["Slack", "Google Workspace", "Okta", "Salesforce"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "Workday", | |
| "category": "HR Software", | |
| "description": "Enterprise cloud applications for finance and HR", | |
| "pricing_min": 100, | |
| "pricing_max": 300, | |
| "pricing_unit": "user/month", | |
| "features": ["HCM", "Financial Management", "Analytics", "Planning", "Payroll"], | |
| "users": "10K+ companies", | |
| "rating": 4.2, | |
| "negotiable": True, | |
| "g2_score": 4.0, | |
| "integrations": ["Slack", "Microsoft Teams", "Okta", "ServiceNow"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "QuickBooks Online", | |
| "category": "Accounting", | |
| "description": "Cloud-based accounting software", | |
| "pricing_min": 35, | |
| "pricing_max": 200, | |
| "pricing_unit": "month", | |
| "features": ["Invoicing", "Expense Tracking", "Payroll", "Tax Filing", "Reporting"], | |
| "users": "7M+ companies", | |
| "rating": 4.3, | |
| "negotiable": False, | |
| "g2_score": 4.0, | |
| "integrations": ["Shopify", "PayPal", "Square", "Bill.com"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Xero", | |
| "category": "Accounting", | |
| "description": "Cloud accounting software for small business", | |
| "pricing_min": 15, | |
| "pricing_max": 78, | |
| "pricing_unit": "month", | |
| "features": ["Bank Reconciliation", "Invoicing", "Inventory", "Financial Reporting", "Multi-Currency"], | |
| "users": "3.5M+", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.3, | |
| "integrations": ["Shopify", "Stripe", "PayPal", "HubSpot"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "FreshBooks", | |
| "category": "Accounting", | |
| "description": "Accounting software for small businesses", | |
| "pricing_min": 19, | |
| "pricing_max": 60, | |
| "pricing_unit": "month", | |
| "features": ["Invoicing", "Expense Tracking", "Time Tracking", "Project Management", "Reporting"], | |
| "users": "30M+", | |
| "rating": 4.5, | |
| "negotiable": False, | |
| "g2_score": 4.5, | |
| "integrations": ["Stripe", "PayPal", "Google Apps", "Gusto"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Tableau", | |
| "category": "Analytics", | |
| "description": "Visual analytics and business intelligence platform", | |
| "pricing_min": 70, | |
| "pricing_max": 70, | |
| "pricing_unit": "user/month", | |
| "features": ["Data Visualization", "Dashboards", "Analytics", "Mobile", "Collaboration"], | |
| "users": "86K+ companies", | |
| "rating": 4.4, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Salesforce", "Google Analytics", "AWS", "Snowflake"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "Power BI", | |
| "category": "Analytics", | |
| "description": "Business analytics service by Microsoft", | |
| "pricing_min": 10, | |
| "pricing_max": 20, | |
| "pricing_unit": "user/month", | |
| "features": ["Data Visualization", "Dashboards", "AI Insights", "Real-time Analytics", "Collaboration"], | |
| "users": "5M+", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.4, | |
| "integrations": ["Azure", "Excel", "SQL Server", "Dynamics 365"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Looker", | |
| "category": "Analytics", | |
| "description": "Enterprise platform for business intelligence", | |
| "pricing_min": 5000, | |
| "pricing_max": 10000, | |
| "pricing_unit": "month", | |
| "features": ["Data Modeling", "Embedded Analytics", "Real-time Dashboards", "API", "LookML"], | |
| "users": "2K+ companies", | |
| "rating": 4.5, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["BigQuery", "Snowflake", "Redshift", "Slack"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "1Password", | |
| "category": "Security", | |
| "description": "Password manager for individuals and businesses", | |
| "pricing_min": 2.99, | |
| "pricing_max": 7.99, | |
| "pricing_unit": "user/month", | |
| "features": ["Password Vault", "2FA", "Secure Sharing", "Travel Mode", "Watchtower"], | |
| "users": "150K+ companies", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Okta", "Azure AD", "Slack", "GitHub"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "LastPass", | |
| "category": "Security", | |
| "description": "Password management and single sign-on", | |
| "pricing_min": 4, | |
| "pricing_max": 9, | |
| "pricing_unit": "user/month", | |
| "features": ["Password Vault", "Auto-fill", "Password Sharing", "MFA", "Security Dashboard"], | |
| "users": "33M+", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.4, | |
| "integrations": ["Okta", "Azure AD", "G Suite", "Salesforce"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Okta", | |
| "category": "Security", | |
| "description": "Identity and access management platform", | |
| "pricing_min": 2, | |
| "pricing_max": 15, | |
| "pricing_unit": "user/month", | |
| "features": ["SSO", "MFA", "Lifecycle Management", "API Access Management", "Adaptive MFA"], | |
| "users": "18K+ companies", | |
| "rating": 4.4, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Salesforce", "Office 365", "Google Workspace", "AWS"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "CrowdStrike", | |
| "category": "Security", | |
| "description": "Cloud-native endpoint protection platform", | |
| "pricing_min": 8.99, | |
| "pricing_max": 22.99, | |
| "pricing_unit": "user/month", | |
| "features": ["Endpoint Protection", "Threat Intelligence", "EDR", "Managed Hunting", "Cloud Security"], | |
| "users": "24K+ companies", | |
| "rating": 4.6, | |
| "negotiable": True, | |
| "g2_score": 4.6, | |
| "integrations": ["ServiceNow", "Splunk", "Palo Alto", "AWS"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Shopify", | |
| "category": "E-commerce", | |
| "description": "E-commerce platform for online stores", | |
| "pricing_min": 39, | |
| "pricing_max": 399, | |
| "pricing_unit": "month", | |
| "features": ["Online Store", "POS", "Marketing", "Payments", "Analytics"], | |
| "users": "4M+ merchants", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.4, | |
| "integrations": ["Facebook", "Instagram", "Amazon", "eBay"], | |
| "compliance": ["PCI DSS", "GDPR", "SOC2"] | |
| }, | |
| { | |
| "name": "WooCommerce", | |
| "category": "E-commerce", | |
| "description": "Open-source e-commerce plugin for WordPress", | |
| "pricing_min": 0, | |
| "pricing_max": 0, | |
| "pricing_unit": "free", | |
| "features": ["Product Management", "Payment Gateways", "Shipping", "Extensions", "Analytics"], | |
| "users": "5M+ sites", | |
| "rating": 4.1, | |
| "negotiable": False, | |
| "g2_score": 4.1, | |
| "integrations": ["Stripe", "PayPal", "Mailchimp", "Google Analytics"], | |
| "compliance": ["PCI DSS", "GDPR"] | |
| }, | |
| { | |
| "name": "Stripe", | |
| "category": "Payment Processing", | |
| "description": "Online payment processing platform", | |
| "pricing_min": 2.9, | |
| "pricing_max": 2.9, | |
| "pricing_unit": "% per transaction", | |
| "features": ["Payment Processing", "Subscriptions", "Invoicing", "Fraud Prevention", "Global Payments"], | |
| "users": "4M+ businesses", | |
| "rating": 4.6, | |
| "negotiable": False, | |
| "g2_score": 4.4, | |
| "integrations": ["Shopify", "WooCommerce", "Salesforce", "QuickBooks"], | |
| "compliance": ["PCI DSS", "SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Square", | |
| "category": "Payment Processing", | |
| "description": "Payment processing and POS system", | |
| "pricing_min": 2.6, | |
| "pricing_max": 2.9, | |
| "pricing_unit": "% per transaction", | |
| "features": ["Payment Processing", "POS", "Invoicing", "Payroll", "E-commerce"], | |
| "users": "2M+ businesses", | |
| "rating": 4.6, | |
| "negotiable": False, | |
| "g2_score": 4.6, | |
| "integrations": ["QuickBooks", "WooCommerce", "BigCommerce", "Wix"], | |
| "compliance": ["PCI DSS", "SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "DocuSign", | |
| "category": "Document Management", | |
| "description": "Electronic signature and contract management", | |
| "pricing_min": 10, | |
| "pricing_max": 40, | |
| "pricing_unit": "user/month", | |
| "features": ["E-signatures", "Contract Management", "Workflow Automation", "Mobile", "Analytics"], | |
| "users": "1M+ companies", | |
| "rating": 4.5, | |
| "negotiable": True, | |
| "g2_score": 4.5, | |
| "integrations": ["Salesforce", "Microsoft Office", "Google Drive", "Dropbox"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Confluence", | |
| "category": "Knowledge Management", | |
| "description": "Team collaboration and documentation platform", | |
| "pricing_min": 0, | |
| "pricing_max": 10.50, | |
| "pricing_unit": "user/month", | |
| "features": ["Wikis", "Documentation", "Templates", "Collaboration", "Integration"], | |
| "users": "60K+ companies", | |
| "rating": 4.1, | |
| "negotiable": False, | |
| "g2_score": 4.1, | |
| "integrations": ["Jira", "Slack", "Microsoft Teams", "Google Drive"], | |
| "compliance": ["SOC2", "GDPR", "ISO27001"] | |
| }, | |
| { | |
| "name": "Trello", | |
| "category": "Project Management", | |
| "description": "Visual collaboration tool for organizing work", | |
| "pricing_min": 0, | |
| "pricing_max": 17.50, | |
| "pricing_unit": "user/month", | |
| "features": ["Boards", "Cards", "Power-Ups", "Automation", "Templates"], | |
| "users": "50M+", | |
| "rating": 4.4, | |
| "negotiable": False, | |
| "g2_score": 4.3, | |
| "integrations": ["Slack", "Google Drive", "Jira", "GitHub"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "ClickUp", | |
| "category": "Project Management", | |
| "description": "All-in-one productivity platform", | |
| "pricing_min": 0, | |
| "pricing_max": 19, | |
| "pricing_unit": "user/month", | |
| "features": ["Task Management", "Docs", "Goals", "Time Tracking", "Dashboards"], | |
| "users": "10M+", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Slack", "Google Drive", "Zoom", "GitHub"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "HubSpot CRM", | |
| "category": "CRM", | |
| "description": "Free CRM with sales and marketing tools", | |
| "pricing_min": 0, | |
| "pricing_max": 1200, | |
| "pricing_unit": "month", | |
| "features": ["Contact Management", "Email Tracking", "Pipeline Management", "Reporting", "Mobile App"], | |
| "users": "228K+ companies", | |
| "rating": 4.4, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Gmail", "Outlook", "Slack", "Zoom"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA"] | |
| }, | |
| { | |
| "name": "Pipedrive", | |
| "category": "CRM", | |
| "description": "Sales-focused CRM platform", | |
| "pricing_min": 14, | |
| "pricing_max": 99, | |
| "pricing_unit": "user/month", | |
| "features": ["Pipeline Management", "Lead Generation", "Email Integration", "Automation", "Reporting"], | |
| "users": "100K+ companies", | |
| "rating": 4.3, | |
| "negotiable": True, | |
| "g2_score": 4.2, | |
| "integrations": ["Gmail", "Slack", "Mailchimp", "Zapier"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Airtable", | |
| "category": "Database", | |
| "description": "Low-code platform for building collaborative apps", | |
| "pricing_min": 0, | |
| "pricing_max": 24, | |
| "pricing_unit": "user/month", | |
| "features": ["Custom Apps", "Database", "Automation", "Integrations", "Views"], | |
| "users": "300K+ organizations", | |
| "rating": 4.6, | |
| "negotiable": False, | |
| "g2_score": 4.6, | |
| "integrations": ["Slack", "Google Drive", "Salesforce", "Jira"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Miro", | |
| "category": "Collaboration", | |
| "description": "Online collaborative whiteboard platform", | |
| "pricing_min": 0, | |
| "pricing_max": 16, | |
| "pricing_unit": "user/month", | |
| "features": ["Whiteboarding", "Templates", "Video Chat", "Integrations", "Workshops"], | |
| "users": "60M+", | |
| "rating": 4.8, | |
| "negotiable": False, | |
| "g2_score": 4.8, | |
| "integrations": ["Zoom", "Microsoft Teams", "Slack", "Jira"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Canva", | |
| "category": "Design Tools", | |
| "description": "Graphic design platform for all skill levels", | |
| "pricing_min": 0, | |
| "pricing_max": 15, | |
| "pricing_unit": "user/month", | |
| "features": ["Templates", "Drag-and-Drop Editor", "Brand Kit", "Collaboration", "Stock Library"], | |
| "users": "170M+", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Dropbox", "Google Drive", "Slack", "Mailchimp"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Loom", | |
| "category": "Video Communication", | |
| "description": "Video messaging for work", | |
| "pricing_min": 0, | |
| "pricing_max": 12.50, | |
| "pricing_unit": "user/month", | |
| "features": ["Screen Recording", "Video Messaging", "Transcriptions", "Analytics", "Integrations"], | |
| "users": "25M+", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Slack", "Gmail", "Notion", "Jira"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Calendly", | |
| "category": "Scheduling", | |
| "description": "Scheduling automation platform", | |
| "pricing_min": 0, | |
| "pricing_max": 16, | |
| "pricing_unit": "user/month", | |
| "features": ["Automated Scheduling", "Calendar Integration", "Meeting Types", "Reminders", "Analytics"], | |
| "users": "20M+", | |
| "rating": 4.7, | |
| "negotiable": False, | |
| "g2_score": 4.7, | |
| "integrations": ["Zoom", "Google Calendar", "Salesforce", "HubSpot"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Zapier", | |
| "category": "Automation", | |
| "description": "Workflow automation platform", | |
| "pricing_min": 0, | |
| "pricing_max": 69, | |
| "pricing_unit": "month", | |
| "features": ["App Integration", "Multi-Step Workflows", "Filters", "Formatters", "Webhooks"], | |
| "users": "2M+", | |
| "rating": 4.5, | |
| "negotiable": False, | |
| "g2_score": 4.5, | |
| "integrations": ["5000+ apps"], | |
| "compliance": ["SOC2", "GDPR"] | |
| }, | |
| { | |
| "name": "Box", | |
| "category": "Cloud Storage", | |
| "description": "Cloud content management and collaboration", | |
| "pricing_min": 5, | |
| "pricing_max": 35, | |
| "pricing_unit": "user/month", | |
| "features": ["File Storage", "Collaboration", "Security", "Workflow Automation", "E-signatures"], | |
| "users": "100K+ companies", | |
| "rating": 4.2, | |
| "negotiable": True, | |
| "g2_score": 4.2, | |
| "integrations": ["Microsoft Office", "Google Workspace", "Slack", "Salesforce"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Smartsheet", | |
| "category": "Project Management", | |
| "description": "Work execution platform for enterprises", | |
| "pricing_min": 7, | |
| "pricing_max": 25, | |
| "pricing_unit": "user/month", | |
| "features": ["Grid", "Gantt", "Card View", "Automation", "Dashboards"], | |
| "users": "90% Fortune 100", | |
| "rating": 4.4, | |
| "negotiable": True, | |
| "g2_score": 4.4, | |
| "integrations": ["Salesforce", "Jira", "Slack", "Microsoft Teams"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| }, | |
| { | |
| "name": "Datadog", | |
| "category": "Monitoring", | |
| "description": "Cloud monitoring and security platform", | |
| "pricing_min": 15, | |
| "pricing_max": 31, | |
| "pricing_unit": "host/month", | |
| "features": ["Infrastructure Monitoring", "APM", "Log Management", "Security Monitoring", "Synthetics"], | |
| "users": "27K+ companies", | |
| "rating": 4.3, | |
| "negotiable": True, | |
| "g2_score": 4.3, | |
| "integrations": ["AWS", "Azure", "GCP", "Kubernetes"], | |
| "compliance": ["SOC2", "GDPR", "HIPAA", "ISO27001"] | |
| } | |
| ] | |
| # Initialize database | |
| if not st.session_state.software_database: | |
| st.session_state.software_database = SOFTWARE_DATABASE | |
| def call_openai(prompt, system_prompt="You are an expert software procurement consultant."): | |
| try: | |
| client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) | |
| completion = client.chat.completions.create( | |
| model="gpt-4o-mini", # or "gpt-4o" if you have access | |
| messages=[ | |
| {"role": "system", "content": system_prompt}, | |
| {"role": "user", "content": prompt} | |
| ], | |
| temperature=0.7, | |
| max_tokens=1000 | |
| ) | |
| return completion.choices[0].message.content | |
| except Exception as e: | |
| return f"β OpenAI API Error: {e}" | |
| # Sidebar | |
| with st.sidebar: | |
| st.markdown("---") | |
| st.markdown("### π Quick Stats") | |
| if st.session_state.compare_list: | |
| st.metric("Selected for Comparison", len(st.session_state.compare_list)) | |
| st.metric("Total Software", len(st.session_state.software_database)) | |
| st.markdown("---") | |
| st.markdown("### π― Navigation") | |
| page = st.radio("Go to:", [ | |
| "π Home", | |
| "π AI Matching Engine", | |
| "π Compare Software", | |
| "π‘ Strategy Optimizer", | |
| "π€ Negotiation Assistant", | |
| "π Usage Analytics" | |
| ]) | |
| # Main content | |
| if page == "π Home": | |
| st.markdown('<h1 class="main-header">π― SoftwareGrid AI</h1>', unsafe_allow_html=True) | |
| st.markdown("### Intelligent Software Procurement & Negotiation Platform") | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| st.info("**π― AI Matching**\n\nIntelligent software recommendations based on your needs") | |
| with col2: | |
| st.info("**π Smart Comparison**\n\nMulti-dimensional analysis of features, pricing & TCO") | |
| with col3: | |
| st.info("**π€ Negotiation AI**\n\nGet the best deals with data-driven negotiation strategies") | |
| st.markdown("---") | |
| st.markdown("## π Quick Start") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.markdown("### 1οΈβ£ Tell Us Your Needs") | |
| company_size = st.selectbox("Company Size", ["1-10", "11-50", "51-200", "201-1000", "1000+"]) | |
| industry = st.selectbox("Industry", ["Technology", "Healthcare", "Finance", "Education", "Retail", "Other"]) | |
| budget = st.selectbox("Monthly Budget", ["<$1K", "$1K-$5K", "$5K-$20K", "$20K-$50K", "$50K+"]) | |
| if st.button("π― Get AI Recommendations", type="primary"): | |
| with st.spinner("Analyzing your requirements..."): | |
| prompt = f""" | |
| You are an expert enterprise software consultant. Based on the following company profile, recommend the top 5 software tools or vendor bundles that best fit their needs. | |
| Company Profile: | |
| - Company Size: {company_size} employees | |
| - Industry: {industry} | |
| - Monthly Budget: {budget} | |
| Available software database: | |
| {json.dumps([ | |
| {"name": s["name"], "category": s["category"], "pricing": f"${s['pricing_min']}-{s['pricing_max']}/{s['pricing_unit']}"} | |
| for s in SOFTWARE_DATABASE | |
| ], indent=2)} | |
| Please perform a holistic evaluation, considering: | |
| 1. **Functional Coverage Efficiency** β Prefer software that covers multiple business needs (reduce overlap). | |
| 2. **Vendor Consolidation** β Recommend single-vendor bundles when one company provides multiple complementary tools. | |
| 3. **Cost Efficiency** β Stay within the monthly budget and note potential savings from reduced redundancy. | |
| 4. **Integration Simplicity** β Fewer vendors β lower integration and training overhead. | |
| 5. **Scalability and Fit** β Match features and complexity to company size and industry-specific workflows. | |
| Note that the overlap issue should be taken into account. It is necessary to consider the situation where many functions can be accomplished by purchasing lisence from just one company | |
| Provide recommendations with reasoning for each. | |
| """ | |
| response = call_openai(prompt) | |
| st.success("β Recommendations Generated!") | |
| st.markdown(response) | |
| with col2: | |
| st.markdown("### 2οΈβ£ Browse Software Catalog") | |
| categories = ["All"] + list(set([s["category"] for s in SOFTWARE_DATABASE])) | |
| selected_category = st.selectbox("Category", categories) | |
| filtered_software = SOFTWARE_DATABASE if selected_category == "All" else [s for s in SOFTWARE_DATABASE if s["category"] == selected_category] | |
| st.markdown(f"**{len(filtered_software)} software found**") | |
| for software in filtered_software[:5]: | |
| with st.expander(f"**{software['name']}** - {software['category']} β {software['rating']}"): | |
| st.markdown(f"*{software['description']}*") | |
| st.markdown(f"**π° Pricing:** ${software['pricing_min']}-${software['pricing_max']}/{software['pricing_unit']}") | |
| st.markdown(f"**π₯ Users:** {software['users']}") | |
| if st.button(f"Add to Compare", key=f"home_compare_{software['name']}"): | |
| if software not in st.session_state.compare_list: | |
| st.session_state.compare_list.append(software) | |
| st.success(f"Added {software['name']} to comparison!") | |
| else: | |
| st.warning("Already in comparison list") | |
| elif page == "π AI Matching Engine": | |
| st.markdown('<h1 class="main-header">π― AI Software Matching Engine</h1>', unsafe_allow_html=True) | |
| st.markdown("### Let AI help you find the perfect software for your needs") | |
| tab1, tab2 = st.tabs(["π¬ Conversational Analysis", "π Questionnaire"]) | |
| with tab1: | |
| st.markdown("#### Chat with our AI to discover your perfect software match") | |
| # Chat interface | |
| for msg in st.session_state.chat_history: | |
| with st.chat_message(msg["role"]): | |
| st.markdown(msg["content"]) | |
| user_input = st.chat_input("Describe your software needs...") | |
| if user_input: | |
| st.session_state.chat_history.append({"role": "user", "content": user_input}) | |
| with st.chat_message("user"): | |
| st.markdown(user_input) | |
| with st.chat_message("assistant"): | |
| with st.spinner("Analyzing..."): | |
| system_prompt = """You are an expert software procurement consultant. Help users find the best software solutions. | |
| Ask clarifying questions about: | |
| - Company size and structure | |
| - Industry and use cases | |
| - Budget constraints | |
| - Current software stack | |
| - Integration requirements | |
| - Compliance needs | |
| Be conversational and helpful. After gathering enough information, recommend specific software from the database.""" | |
| context = f""" | |
| Chat history: {json.dumps(st.session_state.chat_history[-5:])} | |
| Available software: {json.dumps([{"name": s["name"], "category": s["category"], "features": s["features"][:3]} for s in SOFTWARE_DATABASE], indent=2)} | |
| User message: {user_input} | |
| """ | |
| response = call_openai(context, system_prompt) | |
| st.markdown(response) | |
| st.session_state.chat_history.append({"role": "assistant", "content": response}) | |
| with tab2: | |
| st.markdown("#### Complete this questionnaire for precise recommendations") | |
| with st.form("requirements_form"): | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| team_size = st.number_input("Team Size", min_value=1, value=10) | |
| industry = st.selectbox("Industry", ["Technology", "Healthcare", "Finance", "Education", "Retail", "Manufacturing", "Other"]) | |
| remote_work = st.selectbox("Work Model", ["Fully Remote", "Hybrid", "In-Office"]) | |
| budget_range = st.selectbox("Monthly Budget per User", ["<$10", "$10-$30", "$30-$50", "$50-$100", "$100+"]) | |
| with col2: | |
| needs = st.multiselect("Primary Needs", [ | |
| "Team Communication", "Video Conferencing", "Project Management", | |
| "File Storage", "CRM", "Email", "Design Tools", "Developer Tools", | |
| "Knowledge Management", "Time Tracking" | |
| ]) | |
| integrations = st.multiselect("Must Integrate With", [ | |
| "Slack", "Microsoft Teams", "Google Workspace", "Salesforce", | |
| "Jira", "GitHub", "Zoom" | |
| ]) | |
| compliance = st.multiselect("Compliance Requirements", [ | |
| "GDPR", "HIPAA", "SOC2", "ISO27001" | |
| ]) | |
| submitted = st.form_submit_button("π― Get AI Recommendations", type="primary") | |
| if submitted: | |
| with st.spinner("Analyzing your requirements with AI..."): | |
| prompt = f"""Analyze these requirements and recommend the best software solutions: | |
| Company Profile: | |
| - Team Size: {team_size} people | |
| - Industry: {industry} | |
| - Work Model: {remote_work} | |
| - Budget per User: {budget_range} | |
| Requirements: | |
| - Primary Needs: {', '.join(needs)} | |
| - Required Integrations: {', '.join(integrations)} | |
| - Compliance: {', '.join(compliance)} | |
| Available software database: | |
| {json.dumps(SOFTWARE_DATABASE, indent=2)} | |
| Provide: | |
| 1. Top 5 recommended software with match scores | |
| 2. Functional gap analysis | |
| 3. Estimated total cost | |
| 4. Integration compatibility | |
| 5. Compliance coverage | |
| """ | |
| response = call_openai(prompt) | |
| st.success("β Analysis Complete!") | |
| st.markdown("### π― AI Recommendations") | |
| st.markdown(response) | |
| # Extract recommended software | |
| st.markdown("---") | |
| st.markdown("### π Quick Compare Recommended Software") | |
| cols = st.columns(3) | |
| for idx, software in enumerate(SOFTWARE_DATABASE[:3]): | |
| with cols[idx]: | |
| st.markdown(f"**{software['name']}**") | |
| st.markdown(f"β {software['rating']}") | |
| st.markdown(f"π° ${software['pricing_min']}-${software['pricing_max']}") | |
| if st.button(f"Add to Compare", key=f"rec_{software['name']}"): | |
| if software not in st.session_state.compare_list: | |
| st.session_state.compare_list.append(software) | |
| st.success(f"Added!") | |
| elif page == "π Compare Software": | |
| st.markdown('<h1 class="main-header">π Multi-Dimensional Comparison</h1>', unsafe_allow_html=True) | |
| col1, col2 = st.columns([3, 1]) | |
| with col1: | |
| st.markdown(f"### Compare up to 4 software solutions") | |
| with col2: | |
| if st.button("ποΈ Clear All"): | |
| st.session_state.compare_list = [] | |
| st.rerun() | |
| # Software selector | |
| st.markdown("#### Add Software to Compare") | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| selected_software = st.selectbox( | |
| "Select Software", | |
| [s["name"] for s in SOFTWARE_DATABASE if s not in st.session_state.compare_list], | |
| key="software_selector" | |
| ) | |
| with col2: | |
| if st.button("β Add to Comparison", type="primary"): | |
| software = next(s for s in SOFTWARE_DATABASE if s["name"] == selected_software) | |
| if len(st.session_state.compare_list) < 4: | |
| st.session_state.compare_list.append(software) | |
| st.success(f"Added {selected_software}!") | |
| st.rerun() | |
| else: | |
| st.error("Maximum 4 software can be compared") | |
| if len(st.session_state.compare_list) == 0: | |
| st.info("π Add software to start comparing") | |
| else: | |
| st.markdown(f"**{len(st.session_state.compare_list)} software selected**") | |
| # Display comparison cards | |
| cols = st.columns(len(st.session_state.compare_list)) | |
| for idx, software in enumerate(st.session_state.compare_list): | |
| with cols[idx]: | |
| st.markdown(f""" | |
| <div style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| padding: 1rem; border-radius: 10px; color: white; text-align: center;'> | |
| <h3>{software['name']}</h3> | |
| <p style='margin: 0;'>{software['category']}</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| st.markdown(f"β **Rating:** {software['rating']}/5.0") | |
| if st.button("Remove", key=f"remove_{idx}"): | |
| st.session_state.compare_list.pop(idx) | |
| st.rerun() | |
| st.markdown("---") | |
| # Comparison tabs | |
| tab1, tab2, tab3, tab4, tab5 = st.tabs([ | |
| "π° Pricing", "β¨ Features", "π Integrations", "π TCO Analysis", "π€ AI Insights" | |
| ]) | |
| with tab1: | |
| st.markdown("### π° Pricing Structure Comparison") | |
| # Pricing comparison table | |
| pricing_data = [] | |
| for software in st.session_state.compare_list: | |
| pricing_data.append({ | |
| "Software": software["name"], | |
| "Min Price": f"${software['pricing_min']}", | |
| "Max Price": f"${software['pricing_max']}", | |
| "Unit": software["pricing_unit"], | |
| "Negotiable": "β " if software["negotiable"] else "β" | |
| }) | |
| df_pricing = pd.DataFrame(pricing_data) | |
| st.dataframe(df_pricing, use_container_width=True) | |
| # Pricing chart | |
| st.markdown("#### Price Range Comparison") | |
| fig = go.Figure() | |
| for software in st.session_state.compare_list: | |
| fig.add_trace(go.Bar( | |
| name=software["name"], | |
| x=["Min Price", "Max Price"], | |
| y=[software["pricing_min"], software["pricing_max"]], | |
| )) | |
| fig.update_layout(barmode='group', height=400) | |
| st.plotly_chart(fig, use_container_width=True) | |
| # TCO Calculator | |
| st.markdown("#### π΅ Total Cost of Ownership Calculator") | |
| num_users = st.slider("Number of Users", 1, 500, 50) | |
| contract_length = st.selectbox("Contract Length", ["Monthly", "Annual", "Multi-year"]) | |
| st.markdown("**Estimated Annual Cost:**") | |
| for software in st.session_state.compare_list: | |
| avg_price = (software["pricing_min"] + software["pricing_max"]) / 2 | |
| annual_cost = avg_price * num_users * 12 | |
| discount = 0.15 if software["negotiable"] else 0 | |
| final_cost = annual_cost * (1 - discount) | |
| st.metric( | |
| software["name"], | |
| f"${final_cost:,.0f}/year", | |
| f"-${annual_cost * discount:,.0f} (negotiable)" if discount > 0 else "Fixed pricing" | |
| ) | |
| with tab2: | |
| st.markdown("### β¨ Feature Matrix Comparison") | |
| all_features = set() | |
| for software in st.session_state.compare_list: | |
| all_features.update(software["features"]) | |
| feature_matrix = [] | |
| for feature in sorted(all_features): | |
| row = {"Feature": feature} | |
| for software in st.session_state.compare_list: | |
| row[software["name"]] = "β " if feature in software["features"] else "β" | |
| feature_matrix.append(row) | |
| df_features = pd.DataFrame(feature_matrix) | |
| st.dataframe(df_features, use_container_width=True, height=400) | |
| # Feature coverage chart | |
| st.markdown("#### Feature Coverage Score") | |
| coverage_data = [] | |
| for software in st.session_state.compare_list: | |
| coverage = (len(software["features"]) / len(all_features)) * 100 | |
| coverage_data.append({"Software": software["name"], "Coverage": coverage}) | |
| df_coverage = pd.DataFrame(coverage_data) | |
| fig = px.bar(df_coverage, x="Software", y="Coverage", | |
| title="Feature Coverage (%)", | |
| color="Coverage", | |
| color_continuous_scale="Blues") | |
| st.plotly_chart(fig, use_container_width=True) | |
| with tab3: | |
| st.markdown("### π Integration Compatibility") | |
| all_integrations = set() | |
| for software in st.session_state.compare_list: | |
| all_integrations.update(software["integrations"]) | |
| integration_matrix = [] | |
| for integration in sorted(all_integrations): | |
| row = {"Integration": integration} | |
| for software in st.session_state.compare_list: | |
| row[software["name"]] = "β " if integration in software["integrations"] else "β" | |
| integration_matrix.append(row) | |
| df_integrations = pd.DataFrame(integration_matrix) | |
| st.dataframe(df_integrations, use_container_width=True) | |
| # Compliance comparison | |
| st.markdown("#### π‘οΈ Compliance & Security") | |
| compliance_matrix = [] | |
| all_compliance = set() | |
| for software in st.session_state.compare_list: | |
| all_compliance.update(software["compliance"]) | |
| for comp in sorted(all_compliance): | |
| row = {"Certification": comp} | |
| for software in st.session_state.compare_list: | |
| row[software["name"]] = "β " if comp in software["compliance"] else "β" | |
| compliance_matrix.append(row) | |
| df_compliance = pd.DataFrame(compliance_matrix) | |
| st.dataframe(df_compliance, use_container_width=True) | |
| with tab4: | |
| st.markdown("### π Total Cost of Ownership (TCO) Analysis") | |
| st.markdown("#### Configure Your Scenario") | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| num_users_tco = st.number_input("Number of Users", 1, 1000, 50, key="tco_users") | |
| with col2: | |
| years = st.selectbox("Time Period", [1, 2, 3, 5], key="tco_years") | |
| with col3: | |
| include_costs = st.multiselect("Include", ["Training", "Migration", "Support"], default=["Training"]) | |
| tco_data = [] | |
| for software in st.session_state.compare_list: | |
| avg_price = (software["pricing_min"] + software["pricing_max"]) / 2 | |
| subscription_cost = avg_price * num_users_tco * 12 * years | |
| training_cost = 100 * num_users_tco if "Training" in include_costs else 0 | |
| migration_cost = 5000 if "Migration" in include_costs else 0 | |
| support_cost = subscription_cost * 0.1 * years if "Support" in include_costs else 0 | |
| total_tco = subscription_cost + training_cost + migration_cost + support_cost | |
| tco_data.append({ | |
| "Software": software["name"], | |
| "Subscription": subscription_cost, | |
| "Training": training_cost, | |
| "Migration": migration_cost, | |
| "Support": support_cost, | |
| "Total TCO": total_tco | |
| }) | |
| df_tco = pd.DataFrame(tco_data) | |
| # TCO breakdown chart | |
| fig = go.Figure() | |
| for cost_type in ["Subscription", "Training", "Migration", "Support"]: | |
| fig.add_trace(go.Bar( | |
| name=cost_type, | |
| x=df_tco["Software"], | |
| y=df_tco[cost_type] | |
| )) | |
| fig.update_layout(barmode='stack', title="TCO Breakdown", height=400) | |
| st.plotly_chart(fig, use_container_width=True) | |
| # TCO table | |
| st.markdown("#### Detailed TCO Breakdown") | |
| st.dataframe(df_tco.style.format({ | |
| "Subscription": "${:,.0f}", | |
| "Training": "${:,.0f}", | |
| "Migration": "${:,.0f}", | |
| "Support": "${:,.0f}", | |
| "Total TCO": "${:,.0f}" | |
| }), use_container_width=True) | |
| with tab5: | |
| st.markdown("### π€ AI-Powered Insights") | |
| if st.button("π§ Generate AI Analysis", type="primary"): | |
| with st.spinner("AI is analyzing your comparison..."): | |
| prompt = f"""Analyze this software comparison and provide insights: | |
| Software being compared: | |
| {json.dumps(st.session_state.compare_list, indent=2)} | |
| Provide: | |
| 1. **Best Overall Value**: Which offers the best balance of features and price? | |
| 2. **Best for Specific Use Cases**: Recommend which software for different scenarios | |
| 3. **Cost Optimization**: How to reduce costs while maintaining functionality | |
| 4. **Integration Strategy**: Which combination works best together | |
| 5. **Risk Assessment**: Potential issues or limitations | |
| 6. **Negotiation Opportunities**: Which vendors are most likely to offer discounts | |
| Be specific and actionable.""" | |
| response = call_openai(prompt) | |
| st.markdown(response) | |
| st.markdown("---") | |
| st.markdown("#### π Quick Recommendation Matrix") | |
| cols = st.columns(len(st.session_state.compare_list)) | |
| for idx, software in enumerate(st.session_state.compare_list): | |
| with cols[idx]: | |
| st.markdown(f"**{software['name']}**") | |
| # Calculate scores | |
| price_score = 5.0 - (software["pricing_max"] / 50) # Simple price score | |
| feature_score = min(5.0, len(software["features"]) / 2) | |
| integration_score = min(5.0, len(software["integrations"])) | |
| st.metric("Price Score", f"{max(1, price_score):.1f}/5") | |
| st.metric("Feature Score", f"{feature_score:.1f}/5") | |
| st.metric("Integration", f"{integration_score:.1f}/5") | |
| elif page == "π‘ Strategy Optimizer": | |
| st.markdown('<h1 class="main-header">π‘ Strategy Combination Optimizer</h1>', unsafe_allow_html=True) | |
| st.markdown("### Find the optimal software stack for your organization") | |
| # Input parameters | |
| st.markdown("#### π― Your Requirements") | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| team_size = st.number_input("Team Size", 1, 1000, 50) | |
| with col2: | |
| monthly_budget = st.number_input("Monthly Budget ($)", 100, 100000, 5000) | |
| with col3: | |
| optimization_goal = st.selectbox("Optimization Goal", [ | |
| "Minimize Cost", | |
| "Maximize Features", | |
| "Best Integration", | |
| "Balanced Approach" | |
| ]) | |
| required_categories = st.multiselect("Required Software Categories", [ | |
| "Team Communication", "Video Conferencing", "Project Management", | |
| "Email & Productivity", "CRM", "Cloud Storage", "Developer Tools", | |
| "Design Tools", "Knowledge Management" | |
| ]) | |
| if st.button("π Generate Optimization Strategies", type="primary"): | |
| with st.spinner("AI is optimizing your software stack..."): | |
| prompt = f"""Create 3 optimal software stack strategies based on these requirements: | |
| Requirements: | |
| - Team Size: {team_size} people | |
| - Monthly Budget: ${monthly_budget} | |
| - Optimization Goal: {optimization_goal} | |
| - Required Categories: {', '.join(required_categories)} | |
| Available Software: | |
| {json.dumps(SOFTWARE_DATABASE, indent=2)} | |
| Generate 3 strategies: | |
| 1. **All-in-One Solution**: Using comprehensive platforms (Microsoft 365, Google Workspace, etc.) | |
| 2. **Best-of-Breed Combination**: Mix of specialized best-in-class tools | |
| 3. **Budget-Optimized Hybrid**: Balance between functionality and cost | |
| For each strategy provide: | |
| - Recommended software list | |
| - Total monthly cost | |
| - Feature coverage percentage | |
| - Integration difficulty score (1-10) | |
| - Pros and cons | |
| - Learning curve assessment | |
| - ROI timeline | |
| """ | |
| response = call_openai(prompt) | |
| st.success("β Strategies Generated!") | |
| st.markdown(response) | |
| # Visual comparison | |
| st.markdown("---") | |
| st.markdown("### π Strategy Comparison Dashboard") | |
| # Mock data for visualization | |
| strategies = { | |
| "All-in-One": {"cost": monthly_budget * 0.8, "features": 85, "integration": 9, "learning": 6}, | |
| "Best-of-Breed": {"cost": monthly_budget * 1.1, "features": 95, "integration": 6, "learning": 7}, | |
| "Budget-Optimized": {"cost": monthly_budget * 0.6, "features": 75, "integration": 7, "learning": 5} | |
| } | |
| col1, col2, col3 = st.columns(3) | |
| for idx, (strategy_name, metrics) in enumerate(strategies.items()): | |
| with [col1, col2, col3][idx]: | |
| st.markdown(f""" | |
| <div style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| padding: 1.5rem; border-radius: 10px; color: white;'> | |
| <h3 style='margin: 0; color: white;'>{strategy_name}</h3> | |
| <p style='margin: 0.5rem 0 0 0; opacity: 0.9;'>Strategy {idx + 1}</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| st.metric("Monthly Cost", f"${metrics['cost']:.0f}") | |
| st.metric("Feature Coverage", f"{metrics['features']}%") | |
| st.metric("Integration Score", f"{metrics['integration']}/10") | |
| st.metric("Learning Curve", f"{metrics['learning']}/10") | |
| st.button(f"Select {strategy_name}", key=f"select_{strategy_name}") | |
| # Comparison radar chart | |
| st.markdown("#### π Multi-Dimensional Comparison") | |
| fig = go.Figure() | |
| for strategy_name, metrics in strategies.items(): | |
| fig.add_trace(go.Scatterpolar( | |
| r=[ | |
| (monthly_budget - metrics['cost']) / monthly_budget * 100, # Cost efficiency | |
| metrics['features'], | |
| metrics['integration'] * 10, | |
| (10 - metrics['learning']) * 10, # Ease of learning (inverted) | |
| ], | |
| theta=['Cost Efficiency', 'Features', 'Integration', 'Ease of Use'], | |
| fill='toself', | |
| name=strategy_name | |
| )) | |
| fig.update_layout( | |
| polar=dict(radialaxis=dict(visible=True, range=[0, 100])), | |
| showlegend=True, | |
| height=500 | |
| ) | |
| st.plotly_chart(fig, use_container_width=True) | |
| elif page == "π€ Negotiation Assistant": | |
| st.markdown('<h1 class="main-header">π€ AI Negotiation Assistant</h1>', unsafe_allow_html=True) | |
| st.markdown("### Get the best deals with data-driven negotiation strategies") | |
| tab1, tab2, tab3, tab4 = st.tabs([ | |
| "π Market Benchmarks", "π¬ Script Generator", "π Best Timing", "π Contract Analysis" | |
| ]) | |
| with tab1: | |
| st.markdown("### π Market Price Benchmarks") | |
| col1, col2 = st.columns([1, 2]) | |
| with col1: | |
| selected_software_nego = st.selectbox( | |
| "Select Software", | |
| [s["name"] for s in SOFTWARE_DATABASE] | |
| ) | |
| company_size_nego = st.selectbox("Company Size", ["1-10", "11-50", "51-200", "201-1000", "1000+"]) | |
| contract_term = st.selectbox("Contract Term", ["Monthly", "1 Year", "2 Years", "3 Years"]) | |
| with col2: | |
| software_nego = next(s for s in SOFTWARE_DATABASE if s["name"] == selected_software_nego) | |
| st.markdown(f"#### {software_nego['name']} Pricing Intelligence") | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| st.metric("List Price", f"${software_nego['pricing_max']}/user/mo") | |
| with col2: | |
| discount = 0.15 if software_nego["negotiable"] else 0 | |
| st.metric("Typical Discount", f"{discount*100:.0f}%", "Negotiable" if software_nego["negotiable"] else "Fixed") | |
| with col3: | |
| negotiated_price = software_nego['pricing_max'] * (1 - discount) | |
| st.metric("Target Price", f"${negotiated_price:.2f}/user/mo") | |
| # Benchmark chart | |
| st.markdown("#### π° Price by Company Size") | |
| benchmark_data = pd.DataFrame({ | |
| 'Company Size': ['1-10', '11-50', '51-200', '201-1000', '1000+'], | |
| 'Average Price': [ | |
| software_nego['pricing_max'], | |
| software_nego['pricing_max'] * 0.95, | |
| software_nego['pricing_max'] * 0.90, | |
| software_nego['pricing_max'] * 0.85, | |
| software_nego['pricing_max'] * 0.75 | |
| ], | |
| 'Discount %': [0, 5, 10, 15, 25] | |
| }) | |
| fig = px.bar(benchmark_data, x='Company Size', y='Average Price', | |
| title='Average Negotiated Price by Company Size', | |
| color='Discount %', | |
| color_continuous_scale='RdYlGn') | |
| st.plotly_chart(fig, use_container_width=True) | |
| # Similar companies data | |
| st.markdown("#### π’ Similar Companies Paid") | |
| similar_companies = pd.DataFrame({ | |
| 'Company': [f'Company {i}' for i in range(1, 6)], | |
| 'Size': ['45', '52', '48', '55', '50'], | |
| 'Industry': ['Tech', 'Finance', 'Healthcare', 'Tech', 'Education'], | |
| 'Price/User': [f'${software_nego["pricing_max"] * (0.85 + i*0.02):.2f}' for i in range(5)], | |
| 'Contract': ['2 Year', '1 Year', '3 Year', '2 Year', '1 Year'] | |
| }) | |
| st.dataframe(similar_companies, use_container_width=True) | |
| with tab2: | |
| st.markdown("### π¬ AI Negotiation Script Generator") | |
| st.markdown("#### Your Negotiation Context") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| nego_software = st.selectbox("Software to Negotiate", [s["name"] for s in SOFTWARE_DATABASE], key="script_software") | |
| num_licenses = st.number_input("Number of Licenses", 1, 1000, 50, key="script_licenses") | |
| current_price = st.number_input("Current Quote (per user/month)", 0.0, 1000.0, 20.0, key="script_price") | |
| with col2: | |
| contract_length_nego = st.selectbox("Proposed Contract Length", ["1 Year", "2 Years", "3 Years"], key="script_contract") | |
| leverage_points = st.multiselect("Your Leverage", [ | |
| "Multiple vendors being evaluated", | |
| "Existing customer", | |
| "Large team size", | |
| "Multi-year commitment", | |
| "Competitor offers better price", | |
| "Budget constraints", | |
| "Referral potential" | |
| ]) | |
| negotiation_style = st.selectbox("Negotiation Style", ["Professional", "Friendly", "Assertive"]) | |
| if st.button("π― Generate Negotiation Script", type="primary"): | |
| with st.spinner("Crafting your personalized negotiation strategy..."): | |
| prompt = f"""Create a detailed negotiation script for: | |
| Context: | |
| - Software: {nego_software} | |
| - Number of Licenses: {num_licenses} | |
| - Current Quote: ${current_price}/user/month | |
| - Desired Contract: {contract_length_nego} | |
| - Leverage Points: {', '.join(leverage_points)} | |
| - Style: {negotiation_style} | |
| Generate: | |
| 1. **Email Template**: Initial negotiation email | |
| 2. **Call Script**: Talking points for sales call | |
| 3. **Counter-Offer Strategy**: Specific discount requests with justification | |
| 4. **Fallback Positions**: Alternative asks if primary request is denied | |
| 5. **Closing Tactics**: How to finalize the deal | |
| 6. **Common Objections & Responses**: How to handle pushback | |
| Make it professional, specific, and actionable. Include actual price points and percentages.""" | |
| response = call_openai(prompt, system_prompt="You are an expert B2B software negotiation consultant with 20 years of experience.") | |
| st.success("β Negotiation Script Generated!") | |
| st.markdown(response) | |
| # Download button | |
| st.download_button( | |
| label="π₯ Download Script", | |
| data=response, | |
| file_name=f"negotiation_script_{nego_software}.txt", | |
| mime="text/plain" | |
| ) | |
| with tab3: | |
| st.markdown("### π Best Time to Purchase") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.markdown("#### ποΈ Optimal Purchase Timing") | |
| timing_data = pd.DataFrame({ | |
| 'Period': ['Q1', 'Q2', 'Q3', 'Q4'], | |
| 'Discount Potential': [15, 10, 12, 25], | |
| 'Sales Pressure': ['Low', 'Medium', 'Medium', 'Very High'] | |
| }) | |
| fig = px.bar(timing_data, x='Period', y='Discount Potential', | |
| title='Average Discount Potential by Quarter', | |
| color='Discount Potential', | |
| color_continuous_scale='RdYlGn') | |
| st.plotly_chart(fig, use_container_width=True) | |
| st.info("**π‘ Best Time**: End of Q4 (December) when sales teams are closing their year") | |
| st.markdown("#### π Current Opportunities") | |
| current_month = datetime.now().strftime("%B") | |
| st.success(f"**Current Month**: {current_month}") | |
| if "December" in current_month or "June" in current_month: | |
| st.success("π **EXCELLENT TIME TO NEGOTIATE!** End of fiscal period for many companies.") | |
| elif "September" in current_month or "March" in current_month: | |
| st.info("β **GOOD TIME** - End of quarter, moderate pressure on sales teams.") | |
| else: | |
| st.warning("β° Consider waiting until end of quarter for better deals.") | |
| with col2: | |
| st.markdown("#### π― Timing Strategies") | |
| strategies = [ | |
| {"strategy": "End of Quarter", "potential": "15-20%", "risk": "Low"}, | |
| {"strategy": "End of Fiscal Year", "potential": "20-30%", "risk": "Low"}, | |
| {"strategy": "During Product Launch", "potential": "10-15%", "risk": "Medium"}, | |
| {"strategy": "Competitor Announcement", "potential": "15-25%", "risk": "Medium"}, | |
| {"strategy": "Contract Renewal", "potential": "10-20%", "risk": "Low"} | |
| ] | |
| for strategy in strategies: | |
| with st.expander(f"**{strategy['strategy']}** - {strategy['potential']} discount"): | |
| st.markdown(f"**Discount Potential**: {strategy['potential']}") | |
| st.markdown(f"**Risk Level**: {strategy['risk']}") | |
| st.markdown("#### π Seasonal Promotions") | |
| st.markdown(""" | |
| - **Black Friday/Cyber Monday**: Special promotions | |
| - **New Year**: Fresh budgets, soft launches | |
| - **Summer**: Mid-year deals | |
| - **Back to School**: Education-focused promotions | |
| """) | |
| with tab4: | |
| st.markdown("### π AI Contract Analysis") | |
| st.markdown("#### Upload or Paste Your Contract") | |
| input_method = st.radio("Input Method", ["Paste Text", "Upload File"]) | |
| contract_text = "" | |
| if input_method == "Paste Text": | |
| contract_text = st.text_area("Paste Contract Text", height=200, | |
| placeholder="Paste your software contract or terms of service here...") | |
| else: | |
| uploaded_file = st.file_uploader("Upload Contract (PDF or TXT)", type=["pdf", "txt"]) | |
| if uploaded_file: | |
| contract_text = uploaded_file.read().decode("utf-8", errors="ignore") | |
| st.success("Contract uploaded!") | |
| if st.button("π Analyze Contract", type="primary") and contract_text: | |
| with st.spinner("AI is analyzing your contract..."): | |
| prompt = f"""Analyze this software contract and identify: | |
| Contract Text: | |
| {contract_text[:4000]} # Limit for token size | |
| Provide detailed analysis: | |
| 1. **π¨ Risk Factors**: | |
| - Automatic renewal clauses | |
| - Price increase rights | |
| - Unfavorable termination terms | |
| - Data ownership issues | |
| - Liability limitations | |
| 2. **β Compliance Check**: | |
| - GDPR compliance | |
| - SOC2/ISO27001 mentions | |
| - Data privacy protections | |
| - SLA commitments | |
| 3. **π° Financial Terms**: | |
| - Payment terms | |
| - Refund policy | |
| - Price adjustment clauses | |
| - Hidden fees | |
| 4. **βοΈ Legal Concerns**: | |
| - Jurisdiction and governing law | |
| - Dispute resolution | |
| - Indemnification clauses | |
| - IP rights | |
| 5. **βοΈ Recommendations**: | |
| - Terms to negotiate | |
| - Red flags to address | |
| - Missing protections | |
| - Overall risk score (1-10) | |
| Be specific and highlight exact problematic clauses.""" | |
| response = call_openai(prompt, system_prompt="You are an expert software contract attorney specializing in SaaS agreements.") | |
| st.success("β Contract Analysis Complete!") | |
| # Display in organized sections | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.markdown("### π¨ Risk Assessment") | |
| st.error("**High Risk Items Found**") | |
| st.markdown(response[:len(response)//2]) | |
| with col2: | |
| st.markdown("### β Recommendations") | |
| st.info("**Action Items**") | |
| st.markdown(response[len(response)//2:]) | |
| st.download_button( | |
| label="π₯ Download Full Analysis", | |
| data=response, | |
| file_name="contract_analysis.txt", | |
| mime="text/plain" | |
| ) | |
| elif page == "π Usage Analytics": | |
| st.markdown('<h1 class="main-header">π Usage Monitoring & Optimization</h1>', unsafe_allow_html=True) | |
| st.markdown("### Track usage and identify cost-saving opportunities") | |
| # Dashboard metrics | |
| col1, col2, col3, col4 = st.columns(4) | |
| with col1: | |
| st.metric("Total Monthly Spend", "$45,000", "-12% vs last month", delta_color="normal") | |
| with col2: | |
| st.metric("Active Subscriptions", "23", "+2", delta_color="inverse") | |
| with col3: | |
| st.metric("Unused Licenses", "47", "-5", delta_color="normal") | |
| with col4: | |
| st.metric("Potential Savings", "$8,400", "+$1,200", delta_color="normal") | |
| st.markdown("---") | |
| tab1, tab2, tab3, tab4 = st.tabs([ | |
| "π Overview", "π° Cost Analysis", "π₯ License Utilization", "π― Optimization" | |
| ]) | |
| with tab1: | |
| st.markdown("### π Software Portfolio Overview") | |
| # Mock usage data | |
| usage_data = [] | |
| for software in SOFTWARE_DATABASE[:8]: | |
| usage_data.append({ | |
| "Software": software["name"], | |
| "Licenses": 50, | |
| "Active Users": int(50 * (0.6 + 0.3 * (hash(software["name"]) % 10) / 10)), | |
| "Monthly Cost": software["pricing_max"] * 50, | |
| "Category": software["category"] | |
| }) | |
| df_usage = pd.DataFrame(usage_data) | |
| df_usage["Utilization %"] = (df_usage["Active Users"] / df_usage["Licenses"] * 100).round(1) | |
| df_usage["Waste"] = df_usage["Monthly Cost"] * (1 - df_usage["Active Users"] / df_usage["Licenses"]) | |
| # Usage chart | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| fig = px.bar(df_usage, x="Software", y="Utilization %", | |
| title="License Utilization by Software", | |
| color="Utilization %", | |
| color_continuous_scale="RdYlGn", | |
| range_color=[0, 100]) | |
| st.plotly_chart(fig, use_container_width=True) | |
| with col2: | |
| fig = px.pie(df_usage, values="Monthly Cost", names="Software", | |
| title="Cost Distribution") | |
| st.plotly_chart(fig, use_container_width=True) | |
| # Detailed table | |
| st.markdown("#### π Detailed Usage Report") | |
| st.dataframe( | |
| df_usage.style.format({ | |
| "Monthly Cost": "${:,.0f}", | |
| "Waste": "${:,.0f}", | |
| "Utilization %": "{:.1f}%" | |
| }).background_gradient(subset=["Utilization %"], cmap="RdYlGn", vmin=0, vmax=100), | |
| use_container_width=True | |
| ) | |
| with tab2: | |
| st.markdown("### π° Cost Analysis & Trends") | |
| # Monthly spend trend | |
| months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'] | |
| spend_data = pd.DataFrame({ | |
| 'Month': months, | |
| 'Spend': [42000, 43500, 45000, 46000, 44500, 45000], | |
| 'Budget': [50000] * 6 | |
| }) | |
| fig = go.Figure() | |
| fig.add_trace(go.Scatter(x=spend_data['Month'], y=spend_data['Spend'], | |
| mode='lines+markers', name='Actual Spend', | |
| line=dict(color='#667eea', width=3))) | |
| fig.add_trace(go.Scatter(x=spend_data['Month'], y=spend_data['Budget'], | |
| mode='lines', name='Budget', | |
| line=dict(color='red', width=2, dash='dash'))) | |
| fig.update_layout(title='Monthly Software Spend Trend', height=400) | |
| st.plotly_chart(fig, use_container_width=True) | |
| # Cost by category | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| category_spend = df_usage.groupby('Category')['Monthly Cost'].sum().reset_index() | |
| fig = px.bar(category_spend, x='Category', y='Monthly Cost', | |
| title='Spend by Category', | |
| color='Monthly Cost', | |
| color_continuous_scale='Blues') | |
| st.plotly_chart(fig, use_container_width=True) | |
| with col2: | |
| st.markdown("#### π΅ Top 5 Expenses") | |
| top_expenses = df_usage.nlargest(5, 'Monthly Cost')[['Software', 'Monthly Cost']] | |
| for idx, row in top_expenses.iterrows(): | |
| st.metric(row['Software'], f"${row['Monthly Cost']:,.0f}/mo") | |
| with tab3: | |
| st.markdown("### π₯ License Utilization Analysis") | |
| # Utilization heatmap | |
| st.markdown("#### π Utilization Heatmap") | |
| # Mock weekly usage data | |
| weeks = ['Week 1', 'Week 2', 'Week 3', 'Week 4'] | |
| software_list = df_usage['Software'].tolist()[:6] | |
| heatmap_data = [] | |
| for software in software_list: | |
| weekly_usage = [int(50 + (hash(software + week) % 30)) for week in weeks] | |
| heatmap_data.append(weekly_usage) | |
| fig = go.Figure(data=go.Heatmap( | |
| z=heatmap_data, | |
| x=weeks, | |
| y=software_list, | |
| colorscale='RdYlGn', | |
| text=heatmap_data, | |
| texttemplate='%{text}%', | |
| textfont={"size": 10} | |
| )) | |
| fig.update_layout(title='Usage Patterns Over Time (%)', height=400) | |
| st.plotly_chart(fig, use_container_width=True) | |
| # Inactive users | |
| st.markdown("#### β οΈ Inactive License Alert") | |
| inactive_data = [] | |
| for software in SOFTWARE_DATABASE[:5]: | |
| inactive_count = int(50 * (0.1 + 0.2 * (hash(software["name"]) % 10) / 10)) | |
| if inactive_count > 5: | |
| inactive_data.append({ | |
| "Software": software["name"], | |
| "Inactive Licenses": inactive_count, | |
| "Potential Savings": f"${inactive_count * software['pricing_max']:.0f}/mo", | |
| "Last Activity": f"{hash(software['name']) % 30 + 30} days ago" | |
| }) | |
| df_inactive = pd.DataFrame(inactive_data) | |
| for idx, row in df_inactive.iterrows(): | |
| with st.expander(f"β οΈ **{row['Software']}** - {row['Inactive Licenses']} inactive licenses"): | |
| col1, col2, col3 = st.columns(3) | |
| with col1: | |
| st.metric("Inactive Licenses", row['Inactive Licenses']) | |
| with col2: | |
| st.metric("Potential Savings", row['Potential Savings']) | |
| with col3: | |
| st.metric("Last Activity", row['Last Activity']) | |
| if st.button(f"Review Users for {row['Software']}", key=f"review_{idx}"): | |
| st.info("User review interface would open here in production") | |
| with tab4: | |
| st.markdown("### π― AI-Powered Optimization Recommendations") | |
| if st.button("π€ Generate Optimization Report", type="primary"): | |
| with st.spinner("AI is analyzing your usage data..."): | |
| prompt = f"""Analyze this software usage data and provide optimization recommendations: | |
| Current Software Portfolio: | |
| {df_usage.to_json(orient='records')} | |
| Total Monthly Spend: $45,000 | |
| Unused Licenses: 47 | |
| Average Utilization: {df_usage['Utilization %'].mean():.1f}% | |
| Provide: | |
| 1. **Immediate Actions** (Quick wins for cost savings) | |
| 2. **Consolidation Opportunities** (Software that can be replaced/combined) | |
| 3. **Right-sizing Recommendations** (License adjustments) | |
| 4. **Alternative Solutions** (Better value options) | |
| 5. **Implementation Priority** (What to tackle first) | |
| 6. **Expected Savings** (Quantify the impact) | |
| Be specific with dollar amounts and actionable steps.""" | |
| response = call_openai(prompt) | |
| st.success("β Optimization Report Generated!") | |
| st.markdown(response) | |
| st.markdown("---") | |
| st.markdown("#### π‘ Quick Wins") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| st.warning("**β οΈ Remove Unused Licenses**") | |
| st.markdown("47 inactive licenses detected") | |
| st.markdown("**Potential Savings**: $8,400/year") | |
| st.button("Start License Cleanup", key="cleanup") | |
| with col2: | |
| st.info("**π° Bundle Opportunity**") | |
| st.markdown("Consolidate 4 tools into Microsoft 365") | |
| st.markdown("**Potential Savings**: $3,840/year") | |
| st.button("Explore Bundle", key="bundle") | |
| # Optimization roadmap | |
| st.markdown("#### πΊοΈ Optimization Roadmap") | |
| roadmap = [ | |
| {"Month": "Month 1", "Action": "Remove inactive licenses", "Savings": "$700/mo"}, | |
| {"Month": "Month 2", "Action": "Renegotiate Slack contract", "Savings": "$300/mo"}, | |
| {"Month": "Month 3", "Action": "Switch to annual billing", "Savings": "$450/mo"}, | |
| {"Month": "Month 4", "Action": "Consolidate to Microsoft 365", "Savings": "$320/mo"}, | |
| ] | |
| for item in roadmap: | |
| st.success(f"**{item['Month']}**: {item['Action']} β {item['Savings']} savings") | |
| # Footer | |
| st.markdown("---") | |
| st.markdown(""" | |
| <div style='text-align: center; color: #666; padding: 2rem;'> | |
| <p><strong>SoftwareGrid AI</strong> - Intelligent Software Procurement Platform</p> | |
| <p>Powered by Open AI | Made with Streamlit</p> | |
| </div> | |
| """, unsafe_allow_html=True) |