TopRank Skills

Home / Claw Skills / Autres / validation-rules-builder
Official OpenClaw rules 15%

validation-rules-builder

Build validation rules for construction data. Create RegEx and logic-based validation for BIM elements, cost codes, and schedule data.

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 validation-rules-builder 技能。 若已安装,则直接安装 validation-rules-builder 技能。

Overview

Skill Key
datadrivenconstruction/validation-rules-builder
Author
datadrivenconstruction
Source Repo
openclaw/skills
Version
-
Source Path
skills/datadrivenconstruction/validation-rules-builder
Latest Commit SHA
1361ddf722066ee73068f38217eb2bdd257b4bf4

Extracted Content

SKILL.md excerpt

# Validation Rules Builder

## Business Case

### Problem Statement
Construction data quality challenges:
- Inconsistent naming conventions
- Invalid cost codes and WBS
- Missing or malformed data
- Non-compliant BIM elements

### Solution
Rule-based validation engine using RegEx and logic rules to ensure data quality across construction systems.

## Technical Implementation

```python
import re
from typing import Dict, Any, List, Optional, Callable
from dataclasses import dataclass, field
from enum import Enum
from datetime import date


class RuleType(Enum):
    REGEX = "regex"
    RANGE = "range"
    ENUM = "enum"
    CUSTOM = "custom"
    REQUIRED = "required"
    DATE = "date"
    REFERENCE = "reference"


class Severity(Enum):
    ERROR = "error"
    WARNING = "warning"
    INFO = "info"


@dataclass
class ValidationResult:
    field: str
    is_valid: bool
    message: str
    severity: Severity
    value: Any = None


@dataclass
class ValidationRule:
    name: str
    field: str
    rule_type: RuleType
    pattern: str = ""
    min_value: float = None
    max_value: float = None
    allowed_values: List[Any] = field(default_factory=list)
    custom_func: Callable = None
    severity: Severity = Severity.ERROR
    message: str = ""
    enabled: bool = True


class ValidationRulesBuilder:
    """Build and execute validation rules for construction data."""

    # Pre-defined patterns for construction data
    PATTERNS = {
        'wbs_code': r'^[0-9]{2}\.[0-9]{2}\.[0-9]{2}(\.[0-9]{2})?$',
        'cost_code': r'^[A-Z]{1,3}-[0-9]{3,6}$',
        'activity_id': r'^[A-Z]{1,3}[0-9]{4,6}$',
        'drawing_number': r'^[A-Z]{1,2}-[0-9]{3}-[A-Z0-9]{2,4}$',
        'specification_section': r'^[0-9]{2}\s?[0-9]{2}\s?[0-9]{2}(\.[0-9]{2})?$',
        'level_name': r'^(Level|L|FL)\s?[-_]?\s?([0-9]{1,3}|B[0-9]|R|G|M)$',
        'grid_line': r'^[A-Z]\.?[0-9]?$|^[0-9]{1,2}\.?[A-Z]?$',
        'revisio...

Related Claw Skills