[{"data":1,"prerenderedAt":63},["Reactive",2],{"blog-post-markdown-table-data-validation-and-quality-assurance-complete-guide":3},{"slug":4,"title":5,"description":6,"excerpt":7,"date":8,"category":9,"author":10,"keywords":11,"readingMinutes":12,"html":13,"headings":14,"tools":37,"related":38},"markdown-table-data-validation-and-quality-assurance-complete-guide","Markdown Table Data Validation and Quality Assurance: Complete Guide for Automated Testing and Error Detection in Tabular Content","Master comprehensive data validation techniques for Markdown tables, implementing automated quality assurance, error detection systems, and data integrity checks for reliable tabular content management.","Advanced Markdown table data validation and quality assurance techniques enable systematic verification of tabular content accuracy, structural integrity, and formatting consistency across…","2025-12-18","Tutorial","Matthew Rathbone","markdown table validation, table data quality, automated table testing, markdown table errors, data validation markdown, table quality assurance, markdown table integrity, tabular data validation",26,"\u003Cp>Advanced Markdown table data validation and quality assurance techniques enable systematic verification of tabular content accuracy, structural integrity, and formatting consistency across large-scale documentation projects. By implementing automated validation workflows, intelligent error detection systems, and comprehensive quality checks, technical writers can maintain reliable data presentation standards while preventing common table formatting errors, data inconsistencies, and accessibility violations that compromise user experience and content reliability.\u003C/p>\n\u003Ch2 id=\"why-implement-table-data-validation\">Why Implement Table Data Validation?\u003C/h2>\n\u003Cp>Professional table validation provides essential benefits for content quality management:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Cstrong>Data Integrity\u003C/strong>: Ensure accuracy and consistency of tabular information across documentation systems\u003C/li>\n\u003Cli>\u003Cstrong>Error Prevention\u003C/strong>: Automatically detect and prevent formatting errors before content publication\u003C/li>\n\u003Cli>\u003Cstrong>Quality Standards\u003C/strong>: Maintain consistent table structure and presentation across large content repositories\u003C/li>\n\u003Cli>\u003Cstrong>Accessibility Compliance\u003C/strong>: Verify tables meet accessibility guidelines and screen reader compatibility\u003C/li>\n\u003Cli>\u003Cstrong>Performance Optimization\u003C/strong>: Identify table structure issues that impact rendering performance\u003C/li>\n\u003Cli>\u003Cstrong>Automated Workflows\u003C/strong>: Integrate validation into CI/CD pipelines for systematic quality assurance\u003C/li>\n\u003C/ul>\n\u003Ch2 id=\"foundation-validation-principles\">Foundation Validation Principles\u003C/h2>\n\u003Ch3 id=\"core-table-structure-validation\">Core Table Structure Validation\u003C/h3>\n\u003Cp>Understanding essential validation criteria for robust table implementation:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Basic Table Structure Validation Checklist\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Structural Integrity Requirements\u003C/span>\n| Validation Rule | Description | Error Impact | Example |\n|:----------------|:------------|:-------------|:--------|\n| \u003Cspan class=\"hljs-strong\">**Header Count Match**\u003C/span> | All rows must have same column count as header | Critical | Header: 3 cols, Row: 4 cols ❌ |\n| \u003Cspan class=\"hljs-strong\">**Pipe Alignment**\u003C/span> | Proper pipe character placement and escaping | High | \u003Cspan class=\"hljs-code\">`\\|`\u003C/span> escaped vs \u003Cspan class=\"hljs-code\">`|`\u003C/span> unescaped |\n| \u003Cspan class=\"hljs-strong\">**Separator Format**\u003C/span> | Valid alignment markers in separator row | High | \u003Cspan class=\"hljs-code\">`:---:`\u003C/span> center vs \u003Cspan class=\"hljs-code\">`---`\u003C/span> left |\n| \u003Cspan class=\"hljs-strong\">**Empty Cell Handling**\u003C/span> | Consistent treatment of empty table cells | Medium | Missing vs explicit empty cells |\n| \u003Cspan class=\"hljs-strong\">**Line Termination**\u003C/span> | Proper line endings for cross-platform compatibility | Low | Unix vs Windows line endings |\n\n\u003Cspan class=\"hljs-section\">## Data Type Consistency Validation\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\n# validation-rules.yml - Column-specific validation rules\ncolumns:\n  - name: &quot;employee_id&quot;\n    type: &quot;integer&quot;\n    required: true\n    min_value: 1000\n    max_value: 9999\n    unique: true\n    \n  - name: &quot;email_address&quot;\n    type: &quot;email&quot;\n    required: true\n    pattern: &quot;^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$&quot;\n    unique: true\n    \n  - name: &quot;hire_date&quot;\n    type: &quot;date&quot;\n    required: true\n    format: &quot;YYYY-MM-DD&quot;\n    min_date: &quot;2020-01-01&quot;\n    max_date: &quot;today&quot;\n    \n  - name: &quot;department&quot;\n    type: &quot;categorical&quot;\n    required: true\n    allowed_values: [&quot;Engineering&quot;, &quot;Marketing&quot;, &quot;Sales&quot;, &quot;HR&quot;, &quot;Finance&quot;]\n    \n  - name: &quot;salary&quot;\n    type: &quot;currency&quot;\n    required: false\n    min_value: 30000\n    max_value: 500000\n    format: &quot;$X,XXX.XX&quot;\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Sample Employee Table for Validation Testing\u003C/span>\n| Employee ID | Full Name | Email Address | Hire Date | Department | Annual Salary |\n|:------------|:----------|:--------------|:----------|:-----------|:-------------|\n| 1001 | Sarah Chen | sarah.chen@company.com | 2023-01-15 | Engineering | $95,000.00 |\n| 1002 | Michael Rodriguez | mike.r@company.com | 2023-02-01 | Marketing | $75,000.00 |\n| 1003 | Lisa Wang | lisa.wang@company.com | 2023-03-10 | Sales | $68,000.00 |\n| 1004 | James Thompson | j.thompson@company.com | 2023-04-22 | Engineering | $89,500.00 |\n| 1005 | Emily Davis | emily.davis@company.com | 2023-05-08 | HR | $72,000.00 |\n\n\u003Cspan class=\"hljs-quote\">&gt; \u003Cspan class=\"hljs-strong\">**Validation Note**\u003C/span>: This table demonstrates proper data formatting with consistent types, valid email formats, sequential ID numbers, and standardized currency formatting.\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch3 id=\"automated-validation-implementation\">Automated Validation Implementation\u003C/h3>\n\u003Cp>Building comprehensive automated validation systems:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Automated Table Validation Framework\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Python-Based Validation Engine\u003C/span>\n\u003Cspan class=\"hljs-code\">```python\n#!/usr/bin/env python3\n# markdown-table-validator.py - Comprehensive table validation system\n\nimport re\nimport json\nimport yaml\nimport pandas as pd\nfrom typing import Dict, List, Optional, Tuple, Any\nfrom dataclasses import dataclass, field\nfrom datetime import datetime, date\nfrom enum import Enum\nimport email_validator\nfrom decimal import Decimal, InvalidOperation\n\nclass ValidationSeverity(Enum):\n    CRITICAL = &quot;critical&quot;\n    HIGH = &quot;high&quot; \n    MEDIUM = &quot;medium&quot;\n    LOW = &quot;low&quot;\n    INFO = &quot;info&quot;\n\nclass DataType(Enum):\n    TEXT = &quot;text&quot;\n    INTEGER = &quot;integer&quot;\n    FLOAT = &quot;float&quot;\n    CURRENCY = &quot;currency&quot;\n    EMAIL = &quot;email&quot;\n    DATE = &quot;date&quot;\n    PHONE = &quot;phone&quot;\n    URL = &quot;url&quot;\n    CATEGORICAL = &quot;categorical&quot;\n    BOOLEAN = &quot;boolean&quot;\n\n@dataclass\nclass ValidationError:\n    &quot;&quot;&quot;Individual validation error details&quot;&quot;&quot;\n    rule: str\n    message: str\n    severity: ValidationSeverity\n    row_index: Optional[int] = None\n    column_index: Optional[int] = None\n    column_name: Optional[str] = None\n    actual_value: Optional[str] = None\n    expected_value: Optional[str] = None\n    fix_suggestion: Optional[str] = None\n\n@dataclass\nclass ColumnValidationRule:\n    &quot;&quot;&quot;Validation rules for individual table columns&quot;&quot;&quot;\n    name: str\n    data_type: DataType\n    required: bool = True\n    unique: bool = False\n    min_length: Optional[int] = None\n    max_length: Optional[int] = None\n    pattern: Optional[str] = None\n    allowed_values: Optional[List[str]] = None\n    min_value: Optional[float] = None\n    max_value: Optional[float] = None\n    date_format: Optional[str] = None\n    min_date: Optional[str] = None\n    max_date: Optional[str] = None\n    custom_validator: Optional[str] = None\n\n@dataclass\nclass TableValidationConfig:\n    &quot;&quot;&quot;Complete table validation configuration&quot;&quot;&quot;\n    table_name: str\n    description: str\n    columns: List[ColumnValidationRule]\n    allow_extra_columns: bool = False\n    require_header: bool = True\n    min_rows: int = 0\n    max_rows: Optional[int] = None\n    unique_constraints: List[List[str]] = field(default_factory=list)\n    foreign_keys: Dict[str, str] = field(default_factory=dict)\n\nclass MarkdownTableValidator:\n    &quot;&quot;&quot;Comprehensive Markdown table validation system&quot;&quot;&quot;\n    \n    def __init__(self):\n        self.email_validator = email_validator\n        self.validation_errors = []\n        self.validation_warnings = []\n        self.performance_metrics = {}\n        \n    def validate_table_from_markdown(self, markdown_content: str, config: TableValidationConfig) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate a Markdown table against configuration rules&quot;&quot;&quot;\n        start_time = datetime.now()\n        self.validation_errors = []\n        self.validation_warnings = []\n        \n        try:\n            # Parse Markdown table\n            table_data = self._parse_markdown_table(markdown_content)\n            \n            if not table_data:\n                self._add_error(&quot;table_parsing&quot;, &quot;Unable to parse Markdown table&quot;, ValidationSeverity.CRITICAL)\n                return self._generate_validation_report(start_time)\n            \n            # Perform validation checks\n            self._validate_table_structure(table_data, config)\n            self._validate_column_headers(table_data, config)\n            self._validate_row_count(table_data, config)\n            self._validate_column_data(table_data, config)\n            self._validate_unique_constraints(table_data, config)\n            self._validate_foreign_keys(table_data, config)\n            self._validate_accessibility(table_data, config)\n            \n        except Exception as e:\n            self._add_error(&quot;validation_error&quot;, f&quot;Validation process failed: {str(e)}&quot;, ValidationSeverity.CRITICAL)\n        \n        return self._generate_validation_report(start_time)\n    \n    def _parse_markdown_table(self, markdown_content: str) -&gt; Optional[Dict[str, Any]]:\n        &quot;&quot;&quot;Parse Markdown table into structured data&quot;&quot;&quot;\n        lines = [line.strip() for line in markdown_content.strip().split(&#x27;\\n&#x27;) if line.strip()]\n        \n        if len(lines) &lt; 3:\n            return None\n        \n        # Extract header\n        header_line = lines[0]\n        separator_line = lines[1] \n        data_lines = lines[2:]\n        \n        # Parse header\n        headers = self._parse_table_row(header_line)\n        if not headers:\n            return None\n        \n        # Parse separator and detect alignment\n        separators = self._parse_table_row(separator_line)\n        if len(separators) != len(headers):\n            return None\n        \n        alignments = [self._detect_alignment(sep) for sep in separators]\n        \n        # Parse data rows\n        rows = []\n        for i, line in enumerate(data_lines):\n            if line.strip():\n                row = self._parse_table_row(line)\n                if len(row) != len(headers):\n                    self._add_error(&quot;row_column_mismatch&quot;, \n                                   f&quot;Row {i+1} has {len(row)} columns, expected {len(headers)}&quot;, \n                                   ValidationSeverity.HIGH, row_index=i+1)\n                rows.append(row)\n        \n        return {\n            &#x27;headers&#x27;: headers,\n            &#x27;alignments&#x27;: alignments,\n            &#x27;rows&#x27;: rows,\n            &#x27;raw_content&#x27;: markdown_content\n        }\n    \n    def _parse_table_row(self, row: str) -&gt; List[str]:\n        &quot;&quot;&quot;Parse a table row into individual cells&quot;&quot;&quot;\n        # Remove leading/trailing pipes and whitespace\n        row = row.strip().strip(&#x27;|&#x27;).strip()\n        \n        if not row:\n            return []\n        \n        cells = []\n        current_cell = &quot;&quot;\n        escaped = False\n        \n        for char in row:\n            if escaped:\n                current_cell += char\n                escaped = False\n            elif char == &#x27;\\\\&#x27;:\n                escaped = True\n                current_cell += char\n            elif char == &#x27;|&#x27;:\n                cells.append(current_cell.strip())\n                current_cell = &quot;&quot;\n            else:\n                current_cell += char\n        \n        if current_cell or cells:  # Handle final cell\n            cells.append(current_cell.strip())\n        \n        return cells\n    \n    def _detect_alignment(self, separator: str) -&gt; str:\n        &quot;&quot;&quot;Detect column alignment from separator&quot;&quot;&quot;\n        separator = separator.strip()\n        if separator.startswith(&#x27;:&#x27;) and separator.endswith(&#x27;:&#x27;):\n            return &#x27;center&#x27;\n        elif separator.endswith(&#x27;:&#x27;):\n            return &#x27;right&#x27;\n        else:\n            return &#x27;left&#x27;\n    \n    def _validate_table_structure(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate basic table structure&quot;&quot;&quot;\n        headers = table_data[&#x27;headers&#x27;]\n        rows = table_data[&#x27;rows&#x27;]\n        \n        # Check if table has required header\n        if config.require_header and not headers:\n            self._add_error(&quot;missing_header&quot;, &quot;Table requires header row&quot;, ValidationSeverity.CRITICAL)\n        \n        # Check for empty table\n        if not rows:\n            self._add_error(&quot;empty_table&quot;, &quot;Table contains no data rows&quot;, ValidationSeverity.HIGH)\n        \n        # Validate column count consistency\n        expected_columns = len(headers) if headers else (len(rows[0]) if rows else 0)\n        \n        for i, row in enumerate(rows):\n            if len(row) != expected_columns:\n                self._add_error(&quot;column_count_mismatch&quot;,\n                               f&quot;Row {i+1} has {len(row)} columns, expected {expected_columns}&quot;,\n                               ValidationSeverity.HIGH, row_index=i+1)\n    \n    def _validate_column_headers(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate column headers against configuration&quot;&quot;&quot;\n        headers = table_data[&#x27;headers&#x27;]\n        config_columns = {col.name for col in config.columns}\n        actual_columns = set(headers) if headers else set()\n        \n        # Check for missing required columns\n        missing_columns = config_columns - actual_columns\n        if missing_columns:\n            self._add_error(&quot;missing_columns&quot;,\n                           f&quot;Missing required columns: {&#x27;, &#x27;.join(missing_columns)}&quot;,\n                           ValidationSeverity.CRITICAL)\n        \n        # Check for unexpected columns\n        if not config.allow_extra_columns:\n            extra_columns = actual_columns - config_columns\n            if extra_columns:\n                self._add_warning(&quot;extra_columns&quot;,\n                                f&quot;Unexpected columns found: {&#x27;, &#x27;.join(extra_columns)}&quot;,\n                                ValidationSeverity.MEDIUM)\n        \n        # Validate header naming conventions\n        for header in headers:\n            if not re.match(r&#x27;^[a-zA-Z][a-zA-Z0-9_\\s]*$&#x27;, header):\n                self._add_warning(&quot;header_naming&quot;,\n                                f&quot;Header &#x27;{header}&#x27; doesn&#x27;t follow naming conventions&quot;,\n                                ValidationSeverity.LOW)\n    \n    def _validate_row_count(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate table row count constraints&quot;&quot;&quot;\n        row_count = len(table_data[&#x27;rows&#x27;])\n        \n        if row_count &lt; config.min_rows:\n            self._add_error(&quot;insufficient_rows&quot;,\n                           f&quot;Table has {row_count} rows, minimum required: {config.min_rows}&quot;,\n                           ValidationSeverity.HIGH)\n        \n        if config.max_rows and row_count &gt; config.max_rows:\n            self._add_error(&quot;excessive_rows&quot;,\n                           f&quot;Table has {row_count} rows, maximum allowed: {config.max_rows}&quot;,\n                           ValidationSeverity.MEDIUM)\n    \n    def _validate_column_data(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate individual column data against rules&quot;&quot;&quot;\n        headers = table_data[&#x27;headers&#x27;]\n        rows = table_data[&#x27;rows&#x27;]\n        \n        if not headers:\n            return\n        \n        # Create column rule lookup\n        column_rules = {rule.name: rule for rule in config.columns}\n        \n        for col_index, header in enumerate(headers):\n            if header not in column_rules:\n                continue\n                \n            rule = column_rules[header]\n            column_data = [row[col_index] if col_index &lt; len(row) else &quot;&quot; for row in rows]\n            \n            self._validate_column_values(column_data, rule, col_index, header)\n    \n    def _validate_column_values(self, column_data: List[str], rule: ColumnValidationRule, \n                               col_index: int, column_name: str):\n        &quot;&quot;&quot;Validate individual column values&quot;&quot;&quot;\n        for row_index, value in enumerate(column_data):\n            # Check required fields\n            if rule.required and (not value or value.strip() == &quot;&quot;):\n                self._add_error(&quot;required_field_empty&quot;,\n                               f&quot;Required field &#x27;{column_name}&#x27; is empty&quot;,\n                               ValidationSeverity.HIGH, row_index=row_index+1, \n                               column_index=col_index, column_name=column_name)\n                continue\n            \n            if not value or value.strip() == &quot;&quot;:\n                continue  # Skip validation for empty optional fields\n            \n            # Data type validation\n            self._validate_data_type(value, rule, row_index+1, col_index, column_name)\n            \n            # Length validation\n            if rule.min_length and len(value) &lt; rule.min_length:\n                self._add_error(&quot;value_too_short&quot;,\n                               f&quot;Value &#x27;{value}&#x27; in &#x27;{column_name}&#x27; is too short (min: {rule.min_length})&quot;,\n                               ValidationSeverity.MEDIUM, row_index=row_index+1,\n                               column_index=col_index, column_name=column_name, actual_value=value)\n            \n            if rule.max_length and len(value) &gt; rule.max_length:\n                self._add_error(&quot;value_too_long&quot;,\n                               f&quot;Value &#x27;{value}&#x27; in &#x27;{column_name}&#x27; is too long (max: {rule.max_length})&quot;,\n                               ValidationSeverity.MEDIUM, row_index=row_index+1,\n                               column_index=col_index, column_name=column_name, actual_value=value)\n            \n            # Pattern validation\n            if rule.pattern and not re.match(rule.pattern, value):\n                self._add_error(&quot;pattern_mismatch&quot;,\n                               f&quot;Value &#x27;{value}&#x27; in &#x27;{column_name}&#x27; doesn&#x27;t match required pattern&quot;,\n                               ValidationSeverity.HIGH, row_index=row_index+1,\n                               column_index=col_index, column_name=column_name, actual_value=value)\n            \n            # Categorical validation\n            if rule.allowed_values and value not in rule.allowed_values:\n                self._add_error(&quot;invalid_categorical_value&quot;,\n                               f&quot;Value &#x27;{value}&#x27; not in allowed values: {rule.allowed_values}&quot;,\n                               ValidationSeverity.HIGH, row_index=row_index+1,\n                               column_index=col_index, column_name=column_name, actual_value=value,\n                               expected_value=f&quot;One of: {&#x27;, &#x27;.join(rule.allowed_values)}&quot;)\n    \n    def _validate_data_type(self, value: str, rule: ColumnValidationRule, \n                           row_index: int, col_index: int, column_name: str):\n        &quot;&quot;&quot;Validate specific data types&quot;&quot;&quot;\n        try:\n            if rule.data_type == DataType.INTEGER:\n                int_value = int(value.replace(&#x27;,&#x27;, &#x27;&#x27;))\n                if rule.min_value and int_value &lt; rule.min_value:\n                    self._add_error(&quot;value_below_minimum&quot;,\n                                   f&quot;Integer value {int_value} below minimum {rule.min_value}&quot;,\n                                   ValidationSeverity.MEDIUM, row_index=row_index,\n                                   column_index=col_index, column_name=column_name)\n                if rule.max_value and int_value &gt; rule.max_value:\n                    self._add_error(&quot;value_above_maximum&quot;,\n                                   f&quot;Integer value {int_value} above maximum {rule.max_value}&quot;,\n                                   ValidationSeverity.MEDIUM, row_index=row_index,\n                                   column_index=col_index, column_name=column_name)\n            \n            elif rule.data_type == DataType.FLOAT:\n                float_value = float(value.replace(&#x27;,&#x27;, &#x27;&#x27;))\n                if rule.min_value and float_value &lt; rule.min_value:\n                    self._add_error(&quot;value_below_minimum&quot;,\n                                   f&quot;Float value {float_value} below minimum {rule.min_value}&quot;,\n                                   ValidationSeverity.MEDIUM, row_index=row_index,\n                                   column_index=col_index, column_name=column_name)\n                if rule.max_value and float_value &gt; rule.max_value:\n                    self._add_error(&quot;value_above_maximum&quot;,\n                                   f&quot;Float value {float_value} above maximum {rule.max_value}&quot;,\n                                   ValidationSeverity.MEDIUM, row_index=row_index,\n                                   column_index=col_index, column_name=column_name)\n            \n            elif rule.data_type == DataType.CURRENCY:\n                currency_value = value.replace(&#x27;$&#x27;, &#x27;&#x27;).replace(&#x27;,&#x27;, &#x27;&#x27;)\n                Decimal(currency_value)  # Validate format\n                \n            elif rule.data_type == DataType.EMAIL:\n                email_validator.validate_email(value)\n                \n            elif rule.data_type == DataType.DATE:\n                if rule.date_format:\n                    datetime.strptime(value, rule.date_format)\n                else:\n                    # Try common formats\n                    for fmt in [&#x27;%Y-%m-%d&#x27;, &#x27;%m/%d/%Y&#x27;, &#x27;%d-%m-%Y&#x27;]:\n                        try:\n                            datetime.strptime(value, fmt)\n                            break\n                        except ValueError:\n                            continue\n                    else:\n                        raise ValueError(&quot;Invalid date format&quot;)\n                        \n            elif rule.data_type == DataType.PHONE:\n                # Simple phone validation\n                phone_pattern = r&#x27;^[\\+]?[\\d\\s\\-\\(\\)]{10,}$&#x27;\n                if not re.match(phone_pattern, value):\n                    raise ValueError(&quot;Invalid phone format&quot;)\n                    \n            elif rule.data_type == DataType.URL:\n                url_pattern = r&#x27;^https?://[^\\s/$.?#].[^\\s]*$&#x27;\n                if not re.match(url_pattern, value, re.IGNORECASE):\n                    raise ValueError(&quot;Invalid URL format&quot;)\n                    \n            elif rule.data_type == DataType.BOOLEAN:\n                if value.lower() not in [&#x27;true&#x27;, &#x27;false&#x27;, &#x27;yes&#x27;, &#x27;no&#x27;, &#x27;1&#x27;, &#x27;0&#x27;]:\n                    raise ValueError(&quot;Invalid boolean value&quot;)\n                    \n        except (ValueError, InvalidOperation, email_validator.EmailNotValidError) as e:\n            self._add_error(&quot;data_type_validation&quot;,\n                           f&quot;Invalid {rule.data_type.value} format: &#x27;{value}&#x27; - {str(e)}&quot;,\n                           ValidationSeverity.HIGH, row_index=row_index,\n                           column_index=col_index, column_name=column_name, actual_value=value)\n    \n    def _validate_unique_constraints(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate uniqueness constraints&quot;&quot;&quot;\n        headers = table_data[&#x27;headers&#x27;]\n        rows = table_data[&#x27;rows&#x27;]\n        \n        if not headers:\n            return\n            \n        # Individual column uniqueness\n        column_rules = {rule.name: rule for rule in config.columns}\n        \n        for col_index, header in enumerate(headers):\n            if header in column_rules and column_rules[header].unique:\n                column_data = [row[col_index] if col_index &lt; len(row) else &quot;&quot; for row in rows]\n                seen_values = {}\n                \n                for row_index, value in enumerate(column_data):\n                    if value and value in seen_values:\n                        self._add_error(&quot;unique_constraint_violation&quot;,\n                                       f&quot;Duplicate value &#x27;{value}&#x27; in unique column &#x27;{header}&#x27;&quot;,\n                                       ValidationSeverity.HIGH, row_index=row_index+1,\n                                       column_index=col_index, column_name=header, actual_value=value,\n                                       fix_suggestion=f&quot;Previously found in row {seen_values[value]}&quot;)\n                    elif value:\n                        seen_values[value] = row_index + 1\n        \n        # Multi-column uniqueness constraints\n        for constraint_columns in config.unique_constraints:\n            if all(col in headers for col in constraint_columns):\n                constraint_indices = [headers.index(col) for col in constraint_columns]\n                seen_combinations = {}\n                \n                for row_index, row in enumerate(rows):\n                    combination = tuple(row[i] if i &lt; len(row) else &quot;&quot; for i in constraint_indices)\n                    \n                    if combination in seen_combinations:\n                        self._add_error(&quot;multi_column_unique_violation&quot;,\n                                       f&quot;Duplicate combination {combination} in columns {constraint_columns}&quot;,\n                                       ValidationSeverity.HIGH, row_index=row_index+1,\n                                       fix_suggestion=f&quot;Previously found in row {seen_combinations[combination]}&quot;)\n                    else:\n                        seen_combinations[combination] = row_index + 1\n    \n    def _validate_foreign_keys(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate foreign key constraints&quot;&quot;&quot;\n        # Note: This is a simplified implementation\n        # In practice, you would need access to related tables\n        for column_name, referenced_table in config.foreign_keys.items():\n            self._add_warning(&quot;foreign_key_check&quot;,\n                            f&quot;Foreign key validation for &#x27;{column_name}&#x27; -&gt; &#x27;{referenced_table}&#x27; requires external data&quot;,\n                            ValidationSeverity.INFO)\n    \n    def _validate_accessibility(self, table_data: Dict[str, Any], config: TableValidationConfig):\n        &quot;&quot;&quot;Validate table accessibility requirements&quot;&quot;&quot;\n        headers = table_data[&#x27;headers&#x27;]\n        \n        # Check for meaningful headers\n        if headers:\n            for header in headers:\n                if not header or header.strip() == &quot;&quot;:\n                    self._add_error(&quot;empty_header&quot;,\n                                   &quot;Table contains empty header cells&quot;,\n                                   ValidationSeverity.HIGH)\n                elif len(header.strip()) &lt; 2:\n                    self._add_warning(&quot;short_header&quot;,\n                                    f&quot;Header &#x27;{header}&#x27; may not be descriptive enough for screen readers&quot;,\n                                    ValidationSeverity.LOW)\n        \n        # Check table size for accessibility\n        row_count = len(table_data[&#x27;rows&#x27;])\n        col_count = len(headers) if headers else 0\n        \n        if row_count &gt; 50 or col_count &gt; 10:\n            self._add_warning(&quot;large_table&quot;,\n                            f&quot;Large table ({row_count} rows, {col_count} cols) may need pagination for accessibility&quot;,\n                            ValidationSeverity.MEDIUM)\n    \n    def _add_error(self, rule: str, message: str, severity: ValidationSeverity, \n                   row_index: Optional[int] = None, column_index: Optional[int] = None,\n                   column_name: Optional[str] = None, actual_value: Optional[str] = None,\n                   expected_value: Optional[str] = None, fix_suggestion: Optional[str] = None):\n        &quot;&quot;&quot;Add validation error to results&quot;&quot;&quot;\n        error = ValidationError(\n            rule=rule,\n            message=message,\n            severity=severity,\n            row_index=row_index,\n            column_index=column_index,\n            column_name=column_name,\n            actual_value=actual_value,\n            expected_value=expected_value,\n            fix_suggestion=fix_suggestion\n        )\n        \n        if severity in [ValidationSeverity.CRITICAL, ValidationSeverity.HIGH]:\n            self.validation_errors.append(error)\n        else:\n            self.validation_warnings.append(error)\n    \n    def _add_warning(self, rule: str, message: str, severity: ValidationSeverity, **kwargs):\n        &quot;&quot;&quot;Add validation warning&quot;&quot;&quot;\n        self._add_error(rule, message, severity, **kwargs)\n    \n    def _generate_validation_report(self, start_time: datetime) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Generate comprehensive validation report&quot;&quot;&quot;\n        end_time = datetime.now()\n        duration = (end_time - start_time).total_seconds()\n        \n        return {\n            &#x27;validation_summary&#x27;: {\n                &#x27;status&#x27;: &#x27;FAILED&#x27; if self.validation_errors else &#x27;PASSED&#x27;,\n                &#x27;error_count&#x27;: len(self.validation_errors),\n                &#x27;warning_count&#x27;: len(self.validation_warnings),\n                &#x27;duration_seconds&#x27;: duration,\n                &#x27;timestamp&#x27;: end_time.isoformat()\n            },\n            &#x27;errors&#x27;: [self._error_to_dict(error) for error in self.validation_errors],\n            &#x27;warnings&#x27;: [self._error_to_dict(error) for error in self.validation_warnings],\n            &#x27;metrics&#x27;: {\n                &#x27;critical_errors&#x27;: len([e for e in self.validation_errors if e.severity == ValidationSeverity.CRITICAL]),\n                &#x27;high_errors&#x27;: len([e for e in self.validation_errors if e.severity == ValidationSeverity.HIGH]),\n                &#x27;medium_warnings&#x27;: len([e for e in self.validation_warnings if e.severity == ValidationSeverity.MEDIUM]),\n                &#x27;low_warnings&#x27;: len([e for e in self.validation_warnings if e.severity == ValidationSeverity.LOW])\n            }\n        }\n    \n    def _error_to_dict(self, error: ValidationError) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Convert validation error to dictionary&quot;&quot;&quot;\n        return {\n            &#x27;rule&#x27;: error.rule,\n            &#x27;message&#x27;: error.message,\n            &#x27;severity&#x27;: error.severity.value,\n            &#x27;location&#x27;: {\n                &#x27;row&#x27;: error.row_index,\n                &#x27;column&#x27;: error.column_index,\n                &#x27;column_name&#x27;: error.column_name\n            },\n            &#x27;values&#x27;: {\n                &#x27;actual&#x27;: error.actual_value,\n                &#x27;expected&#x27;: error.expected_value\n            },\n            &#x27;fix_suggestion&#x27;: error.fix_suggestion\n        }\n\n# Configuration loading utility\ndef load_validation_config(config_path: str) -&gt; TableValidationConfig:\n    &quot;&quot;&quot;Load validation configuration from YAML file&quot;&quot;&quot;\n    with open(config_path, &#x27;r&#x27;) as f:\n        config_data = yaml.safe_load(f)\n    \n    columns = []\n    for col_config in config_data.get(&#x27;columns&#x27;, []):\n        column_rule = ColumnValidationRule(\n            name=col_config[&#x27;name&#x27;],\n            data_type=DataType(col_config.get(&#x27;type&#x27;, &#x27;text&#x27;)),\n            required=col_config.get(&#x27;required&#x27;, True),\n            unique=col_config.get(&#x27;unique&#x27;, False),\n            min_length=col_config.get(&#x27;min_length&#x27;),\n            max_length=col_config.get(&#x27;max_length&#x27;),\n            pattern=col_config.get(&#x27;pattern&#x27;),\n            allowed_values=col_config.get(&#x27;allowed_values&#x27;),\n            min_value=col_config.get(&#x27;min_value&#x27;),\n            max_value=col_config.get(&#x27;max_value&#x27;),\n            date_format=col_config.get(&#x27;date_format&#x27;),\n            min_date=col_config.get(&#x27;min_date&#x27;),\n            max_date=col_config.get(&#x27;max_date&#x27;),\n            custom_validator=col_config.get(&#x27;custom_validator&#x27;)\n        )\n        columns.append(column_rule)\n    \n    return TableValidationConfig(\n        table_name=config_data.get(&#x27;table_name&#x27;, &#x27;Unknown&#x27;),\n        description=config_data.get(&#x27;description&#x27;, &#x27;&#x27;),\n        columns=columns,\n        allow_extra_columns=config_data.get(&#x27;allow_extra_columns&#x27;, False),\n        require_header=config_data.get(&#x27;require_header&#x27;, True),\n        min_rows=config_data.get(&#x27;min_rows&#x27;, 0),\n        max_rows=config_data.get(&#x27;max_rows&#x27;),\n        unique_constraints=config_data.get(&#x27;unique_constraints&#x27;, []),\n        foreign_keys=config_data.get(&#x27;foreign_keys&#x27;, {})\n    )\n\n# Demonstration function\ndef demonstrate_table_validation():\n    &quot;&quot;&quot;Demonstrate table validation system&quot;&quot;&quot;\n    \n    # Sample validation configuration\n    config = TableValidationConfig(\n        table_name=&quot;employee_directory&quot;,\n        description=&quot;Employee directory table validation&quot;,\n        columns=[\n            ColumnValidationRule(\n                name=&quot;Employee ID&quot;,\n                data_type=DataType.INTEGER,\n                required=True,\n                unique=True,\n                min_value=1000,\n                max_value=9999\n            ),\n            ColumnValidationRule(\n                name=&quot;Full Name&quot;,\n                data_type=DataType.TEXT,\n                required=True,\n                min_length=2,\n                max_length=50\n            ),\n            ColumnValidationRule(\n                name=&quot;Email Address&quot;,\n                data_type=DataType.EMAIL,\n                required=True,\n                unique=True\n            ),\n            ColumnValidationRule(\n                name=&quot;Department&quot;,\n                data_type=DataType.CATEGORICAL,\n                required=True,\n                allowed_values=[&quot;Engineering&quot;, &quot;Marketing&quot;, &quot;Sales&quot;, &quot;HR&quot;, &quot;Finance&quot;]\n            )\n        ],\n        min_rows=1,\n        max_rows=1000\n    )\n    \n    # Sample Markdown table with intentional errors for testing\n    test_table = &quot;&quot;&quot;| Employee ID | Full Name | Email Address | Department | Annual Salary |\n|:------------|:----------|:--------------|:-----------|:-------------|\n| 1001 | Sarah Chen | sarah.chen@company.com | Engineering | $95,000.00 |\n| 1002 | Mike | invalid-email | Marketing | $75,000.00 |\n| 1001 | Lisa Wang | lisa.wang@company.com | InvalidDept | $68,000.00 |\n| abc | James Thompson | j.thompson@company.com |  | $89,500.00 |\n|  | Emily Davis | emily.davis@company.com | HR | $72,000.00 |&quot;&quot;&quot;\n\n    # Run validation\n    validator = MarkdownTableValidator()\n    results = validator.validate_table_from_markdown(test_table, config)\n    \n    # Display results\n    print(&quot;=== Table Validation Results ===&quot;)\n    print(f&quot;Status: {results[&#x27;validation_summary&#x27;][&#x27;status&#x27;]}&quot;)\n    print(f&quot;Errors: {results[&#x27;validation_summary&#x27;][&#x27;error_count&#x27;]}&quot;)\n    print(f&quot;Warnings: {results[&#x27;validation_summary&#x27;][&#x27;warning_count&#x27;]}&quot;)\n    print(f&quot;Duration: {results[&#x27;validation_summary&#x27;][&#x27;duration_seconds&#x27;]:.3f}s&quot;)\n    \n    print(&quot;\\n=== Validation Errors ===&quot;)\n    for error in results[&#x27;errors&#x27;]:\n        print(f&quot;❌ {error[&#x27;rule&#x27;]}: {error[&#x27;message&#x27;]}&quot;)\n        if error[&#x27;location&#x27;][&#x27;row&#x27;]:\n            print(f&quot;   Location: Row {error[&#x27;location&#x27;][&#x27;row&#x27;]}, Column {error[&#x27;location&#x27;][&#x27;column_name&#x27;]}&quot;)\n        if error[&#x27;fix_suggestion&#x27;]:\n            print(f&quot;   Fix: {error[&#x27;fix_suggestion&#x27;]}&quot;)\n    \n    print(&quot;\\n=== Validation Warnings ===&quot;)\n    for warning in results[&#x27;warnings&#x27;]:\n        print(f&quot;⚠️  {warning[&#x27;rule&#x27;]}: {warning[&#x27;message&#x27;]}&quot;)\n\nif __name__ == &quot;__main__&quot;:\n    demonstrate_table_validation()\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"content-specific-validation-strategies\">Content-Specific Validation Strategies\u003C/h2>\n\u003Ch3 id=\"financial-data-validation\">Financial Data Validation\u003C/h3>\n\u003Cp>Implementing specialized validation for financial and numerical content:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Financial Table Validation Patterns\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Revenue and Financial Performance Validation\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\n# financial-validation-config.yml\ntable_name: &quot;quarterly_revenue_report&quot;\ndescription: &quot;Quarterly financial performance data validation&quot;\ncolumns:\n  - name: &quot;Quarter&quot;\n    type: &quot;text&quot;\n    required: true\n    pattern: &quot;^Q[1-4] 20[0-9]{2}$&quot;\n    \n  - name: &quot;Revenue&quot;\n    type: &quot;currency&quot;\n    required: true\n    min_value: 0\n    max_value: 10000000\n    format: &quot;$X,XXX,XXX.XX&quot;\n    \n  - name: &quot;Expenses&quot;\n    type: &quot;currency&quot;\n    required: true\n    min_value: 0\n    max_value: 10000000\n    \n  - name: &quot;Profit&quot;\n    type: &quot;currency&quot;\n    required: false  # Can be calculated\n    \n  - name: &quot;Growth Rate&quot;\n    type: &quot;float&quot;\n    required: false\n    min_value: -100\n    max_value: 1000\n    format: &quot;X.X%&quot;\n\nbusiness_rules:\n  - name: &quot;profit_calculation&quot;\n    description: &quot;Profit should equal Revenue minus Expenses&quot;\n    validation: &quot;profit = revenue - expenses&quot;\n    tolerance: 0.01\n    \n  - name: &quot;growth_rate_logic&quot;\n    description: &quot;Growth rate should be reasonable&quot;\n    validation: &quot;growth_rate &gt;= -50 AND growth_rate &lt;= 200&quot;\n    \n  - name: &quot;quarterly_progression&quot;\n    description: &quot;Quarters should be in chronological order&quot;\n    validation: &quot;quarters_sequential&quot;\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Sample Financial Table with Validation\u003C/span>\n| Quarter | Revenue | Expenses | Profit | Growth Rate |\n|:--------|--------:|---------:|-------:|-------------|\n| Q1 2024 | $1,245,000 | $987,000 | $258,000 | +12.3% |\n| Q2 2024 | $1,389,000 | $1,045,000 | $344,000 | +18.5% |\n| Q3 2024 | $1,567,000 | $1,123,000 | $444,000 | +22.1% |\n| Q4 2024 | $1,789,000 | $1,234,000 | $555,000 | +28.7% |\n\n\u003Cspan class=\"hljs-section\">## Advanced Financial Validation Rules\u003C/span>\n\u003Cspan class=\"hljs-code\">```python\n# financial-validators.py - Specialized financial validation\nimport re\nfrom decimal import Decimal\nfrom typing import List, Dict, Any\n\nclass FinancialTableValidator:\n    &quot;&quot;&quot;Specialized validator for financial data tables&quot;&quot;&quot;\n    \n    def __init__(self):\n        self.currency_pattern = r&#x27;^\\$[\\d,]+\\.?\\d*$&#x27;\n        self.percentage_pattern = r&#x27;^[\\+\\-]?\\d+\\.?\\d*%$&#x27;\n        \n    def validate_currency_format(self, value: str) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate currency formatting&quot;&quot;&quot;\n        if not re.match(self.currency_pattern, value):\n            return {\n                &#x27;valid&#x27;: False,\n                &#x27;error&#x27;: f&quot;Invalid currency format: {value}&quot;,\n                &#x27;expected&#x27;: &quot;$X,XXX.XX format&quot;\n            }\n        \n        # Extract numeric value\n        numeric_value = Decimal(value.replace(&#x27;$&#x27;, &#x27;&#x27;).replace(&#x27;,&#x27;, &#x27;&#x27;))\n        \n        return {\n            &#x27;valid&#x27;: True,\n            &#x27;numeric_value&#x27;: numeric_value,\n            &#x27;formatted_value&#x27;: value\n        }\n    \n    def validate_percentage_format(self, value: str) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate percentage formatting&quot;&quot;&quot;\n        if not re.match(self.percentage_pattern, value):\n            return {\n                &#x27;valid&#x27;: False,\n                &#x27;error&#x27;: f&quot;Invalid percentage format: {value}&quot;,\n                &#x27;expected&#x27;: &quot;+/-X.X% format&quot;\n            }\n        \n        # Extract numeric value\n        numeric_value = float(value.replace(&#x27;%&#x27;, &#x27;&#x27;).replace(&#x27;+&#x27;, &#x27;&#x27;))\n        \n        return {\n            &#x27;valid&#x27;: True,\n            &#x27;numeric_value&#x27;: numeric_value,\n            &#x27;formatted_value&#x27;: value\n        }\n    \n    def validate_profit_calculation(self, revenue: str, expenses: str, profit: str, tolerance: float = 0.01) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate profit calculation accuracy&quot;&quot;&quot;\n        try:\n            rev_val = Decimal(revenue.replace(&#x27;$&#x27;, &#x27;&#x27;).replace(&#x27;,&#x27;, &#x27;&#x27;))\n            exp_val = Decimal(expenses.replace(&#x27;$&#x27;, &#x27;&#x27;).replace(&#x27;,&#x27;, &#x27;&#x27;))\n            profit_val = Decimal(profit.replace(&#x27;$&#x27;, &#x27;&#x27;).replace(&#x27;,&#x27;, &#x27;&#x27;))\n            \n            calculated_profit = rev_val - exp_val\n            difference = abs(calculated_profit - profit_val)\n            \n            if difference &gt; Decimal(str(tolerance)):\n                return {\n                    &#x27;valid&#x27;: False,\n                    &#x27;error&#x27;: f&quot;Profit calculation error. Expected: ${calculated_profit}, Got: {profit}&quot;,\n                    &#x27;calculated_value&#x27;: f&quot;${calculated_profit:,.2f}&quot;,\n                    &#x27;difference&#x27;: f&quot;${difference:,.2f}&quot;\n                }\n            \n            return {&#x27;valid&#x27;: True, &#x27;calculated_value&#x27;: f&quot;${calculated_profit:,.2f}&quot;}\n            \n        except Exception as e:\n            return {\n                &#x27;valid&#x27;: False,\n                &#x27;error&#x27;: f&quot;Error in profit calculation validation: {str(e)}&quot;\n            }\n    \n    def validate_growth_trend(self, values: List[float], period_names: List[str]) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate growth trend logical consistency&quot;&quot;&quot;\n        anomalies = []\n        \n        for i in range(1, len(values)):\n            growth_rate = ((values[i] - values[i-1]) / values[i-1]) * 100\n            \n            # Check for extreme growth rates\n            if abs(growth_rate) &gt; 200:  # 200% growth in one period\n                anomalies.append({\n                    &#x27;period&#x27;: period_names[i],\n                    &#x27;growth_rate&#x27;: f&quot;{growth_rate:.1f}%&quot;,\n                    &#x27;issue&#x27;: &quot;Extreme growth rate detected&quot;\n                })\n            \n            # Check for negative values\n            if values[i] &lt; 0:\n                anomalies.append({\n                    &#x27;period&#x27;: period_names[i],\n                    &#x27;value&#x27;: values[i],\n                    &#x27;issue&#x27;: &quot;Negative value detected&quot;\n                })\n        \n        return {\n            &#x27;valid&#x27;: len(anomalies) == 0,\n            &#x27;anomalies&#x27;: anomalies,\n            &#x27;trend_analysis&#x27;: self._analyze_trend(values)\n        }\n    \n    def _analyze_trend(self, values: List[float]) -&gt; str:\n        &quot;&quot;&quot;Analyze overall trend in financial data&quot;&quot;&quot;\n        if len(values) &lt; 2:\n            return &quot;Insufficient data for trend analysis&quot;\n        \n        increasing = sum(1 for i in range(1, len(values)) if values[i] &gt; values[i-1])\n        decreasing = sum(1 for i in range(1, len(values)) if values[i] &lt; values[i-1])\n        \n        total_periods = len(values) - 1\n        \n        if increasing == total_periods:\n            return &quot;Consistent growth trend&quot;\n        elif decreasing == total_periods:\n            return &quot;Consistent decline trend&quot;\n        elif increasing &gt; decreasing:\n            return &quot;Generally increasing with fluctuations&quot;\n        elif decreasing &gt; increasing:\n            return &quot;Generally decreasing with fluctuations&quot;\n        else:\n            return &quot;Volatile with no clear trend&quot;\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch3 id=\"technical-documentation-validation\">Technical Documentation Validation\u003C/h3>\n\u003Cp>Specialized validation for technical tables and API documentation:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># Technical Documentation Validation\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## API Endpoint Documentation Validation\u003C/span>\n\u003Cspan class=\"hljs-code\">```yaml\n# api-docs-validation.yml\ntable_name: &quot;api_endpoints&quot;\ndescription: &quot;REST API endpoint documentation validation&quot;\ncolumns:\n  - name: &quot;Endpoint&quot;\n    type: &quot;text&quot;\n    required: true\n    pattern: &quot;^/api/v[0-9]+/[a-z0-9/_-]+$&quot;\n    \n  - name: &quot;Method&quot;\n    type: &quot;categorical&quot;\n    required: true\n    allowed_values: [&quot;GET&quot;, &quot;POST&quot;, &quot;PUT&quot;, &quot;PATCH&quot;, &quot;DELETE&quot;]\n    \n  - name: &quot;Authentication&quot;\n    type: &quot;categorical&quot;\n    required: true\n    allowed_values: [&quot;None&quot;, &quot;API Key&quot;, &quot;Bearer Token&quot;, &quot;Basic Auth&quot;, &quot;OAuth&quot;]\n    \n  - name: &quot;Rate Limit&quot;\n    type: &quot;text&quot;\n    required: true\n    pattern: &quot;^[0-9]+/(second|minute|hour|day)$&quot;\n    \n  - name: &quot;Response Format&quot;\n    type: &quot;categorical&quot;\n    required: true\n    allowed_values: [&quot;JSON&quot;, &quot;XML&quot;, &quot;Plain Text&quot;, &quot;Binary&quot;]\n\nvalidation_rules:\n  - name: &quot;endpoint_uniqueness&quot;\n    description: &quot;Endpoint + Method combination must be unique&quot;\n    type: &quot;composite_unique&quot;\n    columns: [&quot;Endpoint&quot;, &quot;Method&quot;]\n    \n  - name: &quot;rate_limit_reasonableness&quot;\n    description: &quot;Rate limits should be reasonable for method type&quot;\n    type: &quot;business_logic&quot;\n    rules:\n      - &quot;GET methods: rate_limit &lt;= 1000/minute&quot;\n      - &quot;POST/PUT/PATCH methods: rate_limit &lt;= 100/minute&quot;\n      - &quot;DELETE methods: rate_limit &lt;= 10/minute&quot;\n```\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## Software Configuration Validation\u003C/span>\n| Configuration Key | Data Type | Default Value | Valid Range | Required | Environment |\n|:------------------|:----------|:--------------|:------------|:---------|:------------|\n| \u003Cspan class=\"hljs-strong\">**server.port**\u003C/span> | integer | 8080 | 1024-65535 | Yes | All |\n| \u003Cspan class=\"hljs-strong\">**database.url**\u003C/span> | url | jdbc:postgresql://localhost:5432/app | Valid JDBC URL | Yes | All |\n| \u003Cspan class=\"hljs-strong\">**cache.ttl**\u003C/span> | duration | 300s | 1s-3600s | No | Production |\n| \u003Cspan class=\"hljs-strong\">**logging.level**\u003C/span> | categorical | INFO | DEBUG, INFO, WARN, ERROR | No | All |\n| \u003Cspan class=\"hljs-strong\">**security.enabled**\u003C/span> | boolean | true | true, false | Yes | Production |\n\n\u003Cspan class=\"hljs-section\">## Code Review Checklist Validation\u003C/span>\n\u003Cspan class=\"hljs-code\">```python\n# code-review-validator.py - Specialized code review table validation\n\nclass CodeReviewValidator:\n    &quot;&quot;&quot;Validator for code review checklist tables&quot;&quot;&quot;\n    \n    def __init__(self):\n        self.valid_statuses = [&#x27;✅&#x27;, &#x27;❌&#x27;, &#x27;⚠️&#x27;, &#x27;🔄&#x27;, &#x27;N/A&#x27;]\n        self.critical_checks = [\n            &#x27;Security scan completed&#x27;,\n            &#x27;All tests passing&#x27;, \n            &#x27;Code style compliance&#x27;,\n            &#x27;Documentation updated&#x27;\n        ]\n    \n    def validate_review_table(self, table_data: Dict[str, Any]) -&gt; List[Dict[str, Any]]:\n        &quot;&quot;&quot;Validate code review checklist table&quot;&quot;&quot;\n        errors = []\n        \n        if &#x27;Status&#x27; not in table_data[&#x27;headers&#x27;]:\n            errors.append({\n                &#x27;type&#x27;: &#x27;missing_column&#x27;,\n                &#x27;message&#x27;: &#x27;Status column required for review tables&#x27;\n            })\n            return errors\n        \n        status_index = table_data[&#x27;headers&#x27;].index(&#x27;Status&#x27;)\n        checklist_index = table_data[&#x27;headers&#x27;].index(&#x27;Checkpoint&#x27;) if &#x27;Checkpoint&#x27; in table_data[&#x27;headers&#x27;] else 0\n        \n        critical_checks_found = set()\n        \n        for row_idx, row in enumerate(table_data[&#x27;rows&#x27;]):\n            if len(row) &lt;= status_index:\n                continue\n                \n            status = row[status_index]\n            checkpoint = row[checklist_index] if len(row) &gt; checklist_index else &#x27;&#x27;\n            \n            # Validate status format\n            if status not in self.valid_statuses:\n                errors.append({\n                    &#x27;type&#x27;: &#x27;invalid_status&#x27;,\n                    &#x27;message&#x27;: f&quot;Invalid status &#x27;{status}&#x27; in row {row_idx + 1}&quot;,\n                    &#x27;expected&#x27;: f&quot;One of: {&#x27;, &#x27;.join(self.valid_statuses)}&quot;,\n                    &#x27;row&#x27;: row_idx + 1\n                })\n            \n            # Track critical checks\n            for critical_check in self.critical_checks:\n                if critical_check.lower() in checkpoint.lower():\n                    critical_checks_found.add(critical_check)\n                    \n                    # Critical checks cannot be failed\n                    if status == &#x27;❌&#x27;:\n                        errors.append({\n                            &#x27;type&#x27;: &#x27;critical_check_failed&#x27;,\n                            &#x27;message&#x27;: f&quot;Critical check &#x27;{checkpoint}&#x27; failed&quot;,\n                            &#x27;severity&#x27;: &#x27;critical&#x27;,\n                            &#x27;row&#x27;: row_idx + 1\n                        })\n        \n        # Check for missing critical checks\n        missing_critical = set(self.critical_checks) - critical_checks_found\n        for missing in missing_critical:\n            errors.append({\n                &#x27;type&#x27;: &#x27;missing_critical_check&#x27;,\n                &#x27;message&#x27;: f&quot;Missing critical check: {missing}&quot;,\n                &#x27;severity&#x27;: &#x27;high&#x27;\n            })\n        \n        return errors\n    \n    def calculate_review_score(self, table_data: Dict[str, Any]) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Calculate review completion score&quot;&quot;&quot;\n        if &#x27;Status&#x27; not in table_data[&#x27;headers&#x27;]:\n            return {&#x27;error&#x27;: &#x27;Status column not found&#x27;}\n        \n        status_index = table_data[&#x27;headers&#x27;].index(&#x27;Status&#x27;)\n        total_checks = len(table_data[&#x27;rows&#x27;])\n        \n        status_counts = {status: 0 for status in self.valid_statuses}\n        \n        for row in table_data[&#x27;rows&#x27;]:\n            if len(row) &gt; status_index:\n                status = row[status_index]\n                if status in status_counts:\n                    status_counts[status] += 1\n        \n        completed = status_counts[&#x27;✅&#x27;]\n        failed = status_counts[&#x27;❌&#x27;]\n        in_progress = status_counts[&#x27;🔄&#x27;]\n        warnings = status_counts[&#x27;⚠️&#x27;]\n        \n        completion_rate = (completed / total_checks) * 100 if total_checks &gt; 0 else 0\n        \n        return {\n            &#x27;total_checks&#x27;: total_checks,\n            &#x27;completed&#x27;: completed,\n            &#x27;failed&#x27;: failed,\n            &#x27;in_progress&#x27;: in_progress,\n            &#x27;warnings&#x27;: warnings,\n            &#x27;completion_rate&#x27;: round(completion_rate, 1),\n            &#x27;review_status&#x27;: self._determine_review_status(completion_rate, failed, warnings)\n        }\n    \n    def _determine_review_status(self, completion_rate: float, failed: int, warnings: int) -&gt; str:\n        &quot;&quot;&quot;Determine overall review status&quot;&quot;&quot;\n        if failed &gt; 0:\n            return &quot;BLOCKED - Failed checks must be resolved&quot;\n        elif completion_rate &lt; 80:\n            return &quot;IN_PROGRESS - More checks needed&quot;\n        elif warnings &gt; 2:\n            return &quot;NEEDS_ATTENTION - Multiple warnings&quot;\n        elif completion_rate &gt;= 95:\n            return &quot;APPROVED - Ready to merge&quot;\n        else:\n            return &quot;REVIEW_REQUIRED - Minor issues to address&quot;\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"cicd-integration-and-automated-workflows\">CI/CD Integration and Automated Workflows\u003C/h2>\n\u003Ch3 id=\"github-actions-integration\">GitHub Actions Integration\u003C/h3>\n\u003Cp>Implementing table validation in automated workflows:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-markdown\">\u003Cspan class=\"hljs-section\"># CI/CD Integration for Table Validation\u003C/span>\n\n\u003Cspan class=\"hljs-section\">## GitHub Actions Workflow\u003C/span>\n\n\u003Cspan class=\"hljs-code\">```yaml\n# .github/workflows/table-validation.yml\nname: Markdown Table Validation\n\non:\n  push:\n    branches: [ main, develop ]\n    paths: \n      - &#x27;**/*.md&#x27;\n      - &#x27;validation-configs/**&#x27;\n  pull_request:\n    branches: [ main ]\n    paths:\n      - &#x27;**/*.md&#x27;\n      - &#x27;validation-configs/**&#x27;\n\njobs:\n  validate-tables:\n    runs-on: ubuntu-latest\n    \n    steps:\n    - uses: actions/checkout@v4\n      with:\n        fetch-depth: 0\n    \n    - name: Set up Python\n      uses: actions/setup-python@v4\n      with:\n        python-version: &#x27;3.11&#x27;\n    \n    - name: Install dependencies\n      run: |\n        pip install -r requirements.txt\n        pip install pyyaml pandas email-validator\n    \n    - name: Find modified markdown files\n      id: changed-files\n      uses: tj-actions/changed-files@v40\n      with:\n        files: |\n          **/*.md\n    \n    - name: Run table validation\n      run: |\n        python scripts/validate-all-tables.py \\\n          --files=&quot;${{ steps.changed-files.outputs.all_changed_files }}&quot; \\\n          --config-dir=&quot;validation-configs&quot; \\\n          --output-format=&quot;github-actions&quot; \\\n          --fail-on-error\n    \n    - name: Generate validation report\n      if: always()\n      run: |\n        python scripts/generate-validation-report.py \\\n          --output=&quot;table-validation-report.html&quot; \\\n          --include-suggestions \\\n          --include-statistics\n    \n    - name: Upload validation report\n      if: always()\n      uses: actions/upload-artifact@v3\n      with:\n        name: table-validation-report\n        path: table-validation-report.html\n    \n    - name: Comment PR with validation results\n      if: github.event_name == &#x27;pull_request&#x27;\n      uses: actions/github-script@v6\n      with:\n        script: |\n          const fs = require(&#x27;fs&#x27;);\n          \n          try {\n            const report = fs.readFileSync(&#x27;validation-summary.md&#x27;, &#x27;utf8&#x27;);\n            \n            github.rest.issues.createComment({\n              issue_number: context.issue.number,\n              owner: context.repo.owner,\n              repo: context.repo.repo,\n              body: report\n            });\n          } catch (error) {\n            console.log(&#x27;No validation summary found or error reading file&#x27;);\n          }\n\n  table-performance-check:\n    runs-on: ubuntu-latest\n    needs: validate-tables\n    if: github.event_name == &#x27;pull_request&#x27;\n    \n    steps:\n    - uses: actions/checkout@v4\n    \n    - name: Set up Node.js\n      uses: actions/setup-node@v4\n      with:\n        node-version: &#x27;18&#x27;\n    \n    - name: Install dependencies\n      run: |\n        npm install puppeteer lighthouse\n    \n    - name: Build documentation site\n      run: |\n        bundle install\n        bundle exec jekyll build\n    \n    - name: Run table performance audit\n      run: |\n        node scripts/table-performance-audit.js \\\n          --site-dir=&quot;_site&quot; \\\n          --output=&quot;performance-report.json&quot;\n    \n    - name: Check performance thresholds\n      run: |\n        python scripts/check-performance-thresholds.py \\\n          --report=&quot;performance-report.json&quot; \\\n          --max-render-time=100 \\\n          --max-memory-usage=50\n```\u003C/span>\n\n\n\u003Cspan class=\"hljs-section\">## Advanced Validation Script\u003C/span>\n\u003Cspan class=\"hljs-code\">```python\n#!/usr/bin/env python3\n# validate-all-tables.py - Batch table validation script\n\nimport os\nimport sys\nimport json\nimport argparse\nimport glob\nfrom pathlib import Path\nfrom typing import List, Dict, Any\nimport concurrent.futures\nfrom markdown_table_validator import MarkdownTableValidator, load_validation_config\n\nclass BatchTableValidator:\n    &quot;&quot;&quot;Batch validation system for multiple Markdown files&quot;&quot;&quot;\n    \n    def __init__(self, config_dir: str, max_workers: int = 4):\n        self.config_dir = Path(config_dir)\n        self.max_workers = max_workers\n        self.validator = MarkdownTableValidator()\n        self.validation_configs = {}\n        self.load_all_configs()\n    \n    def load_all_configs(self):\n        &quot;&quot;&quot;Load all validation configurations&quot;&quot;&quot;\n        config_files = list(self.config_dir.glob(&#x27;*.yml&#x27;)) + list(self.config_dir.glob(&#x27;*.yaml&#x27;))\n        \n        for config_file in config_files:\n            try:\n                config = load_validation_config(str(config_file))\n                self.validation_configs[config.table_name] = config\n                print(f&quot;Loaded config for: {config.table_name}&quot;)\n            except Exception as e:\n                print(f&quot;Error loading config {config_file}: {e}&quot;)\n    \n    def validate_files(self, file_paths: List[str]) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate multiple Markdown files&quot;&quot;&quot;\n        results = {\n            &#x27;summary&#x27;: {\n                &#x27;total_files&#x27;: len(file_paths),\n                &#x27;files_with_tables&#x27;: 0,\n                &#x27;files_validated&#x27;: 0,\n                &#x27;total_errors&#x27;: 0,\n                &#x27;total_warnings&#x27;: 0,\n                &#x27;validation_passed&#x27;: True\n            },\n            &#x27;file_results&#x27;: {}\n        }\n        \n        with concurrent.futures.ThreadPoolExecutor(max_workers=self.max_workers) as executor:\n            future_to_file = {\n                executor.submit(self.validate_file, file_path): file_path \n                for file_path in file_paths\n            }\n            \n            for future in concurrent.futures.as_completed(future_to_file):\n                file_path = future_to_file[future]\n                try:\n                    file_result = future.result()\n                    results[&#x27;file_results&#x27;][file_path] = file_result\n                    \n                    # Update summary\n                    if file_result[&#x27;tables_found&#x27;] &gt; 0:\n                        results[&#x27;summary&#x27;][&#x27;files_with_tables&#x27;] += 1\n                        \n                    if file_result[&#x27;validation_run&#x27;]:\n                        results[&#x27;summary&#x27;][&#x27;files_validated&#x27;] += 1\n                        results[&#x27;summary&#x27;][&#x27;total_errors&#x27;] += file_result[&#x27;total_errors&#x27;]\n                        results[&#x27;summary&#x27;][&#x27;total_warnings&#x27;] += file_result[&#x27;total_warnings&#x27;]\n                        \n                        if file_result[&#x27;total_errors&#x27;] &gt; 0:\n                            results[&#x27;summary&#x27;][&#x27;validation_passed&#x27;] = False\n                            \n                except Exception as e:\n                    results[&#x27;file_results&#x27;][file_path] = {\n                        &#x27;error&#x27;: f&quot;Validation failed: {str(e)}&quot;,\n                        &#x27;tables_found&#x27;: 0,\n                        &#x27;validation_run&#x27;: False,\n                        &#x27;total_errors&#x27;: 1,\n                        &#x27;total_warnings&#x27;: 0\n                    }\n                    results[&#x27;summary&#x27;][&#x27;total_errors&#x27;] += 1\n                    results[&#x27;summary&#x27;][&#x27;validation_passed&#x27;] = False\n        \n        return results\n    \n    def validate_file(self, file_path: str) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate tables in a single Markdown file&quot;&quot;&quot;\n        try:\n            with open(file_path, &#x27;r&#x27;, encoding=&#x27;utf-8&#x27;) as f:\n                content = f.read()\n            \n            # Extract tables from markdown content\n            tables = self.extract_tables(content)\n            \n            file_result = {\n                &#x27;file_path&#x27;: file_path,\n                &#x27;tables_found&#x27;: len(tables),\n                &#x27;validation_run&#x27;: False,\n                &#x27;total_errors&#x27;: 0,\n                &#x27;total_warnings&#x27;: 0,\n                &#x27;table_results&#x27;: []\n            }\n            \n            if not tables:\n                return file_result\n            \n            for i, table_content in enumerate(tables):\n                table_result = self.validate_single_table(table_content, file_path, i)\n                file_result[&#x27;table_results&#x27;].append(table_result)\n                file_result[&#x27;total_errors&#x27;] += table_result[&#x27;error_count&#x27;]\n                file_result[&#x27;total_warnings&#x27;] += table_result[&#x27;warning_count&#x27;]\n            \n            file_result[&#x27;validation_run&#x27;] = True\n            return file_result\n            \n        except Exception as e:\n            return {\n                &#x27;file_path&#x27;: file_path,\n                &#x27;error&#x27;: str(e),\n                &#x27;tables_found&#x27;: 0,\n                &#x27;validation_run&#x27;: False,\n                &#x27;total_errors&#x27;: 1,\n                &#x27;total_warnings&#x27;: 0\n            }\n    \n    def extract_tables(self, content: str) -&gt; List[str]:\n        &quot;&quot;&quot;Extract table content from Markdown&quot;&quot;&quot;\n        import re\n        \n        # Pattern to match Markdown tables\n        table_pattern = r&#x27;(\\|[^\\n]*\\|(?:\\n\\|[^\\n]*\\|)*)&#x27;\n        tables = re.findall(table_pattern, content, re.MULTILINE)\n        \n        # Filter out single-line false matches\n        valid_tables = []\n        for table in tables:\n            lines = table.strip().split(&#x27;\\n&#x27;)\n            if len(lines) &gt;= 3:  # Header + separator + at least one data row\n                valid_tables.append(table.strip())\n        \n        return valid_tables\n    \n    def validate_single_table(self, table_content: str, file_path: str, table_index: int) -&gt; Dict[str, Any]:\n        &quot;&quot;&quot;Validate a single table&quot;&quot;&quot;\n        # Try to match table with appropriate config\n        config = self.select_config_for_table(table_content)\n        \n        if not config:\n            return {\n                &#x27;table_index&#x27;: table_index,\n                &#x27;config_used&#x27;: &#x27;none&#x27;,\n                &#x27;validation_skipped&#x27;: True,\n                &#x27;reason&#x27;: &#x27;No matching validation config found&#x27;,\n                &#x27;error_count&#x27;: 0,\n                &#x27;warning_count&#x27;: 0\n            }\n        \n        validation_result = self.validator.validate_table_from_markdown(table_content, config)\n        \n        return {\n            &#x27;table_index&#x27;: table_index,\n            &#x27;config_used&#x27;: config.table_name,\n            &#x27;validation_skipped&#x27;: False,\n            &#x27;error_count&#x27;: validation_result[&#x27;validation_summary&#x27;][&#x27;error_count&#x27;],\n            &#x27;warning_count&#x27;: validation_result[&#x27;validation_summary&#x27;][&#x27;warning_count&#x27;],\n            &#x27;status&#x27;: validation_result[&#x27;validation_summary&#x27;][&#x27;status&#x27;],\n            &#x27;errors&#x27;: validation_result[&#x27;errors&#x27;],\n            &#x27;warnings&#x27;: validation_result[&#x27;warnings&#x27;]\n        }\n    \n    def select_config_for_table(self, table_content: str) -&gt; Optional[&#x27;TableValidationConfig&#x27;]:\n        &quot;&quot;&quot;Select appropriate validation config for table&quot;&quot;&quot;\n        # Simple heuristic: try to match based on header content\n        lines = table_content.strip().split(&#x27;\\n&#x27;)\n        if len(lines) &lt; 1:\n            return None\n            \n        header_line = lines[0].lower()\n        \n        # Priority matching based on header keywords\n        for config_name, config in self.validation_configs.items():\n            config_keywords = config_name.lower().split(&#x27;_&#x27;)\n            \n            if any(keyword in header_line for keyword in config_keywords):\n                return config\n        \n        # Fallback to first available config\n        if self.validation_configs:\n            return next(iter(self.validation_configs.values()))\n        \n        return None\n    \n    def generate_github_actions_output(self, results: Dict[str, Any]):\n        &quot;&quot;&quot;Generate GitHub Actions formatted output&quot;&quot;&quot;\n        summary = results[&#x27;summary&#x27;]\n        \n        if not summary[&#x27;validation_passed&#x27;]:\n            print(&quot;::error::Table validation failed&quot;)\n            \n        print(f&quot;::notice::Validated {summary[&#x27;files_validated&#x27;]} files with {summary[&#x27;files_with_tables&#x27;]} containing tables&quot;)\n        \n        # Output errors and warnings\n        for file_path, file_result in results[&#x27;file_results&#x27;].items():\n            if &#x27;error&#x27; in file_result:\n                print(f&quot;::error file={file_path}::{file_result[&#x27;error&#x27;]}&quot;)\n                continue\n                \n            for table_result in file_result.get(&#x27;table_results&#x27;, []):\n                for error in table_result.get(&#x27;errors&#x27;, []):\n                    location = &quot;&quot;\n                    if error[&#x27;location&#x27;][&#x27;row&#x27;]:\n                        location = f&quot;,line={error[&#x27;location&#x27;][&#x27;row&#x27;]}&quot;\n                    \n                    print(f&quot;::error file={file_path}{location}::{error[&#x27;message&#x27;]}&quot;)\n                \n                for warning in table_result.get(&#x27;warnings&#x27;, []):\n                    location = &quot;&quot;\n                    if warning[&#x27;location&#x27;][&#x27;row&#x27;]:\n                        location = f&quot;,line={warning[&#x27;location&#x27;][&#x27;row&#x27;]}&quot;\n                    \n                    print(f&quot;::warning file={file_path}{location}::{warning[&#x27;message&#x27;]}&quot;)\n\ndef main():\n    parser = argparse.ArgumentParser(description=&#x27;Batch Markdown table validation&#x27;)\n    parser.add_argument(&#x27;--files&#x27;, required=True, help=&#x27;Space-separated list of files to validate&#x27;)\n    parser.add_argument(&#x27;--config-dir&#x27;, required=True, help=&#x27;Directory containing validation configs&#x27;)\n    parser.add_argument(&#x27;--output-format&#x27;, choices=[&#x27;json&#x27;, &#x27;github-actions&#x27;], default=&#x27;json&#x27;)\n    parser.add_argument(&#x27;--fail-on-error&#x27;, action=&#x27;store_true&#x27;, help=&#x27;Exit with error code if validation fails&#x27;)\n    parser.add_argument(&#x27;--max-workers&#x27;, type=int, default=4, help=&#x27;Maximum number of worker threads&#x27;)\n    \n    args = parser.parse_args()\n    \n    file_list = args.files.split() if args.files else []\n    \n    validator = BatchTableValidator(args.config_dir, args.max_workers)\n    results = validator.validate_files(file_list)\n    \n    if args.output_format == &#x27;github-actions&#x27;:\n        validator.generate_github_actions_output(results)\n    else:\n        print(json.dumps(results, indent=2))\n    \n    if args.fail_on_error and not results[&#x27;summary&#x27;][&#x27;validation_passed&#x27;]:\n        sys.exit(1)\n\nif __name__ == &quot;__main__&quot;:\n    main()\n```\u003C/span>\n\u003C/code>\u003C/pre>\u003Ch2 id=\"integration-with-documentation-systems\">Integration with Documentation Systems\u003C/h2>\n\u003Cp>Advanced table validation integrates seamlessly with comprehensive documentation workflows. When combined with \u003Ca href=\"/blog/markdown-automated-testing-validation-complete-guide\">automated testing and validation frameworks\u003C/a>, table validation ensures data consistency across documentation updates while maintaining quality standards through systematic verification processes.\u003C/p>\n\u003Cp>For comprehensive content management, validation systems work effectively with \u003Ca href=\"/blog/markdown-collaborative-editing-real-time-synchronization-complete-guide\">collaborative editing and version control workflows\u003C/a> to enable distributed teams to maintain consistent data presentation standards while preventing validation errors through pre-commit hooks and automated quality checks.\u003C/p>\n\u003Cp>When building sophisticated documentation platforms, table validation complements \u003Ca href=\"/blog/markdown-content-organization-project-structure-complete-guide\">content organization and project structure systems\u003C/a> by enabling systematic data quality management across large documentation repositories while supporting complex validation rules and business logic verification.\u003C/p>\n\u003Ch2 id=\"performance-optimization-and-monitoring\">Performance Optimization and Monitoring\u003C/h2>\n\u003Ch3 id=\"validation-performance-metrics\">Validation Performance Metrics\u003C/h3>\n\u003Cp>Implementing comprehensive performance monitoring for validation systems:\u003C/p>\n\u003Cpre>\u003Ccode class=\"hljs language-python\">\u003Cspan class=\"hljs-comment\">#!/usr/bin/env python3\u003C/span>\n\u003Cspan class=\"hljs-comment\"># validation-performance-monitor.py - Performance monitoring system\u003C/span>\n\n\u003Cspan class=\"hljs-keyword\">import\u003C/span> time\n\u003Cspan class=\"hljs-keyword\">import\u003C/span> psutil\n\u003Cspan class=\"hljs-keyword\">import\u003C/span> threading\n\u003Cspan class=\"hljs-keyword\">from\u003C/span> typing \u003Cspan class=\"hljs-keyword\">import\u003C/span> \u003Cspan class=\"hljs-type\">Dict\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>, \u003Cspan class=\"hljs-type\">List\u003C/span>, \u003Cspan class=\"hljs-type\">Optional\u003C/span>\n\u003Cspan class=\"hljs-keyword\">from\u003C/span> dataclasses \u003Cspan class=\"hljs-keyword\">import\u003C/span> dataclass\n\u003Cspan class=\"hljs-keyword\">from\u003C/span> datetime \u003Cspan class=\"hljs-keyword\">import\u003C/span> datetime, timedelta\n\u003Cspan class=\"hljs-keyword\">import\u003C/span> statistics\n\n\u003Cspan class=\"hljs-meta\">@dataclass\u003C/span>\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">PerformanceMetrics\u003C/span>:\n    \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Performance metrics for validation operations&quot;&quot;&quot;\u003C/span>\n    operation: \u003Cspan class=\"hljs-built_in\">str\u003C/span>\n    start_time: datetime\n    end_time: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[datetime] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\n    duration_ms: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">float\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\n    memory_usage_mb: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">float\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\n    cpu_usage_percent: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">float\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\n    rows_processed: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">int\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\n    errors_found: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">int\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\n\n\u003Cspan class=\"hljs-keyword\">class\u003C/span> \u003Cspan class=\"hljs-title class_\">ValidationPerformanceMonitor\u003C/span>:\n    \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Performance monitoring for table validation operations&quot;&quot;&quot;\u003C/span>\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">__init__\u003C/span>(\u003Cspan class=\"hljs-params\">self\u003C/span>):\n        self.metrics_history: \u003Cspan class=\"hljs-type\">List\u003C/span>[PerformanceMetrics] = []\n        self.active_operations: \u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, PerformanceMetrics] = {}\n        self.monitoring_enabled = \u003Cspan class=\"hljs-literal\">True\u003C/span>\n        self.process = psutil.Process()\n        \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">start_operation\u003C/span>(\u003Cspan class=\"hljs-params\">self, operation_id: \u003Cspan class=\"hljs-built_in\">str\u003C/span>, operation_type: \u003Cspan class=\"hljs-built_in\">str\u003C/span>, rows_count: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">int\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\u003C/span>) -&gt; PerformanceMetrics:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Start monitoring a validation operation&quot;&quot;&quot;\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> self.monitoring_enabled:\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">None\u003C/span>\n            \n        metrics = PerformanceMetrics(\n            operation=operation_type,\n            start_time=datetime.now(),\n            rows_processed=rows_count\n        )\n        \n        self.active_operations[operation_id] = metrics\n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> metrics\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">end_operation\u003C/span>(\u003Cspan class=\"hljs-params\">self, operation_id: \u003Cspan class=\"hljs-built_in\">str\u003C/span>, errors_found: \u003Cspan class=\"hljs-built_in\">int\u003C/span> = \u003Cspan class=\"hljs-number\">0\u003C/span>\u003C/span>) -&gt; PerformanceMetrics:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;End monitoring and calculate metrics&quot;&quot;&quot;\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> operation_id \u003Cspan class=\"hljs-keyword\">not\u003C/span> \u003Cspan class=\"hljs-keyword\">in\u003C/span> self.active_operations:\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> \u003Cspan class=\"hljs-literal\">None\u003C/span>\n            \n        metrics = self.active_operations[operation_id]\n        metrics.end_time = datetime.now()\n        metrics.duration_ms = (metrics.end_time - metrics.start_time).total_seconds() * \u003Cspan class=\"hljs-number\">1000\u003C/span>\n        metrics.errors_found = errors_found\n        \n        \u003Cspan class=\"hljs-comment\"># Capture resource usage\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">try\u003C/span>:\n            memory_info = self.process.memory_info()\n            metrics.memory_usage_mb = memory_info.rss / (\u003Cspan class=\"hljs-number\">1024\u003C/span> * \u003Cspan class=\"hljs-number\">1024\u003C/span>)\n            metrics.cpu_usage_percent = self.process.cpu_percent()\n        \u003Cspan class=\"hljs-keyword\">except\u003C/span> Exception:\n            \u003Cspan class=\"hljs-keyword\">pass\u003C/span>  \u003Cspan class=\"hljs-comment\"># Resource monitoring failed\u003C/span>\n        \n        self.metrics_history.append(metrics)\n        \u003Cspan class=\"hljs-keyword\">del\u003C/span> self.active_operations[operation_id]\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> metrics\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">get_performance_summary\u003C/span>(\u003Cspan class=\"hljs-params\">self, operation_type: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>] = \u003Cspan class=\"hljs-literal\">None\u003C/span>, \n                              time_window: \u003Cspan class=\"hljs-type\">Optional\u003C/span>[timedelta] = \u003Cspan class=\"hljs-literal\">None\u003C/span>\u003C/span>) -&gt; \u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>]:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Generate performance summary report&quot;&quot;&quot;\u003C/span>\n        \n        \u003Cspan class=\"hljs-comment\"># Filter metrics based on criteria\u003C/span>\n        filtered_metrics = self.metrics_history\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> operation_type:\n            filtered_metrics = [m \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> filtered_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.operation == operation_type]\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> time_window:\n            cutoff_time = datetime.now() - time_window\n            filtered_metrics = [m \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> filtered_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.start_time &gt;= cutoff_time]\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> filtered_metrics:\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> {\u003Cspan class=\"hljs-string\">&#x27;error&#x27;\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;No metrics found for criteria&#x27;\u003C/span>}\n        \n        \u003Cspan class=\"hljs-comment\"># Calculate statistics\u003C/span>\n        durations = [m.duration_ms \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> filtered_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.duration_ms \u003Cspan class=\"hljs-keyword\">is\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> \u003Cspan class=\"hljs-literal\">None\u003C/span>]\n        memory_usage = [m.memory_usage_mb \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> filtered_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.memory_usage_mb \u003Cspan class=\"hljs-keyword\">is\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> \u003Cspan class=\"hljs-literal\">None\u003C/span>]\n        rows_processed = [m.rows_processed \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> filtered_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.rows_processed \u003Cspan class=\"hljs-keyword\">is\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> \u003Cspan class=\"hljs-literal\">None\u003C/span>]\n        errors_found = [m.errors_found \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> filtered_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.errors_found \u003Cspan class=\"hljs-keyword\">is\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> \u003Cspan class=\"hljs-literal\">None\u003C/span>]\n        \n        summary = {\n            \u003Cspan class=\"hljs-string\">&#x27;operation_count&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">len\u003C/span>(filtered_metrics),\n            \u003Cspan class=\"hljs-string\">&#x27;time_window&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">str\u003C/span>(time_window) \u003Cspan class=\"hljs-keyword\">if\u003C/span> time_window \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;All time&#x27;\u003C/span>,\n            \u003Cspan class=\"hljs-string\">&#x27;operation_type&#x27;\u003C/span>: operation_type \u003Cspan class=\"hljs-keyword\">or\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;All operations&#x27;\u003C/span>\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> durations:\n            summary[\u003Cspan class=\"hljs-string\">&#x27;performance&#x27;\u003C/span>] = {\n                \u003Cspan class=\"hljs-string\">&#x27;avg_duration_ms&#x27;\u003C/span>: statistics.mean(durations),\n                \u003Cspan class=\"hljs-string\">&#x27;min_duration_ms&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">min\u003C/span>(durations),\n                \u003Cspan class=\"hljs-string\">&#x27;max_duration_ms&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">max\u003C/span>(durations),\n                \u003Cspan class=\"hljs-string\">&#x27;median_duration_ms&#x27;\u003C/span>: statistics.median(durations),\n                \u003Cspan class=\"hljs-string\">&#x27;p95_duration_ms&#x27;\u003C/span>: self._percentile(durations, \u003Cspan class=\"hljs-number\">95\u003C/span>),\n                \u003Cspan class=\"hljs-string\">&#x27;p99_duration_ms&#x27;\u003C/span>: self._percentile(durations, \u003Cspan class=\"hljs-number\">99\u003C/span>)\n            }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> memory_usage:\n            summary[\u003Cspan class=\"hljs-string\">&#x27;memory&#x27;\u003C/span>] = {\n                \u003Cspan class=\"hljs-string\">&#x27;avg_memory_mb&#x27;\u003C/span>: statistics.mean(memory_usage),\n                \u003Cspan class=\"hljs-string\">&#x27;peak_memory_mb&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">max\u003C/span>(memory_usage),\n                \u003Cspan class=\"hljs-string\">&#x27;min_memory_mb&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">min\u003C/span>(memory_usage)\n            }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> rows_processed:\n            summary[\u003Cspan class=\"hljs-string\">&#x27;throughput&#x27;\u003C/span>] = {\n                \u003Cspan class=\"hljs-string\">&#x27;total_rows&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">sum\u003C/span>(rows_processed),\n                \u003Cspan class=\"hljs-string\">&#x27;avg_rows_per_operation&#x27;\u003C/span>: statistics.mean(rows_processed),\n                \u003Cspan class=\"hljs-string\">&#x27;avg_rows_per_second&#x27;\u003C/span>: self._calculate_throughput(filtered_metrics)\n            }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> errors_found:\n            summary[\u003Cspan class=\"hljs-string\">&#x27;quality&#x27;\u003C/span>] = {\n                \u003Cspan class=\"hljs-string\">&#x27;total_errors&#x27;\u003C/span>: \u003Cspan class=\"hljs-built_in\">sum\u003C/span>(errors_found),\n                \u003Cspan class=\"hljs-string\">&#x27;avg_errors_per_operation&#x27;\u003C/span>: statistics.mean(errors_found),\n                \u003Cspan class=\"hljs-string\">&#x27;error_rate_percent&#x27;\u003C/span>: (\u003Cspan class=\"hljs-built_in\">sum\u003C/span>(errors_found) / \u003Cspan class=\"hljs-built_in\">sum\u003C/span>(rows_processed)) * \u003Cspan class=\"hljs-number\">100\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> rows_processed \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-number\">0\u003C/span>\n            }\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> summary\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">_percentile\u003C/span>(\u003Cspan class=\"hljs-params\">self, data: \u003Cspan class=\"hljs-type\">List\u003C/span>[\u003Cspan class=\"hljs-built_in\">float\u003C/span>], percentile: \u003Cspan class=\"hljs-built_in\">int\u003C/span>\u003C/span>) -&gt; \u003Cspan class=\"hljs-built_in\">float\u003C/span>:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Calculate percentile value&quot;&quot;&quot;\u003C/span>\n        sorted_data = \u003Cspan class=\"hljs-built_in\">sorted\u003C/span>(data)\n        index = (percentile / \u003Cspan class=\"hljs-number\">100\u003C/span>) * (\u003Cspan class=\"hljs-built_in\">len\u003C/span>(sorted_data) - \u003Cspan class=\"hljs-number\">1\u003C/span>)\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> index.is_integer():\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> sorted_data[\u003Cspan class=\"hljs-built_in\">int\u003C/span>(index)]\n        \u003Cspan class=\"hljs-keyword\">else\u003C/span>:\n            lower = sorted_data[\u003Cspan class=\"hljs-built_in\">int\u003C/span>(index)]\n            upper = sorted_data[\u003Cspan class=\"hljs-built_in\">int\u003C/span>(index) + \u003Cspan class=\"hljs-number\">1\u003C/span>]\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> lower + (upper - lower) * (index - \u003Cspan class=\"hljs-built_in\">int\u003C/span>(index))\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">_calculate_throughput\u003C/span>(\u003Cspan class=\"hljs-params\">self, metrics: \u003Cspan class=\"hljs-type\">List\u003C/span>[PerformanceMetrics]\u003C/span>) -&gt; \u003Cspan class=\"hljs-built_in\">float\u003C/span>:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Calculate average throughput in rows per second&quot;&quot;&quot;\u003C/span>\n        total_rows = \u003Cspan class=\"hljs-number\">0\u003C/span>\n        total_time_seconds = \u003Cspan class=\"hljs-number\">0\u003C/span>\n        \n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> metric \u003Cspan class=\"hljs-keyword\">in\u003C/span> metrics:\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> metric.rows_processed \u003Cspan class=\"hljs-keyword\">and\u003C/span> metric.duration_ms:\n                total_rows += metric.rows_processed\n                total_time_seconds += metric.duration_ms / \u003Cspan class=\"hljs-number\">1000\u003C/span>\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> total_rows / total_time_seconds \u003Cspan class=\"hljs-keyword\">if\u003C/span> total_time_seconds &gt; \u003Cspan class=\"hljs-number\">0\u003C/span> \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-number\">0\u003C/span>\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">detect_performance_anomalies\u003C/span>(\u003Cspan class=\"hljs-params\">self, window_size: \u003Cspan class=\"hljs-built_in\">int\u003C/span> = \u003Cspan class=\"hljs-number\">10\u003C/span>\u003C/span>) -&gt; \u003Cspan class=\"hljs-type\">List\u003C/span>[\u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>]]:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Detect performance anomalies in recent operations&quot;&quot;&quot;\u003C/span>\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-built_in\">len\u003C/span>(self.metrics_history) &lt; window_size:\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> []\n        \n        recent_metrics = self.metrics_history[-window_size:]\n        anomalies = []\n        \n        \u003Cspan class=\"hljs-comment\"># Calculate baseline performance\u003C/span>\n        durations = [m.duration_ms \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> recent_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.duration_ms]\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-built_in\">len\u003C/span>(durations) &lt; \u003Cspan class=\"hljs-number\">3\u003C/span>:\n            \u003Cspan class=\"hljs-keyword\">return\u003C/span> anomalies\n        \n        avg_duration = statistics.mean(durations)\n        stdev_duration = statistics.stdev(durations) \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-built_in\">len\u003C/span>(durations) &gt; \u003Cspan class=\"hljs-number\">1\u003C/span> \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-number\">0\u003C/span>\n        \n        \u003Cspan class=\"hljs-comment\"># Detect outliers (values beyond 2 standard deviations)\u003C/span>\n        threshold = avg_duration + (\u003Cspan class=\"hljs-number\">2\u003C/span> * stdev_duration)\n        \n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> metric \u003Cspan class=\"hljs-keyword\">in\u003C/span> recent_metrics:\n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> metric.duration_ms \u003Cspan class=\"hljs-keyword\">and\u003C/span> metric.duration_ms &gt; threshold:\n                anomalies.append({\n                    \u003Cspan class=\"hljs-string\">&#x27;type&#x27;\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;slow_operation&#x27;\u003C/span>,\n                    \u003Cspan class=\"hljs-string\">&#x27;operation&#x27;\u003C/span>: metric.operation,\n                    \u003Cspan class=\"hljs-string\">&#x27;duration_ms&#x27;\u003C/span>: metric.duration_ms,\n                    \u003Cspan class=\"hljs-string\">&#x27;expected_max_ms&#x27;\u003C/span>: threshold,\n                    \u003Cspan class=\"hljs-string\">&#x27;timestamp&#x27;\u003C/span>: metric.start_time.isoformat(),\n                    \u003Cspan class=\"hljs-string\">&#x27;severity&#x27;\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;high&#x27;\u003C/span> \u003Cspan class=\"hljs-keyword\">if\u003C/span> metric.duration_ms &gt; threshold * \u003Cspan class=\"hljs-number\">1.5\u003C/span> \u003Cspan class=\"hljs-keyword\">else\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;medium&#x27;\u003C/span>\n                })\n        \n        \u003Cspan class=\"hljs-comment\"># Check for memory anomalies\u003C/span>\n        memory_values = [m.memory_usage_mb \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> recent_metrics \u003Cspan class=\"hljs-keyword\">if\u003C/span> m.memory_usage_mb]\n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> memory_values:\n            avg_memory = statistics.mean(memory_values)\n            memory_threshold = avg_memory * \u003Cspan class=\"hljs-number\">2\u003C/span>  \u003Cspan class=\"hljs-comment\"># 100% increase threshold\u003C/span>\n            \n            \u003Cspan class=\"hljs-keyword\">for\u003C/span> metric \u003Cspan class=\"hljs-keyword\">in\u003C/span> recent_metrics:\n                \u003Cspan class=\"hljs-keyword\">if\u003C/span> metric.memory_usage_mb \u003Cspan class=\"hljs-keyword\">and\u003C/span> metric.memory_usage_mb &gt; memory_threshold:\n                    anomalies.append({\n                        \u003Cspan class=\"hljs-string\">&#x27;type&#x27;\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;high_memory_usage&#x27;\u003C/span>,\n                        \u003Cspan class=\"hljs-string\">&#x27;operation&#x27;\u003C/span>: metric.operation,\n                        \u003Cspan class=\"hljs-string\">&#x27;memory_mb&#x27;\u003C/span>: metric.memory_usage_mb,\n                        \u003Cspan class=\"hljs-string\">&#x27;expected_max_mb&#x27;\u003C/span>: memory_threshold,\n                        \u003Cspan class=\"hljs-string\">&#x27;timestamp&#x27;\u003C/span>: metric.start_time.isoformat(),\n                        \u003Cspan class=\"hljs-string\">&#x27;severity&#x27;\u003C/span>: \u003Cspan class=\"hljs-string\">&#x27;high&#x27;\u003C/span>\n                    })\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> anomalies\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">generate_performance_report\u003C/span>(\u003Cspan class=\"hljs-params\">self, include_recommendations: \u003Cspan class=\"hljs-built_in\">bool\u003C/span> = \u003Cspan class=\"hljs-literal\">True\u003C/span>\u003C/span>) -&gt; \u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>]:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Generate comprehensive performance report&quot;&quot;&quot;\u003C/span>\n        overall_summary = self.get_performance_summary()\n        recent_summary = self.get_performance_summary(time_window=timedelta(hours=\u003Cspan class=\"hljs-number\">24\u003C/span>))\n        anomalies = self.detect_performance_anomalies()\n        \n        report = {\n            \u003Cspan class=\"hljs-string\">&#x27;report_timestamp&#x27;\u003C/span>: datetime.now().isoformat(),\n            \u003Cspan class=\"hljs-string\">&#x27;overall_performance&#x27;\u003C/span>: overall_summary,\n            \u003Cspan class=\"hljs-string\">&#x27;recent_performance&#x27;\u003C/span>: recent_summary,\n            \u003Cspan class=\"hljs-string\">&#x27;anomalies&#x27;\u003C/span>: anomalies,\n            \u003Cspan class=\"hljs-string\">&#x27;operation_types&#x27;\u003C/span>: self._get_operation_type_breakdown()\n        }\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> include_recommendations:\n            report[\u003Cspan class=\"hljs-string\">&#x27;recommendations&#x27;\u003C/span>] = self._generate_recommendations(overall_summary, anomalies)\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> report\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">_get_operation_type_breakdown\u003C/span>(\u003Cspan class=\"hljs-params\">self\u003C/span>) -&gt; \u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>]]:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Get performance breakdown by operation type&quot;&quot;&quot;\u003C/span>\n        operation_types = \u003Cspan class=\"hljs-built_in\">set\u003C/span>(m.operation \u003Cspan class=\"hljs-keyword\">for\u003C/span> m \u003Cspan class=\"hljs-keyword\">in\u003C/span> self.metrics_history)\n        breakdown = {}\n        \n        \u003Cspan class=\"hljs-keyword\">for\u003C/span> op_type \u003Cspan class=\"hljs-keyword\">in\u003C/span> operation_types:\n            breakdown[op_type] = self.get_performance_summary(operation_type=op_type)\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> breakdown\n    \n    \u003Cspan class=\"hljs-keyword\">def\u003C/span> \u003Cspan class=\"hljs-title function_\">_generate_recommendations\u003C/span>(\u003Cspan class=\"hljs-params\">self, summary: \u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>], anomalies: \u003Cspan class=\"hljs-type\">List\u003C/span>[\u003Cspan class=\"hljs-type\">Dict\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>, \u003Cspan class=\"hljs-type\">Any\u003C/span>]]\u003C/span>) -&gt; \u003Cspan class=\"hljs-type\">List\u003C/span>[\u003Cspan class=\"hljs-built_in\">str\u003C/span>]:\n        \u003Cspan class=\"hljs-string\">&quot;&quot;&quot;Generate performance improvement recommendations&quot;&quot;&quot;\u003C/span>\n        recommendations = []\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;performance&#x27;\u003C/span> \u003Cspan class=\"hljs-keyword\">in\u003C/span> summary:\n            avg_duration = summary[\u003Cspan class=\"hljs-string\">&#x27;performance&#x27;\u003C/span>][\u003Cspan class=\"hljs-string\">&#x27;avg_duration_ms&#x27;\u003C/span>]\n            p95_duration = summary[\u003Cspan class=\"hljs-string\">&#x27;performance&#x27;\u003C/span>][\u003Cspan class=\"hljs-string\">&#x27;p95_duration_ms&#x27;\u003C/span>]\n            \n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> avg_duration &gt; \u003Cspan class=\"hljs-number\">1000\u003C/span>:  \u003Cspan class=\"hljs-comment\"># 1 second\u003C/span>\n                recommendations.append(\n                    \u003Cspan class=\"hljs-string\">&quot;Consider optimizing validation algorithms or implementing parallel processing for large tables&quot;\u003C/span>\n                )\n            \n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> p95_duration &gt; avg_duration * \u003Cspan class=\"hljs-number\">3\u003C/span>:\n                recommendations.append(\n                    \u003Cspan class=\"hljs-string\">&quot;High variability in processing times detected. Review input data size distribution&quot;\u003C/span>\n                )\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;memory&#x27;\u003C/span> \u003Cspan class=\"hljs-keyword\">in\u003C/span> summary:\n            peak_memory = summary[\u003Cspan class=\"hljs-string\">&#x27;memory&#x27;\u003C/span>][\u003Cspan class=\"hljs-string\">&#x27;peak_memory_mb&#x27;\u003C/span>]\n            \n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> peak_memory &gt; \u003Cspan class=\"hljs-number\">500\u003C/span>:  \u003Cspan class=\"hljs-comment\"># 500 MB\u003C/span>\n                recommendations.append(\n                    \u003Cspan class=\"hljs-string\">&quot;High memory usage detected. Consider implementing streaming validation for large datasets&quot;\u003C/span>\n                )\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-string\">&#x27;quality&#x27;\u003C/span> \u003Cspan class=\"hljs-keyword\">in\u003C/span> summary:\n            error_rate = summary[\u003Cspan class=\"hljs-string\">&#x27;quality&#x27;\u003C/span>][\u003Cspan class=\"hljs-string\">&#x27;error_rate_percent&#x27;\u003C/span>]\n            \n            \u003Cspan class=\"hljs-keyword\">if\u003C/span> error_rate &gt; \u003Cspan class=\"hljs-number\">10\u003C/span>:\n                recommendations.append(\n                    \u003Cspan class=\"hljs-string\">&quot;High error rate suggests data quality issues. Consider implementing pre-validation checks&quot;\u003C/span>\n                )\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-built_in\">len\u003C/span>([a \u003Cspan class=\"hljs-keyword\">for\u003C/span> a \u003Cspan class=\"hljs-keyword\">in\u003C/span> anomalies \u003Cspan class=\"hljs-keyword\">if\u003C/span> a[\u003Cspan class=\"hljs-string\">&#x27;severity&#x27;\u003C/span>] == \u003Cspan class=\"hljs-string\">&#x27;high&#x27;\u003C/span>]) &gt; \u003Cspan class=\"hljs-number\">2\u003C/span>:\n            recommendations.append(\n                \u003Cspan class=\"hljs-string\">&quot;Multiple high-severity performance anomalies detected. Review system resources and validation rules&quot;\u003C/span>\n            )\n        \n        \u003Cspan class=\"hljs-keyword\">if\u003C/span> \u003Cspan class=\"hljs-keyword\">not\u003C/span> recommendations:\n            recommendations.append(\u003Cspan class=\"hljs-string\">&quot;Performance metrics are within acceptable ranges&quot;\u003C/span>)\n        \n        \u003Cspan class=\"hljs-keyword\">return\u003C/span> recommendations\n\n\u003Cspan class=\"hljs-comment\"># Global performance monitor instance\u003C/span>\nperformance_monitor = ValidationPerformanceMonitor()\n\u003C/code>\u003C/pre>\u003Ch2 id=\"conclusion\">Conclusion\u003C/h2>\n\u003Cp>Advanced Markdown table data validation and quality assurance represent essential practices for maintaining reliable, accurate, and accessible tabular content across large-scale documentation projects. By implementing comprehensive validation frameworks, automated error detection systems, and performance monitoring tools, technical writers can ensure consistent data quality while preventing common formatting errors and accessibility violations that compromise user experience.\u003C/p>\n\u003Cp>The key to successful table validation implementation lies in understanding content-specific validation requirements, implementing systematic quality checks that integrate seamlessly with existing workflows, and maintaining performance standards that scale effectively with growing datasets. Whether you&#39;re managing financial reports, technical specifications, or collaborative documentation, the validation techniques and automation strategies covered in this guide provide the foundation for building robust quality assurance systems.\u003C/p>\n\u003Cp>Remember to implement validation rules progressively, starting with critical structural checks before adding sophisticated business logic validation, and ensure that error messages provide clear guidance for content creators to resolve issues quickly. With proper implementation of automated validation workflows, your Markdown tables can achieve enterprise-level data quality standards while maintaining the simplicity and version-control benefits that make Markdown an ideal choice for collaborative technical documentation projects.\u003C/p>\n",[15,19,22,25,28,31,34],{"id":16,"text":17,"level":18},"why-implement-table-data-validation","Why Implement Table Data Validation?",2,{"id":20,"text":21,"level":18},"foundation-validation-principles","Foundation Validation Principles",{"id":23,"text":24,"level":18},"content-specific-validation-strategies","Content-Specific Validation Strategies",{"id":26,"text":27,"level":18},"cicd-integration-and-automated-workflows","CI/CD Integration and Automated Workflows",{"id":29,"text":30,"level":18},"integration-with-documentation-systems","Integration with Documentation Systems",{"id":32,"text":33,"level":18},"performance-optimization-and-monitoring","Performance Optimization and Monitoring",{"id":35,"text":36,"level":18},"conclusion","Conclusion",[],[39,47,55],{"slug":40,"title":41,"description":42,"excerpt":43,"date":44,"category":9,"author":10,"keywords":45,"readingMinutes":46},"markdown-table-data-validation-quality-assurance-complete-guide","Markdown Table Data Validation and Quality Assurance: Complete Guide for Automated Table Content Verification","Master comprehensive table data validation techniques in Markdown for automated quality assurance, content verification, and structural integrity checking. Learn advanced validation patterns and automated testing workflows.","Markdown table data validation and quality assurance ensure accurate, consistent, and reliable table content across documentation systems through automated verification, structural integrity…","2025-11-09","markdown table validation, data quality assurance, table content verification, automated markdown testing, table structure validation, data integrity checking, markdown quality control, table validation tools",22,{"slug":48,"title":49,"description":50,"excerpt":51,"date":52,"category":9,"author":10,"keywords":53,"readingMinutes":54},"markdown-error-handling-validation-complete-guide","Markdown Error Handling and Validation: Complete Guide for Content Quality Assurance and Automated Checking","Master Markdown error handling, validation techniques, and automated quality assurance. Learn syntax checking, link validation, content linting, and comprehensive testing strategies for robust Markdown workflows.","Markdown error handling and validation techniques enable content teams to maintain high-quality documentation through automated quality assurance processes that catch syntax errors, validate…","2025-12-04","markdown validation, markdown error handling, markdown linting, content quality assurance, markdown syntax checking, automated markdown testing, markdown workflow validation",28,{"slug":56,"title":57,"description":58,"excerpt":59,"date":60,"category":9,"author":10,"keywords":61,"readingMinutes":62},"markdown-table-data-validation-quality-assurance-guide","Markdown Table Data Validation and Quality Assurance: Complete Guide for Content Integrity and Data Quality Management","Master advanced Markdown table data validation techniques for content integrity, quality assurance, and automated data verification. Learn validation rules, data quality checks, and error detection for professional documentation systems.","Advanced Markdown table data validation and quality assurance systems enable sophisticated content management workflows that ensure data integrity, maintain consistency standards, and provide…","2025-11-10","markdown table validation, data quality assurance, table content verification, markdown data integrity, table validation rules, content quality control, markdown table testing, data validation automation",31,1792184945940]