Skip to main content

Business Service Analyzer Technical Reference

Architecture Overview

The Business Service Analyzer consists of several integrated components:

┌─────────────────────────────────────────────────────────────┐
│ Frontend Components │
├─────────────────────────────────────────────────────────────┤
│ BusinessServiceAnalyzer.tsx - Main wizard component │
│ ├── ServiceDescriptionSection │
│ ├── SoftwareSelectionSection │
│ ├── EnrichmentSection │
│ ├── DiscoveryConfigSection │
│ ├── DiscoveryPreviewSection │
│ └── DiscoveryResultsSection │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ API Endpoints │
├─────────────────────────────────────────────────────────────┤
│ POST /api/business-service-analyzer/enrich │
│ POST /api/business-service-analyzer/discover │
│ POST /api/business-service-analyzer/classify │
│ POST /api/business-service-analyzer/insights │
│ POST /api/business-service-analyzer/save │
└─────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│ Backend Services │
├─────────────────────────────────────────────────────────────┤
│ enrichmentService.js - AI-powered enrichment │
│ discoveryService.js - Component discovery │
│ classificationService.js - Server classification │
│ insightsService.js - Analysis generation │
└─────────────────────────────────────────────────────────────┘

API Reference

Enrichment Endpoint

POST /api/business-service-analyzer/enrich

Enriches service definition with AI suggestions.

Request Body:

{
"description": "Email service for corporate communications",
"selectedSoftware": [
{
"catalogId": "123",
"name": "Microsoft Exchange",
"vendor": "Microsoft"
}
],
"manualProcesses": ["w3wp.exe"],
"manualSoftware": ["Custom Email Gateway"]
}

Response:

{
"success": true,
"enrichedData": {
"processes": [
{
"name": "MSExchangeTransport.exe",
"source": "ai-suggested",
"confidence": 0.95,
"ports": [25, 587]
}
],
"software": [...],
"ports": [...],
"searchPatterns": {...}
}
}

Discovery Endpoint

POST /api/business-service-analyzer/discover

Discovers service components based on patterns.

Request Body:

{
"processes": ["process1", "process2"],
"software": ["software1"],
"ports": [
{
"port": 80,
"protocol": "TCP",
"description": "HTTP"
}
],
"searchPatterns": {
"processPatterns": ["exchange.*"],
"portRanges": [{"start": 8080, "end": 8090}]
},
"timeRange": {
"start": "2024-01-01T00:00:00Z",
"end": "2024-01-07T23:59:59Z"
}
}

Response:

{
"success": true,
"servers": [...],
"connections": [...],
"statistics": {
"totalServers": 10,
"totalConnections": 45,
"uniqueProcesses": 23
}
}

Classification Endpoint

POST /api/business-service-analyzer/classify

Classifies servers and determines service architecture.

Request Body:

{
"servers": [...],
"connections": [...],
"serviceDescription": "Email service"
}

Response:

{
"success": true,
"classifiedServers": [...],
"serviceTiers": {
"frontend": {...},
"application": {...},
"data": {...}
}
}

Save Endpoint

POST /api/business-service-analyzer/save

Saves discovered service as Business Service CI.

Request Body:

{
"name": "Corporate Email",
"description": "Email service for all employees",
"category": "Email",
"discoveryConfig": {...},
"components": {
"servers": [...],
"connections": [...]
},
"analysis": {...}
}

Data Models

BusinessService Model

{
name: String,
description: String,
tenant: ObjectId,
category: {
type: String,
enum: ['ERP', 'Email', 'Database', 'Web Application',
'Authentication', 'Monitoring', 'Custom']
},
discoveryConfig: {
selectedSoftware: [{
catalogId: String,
name: String,
vendor: String
}],
processes: [{
name: String,
source: String,
ports: [Number]
}],
software: [Object],
ports: [Object],
searchPatterns: Object
},
components: {
servers: [{
ciId: ObjectId,
hostname: String,
role: String,
tier: String,
processes: [Object],
metadata: Object
}],
connections: [Object]
},
analysis: {
summary: String,
insights: Object,
classification: Object,
generatedAt: Date
},
status: {
type: String,
enum: ['draft', 'discovering', 'discovered', 'validated', 'active', 'archived']
},
createdBy: ObjectId,
validatedBy: ObjectId,
lastDiscoveryAt: Date
}

CI Custom Fields (Business Service)

customFields: {
// Core fields
serviceId: String, // BusinessService._id
category: String, // Service category
criticality: String, // Critical/High/Medium/Low
description: String, // Service description

// Discovery data (stringified JSON)
discoveredServers: String, // Array of discovered servers
discoveredConnections: String, // Network connections
classifiedServers: String, // Server classifications
serviceTiers: String, // Tier organization
serviceInsights: String, // Full AI insights

// Statistics
discoveryStatistics: String, // Discovery metrics
discoveryConfig: String, // Configuration used
analysisData: String, // Complete analysis

// Counters
serverCount: Number,
connectionCount: Number,
lastDiscoveryDate: Date,
discoveryStatus: String
}

AIInsights for Business Service

{
ciId: ObjectId, // Business Service CI ID
insightCategory: 'business_service',
insightData: {
serviceInfo: {
name: String,
description: String,
category: String,
businessServiceId: ObjectId,
discoveryDate: Date
},
statistics: {
totalServers: Number,
totalConnections: Number,
serversByRole: Object,
serversByTier: Object
},
analysis: {
summary: String,
insights: Object, // Complete insights
classification: Object
},
discoveryConfig: Object,
serverSummary: Array,
connectionPatterns: Object
}
}

Service Components

EnrichmentService

Key Functions:

  • enrichServiceDefinition(): Main enrichment logic
  • AI prompt engineering for process/port suggestions
  • Token management (4000 max tokens)
  • JSON parsing with error recovery

AI Integration:

  • Uses AWS Bedrock Claude-3-Sonnet
  • Structured prompts for consistent output
  • Handles rate limiting

DiscoveryService

Key Functions:

  • discoverServiceComponents(): Main discovery logic
  • Optimized MongoDB queries
  • Process name matching with regex
  • Network connection mapping

Performance Optimizations:

  • Simplified aggregations
  • Batch processing
  • Index usage on process_name, tenant

ClassificationService

Key Functions:

  • classifyServiceComponents(): Server role classification
  • Tier assignment logic
  • Confidence scoring

Classification Rules:

  • Web servers: IIS, Apache, nginx processes
  • App servers: Application-specific processes
  • Databases: Database engine processes
  • Infrastructure: Supporting services

Data Flow

  1. User Input → Frontend form validation
  2. Enrichment → AI processing → Enhanced patterns
  3. Discovery → Database queries → Raw components
  4. Classification → AI analysis → Structured service
  5. Save → Create CI + Relationships + AI Insights

Frontend Components

BusinessServiceAnalyzer.tsx

Main orchestrator component:

  • Step management
  • State persistence
  • API integration
  • Error handling

ServiceAnalysisTab.tsx

Displays saved services:

  • Data transformation (processes ↔ runningProcesses)
  • Metadata extraction
  • Dynamic rendering with DiscoveryResultsSection

Key Data Transformations

During Save:

// Frontend to Backend
processes: server.runningProcesses || []
metadata: {
ipAddress: server.ipAddress,
operatingSystem: server.operatingSystem
}

During Load:

// Backend to Frontend
runningProcesses: server.runningProcesses || server.processes || []
operatingSystem: server.operatingSystem || server.metadata?.operatingSystem
ipAddress: server.ipAddress || server.metadata?.ipAddress

Configuration

Environment Variables

# AI Service
AWS_REGION=us-east-1
ANTHROPIC_MODEL=claude-3-sonnet-20240229

# Discovery
DISCOVERY_TIMEOUT=120000
MAX_DISCOVERY_RESULTS=1000

Feature Flags

// In app configuration
features: {
businessServiceAnalyzer: {
enabled: true,
maxServersPerService: 100,
discoveryTimeoutMs: 120000
}
}

Security Considerations

  1. Tenant Isolation: All queries include tenant filter
  2. Data Sanitization: User input validated and escaped
  3. AI Safety: No sensitive data in prompts
  4. Rate Limiting: API endpoints protected
  5. Audit Logging: All operations logged

Performance Guidelines

  1. Discovery Optimization:

    • Use appropriate time ranges
    • Limit process patterns
    • Index on frequently queried fields
  2. UI Responsiveness:

    • Pagination for large result sets
    • Progressive loading
    • Client-side caching
  3. AI Service Usage:

    • Token limits enforced
    • Response caching where appropriate
    • Fallback mechanisms

Troubleshooting

Common Issues

  1. Empty Process Lists:

    • Check data structure (processes vs runningProcesses)
    • Verify metadata extraction
    • Confirm discovery data exists
  2. AI Parsing Errors:

    • Increase token limits
    • Add JSON extraction regex
    • Handle markdown code blocks
  3. Discovery Timeouts:

    • Reduce time range
    • Optimize queries
    • Check indexes

Debug Endpoints

# Check business service data
GET /api/business-service-analyzer/debug/:serviceId

# Verify discovery data
GET /api/discovery/scan-data?limit=10

# Test AI service
POST /api/ai/test