File size: 14,816 Bytes
d8635c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
// Suggestion Engine for RFP Answer Enhancement

interface CompetitiveElement {
  keywords: string[];
  suggestions: string[];
}

interface CompanyProfile {
  name: string;
  experience: string;
  projectsCompleted: string;
  specializations: string[];
  certifications: string[];
  methodology: string[];
  teamSize: string;
  security: string[];
  timeline: string;
  pricing: string;
  staffingCapabilities?: {
    candidateDatabase: string;
    timeToFill: string;
    retentionRate: string;
    replacementGuarantee: string;
    skillLevels: string[];
    technologies: string[];
    clearances: string;
  };
}

interface AnalysisResult {
  qualityScore: number;
  strengths: string[];
  missingElements: string[];
  suggestions: string[];
  sednaEnhancements: string[];
}

interface RFPInsights {
  keyRequirements: string[];
  emphasizedAreas: string[];
  budgetIndicators: string[];
  timelineIndicators: string[];
  technologyMentions: string[];
  complianceRequirements: string[];
}

export class SuggestionEngine {
  private competitiveElements: Record<string, CompetitiveElement>;
  private companyProfile: CompanyProfile;

  constructor() {
    // Key elements that make RFP responses competitive
    this.competitiveElements = {
      experience: {
        keywords: ['years', 'experience', 'projects', 'delivered', 'successfully', 'track record'],
        suggestions: [
          'Add specific number of years of experience',
          'Include number of similar projects completed',
          'Mention client testimonials or case studies',
          'Highlight industry certifications'
        ]
      },
      methodology: {
        keywords: ['approach', 'methodology', 'process', 'framework', 'best practices'],
        suggestions: [
          'Detail your project management methodology (Agile, Waterfall, etc.)',
          'Include quality assurance processes',
          'Mention risk management strategies',
          'Describe testing and validation procedures'
        ]
      },
      security: {
        keywords: ['security', 'encryption', 'compliance', 'gdpr', 'soc', 'iso'],
        suggestions: [
          'Specify security certifications (SOC 2, ISO 27001)',
          'Detail encryption standards used',
          'Mention compliance frameworks (GDPR, HIPAA)',
          'Include penetration testing procedures'
        ]
      },
      team: {
        keywords: ['team', 'resources', 'staff', 'developers', 'architects'],
        suggestions: [
          'Provide team composition and roles',
          'Include team member certifications',
          'Mention relevant experience of key personnel',
          'Describe team scalability options'
        ]
      },
      timeline: {
        keywords: ['timeline', 'schedule', 'delivery', 'milestones', 'phases'],
        suggestions: [
          'Provide detailed project timeline',
          'Include milestone-based delivery approach',
          'Mention contingency planning for delays',
          'Describe parallel workstream capabilities'
        ]
      },
      cost: {
        keywords: ['cost', 'price', 'budget', 'value', 'roi'],
        suggestions: [
          'Provide transparent pricing model',
          'Include cost breakdown by phases',
          'Mention value-added services included',
          'Describe warranty and support terms'
        ]
      },
      technology: {
        keywords: ['technology', 'platform', 'architecture', 'integration', 'scalability'],
        suggestions: [
          'Detail technology stack and rationale',
          'Mention scalability and performance considerations',
          'Include integration capabilities',
          'Describe future-proofing strategies'
        ]
      },
      staffing: {
        keywords: ['staffing', 'recruitment', 'talent', 'candidates', 'placement', 'hire', 'augmentation'],
        suggestions: [
          'Highlight candidate database size and quality',
          'Include time-to-fill metrics and guarantees',
          'Mention retention rates and replacement policies',
          'Detail screening and vetting processes'
        ]
      }
    };

    this.companyProfile = {
      name: 'SEDNA Consulting Group',
      experience: '15+ years',
      projectsCompleted: '200+',
      specializations: ['enterprise digital transformation', 'healthcare', 'finance', 'manufacturing', 'IT staffing'],
      certifications: ['SOC 2', 'ISO 27001', 'GDPR'],
      methodology: ['Discovery', 'Design', 'Implementation', 'Testing', 'Deployment'],
      teamSize: '50+ professionals',
      security: ['end-to-end encryption', 'RBAC', 'security audits', 'penetration testing'],
      timeline: '18-week standard delivery',
      pricing: 'transparent fixed price with milestone billing',
      staffingCapabilities: {
        candidateDatabase: '2000+ qualified IT professionals',
        timeToFill: '48-72 hours initial submission',
        retentionRate: '90%+ placement retention',
        replacementGuarantee: '90-day no-cost replacement',
        skillLevels: ['Junior', 'Mid-level', 'Senior', 'Expert/Lead'],
        technologies: ['Full-stack Development', 'Cloud (AWS/Azure)', 'DevOps', 'Data Analytics', 'Cybersecurity', 'QA'],
        clearances: 'Security clearance capabilities available'
      }
    };
  }

  analyzeAnswer(question: string, answer: string, category = 'general'): AnalysisResult {
    const suggestions: string[] = [];
    const missingElements: string[] = [];
    const strengths: string[] = [];

    // Convert to lowercase for analysis
    const answerLower = answer.toLowerCase();
    const questionLower = question.toLowerCase();

    // Analyze coverage of competitive elements
    for (const [element, data] of Object.entries(this.competitiveElements)) {
      const hasKeywords = data.keywords.some((keyword: string) => 
        answerLower.includes(keyword) || questionLower.includes(keyword)
      );

      if (hasKeywords) {
        const coverage = this.calculateCoverage(answerLower, data.keywords);
        if (coverage < 0.3) { // Less than 30% keyword coverage
          missingElements.push(element);
          suggestions.push(...data.suggestions.slice(0, 2)); // Add top 2 suggestions
        } else {
          strengths.push(element);
        }
      }
    }

    // Add SEDNA-specific suggestions based on company profile
    const sednaSpecificSuggestions = this.generateSednaSpecificSuggestions(questionLower, answerLower);
    suggestions.push(...sednaSpecificSuggestions);

    // Quality score (0-100)
    const qualityScore = this.calculateQualityScore(answer, strengths.length, missingElements.length);

    return {
      qualityScore,
      strengths,
      missingElements,
      suggestions: this.removeDuplicates(suggestions),
      sednaEnhancements: this.getSednaEnhancements(questionLower)
    };
  }

  private calculateCoverage(text: string, keywords: string[]): number {
    const foundKeywords = keywords.filter((keyword: string) => text.includes(keyword));
    return foundKeywords.length / keywords.length;
  }

  private calculateQualityScore(answer: string, strengthsCount: number, missingCount: number): number {
    const baseScore = Math.min(answer.length / 10, 50); // Length-based score (max 50)
    const strengthBonus = strengthsCount * 8; // 8 points per strength
    const missingPenalty = missingCount * 5; // 5 points penalty per missing element
    
    return Math.max(0, Math.min(100, baseScore + strengthBonus - missingPenalty));
  }

  private generateSednaSpecificSuggestions(question: string, answer: string): string[] {
    const suggestions: string[] = [];

    // Experience-related suggestions
    if ((question.includes('experience') || question.includes('qualification')) && 
        !answer.includes('15') && !answer.includes('200')) {
      suggestions.push('Mention SEDNA\'s 15+ years of experience and 200+ completed projects');
    }

    // IT Staffing specific suggestions
    if (question.includes('staffing') || question.includes('recruitment') || question.includes('candidates')) {
      if (!answer.includes('2000')) {
        suggestions.push('Highlight SEDNA\'s database of 2000+ qualified IT professionals');
      }
      if (!answer.includes('48-72 hours')) {
        suggestions.push('Mention 48-72 hour response time for initial candidate submissions');
      }
      if (!answer.includes('90%')) {
        suggestions.push('Include 90%+ retention rate and 90-day replacement guarantee');
      }
    }

    // Time-to-fill and performance metrics
    if (question.includes('time') && question.includes('fill')) {
      suggestions.push('Emphasize SEDNA\'s rapid 48-72 hour initial candidate submission timeframe');
    }

    // Candidate quality and screening
    if (question.includes('quality') || question.includes('screening')) {
      suggestions.push('Detail SEDNA\'s comprehensive vetting process and quality assurance measures');
    }

    // Industry-specific suggestions
    if (question.includes('healthcare') && !answer.includes('healthcare')) {
      suggestions.push('Highlight SEDNA\'s healthcare industry expertise');
    }

    if (question.includes('finance') && !answer.includes('finance')) {
      suggestions.push('Emphasize SEDNA\'s financial services experience');
    }

    // Security-related suggestions
    if ((question.includes('security') || question.includes('compliance')) && 
        !answer.includes('soc 2')) {
      suggestions.push('Include SEDNA\'s SOC 2, ISO 27001, and GDPR compliance certifications');
    }

    // Methodology suggestions
    if ((question.includes('approach') || question.includes('methodology')) && 
        !answer.includes('discovery')) {
      suggestions.push('Detail SEDNA\'s 5-phase methodology: Discovery → Design → Implementation → Testing → Deployment');
    }

    // Team composition suggestions
    if (question.includes('team') && !answer.includes('project manager')) {
      suggestions.push('Describe SEDNA\'s standard team composition including PMP certified Project Manager');
    }

    return suggestions;
  }

  private getSednaEnhancements(question: string): string[] {
    const enhancements: string[] = [];

    // IT Staffing specific enhancements
    if (question.includes('staffing') || question.includes('recruitment') || question.includes('talent')) {
      enhancements.push(
        'SEDNA\'s comprehensive candidate database: 2000+ qualified IT professionals across all skill levels',
        'Rapid response time: Initial candidate submissions within 48-72 hours',
        'Proven retention: 90%+ placement retention rate with 90-day replacement guarantee',
        'Full-spectrum capabilities: Contract, contract-to-hire, and direct placement services',
        'Security clearance capabilities for government and defense contractor requirements'
      );
    }

    // Add specific SEDNA differentiators based on question type
    if (question.includes('why choose') || question.includes('competitive advantage')) {
      enhancements.push(
        'SEDNA\'s proven track record: 200+ successful projects across healthcare, finance, and manufacturing',
        'Multi-layered security approach with SOC 2 and ISO 27001 certifications',
        'Transparent pricing model with competitive rates and volume discounts'
      );
    }

    if (question.includes('experience') || question.includes('background')) {
      enhancements.push(
        '15+ years of experience in enterprise digital transformation and IT staffing',
        'Deep expertise across multiple industries: healthcare, finance, manufacturing',
        'Proven methodology for complex technology initiatives and staff augmentation'
      );
    }

    if (question.includes('timeline') || question.includes('delivery')) {
      enhancements.push(
        'SEDNA\'s standard 18-week delivery timeline with staged rollout approach',
        'Agile methodology with continuous integration and sprint reviews',
        'Risk mitigation through cross-trained team members and early API testing'
      );
    }

    if (question.includes('cost') || question.includes('pricing')) {
      enhancements.push(
        'Transparent pricing model with no hidden costs',
        'Monthly billing with milestone-based payments',
        'Includes 6-month warranty and support in base price',
        'Change management process for scope modifications'
      );
    }

    return enhancements;
  }

  private removeDuplicates(array: string[]): string[] {
    return [...new Set(array)];
  }

  // Analyze the entire RFP document for strategic insights
  analyzeRFPDocument(rfpContent: string): RFPInsights {
    const insights: RFPInsights = {
      keyRequirements: [],
      emphasizedAreas: [],
      budgetIndicators: [],
      timelineIndicators: [],
      technologyMentions: [],
      complianceRequirements: []
    };

    const contentLower = rfpContent.toLowerCase();

    // Extract key requirements (words that appear frequently)
    const words = contentLower.split(/\s+/);
    const wordFreq: Record<string, number> = {};
    words.forEach((word: string) => {
      if (word.length > 4) { // Only consider meaningful words
        wordFreq[word] = (wordFreq[word] || 0) + 1;
      }
    });

    // Get most frequent words as key requirements
    insights.keyRequirements = Object.entries(wordFreq)
      .sort(([,a], [,b]) => (b as number) - (a as number))
      .slice(0, 10)
      .map(([word]) => word);

    // Look for budget indicators
    const budgetPatterns = /\$[\d,]+|\d+k|\d+m|budget|cost|price/gi;
    insights.budgetIndicators = [...new Set(rfpContent.match(budgetPatterns) || [])] as string[];

    // Look for timeline indicators
    const timelinePatterns = /\d+\s*(weeks?|months?|days?)|deadline|delivery|timeline/gi;
    insights.timelineIndicators = [...new Set(rfpContent.match(timelinePatterns) || [])] as string[];

    // Technology mentions
    const techPatterns = /cloud|aws|azure|javascript|python|react|angular|api|database|sql/gi;
    insights.technologyMentions = [...new Set(rfpContent.match(techPatterns) || [])] as string[];

    // Compliance requirements
    const compliancePatterns = /gdpr|hipaa|soc\s*2|iso\s*27001|compliance|security|encryption/gi;
    insights.complianceRequirements = [...new Set(rfpContent.match(compliancePatterns) || [])] as string[];

    return insights;
  }
}

export const suggestionEngine = new SuggestionEngine();