business-as-code
Version:
Primitives for expressing business logic and processes as code
311 lines (301 loc) • 21.3 kB
text/typescript
import type { Noun } from 'ai-database'
/**
* Market Intelligence Entities
* Market, Competitor, Trend, Opportunity, SWOT, Industry
*/
export const Market: Noun = {
singular: 'market',
plural: 'markets',
description: 'A target market or market segment',
properties: {
name: { type: 'string', description: 'Market name' },
description: { type: 'string', description: 'Market description' },
type: { type: 'string', description: 'Type of market', examples: ['geographic', 'demographic', 'psychographic', 'behavioral', 'industry', 'vertical', 'horizontal'] },
status: { type: 'string', description: 'Market status', examples: ['emerging', 'growing', 'mature', 'declining', 'target', 'active', 'exited'] },
region: { type: 'string', description: 'Geographic region' },
countries: { type: 'string[]', description: 'Countries in market' },
size: { type: 'number', description: 'Total addressable market (TAM)' },
serviceable: { type: 'number', description: 'Serviceable addressable market (SAM)' },
obtainable: { type: 'number', description: 'Serviceable obtainable market (SOM)' },
currency: { type: 'string', description: 'Currency for market size' },
growthRate: { type: 'number', description: 'Annual growth rate (CAGR)' },
growthDrivers: { type: 'string[]', description: 'Growth drivers' },
growthBarriers: { type: 'string[]', description: 'Growth barriers' },
maturity: { type: 'string', description: 'Market maturity', examples: ['nascent', 'emerging', 'growth', 'mature', 'saturated', 'declining'] },
competitiveness: { type: 'string', description: 'Competitive intensity', examples: ['low', 'moderate', 'high', 'intense'] },
marketShare: { type: 'number', description: 'Our market share' },
targetShare: { type: 'number', description: 'Target market share' },
customers: { type: 'number', description: 'Total potential customers' },
activeCustomers: { type: 'number', description: 'Our active customers' },
penetration: { type: 'number', description: 'Market penetration rate' },
avgDealSize: { type: 'number', description: 'Average deal size' },
salesCycle: { type: 'number', description: 'Average sales cycle (days)' },
entryBarriers: { type: 'string[]', description: 'Entry barriers' },
regulations: { type: 'string[]', description: 'Key regulations' },
keyPlayers: { type: 'string[]', description: 'Key market players' },
trends: { type: 'string[]', description: 'Market trends' },
risks: { type: 'string[]', description: 'Market risks' },
opportunities: { type: 'string[]', description: 'Market opportunities' },
priority: { type: 'string', description: 'Strategic priority', examples: ['primary', 'secondary', 'exploratory', 'maintain', 'exit'] },
owner: { type: 'string', description: 'Market owner' },
analyst: { type: 'string', description: 'Market analyst' },
lastAnalyzed: { type: 'date', description: 'Last analysis date' },
nextReview: { type: 'date', description: 'Next review date' },
notes: { type: 'string', description: 'Internal notes', optional: true },
tags: { type: 'string[]', description: 'Market tags' },
metadata: { type: 'object', description: 'Additional metadata', optional: true },
},
relationships: {
competitors: { type: 'competitor[]', description: 'Competitors in market', backref: 'markets' },
trends: { type: 'trend[]', description: 'Market trends', backref: 'markets' },
opportunities: { type: 'opportunity[]', description: 'Market opportunities', backref: 'market' },
segments: { type: 'segment[]', description: 'Customer segments', backref: 'market' },
products: { type: 'product[]', description: 'Products in market', backref: 'markets' },
campaigns: { type: 'campaign[]', description: 'Marketing campaigns', backref: 'market' },
parentMarket: { type: 'market', description: 'Parent market', backref: 'subMarkets' },
subMarkets: { type: 'market[]', description: 'Sub-markets', backref: 'parentMarket' },
},
actions: ['create', 'update', 'analyze', 'enter', 'expand', 'exit', 'prioritize', 'segment', 'review'],
events: ['created', 'updated', 'analyzed', 'entered', 'expanded', 'exited', 'prioritized', 'segmented', 'reviewed'],
}
export const Competitor: Noun = {
singular: 'competitor',
plural: 'competitors',
description: 'A competitor in the market',
properties: {
name: { type: 'string', description: 'Competitor name' },
description: { type: 'string', description: 'Competitor description' },
type: { type: 'string', description: 'Type of competitor', examples: ['direct', 'indirect', 'substitute', 'potential', 'emerging'] },
status: { type: 'string', description: 'Competitor status', examples: ['active', 'inactive', 'acquired', 'defunct', 'emerging', 'monitoring'] },
website: { type: 'string', description: 'Competitor website' },
founded: { type: 'number', description: 'Year founded' },
headquarters: { type: 'string', description: 'Headquarters location' },
employeeCount: { type: 'number', description: 'Employee count' },
fundingTotal: { type: 'number', description: 'Total funding raised', optional: true },
lastFundingRound: { type: 'string', description: 'Last funding round', optional: true },
lastFundingDate: { type: 'date', description: 'Last funding date', optional: true },
revenue: { type: 'number', description: 'Estimated revenue' },
revenueGrowth: { type: 'number', description: 'Revenue growth rate' },
marketCap: { type: 'number', description: 'Market cap (if public)', optional: true },
publiclyTraded: { type: 'boolean', description: 'Is publicly traded' },
stockSymbol: { type: 'string', description: 'Stock symbol', optional: true },
marketShare: { type: 'number', description: 'Estimated market share' },
positioning: { type: 'string', description: 'Market positioning' },
targetSegments: { type: 'string[]', description: 'Target segments' },
products: { type: 'string[]', description: 'Key products' },
pricing: { type: 'string', description: 'Pricing strategy' },
priceRange: { type: 'string', description: 'Price range', examples: ['budget', 'mid-market', 'premium', 'enterprise'] },
strengths: { type: 'string[]', description: 'Key strengths' },
weaknesses: { type: 'string[]', description: 'Key weaknesses' },
differentiators: { type: 'string[]', description: 'Key differentiators' },
technology: { type: 'string[]', description: 'Key technologies' },
partnerships: { type: 'string[]', description: 'Key partnerships' },
customers: { type: 'string[]', description: 'Known customers' },
threats: { type: 'string[]', description: 'Threats to us' },
opportunities: { type: 'string[]', description: 'Opportunities against' },
winRate: { type: 'number', description: 'Our win rate against', optional: true },
lossRate: { type: 'number', description: 'Our loss rate against', optional: true },
dealsWon: { type: 'number', description: 'Deals won against' },
dealsLost: { type: 'number', description: 'Deals lost against' },
battleCard: { type: 'string', description: 'Battle card URL', optional: true },
analyst: { type: 'string', description: 'Assigned analyst' },
lastUpdated: { type: 'date', description: 'Last updated date' },
nextReview: { type: 'date', description: 'Next review date' },
threatLevel: { type: 'string', description: 'Threat level', examples: ['low', 'medium', 'high', 'critical'] },
priority: { type: 'string', description: 'Monitoring priority', examples: ['primary', 'secondary', 'tertiary', 'watch'] },
notes: { type: 'string', description: 'Internal notes', optional: true },
tags: { type: 'string[]', description: 'Competitor tags' },
metadata: { type: 'object', description: 'Additional metadata', optional: true },
},
relationships: {
markets: { type: 'market[]', description: 'Active markets', backref: 'competitors' },
products: { type: 'product[]', description: 'Competitor products', backref: 'competitor' },
deals: { type: 'deal[]', description: 'Competitive deals', backref: 'competitors' },
swots: { type: 'swot[]', description: 'SWOT analyses', backref: 'competitor' },
},
actions: ['create', 'update', 'analyze', 'monitor', 'compare', 'benchmark', 'track', 'alert', 'archive'],
events: ['created', 'updated', 'analyzed', 'monitored', 'compared', 'benchmarked', 'tracked', 'alerted', 'archived'],
}
export const Trend: Noun = {
singular: 'trend',
plural: 'trends',
description: 'A market or industry trend',
properties: {
name: { type: 'string', description: 'Trend name' },
description: { type: 'string', description: 'Trend description' },
type: { type: 'string', description: 'Type of trend', examples: ['technology', 'market', 'consumer', 'regulatory', 'economic', 'social', 'environmental', 'competitive'] },
status: { type: 'string', description: 'Trend status', examples: ['emerging', 'growing', 'mainstream', 'declining', 'ended'] },
category: { type: 'string', description: 'Trend category' },
timeframe: { type: 'string', description: 'Trend timeframe', examples: ['short-term', 'medium-term', 'long-term', 'permanent'] },
strength: { type: 'string', description: 'Trend strength', examples: ['weak', 'moderate', 'strong', 'disruptive'] },
confidence: { type: 'string', description: 'Confidence level', examples: ['low', 'medium', 'high', 'very-high'] },
impact: { type: 'string', description: 'Potential impact', examples: ['minimal', 'moderate', 'significant', 'transformational'] },
impactAreas: { type: 'string[]', description: 'Areas of impact' },
drivers: { type: 'string[]', description: 'Trend drivers' },
signals: { type: 'string[]', description: 'Signal indicators' },
implications: { type: 'string[]', description: 'Business implications' },
opportunities: { type: 'string[]', description: 'Opportunities created' },
threats: { type: 'string[]', description: 'Threats posed' },
responseOptions: { type: 'string[]', description: 'Response options' },
adoptionRate: { type: 'number', description: 'Current adoption rate' },
projectedAdoption: { type: 'number', description: 'Projected adoption rate' },
relevance: { type: 'string', description: 'Relevance to business', examples: ['not-relevant', 'somewhat', 'relevant', 'highly-relevant', 'critical'] },
actionRequired: { type: 'boolean', description: 'Requires action' },
owner: { type: 'string', description: 'Trend owner' },
sources: { type: 'string[]', description: 'Data sources' },
firstIdentified: { type: 'date', description: 'First identified date' },
lastReviewed: { type: 'date', description: 'Last review date' },
nextReview: { type: 'date', description: 'Next review date' },
notes: { type: 'string', description: 'Internal notes', optional: true },
tags: { type: 'string[]', description: 'Trend tags' },
metadata: { type: 'object', description: 'Additional metadata', optional: true },
},
relationships: {
markets: { type: 'market[]', description: 'Affected markets', backref: 'trends' },
industry: { type: 'industry', description: 'Related industry', backref: 'trends' },
opportunities: { type: 'opportunity[]', description: 'Created opportunities', backref: 'trend' },
initiatives: { type: 'initiative[]', description: 'Response initiatives', backref: 'trends' },
relatedTrends: { type: 'trend[]', description: 'Related trends', backref: 'relatedTrends' },
},
actions: ['create', 'update', 'identify', 'analyze', 'monitor', 'respond', 'archive', 'validate', 'escalate'],
events: ['created', 'updated', 'identified', 'analyzed', 'monitored', 'responded', 'archived', 'validated', 'escalated'],
}
export const Opportunity: Noun = {
singular: 'opportunity',
plural: 'opportunities',
description: 'A strategic business opportunity',
properties: {
name: { type: 'string', description: 'Opportunity name' },
description: { type: 'string', description: 'Opportunity description' },
type: { type: 'string', description: 'Type of opportunity', examples: ['market-expansion', 'product', 'acquisition', 'partnership', 'technology', 'cost-reduction', 'revenue', 'efficiency'] },
status: { type: 'string', description: 'Opportunity status', examples: ['identified', 'evaluating', 'approved', 'pursuing', 'captured', 'declined', 'missed'] },
source: { type: 'string', description: 'Opportunity source', examples: ['market-analysis', 'customer-feedback', 'competitor-watch', 'trend', 'internal', 'partner'] },
potentialValue: { type: 'number', description: 'Potential value' },
currency: { type: 'string', description: 'Currency' },
probability: { type: 'number', description: 'Success probability (%)' },
expectedValue: { type: 'number', description: 'Expected value' },
timeToValue: { type: 'string', description: 'Time to realize value' },
investmentRequired: { type: 'number', description: 'Investment required' },
roi: { type: 'number', description: 'Expected ROI' },
paybackPeriod: { type: 'string', description: 'Payback period' },
risks: { type: 'string[]', description: 'Key risks' },
benefits: { type: 'string[]', description: 'Key benefits' },
requirements: { type: 'string[]', description: 'Requirements to capture' },
constraints: { type: 'string[]', description: 'Constraints' },
alternatives: { type: 'string[]', description: 'Alternative approaches' },
dependencies: { type: 'string[]', description: 'Dependencies' },
stakeholders: { type: 'string[]', description: 'Key stakeholders' },
owner: { type: 'string', description: 'Opportunity owner' },
sponsor: { type: 'string', description: 'Executive sponsor' },
identifiedDate: { type: 'date', description: 'Date identified' },
evaluationDeadline: { type: 'date', description: 'Evaluation deadline' },
targetCaptureDate: { type: 'date', description: 'Target capture date' },
windowStart: { type: 'date', description: 'Opportunity window start' },
windowEnd: { type: 'date', description: 'Opportunity window end' },
priority: { type: 'string', description: 'Priority level', examples: ['critical', 'high', 'medium', 'low'] },
strategicFit: { type: 'string', description: 'Strategic fit', examples: ['perfect', 'strong', 'moderate', 'weak'] },
notes: { type: 'string', description: 'Internal notes', optional: true },
tags: { type: 'string[]', description: 'Opportunity tags' },
metadata: { type: 'object', description: 'Additional metadata', optional: true },
},
relationships: {
market: { type: 'market', description: 'Related market', backref: 'opportunities' },
trend: { type: 'trend', description: 'Source trend', backref: 'opportunities' },
initiative: { type: 'initiative', description: 'Resulting initiative', backref: 'opportunity' },
project: { type: 'project', description: 'Implementation project', backref: 'opportunity' },
relatedOpportunities: { type: 'opportunity[]', description: 'Related opportunities', backref: 'relatedOpportunities' },
},
actions: ['create', 'update', 'identify', 'evaluate', 'approve', 'decline', 'pursue', 'capture', 'abandon', 'review'],
events: ['created', 'updated', 'identified', 'evaluated', 'approved', 'declined', 'pursued', 'captured', 'abandoned', 'reviewed'],
}
export const SWOT: Noun = {
singular: 'swot',
plural: 'swots',
description: 'A SWOT analysis (Strengths, Weaknesses, Opportunities, Threats)',
properties: {
name: { type: 'string', description: 'Analysis name' },
description: { type: 'string', description: 'Analysis description' },
type: { type: 'string', description: 'Type of SWOT', examples: ['company', 'product', 'market', 'competitor', 'project', 'initiative'] },
status: { type: 'string', description: 'Analysis status', examples: ['draft', 'in-progress', 'completed', 'archived'] },
subject: { type: 'string', description: 'Subject of analysis' },
strengths: { type: 'string[]', description: 'Strengths identified' },
weaknesses: { type: 'string[]', description: 'Weaknesses identified' },
opportunities: { type: 'string[]', description: 'Opportunities identified' },
threats: { type: 'string[]', description: 'Threats identified' },
strengthsScore: { type: 'number', description: 'Strengths aggregate score' },
weaknessesScore: { type: 'number', description: 'Weaknesses aggregate score' },
opportunitiesScore: { type: 'number', description: 'Opportunities aggregate score' },
threatsScore: { type: 'number', description: 'Threats aggregate score' },
overallAssessment: { type: 'string', description: 'Overall assessment' },
recommendations: { type: 'string[]', description: 'Recommendations' },
actionItems: { type: 'string[]', description: 'Resulting action items' },
participants: { type: 'string[]', description: 'Analysis participants' },
author: { type: 'string', description: 'Analysis author' },
reviewer: { type: 'string', description: 'Reviewer' },
analysisDate: { type: 'date', description: 'Analysis date' },
reviewDate: { type: 'date', description: 'Review date' },
validUntil: { type: 'date', description: 'Valid until date' },
documentUrl: { type: 'string', description: 'Document URL' },
notes: { type: 'string', description: 'Internal notes', optional: true },
tags: { type: 'string[]', description: 'SWOT tags' },
metadata: { type: 'object', description: 'Additional metadata', optional: true },
},
relationships: {
competitor: { type: 'competitor', description: 'Analyzed competitor', backref: 'swots' },
product: { type: 'product', description: 'Analyzed product', backref: 'swots' },
market: { type: 'market', description: 'Related market', backref: 'swots' },
initiative: { type: 'initiative', description: 'Resulting initiative', backref: 'swots' },
},
actions: ['create', 'update', 'conduct', 'review', 'approve', 'archive', 'share', 'revisit'],
events: ['created', 'updated', 'conducted', 'reviewed', 'approved', 'archived', 'shared', 'revisited'],
}
export const Industry: Noun = {
singular: 'industry',
plural: 'industries',
description: 'An industry or sector',
properties: {
name: { type: 'string', description: 'Industry name' },
description: { type: 'string', description: 'Industry description' },
code: { type: 'string', description: 'Industry code (NAICS, SIC)' },
classification: { type: 'string', description: 'Classification system', examples: ['NAICS', 'SIC', 'GICS', 'ICB', 'custom'] },
status: { type: 'string', description: 'Industry status', examples: ['emerging', 'growing', 'mature', 'declining', 'disrupted'] },
size: { type: 'number', description: 'Industry size (revenue)' },
growthRate: { type: 'number', description: 'Annual growth rate' },
employmentSize: { type: 'number', description: 'Total employment' },
majorPlayers: { type: 'string[]', description: 'Major players' },
concentration: { type: 'string', description: 'Industry concentration', examples: ['fragmented', 'competitive', 'oligopolistic', 'monopolistic'] },
barriers: { type: 'string[]', description: 'Entry barriers' },
regulations: { type: 'string[]', description: 'Key regulations' },
technologyDrivers: { type: 'string[]', description: 'Technology drivers' },
disruptions: { type: 'string[]', description: 'Potential disruptions' },
trends: { type: 'string[]', description: 'Industry trends' },
challenges: { type: 'string[]', description: 'Industry challenges' },
opportunities: { type: 'string[]', description: 'Industry opportunities' },
valueChain: { type: 'string[]', description: 'Value chain stages' },
relevance: { type: 'string', description: 'Relevance to business', examples: ['primary', 'secondary', 'adjacent', 'monitoring'] },
analyst: { type: 'string', description: 'Assigned analyst' },
lastAnalyzed: { type: 'date', description: 'Last analysis date' },
notes: { type: 'string', description: 'Internal notes', optional: true },
tags: { type: 'string[]', description: 'Industry tags' },
metadata: { type: 'object', description: 'Additional metadata', optional: true },
},
relationships: {
markets: { type: 'market[]', description: 'Related markets', backref: 'industry' },
competitors: { type: 'competitor[]', description: 'Industry competitors', backref: 'industries' },
trends: { type: 'trend[]', description: 'Industry trends', backref: 'industry' },
parentIndustry: { type: 'industry', description: 'Parent industry', backref: 'subIndustries' },
subIndustries: { type: 'industry[]', description: 'Sub-industries', backref: 'parentIndustry' },
},
actions: ['create', 'update', 'analyze', 'monitor', 'enter', 'exit', 'benchmark', 'report'],
events: ['created', 'updated', 'analyzed', 'monitored', 'entered', 'exited', 'benchmarked', 'reported'],
}
// Export all market entities
export const MarketEntities = {
Market,
Competitor,
Trend,
Opportunity,
SWOT,
Industry,
}
export default MarketEntities