Compliance Scoring System - Complete Guide

27 min read
Cover Image for Compliance Scoring System - Complete Guide

Last Updated: 2026-01-24
Status: Active System - Guides Document Generation to Perfection
Purpose: Explain how compliance scores evaluate and improve document quality


Overview

ADPA's Compliance Scoring System is a comprehensive multi-dimensional evaluation framework that analyzes every generated document and provides actionable feedback to guide improvements. The system evaluates documents across 10 quality dimensions and 7 compliance metrics, creating a feedback loop that drives documents toward perfection.


🎯 The Two-Layer Scoring System

Layer 1: Quality Dimensions (10 Metrics)

Purpose: Evaluate document structure, content, and presentation quality

Layer 2: Compliance Metrics (7 Standards)

Purpose: Evaluate adherence to frameworks and regulatory standards

Together: These layers create a comprehensive assessment that guides document generation from initial draft to perfection.


📊 Layer 1: 10-Dimension Quality System

How Each Dimension Guides Perfection

1. Completeness (0-100%, Weight: 14%)

What It Measures: Presence of all required document elements

Scoring Algorithm:

completeness = 
  (hasMainTitle ? 25 : 0) +
  (hasHeaders >= 3 ? 25 : 0) +
  (hasTables >= 10 cells ? 25 : 0) +
  (hasLists >= 5 items ? 25 : 0)

How It Guides Perfection:

  • Score < 75%: System recommends adding missing elements

  • Feedback: "Add more sections with headers, tables, and lists"

  • AI Prompt Enhancement: System prompts AI to include missing elements in next generation

  • Result: Documents become more complete with each iteration

Example Progression:

Draft 1: 50% → Missing tables and lists
Draft 2: 75% → Added tables, still needs more lists
Draft 3: 100% → All elements present ✅

2. Structure Score (0-100%, Weight: 14%)

What It Measures: Logical organization and proper hierarchy

Scoring Algorithm:

structureScore =
  (hasProperHierarchy ? 50 : 25) +  // 1 H1, 3+ H2
  (hasSubsections ? 30 : 0) +        // 2+ H3
  (paragraphCount >= 5 ? 20 : 10)

How It Guides Perfection:

  • Score < 75%: Identifies hierarchy issues

  • Feedback: "Improve document hierarchy with proper H1/H2/H3 structure"

  • AI Enhancement: System instructs AI to reorganize content hierarchically

  • Result: Documents develop clear, logical structure

Example Progression:

Draft 1: 40% → Flat structure, no hierarchy
Draft 2: 70% → Added H2 sections, needs H3 subsections
Draft 3: 95% → Perfect hierarchy with H1/H2/H3 ✅

3. Formatting Score (0-100%, Weight: 9%)

What It Measures: Markdown syntax quality and visual presentation

Scoring Algorithm:

formattingScore =
  (hasBold ? 20 : 0) +
  (hasCode ? 15 : 0) +
  (hasHR ? 15 : 0) +
  (hasNumberedLists ? 20 : 0) +
  (hasTables ? 30 : 0)

How It Guides Perfection:

  • Score < 70%: Identifies formatting deficiencies

  • Feedback: "Enhance formatting with bold text, tables, and code blocks"

  • AI Enhancement: System prompts AI to use proper Markdown formatting

  • Result: Documents become more visually appealing and readable


4. Content Depth (0-100%, Weight: 11%)

What It Measures: Level of detail and comprehensiveness

Scoring Algorithm:

contentDepth =
  (avgWordsPerSection >= 150 ? 40 : 20) +
  (totalWords >= 800 ? 40 : 20) +
  (sentenceCount >= 20 ? 20 : 10)

How It Guides Perfection:

  • Score < 80%: Identifies shallow content

  • Feedback: "Increase content depth with more detailed sections (aim for 150+ words per section)"

  • AI Enhancement: System instructs AI to expand sections with more detail

  • Result: Documents become more comprehensive and informative

Example Progression:

Draft 1: 45% → Brief sections, 400 words total
Draft 2: 70% → Expanded sections, 600 words
Draft 3: 95% → Detailed sections, 1200 words ✅

5. Accuracy (0-100%, Weight: 11%)

What It Measures: Information precision and factual correctness

Scoring Algorithm:

accuracy =
  (hasSpecificData ? 30 : 0) +      // Percentages, costs, timeframes
  (hasCitations ? 20 : 0) +         // References to sources
  (hasDefinitions ? 25 : 10) +      // Clear definitions
  (hasExamples ? 25 : 10)           // Concrete examples

How It Guides Perfection:

  • Score < 85%: Identifies vague or unsupported content

  • Feedback: "Add specific data, citations, and examples"

  • AI Enhancement: System prompts AI to include quantifiable data and references

  • Result: Documents become more precise and credible


6. Consistency (0-100%, Weight: 10%)

What It Measures: Internal coherence and uniform terminology

Scoring Algorithm:

consistency =
  (hasTOC ? 20 : 0) +
  (hasConsistentHeaders ? 25 : 10) +
  (hasGoodFlowRange ? 30 : 15) +    // 10-25 words/sentence
  (hasUniformSections ? 25 : 10)    // Similar section lengths

How It Guides Perfection:

  • Score < 85%: Identifies inconsistencies

  • Feedback: "Improve consistency in terminology and section structure"

  • AI Enhancement: System instructs AI to maintain consistent style

  • Result: Documents become more cohesive and professional


7. Context Relevance (0-100%, Weight: 10%)

What It Measures: Alignment with project context and framework

Scoring Algorithm:

contextRelevance =
  (hasProjectContext ? 35 : 15) +
  (hasFrameworkAlignment ? 25 : 0) +  // PMBOK/BABOK/DMBOK
  (hasActionableContent ? 25 : 10) +   // should/must/will
  (frameworkMentions >= 5 ? 15 : 0)

How It Guides Perfection:

  • Score < 80%: Identifies misalignment with project/framework

  • Feedback: "Enhance project context references and framework alignment"

  • AI Enhancement: System prompts AI to include more project-specific content

  • Result: Documents become more relevant and actionable


8. Professional Quality (0-100%, Weight: 8%)

What It Measures: Writing standards and presentation

Scoring Algorithm:

professionalQuality =
  (hasExecutiveSummary ? 25 : 0) +
  (hasIntroduction ? 20 : 10) +
  (hasConclusion ? 20 : 0) +
  (hasProperGrammar ? 20 : 10) +
  (noExcessiveCaps ? 15 : 0)

How It Guides Perfection:

  • Score < 75%: Identifies unprofessional elements

  • Feedback: "Add executive summary, introduction, and conclusion sections"

  • AI Enhancement: System instructs AI to follow professional document structure

  • Result: Documents become more polished and executive-ready


9. Standards Compliance (0-100%, Weight: 8%)

What It Measures: Adherence to framework requirements

Scoring Algorithm:

standardsCompliance =
  (hasRequiredSections >= 5 ? 25 : 10) +
  (hasRolesResponsibilities ? 20 : 0) +
  (hasMetrics ? 20 : 0) +
  (hasTimelines ? 20 : 0) +
  (hasApprovals ? 15 : 0)

How It Guides Perfection:

  • Score < 85%: Identifies missing framework elements

  • Feedback: "Add roles & responsibilities, metrics, timelines, and approvals"

  • AI Enhancement: System prompts AI to include framework-required sections

  • Result: Documents become fully compliant with chosen framework


10. Complexity Score (0-100%, Weight: 5%)

What It Measures: Manual creation effort (ROI calculation)

Scoring Algorithm:

complexityScore = 
  outputComplexity (60 points max) +
  researchComplexity (40 points max)

// Output Complexity
outputComplexity =
  (hasMultipleTables ? 12 : 6) +
  (hasDeepHierarchy ? 12 : 6) +
  (hasLongSections ? 12 : 6) +
  (hasTechnicalContent ? 15 : 3) +
  (isLongDocument ? 9 : 3)

// Research Complexity
researchComplexity =
  (sourceDocCount === 0 ? 0 :
   sourceDocCount === 1 ? 5 :
   sourceDocCount <= 3 ? 10 :
   sourceDocCount <= 5 ? 20 :
   sourceDocCount <= 7 ? 30 : 40)

How It Guides Perfection:

  • Purpose: Quantifies time savings (ROI)

  • Feedback: Shows estimated manual creation time vs AI generation time

  • Result: Demonstrates value and guides complexity decisions


🎯 Layer 2: Compliance Metrics (7 Standards)

How Compliance Metrics Guide Perfection

1. PMBOK Guide Compliance (0-100%)

What It Measures: Adherence to PMBOK 7 principles and knowledge areas

Scoring Algorithm:

pmbokGuide =
  (hasPmbokStructure ? 30 : 0) +        // Project charter/plan
  (hasPmbokProcesses ? 30 : 0) +        // Initiating/planning/etc
  (hasPmbokKnowledgeAreas ? 25 : 0) +   // 5+ knowledge areas
  (pmbokMentions >= 8 ? 15 : 0)         // Keyword density

How It Guides Perfection:

  • Score < 80%: Identifies missing PMBOK elements

  • Feedback: "Add PMBOK process groups and knowledge areas"

  • AI Enhancement: System prompts AI to include PMBOK-specific content

  • Result: Documents become fully PMBOK-compliant

Example Progression:

Draft 1: 40% → Generic project document
Draft 2: 70% → Added PMBOK terminology
Draft 3: 95% → Full PMBOK structure with all knowledge areas ✅

2. GDPR Compliance (0-100%)

What It Measures: Data protection and privacy considerations

Scoring Algorithm:

gdpr =
  (hasGdprCompliance ? 40 : 0) +
  (hasGdprPrinciples ? 25 : 0) +    // Lawfulness, fairness, transparency
  (hasGdprRights ? 20 : 0) +         // Right to access, erasure, etc
  (gdprMentions >= 5 ? 15 : 0)

How It Guides Perfection:

  • Score < 70%: Identifies missing GDPR considerations

  • Feedback: "Add GDPR compliance section with data protection principles"

  • AI Enhancement: System prompts AI to include GDPR requirements

  • Result: Documents address data protection requirements


3. HIPAA Compliance (0-100%)

What It Measures: Healthcare data protection requirements

Scoring Algorithm:

hipaa =
  (hasHipaaCompliance ? 40 : 0) +
  (hasHipaaPrivacy ? 25 : 0) +      // Privacy Rule, PHI
  (hasHipaaSecurity ? 25 : 0) +     // Security Rule, ePHI
  (hipaaMentions >= 4 ? 10 : 0)

How It Guides Perfection:

  • Score < 70%: Identifies missing HIPAA considerations

  • Feedback: "Add HIPAA Privacy and Security Rule compliance"

  • AI Enhancement: System prompts AI to include HIPAA requirements

  • Result: Documents address healthcare data protection


4. SOC 2 Compliance (0-100%)

What It Measures: Service organization control and security

Scoring Algorithm:

soc2 =
  (hasSoc2Compliance ? 40 : 0) +
  (hasSoc2Criteria ? 25 : 0) +      // Trust Service Criteria
  (hasSoc2Controls ? 25 : 0) +       // Security/availability controls
  (soc2Mentions >= 4 ? 10 : 0)

How It Guides Perfection:

  • Score < 70%: Identifies missing SOC 2 considerations

  • Feedback: "Add SOC 2 Trust Service Criteria and controls"

  • AI Enhancement: System prompts AI to include SOC 2 requirements

  • Result: Documents address service organization controls


5. Industry Standards (0-100%)

What It Measures: Adherence to ISO, ANSI, IEEE, NIST, etc.

Scoring Algorithm:

industryStandards =
  (hasIsoStandards ? 35 : 0) +       // ISO 9001, 27001, 20000
  (hasOtherStandards ? 25 : 0) +     // ANSI, IEEE, NIST
  (hasStandardsReferences ? 25 : 0) +
  (industryMentions >= 5 ? 15 : 0)

How It Guides Perfection:

  • Score < 70%: Identifies missing industry standard references

  • Feedback: "Add references to relevant industry standards (ISO, ANSI, etc.)"

  • AI Enhancement: System prompts AI to include industry standard references

  • Result: Documents align with industry best practices


6. Best Practices (0-100%)

What It Measures: Inclusion of proven methodologies and lessons learned

Scoring Algorithm:

bestPractices =
  (hasBestPractices ? 30 : 0) +
  (hasLessonsLearned ? 25 : 0) +
  (hasProvenMethods ? 20 : 0) +
  (hasDocumentationStandards ? 15 : 0) +
  (bestPracticeMentions >= 3 ? 10 : 0)

How It Guides Perfection:

  • Score < 70%: Identifies missing best practices

  • Feedback: "Include best practices, lessons learned, and proven methodologies"

  • AI Enhancement: System prompts AI to include industry best practices

  • Result: Documents incorporate proven approaches


7. Template Adherence (0-100%)

What It Measures: Following expected template structure

Scoring Algorithm:

templateAdherence =
  (hasRequiredSections ? 40 : 0) +
  (hasProperFormatting ? 30 : 0) +
  (hasConsistentStructure ? 30 : 0)

How It Guides Perfection:

  • Score < 80%: Identifies template deviations

  • Feedback: "Follow template structure with required sections"

  • AI Enhancement: System instructs AI to strictly follow template

  • Result: Documents match template expectations


🔄 The Perfection Feedback Loop

How Scores Guide Document Generation

┌─────────────────────────────────────────────────────────┐
│ 1. Document Generated                                    │
│    ↓                                                     │
│ 2. Compliance Scores Calculated                         │
│    - 10 Quality Dimensions                               │
│    - 7 Compliance Metrics                                │
│    - Overall Quality Score                               │
│    ↓                                                     │
│ 3. Gap Analysis Performed                                │
│    - Identify scores < target threshold                 │
│    - Generate specific recommendations                  │
│    ↓                                                     │
│ 4. Feedback Provided to User                             │
│    - Visual score displays                              │
│    - Actionable recommendations                         │
│    - Missing elements highlighted                        │
│    ↓                                                     │
│ 5. User Regenerates OR System Auto-Improves             │
│    - Enhanced prompts with missing elements              │
│    - Framework-specific guidance                        │
│    - Template adherence instructions                    │
│    ↓                                                     │
│ 6. New Document Generated                                │
│    - Improved scores                                    │
│    - Better compliance                                  │
│    - Closer to perfection                               │
│    ↓                                                     │
│ 7. Loop Continues Until Target Scores Reached           │
│    - Target: 85%+ overall quality                       │
│    - Target: 80%+ compliance                            │
│    - Target: All dimensions75%                        │
└─────────────────────────────────────────────────────────┘

📈 Real-World Example: Document Journey to Perfection

Project Charter Generation

Draft 1: Initial Generation

Overall Quality: 62% (D - Needs Improvement)

Quality Dimensions:
- Completeness: 50% ⚠️ Missing tables and lists
- Structure: 40% ⚠️ Flat structure, no hierarchy
- Formatting: 45% ⚠️ Basic formatting only
- Content Depth: 55% ⚠️ Brief sections
- Accuracy: 60% ⚠️ Vague statements
- Consistency: 50% ⚠️ Inconsistent terminology
- Context Relevance: 70% ✅ Good project context
- Professional Quality: 45% ⚠️ Missing executive summary
- Standards Compliance: 50% ⚠️ Missing required sections
- Complexity: 30% (Simple document)

Compliance Metrics:
- PMBOK Guide: 40% ⚠️ Missing PMBOK structure
- GDPR: 0% (Not applicable)
- HIPAA: 0% (Not applicable)
- SOC 2: 0% (Not applicable)
- Industry Standards: 20% ⚠️ No standard references
- Best Practices: 30% ⚠️ Limited best practices
- Template Adherence: 50% ⚠️ Missing required sections
- Overall Compliance: 35%

Recommendations:
1. Add more sections with headers, tables, and lists
2. Improve document hierarchy with proper H1/H2/H3 structure
3. Enhance formatting with bold text, tables, and code blocks
4. Increase content depth with more detailed sections
5. Add PMBOK process groups and knowledge areas
6. Include industry standard references

Draft 2: After First Improvement

Overall Quality: 78% (C - Satisfactory)

Quality Dimensions:
- Completeness: 85% ✅ Added tables and lists
- Structure: 75% ✅ Improved hierarchy
- Formatting: 80% ✅ Enhanced formatting
- Content Depth: 70% ⚠️ Still needs more detail
- Accuracy: 75% ⚠️ Some vague statements remain
- Consistency: 80% ✅ Better consistency
- Context Relevance: 85% ✅ Excellent project context
- Professional Quality: 70% ⚠️ Added introduction, needs executive summary
- Standards Compliance: 75% ✅ Added required sections
- Complexity: 50% (Moderate complexity)

Compliance Metrics:
- PMBOK Guide: 75% ✅ Added PMBOK terminology
- Industry Standards: 60% ✅ Added some references
- Best Practices: 70% ✅ Included best practices
- Template Adherence: 80% ✅ Better template adherence
- Overall Compliance: 65%

Recommendations:
1. Expand sections with more detail (aim for 150+ words per section)
2. Add specific data, citations, and examples
3. Add executive summary section
4. Include more PMBOK knowledge areas

Draft 3: Near Perfection

Overall Quality: 92% (A - Excellent)

Quality Dimensions:
- Completeness: 100% ✅ All elements present
- Structure: 100% ✅ Perfect hierarchy
- Formatting: 95% ✅ Excellent formatting
- Content Depth: 95% ✅ Comprehensive detail
- Accuracy: 90% ✅ Specific data and examples
- Consistency: 95% ✅ Excellent consistency
- Context Relevance: 95% ✅ Perfect project alignment
- Professional Quality: 90% ✅ Professional structure
- Standards Compliance: 95% ✅ All framework requirements
- Complexity: 75% (Complex document - 1-2 days manual)

Compliance Metrics:
- PMBOK Guide: 95% ✅ Full PMBOK compliance
- Industry Standards: 85% ✅ Multiple standard references
- Best Practices: 90% ✅ Comprehensive best practices
- Template Adherence: 100% ✅ Perfect template match
- Overall Compliance: 92%

Recommendations:
- Minor: Add one more example in risk section
- Minor: Expand change management section slightly

Draft 4: Perfection Achieved

Overall Quality: 98% (A - Excellent)

Quality Dimensions:
- Completeness: 100% ✅
- Structure: 100% ✅
- Formatting: 100% ✅
- Content Depth: 100% ✅
- Accuracy: 98% ✅
- Consistency: 100% ✅
- Context Relevance: 100% ✅
- Professional Quality: 95% ✅
- Standards Compliance: 100% ✅
- Complexity: 85% (Very Complex - 2-4 days manual)

Compliance Metrics:
- PMBOK Guide: 100% ✅ Perfect PMBOK compliance
- Industry Standards: 95% ✅ Comprehensive standards
- Best Practices: 100% ✅ All best practices included
- Template Adherence: 100% ✅ Perfect template match
- Overall Compliance: 98%

Status: ✅ PERFECT - Ready for production use

🎯 How Scores Guide Each Generation

1. Automatic Prompt Enhancement

When scores are below target, the system automatically enhances the AI prompt:

// Original Prompt
"Generate a project charter for {projectName}"

// Enhanced Prompt (after low scores detected)
"Generate a project charter for {projectName} that includes:
- Executive summary section
- Comprehensive stakeholder matrix (table format)
- Detailed risk register with mitigation strategies
- PMBOK 7 process groups and knowledge areas
- Industry standard references (ISO, ANSI)
- Best practices and lessons learned
- Proper H1/H2/H3 hierarchy
- Specific data (percentages, costs, timeframes)
- Professional formatting with tables and lists"

2. Template Refinement

Low compliance scores trigger template improvements:

// System identifies: Template Adherence = 50%
// Action: Enhance template with missing sections

// Before
template.sections = ["Introduction", "Scope", "Timeline"]

// After
template.sections = [
  "Executive Summary",
  "Introduction", 
  "Stakeholder Analysis",
  "Scope",
  "Roles & Responsibilities",
  "Timeline",
  "Budget",
  "Risk Management",
  "Success Criteria",
  "Approvals"
]

3. Framework-Specific Guidance

When framework compliance is low, system provides framework-specific instructions:

// PMBOK Guide = 40%
// System adds to prompt:

"Ensure document includes all PMBOK 7 principles:
- Stewardship: Responsible resource management
- Team: Team roles and collaboration
- Stakeholders: Comprehensive stakeholder analysis
- Value: Clear value delivery
- Systems Thinking: Organizational context
- Leadership: Governance structure
- Tailoring: Project context adaptation
- Quality: Quality standards
- Complexity: Complexity factors
- Risk: Risk management
- Adaptability: Flexibility
- Change: Change management"

4. Iterative Improvement

The system tracks improvements across generations:

// Generation History
generations = [
  { overallQuality: 62, compliance: 35, recommendations: 8 },
  { overallQuality: 78, compliance: 65, recommendations: 4 },
  { overallQuality: 92, compliance: 92, recommendations: 2 },
  { overallQuality: 98, compliance: 98, recommendations: 0 }
]

// System learns which improvements work best
// Applies successful patterns to future generations

📊 Score Thresholds and Actions

Quality Dimension Thresholds

Score RangeGradeActionSystem Response
90-100%A (Excellent)✅ AcceptDocument ready for use
80-89%B (Good)⚠️ Minor improvementsSuggest 1-2 enhancements
70-79%C (Satisfactory)⚠️ Needs improvementSuggest 3-5 enhancements
60-69%D (Needs Improvement)❌ Regenerate recommendedProvide detailed feedback
< 60%F (Inadequate)❌ Must regenerateComprehensive improvement guide

Compliance Metric Thresholds

Score RangeStatusAction
90-100%✅ Excellent ComplianceNo action needed
80-89%✅ Good ComplianceMinor enhancements suggested
70-79%⚠️ Partial ComplianceFramework-specific improvements
60-69%⚠️ Limited ComplianceSignificant improvements needed
< 60%❌ Non-CompliantMajor revisions required

🔧 Technical Implementation

Score Calculation Flow

// 1. Document Generated
const document = await generateDocument(prompt, template)

// 2. Calculate Quality Metrics
const qualityMetrics = analyzeDocumentQuality(
  document.content,
  document.metadata,
  sourceDocCount
)

// 3. Calculate Compliance Metrics
const complianceMetrics = calculateComplianceMetrics(
  document.content,
  document.metadata,
  template.framework
)

// 4. Calculate Overall Scores
const overallQuality = calculateWeightedAverage(qualityMetrics)
const overallCompliance = calculateWeightedAverage(complianceMetrics)

// 5. Generate Recommendations
const recommendations = generateRecommendations(
  qualityMetrics,
  complianceMetrics,
  thresholds
)

// 6. Store Scores
await saveDocumentScores({
  documentId,
  qualityMetrics,
  complianceMetrics,
  overallQuality,
  overallCompliance,
  recommendations
})

// 7. Provide Feedback
return {
  document,
  scores: {
    quality: qualityMetrics,
    compliance: complianceMetrics,
    overall: {
      quality: overallQuality,
      compliance: overallCompliance
    }
  },
  recommendations,
  nextSteps: generateNextSteps(overallQuality, overallCompliance)
}

Automatic Improvement Trigger

// If scores below threshold, automatically enhance next generation
if (overallQuality < 85 || overallCompliance < 80) {
  const enhancedPrompt = enhancePromptWithRecommendations(
    originalPrompt,
    recommendations,
    qualityMetrics,
    complianceMetrics
  )

  // Regenerate with enhanced prompt
  const improvedDocument = await generateDocument(
    enhancedPrompt,
    template
  )

  // Scores should improve
  // Loop continues until targets met
}

📈 Success Metrics

How We Measure "Perfection"

Target Scores for Production-Ready Documents:

  • Overall Quality: ≥ 85% (B+ or better)

  • Overall Compliance: ≥ 80% (Good compliance)

  • All Quality Dimensions: ≥ 75% (No dimension below satisfactory)

  • Framework Compliance: ≥ 85% (If framework specified)

  • Template Adherence: ≥ 90% (If template used)

Perfection Indicators:

  • ✅ All dimensions ≥ 90%

  • ✅ Compliance ≥ 95%

  • ✅ Zero critical recommendations

  • ✅ Framework fully aligned

  • ✅ Professional quality achieved


🎓 Best Practices for Using Compliance Scores

1. Review Scores Before Finalizing

  • Check overall quality score

  • Review dimension breakdowns

  • Address recommendations

2. Focus on Low Scores

  • Identify dimensions < 75%

  • Address highest-impact improvements first

  • Regenerate if multiple dimensions need work

3. Use Framework-Specific Scores

  • For PMBOK documents, focus on PMBOK Guide score

  • For BABOK documents, focus on BABOK compliance

  • Ensure framework score ≥ 85%

4. Iterate Until Targets Met

  • Don't accept documents with < 80% overall quality

  • Use recommendations to guide improvements

  • Each iteration should improve scores

5. Track Improvement Over Time

  • Monitor score trends

  • Identify patterns in low scores

  • Refine templates based on common gaps


🔄 Continuous Improvement

How the System Learns

  1. Pattern Recognition: System identifies common low-score patterns

  2. Template Updates: Templates enhanced based on score data

  3. Prompt Optimization: Prompts refined to address frequent gaps

  4. Framework Alignment: Framework checklists updated based on compliance data

Example: Template Evolution

Template v1.0:
- Average Quality: 72%
- Common Gap: Missing executive summary
- Action: Add executive summary to template

Template v1.1:
- Average Quality: 85%
- Common Gap: Missing stakeholder matrix
- Action: Add stakeholder section to template

Template v1.2:
- Average Quality: 92%
- Status: Production-ready ✅


🎯 Summary

The Compliance Scoring System guides documents to perfection through:

  1. Comprehensive Evaluation: 10 quality dimensions + 7 compliance metrics

  2. Actionable Feedback: Specific recommendations for each low score

  3. Automatic Enhancement: System improves prompts based on scores

  4. Iterative Improvement: Each generation builds on previous scores

  5. Framework Alignment: Ensures documents meet framework requirements

  6. Continuous Learning: System learns and improves over time

Result: Documents progress from initial drafts (60-70%) to production-ready perfection (90-98%) through guided, data-driven improvements.


Last Updated: 2026-01-24
Status: Active System - Continuously Improving Document Quality
Next Review: Quarterly or upon system enhancements

Ready to implement additional compliance requirements and standards to any of the quality gates.

EU AI Act Quality Gate Integration

Last Updated: 2026-01-24
Status: ✅ Implemented - EU AI Act Compliance Integrated into Quality Gates
Purpose: Ensure all generated documents meet EU AI Act requirements before passing quality gates


Overview

EU AI Act compliance requirements have been integrated into ADPA's quality gate system. Documents generated for EU users or in EU regions must pass EU AI Act compliance checks before being approved. This ensures regulatory compliance and protects users.


Integration Points

1. Quality Assurance Stage (qualityAssuranceStage.ts)

EU AI Act compliance is checked during the Quality Assurance stage of document generation:

// EU AI Act compliance validation
const complianceValidation = await this.performEnhancedComplianceValidation(
  contextualized_document, 
  validationContext
)

// Quality gates include EU AI Act compliance gate for EU users
const qualityGateResults = await this.applyQualityGates(qualityReport, input.context)

2. Compliance Rules

Five EU AI Act compliance rules are automatically added to all documents:

  1. AI-Generated Content Transparency (EU_AI_ACT_TRANSPARENCY_001)

    • Requirement: AI-generated content must be clearly labeled

    • Severity: Critical

    • Mandatory: Yes

    • Threshold: 80%

  2. Human Oversight (EU_AI_ACT_HUMAN_OVERSIGHT_001)

    • Requirement: AI outputs must be reviewable by humans

    • Severity: Critical

    • Mandatory: Yes

    • Threshold: 80%

  3. AI Accuracy and Robustness (EU_AI_ACT_ACCURACY_001)

    • Requirement: AI systems must be reliable and accurate

    • Severity: High

    • Mandatory: Yes

    • Threshold: 70%

  4. Data Governance (EU_AI_ACT_DATA_GOVERNANCE_001)

    • Requirement: Document data sources and processing

    • Severity: Medium

    • Mandatory: No (recommended)

    • Threshold: 60%

  5. Record Keeping (EU_AI_ACT_RECORD_KEEPING_001)

    • Requirement: Maintain records of AI system usage

    • Severity: Medium

    • Mandatory: No (recommended)

    • Threshold: 70%


Quality Gate Structure

EU AI Act Compliance Gate

When a document is generated for an EU user/region, an EU AI Act Compliance Gate is automatically added:

{
  gate_id: 'EU_AI_ACT_COMPLIANCE_GATE',
  gate_name: 'EU AI Act Compliance Gate',
  criteria: [
    {
      criterion_id: 'EU_AI_ACT_TRANSPARENCY',
      criterion_name: 'AI-Generated Content Transparency',
      metric: 'ai_content_labeling',
      threshold: 80,
      weight: 0.30  // 30% of gate score
    },
    {
      criterion_id: 'EU_AI_ACT_HUMAN_OVERSIGHT',
      criterion_name: 'Human Oversight',
      metric: 'human_oversight',
      threshold: 80,
      weight: 0.30  // 30% of gate score
    },
    {
      criterion_id: 'EU_AI_ACT_ACCURACY',
      criterion_name: 'AI Accuracy and Robustness',
      metric: 'ai_accuracy',
      threshold: 70,
      weight: 0.25  // 25% of gate score
    },
    {
      criterion_id: 'EU_AI_ACT_DATA_GOVERNANCE',
      criterion_name: 'Data Governance',
      metric: 'data_governance',
      threshold: 60,
      weight: 0.10  // 10% of gate score
    },
    {
      criterion_id: 'EU_AI_ACT_RECORD_KEEPING',
      criterion_name: 'Record Keeping',
      metric: 'record_keeping',
      threshold: 70,
      weight: 0.05  // 5% of gate score
    }
  ],
  threshold: 75,  // Overall gate must pass at 75%+
  action_on_failure: 'stop'  // BLOCKS document if compliance fails
}

Validation Logic

1. AI-Generated Content Labeling

Checks:

  • ✅ Document metadata includes generation_metadata.provider and generation_metadata.model

  • ✅ Document metadata has generation_metadata.ai_generated = true

  • ✅ Document content includes "AI-Generated" or "Generated by AI" labeling (for EU users)

Scoring:

  • 100%: Both metadata and content labeling present (EU requirement)

  • 80%: Metadata present but no content labeling (non-EU acceptable)

  • 0%: No AI generation indicators

2. Human Oversight

Checks:

  • ✅ Document is editable (metadata.editable !== false)

  • ✅ Document has review workflow (metadata.review_status or metadata.approval_required)

  • ✅ No automated decision-making affecting individuals

Scoring:

  • 100%: Editable, reviewable, and no automated decisions

  • 50%: Either editable OR reviewable (partial compliance)

  • 0%: Read-only or no review mechanism

3. AI Accuracy

Checks:

  • ✅ Overall quality score ≥ 70%

  • ✅ Accuracy dimension score ≥ 70%

  • ✅ Document has validation indicators

Scoring:

  • 100%: Quality and accuracy scores meet thresholds

  • 0%: Scores below thresholds

4. Data Governance

Checks:

  • ✅ AI provider information documented (generation_metadata.provider and model)

  • ✅ Data sources documented (if applicable)

  • ✅ Processing information available

Scoring:

  • 100%: Provider info documented

  • 50%: Partial documentation

  • 0%: No documentation

5. Record Keeping

Checks:

  • ✅ Generation timestamp recorded

  • ✅ Provider/model information logged

  • ✅ Usage metrics recorded (tokens, cost)

Scoring:

  • 100%: Timestamp and provider/model logged

  • 50%: Either timestamp OR provider/model logged

  • 0%: No logging


Quality Gate Decision Flow

Document Generated
    ↓
Quality Assurance Stage
    ↓
Check User Region
    ↓
Is EU Region? ──No──→ Apply Standard Quality Gates
    │
   Yes
    ↓
Add EU AI Act Compliance Gate
    ↓
Evaluate All Quality Gates
    ↓
EU AI Act Gate Score Calculated
    ├─ Transparency: 30% weight
    ├─ Human Oversight: 30% weight
    ├─ Accuracy: 25% weight
    ├─ Data Governance: 10% weight
    └─ Record Keeping: 5% weight
    ↓
Overall Gate Score ≥ 75%?
    ├─ Yes → ✅ PASS - Document approved
    └─ No → ❌ FAIL - Document BLOCKED
         ↓
    Generate Compliance Recommendations
         ↓
    User must address violations
         ↓
    Regenerate or fix document

Blocking Behavior

When EU AI Act Compliance Fails

If the EU AI Act Compliance Gate fails (score < 75%):

  1. Document is BLOCKED (action_on_failure: 'stop')

  2. Quality status set to 'failed'

  3. Detailed violation report generated

  4. Specific remediation steps provided

  5. User notified with compliance issues

Critical Violations

The following violations automatically block documents:

  • AI-Generated Content Labeling Missing (Transparency < 80%)

  • Human Oversight Not Met (Human Oversight < 80%)

  • AI Accuracy Below Threshold (Accuracy < 70%)

Non-Blocking Violations

These violations generate warnings but don't block:

  • ⚠️ Data Governance Incomplete (Data Governance < 60%)

  • ⚠️ Record Keeping Incomplete (Record Keeping < 70%)


Region Detection

Automatic EU Detection

The system automatically detects EU regions based on:

  1. User Context: userContext.region

  2. Project Context: projectContext.region

  3. Explicit Flag: projectContext.eu_ai_act_compliance = true

Supported EU Region Codes

  • Country codes: AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE

  • Region strings: EU, Europe, European Union

Manual Override

Projects can explicitly enable EU AI Act compliance:

projectContext.eu_ai_act_compliance = true

Compliance Score Calculation

Individual Criterion Scores

Each EU AI Act criterion is scored 0-100%:

// Example: Transparency Score
const transparencyScore = 
  hasAIGenerationMetadata && hasAILabel ? 100 :  // EU: Both required
  hasAIGenerationMetadata ? 80 :                // Non-EU: Metadata sufficient
  0                                             // Missing

Overall Gate Score

Weighted average of all criteria:

overallGateScore = 
  (transparencyScore * 0.30) +
  (humanOversightScore * 0.30) +
  (accuracyScore * 0.25) +
  (dataGovernanceScore * 0.10) +
  (recordKeepingScore * 0.05)

Pass/Fail Decision

const passed = overallGateScore >= 75  // 75% threshold

if (!passed) {
  // Document BLOCKED
  // Generate recommendations
  // Notify user
}

Recommendations Generated

When EU AI Act compliance fails, the system generates specific recommendations:

Transparency Violations

  • "EU AI Act: Add explicit 'AI-Generated' badge/label to document"

  • "EU AI Act: Include AI generation metadata in document records"

  • "EU AI Act: Add export metadata (PDF/DOCX) indicating AI generation"

Human Oversight Violations

  • "EU AI Act: Ensure document is editable and reviewable by users"

  • "EU AI Act: Implement review/approval workflow before finalization"

  • "EU AI Act: Remove any automated decision-making affecting individuals"

Accuracy Violations

  • "EU AI Act: Verify AI-generated content accuracy"

  • "EU AI Act: Implement error handling and validation mechanisms"

  • "EU AI Act: Ensure quality score meets minimum threshold (70%+)"

Data Governance Violations

  • "EU AI Act: Document what data is sent to AI providers"

  • "EU AI Act: Ensure data processing is transparent and documented"

Record Keeping Violations

  • "EU AI Act: Ensure AI system usage is logged with provider/model information"

  • "EU AI Act: Maintain audit trail for compliance verification"


Example: Document Blocked by EU AI Act Gate

Scenario

  • User region: DE (Germany - EU)

  • Document generated without AI labeling

  • Human oversight not configured

Quality Gate Result

{
  "gate_id": "EU_AI_ACT_COMPLIANCE_GATE",
  "gate_name": "EU AI Act Compliance Gate",
  "passed": false,
  "score": 45,
  "threshold": 75,
  "blocking": true,
  "criteria_results": [
    {
      "criterion_id": "EU_AI_ACT_TRANSPARENCY",
      "criterion_name": "AI-Generated Content Transparency",
      "score": 0,
      "threshold": 80,
      "passed": false,
      "weight": 0.30
    },
    {
      "criterion_id": "EU_AI_ACT_HUMAN_OVERSIGHT",
      "criterion_name": "Human Oversight",
      "score": 50,
      "threshold": 80,
      "passed": false,
      "weight": 0.30
    },
    {
      "criterion_id": "EU_AI_ACT_ACCURACY",
      "criterion_name": "AI Accuracy and Robustness",
      "score": 85,
      "threshold": 70,
      "passed": true,
      "weight": 0.25
    },
    {
      "criterion_id": "EU_AI_ACT_DATA_GOVERNANCE",
      "criterion_name": "Data Governance",
      "score": 80,
      "threshold": 60,
      "passed": true,
      "weight": 0.10
    },
    {
      "criterion_id": "EU_AI_ACT_RECORD_KEEPING",
      "criterion_name": "Record Keeping",
      "score": 90,
      "threshold": 70,
      "passed": true,
      "weight": 0.05
    }
  ],
  "action_taken": "stop"
}

User Notification

❌ Document Generation Blocked

EU AI Act Compliance Gate Failed (Score: 45% / Required: 75%)

Critical Violations:
1. AI-Generated Content Transparency: 0% (Required: 80%)
   - Missing: AI generation labeling
   - Action: Add "AI-Generated" badge to document

2. Human Oversight: 50% (Required: 80%)
   - Missing: Review workflow configuration
   - Action: Enable document review/approval workflow

Recommendations:
- EU AI Act: Add explicit "AI-Generated" badge/label to document
- EU AI Act: Include AI generation metadata in document records
- EU AI Act: Ensure document is editable and reviewable by users
- EU AI Act: Implement review/approval workflow before finalization

Please address these violations and regenerate the document.

Integration with Document Generation

Automatic Application

EU AI Act compliance gates are automatically applied when:

  1. User region is detected as EU

  2. Project has eu_ai_act_compliance flag set

  3. User has eu_ai_act_compliance preference enabled

No Manual Configuration Required

The system automatically:

  • ✅ Detects EU users/regions

  • ✅ Adds EU AI Act compliance rules

  • ✅ Creates EU AI Act compliance gate

  • ✅ Evaluates compliance during quality assurance

  • ✅ Blocks non-compliant documents

  • ✅ Generates specific remediation recommendations


Compliance Status Indicators

In Quality Report

{
  "compliance_validation": {
    "assessment_type": "enhanced_compliance_validation",
    "score": 0.85,
    "framework": "EU_AI_ACT",
    "rules_assessed": 5,
    "compliance_results": [
      {
        "rule_id": "EU_AI_ACT_TRANSPARENCY_001",
        "passed": true,
        "description": "AI-generated content is properly labeled"
      },
      {
        "rule_id": "EU_AI_ACT_HUMAN_OVERSIGHT_001",
        "passed": true,
        "description": "Human oversight mechanisms in place"
      },
      // ... other rules
    ],
    "violations": [],
    "issues": [],
    "recommendations": [
      "EU AI Act: All compliance requirements met ✅"
    ]
  }
}

In Quality Gate Results

{
  "quality_gate_results": [
    {
      "gate_id": "EU_AI_ACT_COMPLIANCE_GATE",
      "gate_name": "EU AI Act Compliance Gate",
      "passed": true,
      "score": 87,
      "threshold": 75,
      "blocking": false,
      "criteria_results": [
        // Individual criterion scores
      ]
    }
  ]
}

Testing EU AI Act Compliance

Test Case 1: EU User - Compliant Document

Setup:

  • User region: FR (France)

  • Document with AI generation metadata

  • Document editable and reviewable

  • Quality score ≥ 70%

Expected Result:

  • ✅ EU AI Act Compliance Gate: PASSED

  • ✅ Document approved

  • ✅ No violations

Test Case 2: EU User - Non-Compliant Document

Setup:

  • User region: DE (Germany)

  • Document without AI labeling

  • Document read-only

  • Quality score < 70%

Expected Result:

  • ❌ EU AI Act Compliance Gate: FAILED

  • ❌ Document BLOCKED

  • ❌ Violations: Transparency, Human Oversight, Accuracy

  • ✅ Specific recommendations provided

Test Case 3: Non-EU User

Setup:

  • User region: US

  • Document with basic metadata

Expected Result:

  • ✅ EU AI Act Compliance Gate: Not applied

  • ✅ Standard quality gates only

  • ✅ Document approved if quality thresholds met


Configuration

Environment Variables

No additional environment variables required. EU AI Act compliance is automatically enabled based on user/region detection.

Quality Gate Configuration

EU AI Act compliance gate is automatically added. No manual configuration needed.

Thresholds

Current thresholds (configurable):

CriterionThresholdWeightAction on Fail
Transparency80%30%Block
Human Oversight80%30%Block
Accuracy70%25%Block
Data Governance60%10%Warn
Record Keeping70%5%Warn
Overall Gate75%-Block

Benefits

1. Automatic Compliance

  • No manual checks required

  • System ensures compliance automatically

  • Reduces risk of non-compliant documents

2. Early Detection

  • Compliance checked during generation

  • Issues identified before document delivery

  • Prevents compliance violations

3. Actionable Feedback

  • Specific violation details

  • Clear remediation steps

  • Guided improvement process

4. Regulatory Protection

  • Protects organization from EU AI Act violations

  • Ensures user rights are respected

  • Maintains audit trail

5. User Confidence

  • Users know documents are compliant

  • Transparent compliance status

  • Trust in system reliability



Implementation Details

Files Modified

  1. server/src/modules/multiStageDocumentProcessor/stages/qualityAssuranceStage.ts

    • Added EU AI Act compliance rules

    • Added EU AI Act validation methods

    • Added EU AI Act compliance gate

    • Updated quality gate evaluation logic

Key Methods Added

  • validateAIGeneratedContentLabeling() - Checks AI labeling

  • validateHumanOversight() - Checks human review capability

  • validateAIAccuracy() - Checks accuracy requirements

  • validateEUAIActDataGovernance() - Checks data documentation

  • validateRecordKeeping() - Checks audit logging

  • isEURegion() - Detects EU users/regions

  • createEUAIActComplianceGate() - Creates compliance gate

  • calculateAIContentLabelingScore() - Scores transparency

  • calculateHumanOversightScore() - Scores oversight

  • calculateAIAccuracyScore() - Scores accuracy

  • calculateDataGovernanceScore() - Scores data governance

  • calculateRecordKeepingScore() - Scores record keeping


Status

EU AI Act Compliance Integrated into Quality Gates

  • ✅ Compliance rules added

  • ✅ Validation logic implemented

  • ✅ Quality gate created

  • ✅ Blocking behavior configured

  • ✅ Recommendations generated

  • ✅ Region detection working

  • ⏳ Testing in progress


Last Updated: 2026-01-24
Status: ✅ Implemented - Ready for Testing
Next Steps: Test with EU users and verify blocking behavior

© 2026 CBA Value Proposition