Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Load and parse DDC CWICR construction cost database from multiple formats: Parquet, Excel, CSV, Qdrant snapshots. Foundation for all CWICR operations.
.claude/skills/datadrivenconstruction-cwicr-data-loader/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 198% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 167% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 75% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -25% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 65% | 0% |
DDC CWICR database is distributed in multiple formats:
Applications need unified data access regardless of source format.
Universal data loader supporting all CWICR formats with automatic schema detection, validation, and pandas DataFrame conversion.
bashpip install pandas pyarrow openpyxl qdrant-client
pythonimport pandas as pd import pyarrow.parquet as pq from pathlib import Path from typing import Optional, Dict, Any, List, Union from dataclasses import dataclass, field from enum import Enum import json class CWICRFormat(Enum): """Supported CWICR data formats.""" PARQUET = "parquet" EXCEL = "excel" CSV = "csv" QDRANT = "qdrant" JSON = "json" class CWICRLanguage(Enum): """Supported languages in CWICR database.""" ARABIC = "ar" CHINESE = "zh" GERMAN = "de" ENGLISH = "en" SPANISH = "es" FRENCH = "fr" HINDI = "hi" PORTUGUESE = "pt" RUSSIAN = "ru" @dataclass class CWICRSchema: """CWICR database schema definition.""" # Core fields work_item_code: str = "work_item_code" description: str = "description" unit: str = "unit" category: str = "category" # Cost fields unit_price: str = "unit_price" labor_cost: str = "labor_cost" material_cost: str = "material_cost" equipment_cost: str = "equipment_cost" overhead_cost: str = "overhead_cost" # Norm fields labor_norm: str = "labor_norm" material_norm: str = "material_norm" equipment_norm: str = "equipment_norm" # Metadata language: str = "language" region: str = "region" currency: str = "currency" last_updated: str = "last_updated" # Optional embedding embedding: str = "embedding" @dataclass class CWICRWorkItem: """Represents a single work item from CWICR database.""" work_item_code: str description: str unit: str category: str unit_price: float = 0.0 labor_cost: float = 0.0 material_cost: float = 0.0 equipment_cost: float = 0.0 overhead_cost: float = 0.0 labor_norm: float = 0.0 labor_unit: str = "h" resources: List[Dict[str, Any]] = field(default_factory=list) language: str = "en" region: str = "" currency: str = "USD" @dataclass class CWICRResource: """Represents a resource (material, labor, equipment).""" resource_code: str description: str unit: str unit_price: float resource_type: str # 'labor', 'material', 'equipment' category: str = "" class CWICRDataLoader: """Universal loader for CWICR database formats.""" REQUIRED_COLUMNS = ['work_item_code', 'description', 'unit'] NUMERIC_COLUMNS = ['unit_price', 'labor_cost', 'material_cost', 'equipment_cost', 'labor_norm'] def __init__(self): self.schema = CWICRSchema() self._cache: Dict[str, pd.DataFrame] = {} def load(self, source: str, format: Optional[CWICRFormat] = None, language: Optional[CWICRLanguage] = None, use_cache: bool = True) -> pd.DataFrame: """Load CWICR data from any supported source.""" cache_key = f"{source}_{language}" if use_cache and cache_key in self._cache: return self._cache[cache_key] # Auto-detect format if not specified if format is None: format = self._detect_format(source) # Load based on format if format == CWICRFormat.PARQUET: df = self._load_parquet(source) elif format == CWICRFormat.EXCEL: df = self._load_excel(source) elif format == CWICRFormat.CSV: df = self._load_csv(source) elif format == CWICRFormat.JSON: df = self._load_json(source) else: raise ValueError(f"Unsupported format: {format}") # Validate and normalize df = self._validate_schema(df) df = self._normalize_types(df) # Filter by language if specified if language and 'language' in df.columns: df = df[df['language'] == language.value] # Cache result if use_cache: self._cache[cache_key] = df return df def _detect_format(self, source: str) -> CWICRFormat: """Auto-detect data format from source.""" path = Path(source) if path.suffix.lower() == '.parquet': return CWICRFormat.PARQUET elif path.suffix.lower() in ['.xlsx', '.xls']: return CWICRFormat.EXCEL elif path.suffix.lower() == '.csv': return CWICRFormat.CSV elif path.suffix.lower() == '.json': return CWICRFormat.JSON else: raise ValueError(f"Cannot detect format: {source}") def _load_parquet(self, source: str) -> pd.DataFrame: """Load from Parquet file.""" return pd.read_parquet(source) def _load_excel(self, source: str, sheet_name: str = "WorkItems") -> pd.DataFrame: """Load from Excel workbook.""" try: return pd.read_excel(source, sheet_name=sheet_name) except: # Try first sheet if named sheet doesn't exist return pd.read_excel(source, sheet_name=0) def _load_csv(self, source: str) -> pd.DataFrame: """Load from CSV file.""" # Try different encodings for encoding in ['utf-8', 'latin-1', 'cp1252']: try: return pd.read_csv(source, encoding=encoding) except UnicodeDecodeError: continue raise ValueError(f"Cannot read CSV with any encoding: {source}") def _load_json(self, source: str) -> pd.DataFrame: """Load from JSON file.""" with open(source, 'r', encoding='utf-8') as f: data = json.load(f) if isinstance(data, list): return pd.DataFrame(data) elif isinstance(data, dict) and 'items' in data: return pd.DataFrame(data['items']) else: return pd.DataFrame([data]) def _validate_schema(self, df: pd.DataFrame) -> pd.DataFrame: """Validate DataFrame against CWICR schema.""" # Check required columns missing = set(self.REQUIRED_COLUMNS) - set(df.columns) if missing: raise ValueError(f"Missing required columns: {missing}") return df def _normalize_types(self, df: pd.DataFrame) -> pd.DataFrame: """Normalize column types.""" for col in self.NUMERIC_COLUMNS: if col in df.columns: df[col] = pd.to_numeric(df[col], errors='coerce').fillna(0) # Ensure string columns for col in ['work_item_code', 'description', 'unit', 'category']: if col in df.columns: df[col] = df[col].astype(str) return df def load_resources(self, source: str, format: Optional[CWICRFormat] = None) -> pd.DataFrame: """Load resources separately.""" if format is None: format = self._detect_format(source) if format == CWICRFormat.EXCEL: try: return pd.read_excel(source, sheet_name="Resources") except: return pd.DataFrame() else: return self.load(source, format) def get_work_item(self, df: pd.DataFrame, code: str) -> Optional[CWICRWorkItem]: """Get single work item by code.""" item = df[df['work_item_code'] == code] if item.empty: return None row = item.iloc[0] return CWICRWorkItem( work_item_code=row['work_item_code'], description=row.get('description', ''), unit=row.get('unit', ''), category=row.get('category', ''), unit_price=row.get('unit_price', 0), labor_cost=row.get('labor_cost', 0), material_cost=row.get('material_cost', 0), equipment_cost=row.get('equipment_cost', 0), labor_norm=row.get('labor_norm', 0), language=row.get('language', 'en'), region=row.get('region', ''), currency=row.get('currency', 'USD') ) def get_categories(self, df: pd.DataFrame) -> List[str]: """Get unique categories.""" if 'category' not in df.columns: return [] return df['category'].dropna().unique().tolist() def filter_by_category(self, df: pd.DataFrame, category: str) -> pd.DataFrame: """Filter work items by category.""" return df[df['category'] == category] def search_by_description(self, df: pd.DataFrame, keyword: str, case_sensitive: bool = False) -> pd.DataFrame: """Simple keyword search in descriptions.""" if case_sensitive: return df[df['description'].str.contains(keyword, na=False)] return df[df['description'].str.contains(keyword, case=False, na=False)] def get_statistics(self, df: pd.DataFrame) -> Dict[str, Any]: """Get database statistics.""" stats = { 'total_work_items': len(df), 'categories': df['category'].nunique() if 'category' in df.columns else 0, 'languages': df['language'].unique().tolist() if 'language' in df.columns else ['en'] } if 'unit_price' in df.columns: stats['price_range'] = { 'min': df['unit_price'].min(), 'max': df['unit_price'].max(), 'mean': df['unit_price'].mean() } return stats def export(self, df: pd.DataFrame, output_path: str, format: CWICRFormat = CWICRFormat.PARQUET): """Export DataFrame to file.""" if format == CWICRFormat.PARQUET: df.to_parquet(output_path, index=False) elif format == CWICRFormat.EXCEL: df.to_excel(output_path, index=False) elif format == CWICRFormat.CSV: df.to_csv(output_path, index=False) elif format == CWICRFormat.JSON: df.to_json(output_path, orient='records', indent=2) class CWICRBatchLoader: """Load multiple CWICR files and merge.""" def __init__(self): self.loader = CWICRDataLoader() def load_multiple(self, sources: List[str]) -> pd.DataFrame: """Load and merge multiple CWICR files.""" dfs = [] for source in sources: try: df = self.loader.load(source) dfs.append(df) except Exception as e: print(f"Warning: Failed to load {source}: {e}") if not dfs: return pd.DataFrame() return pd.concat(dfs, ignore_index=True) def load_all_languages(self, base_path: str) -> pd.DataFrame: """Load all language variants from directory.""" path = Path(base_path) dfs = [] for lang in CWICRLanguage: # Try various naming patterns patterns = [ f"cwicr_{lang.value}.*", f"ddc_cwicr_{lang.value}.*", f"*_{lang.value}.*" ] for pattern in patterns: files = list(path.glob(pattern)) for file in files: try: df = self.loader.load(str(file), language=lang) dfs.append(df) except Exception as e: continue if not dfs: return pd.DataFrame() return pd.concat(dfs, ignore_index=True) # Convenience functions def load_cwicr(source: str, language: str = None) -> pd.DataFrame: """Quick load CWICR data.""" loader = CWICRDataLoader() lang = CWICRLanguage(language) if language else None return loader.load(source, language=lang) def get_cwicr_statistics(source: str) -> Dict[str, Any]: """Get statistics from CWICR source.""" loader = CWICRDataLoader() df = loader.load(source) return loader.get_statistics(df)
python# Load from Parquet (fastest) loader = CWICRDataLoader() df = loader.load("TR_workitems_costs_resources_DDC_CWICR.parquet") print(f"Loaded {len(df)} work items") # Load from Excel df = loader.load("cwicr_database.xlsx") # Get specific work item item = loader.get_work_item(df, "CONC-001") print(f"{item.description}: ${item.unit_price} per {item.unit}") # Get all categories categories = loader.get_categories(df) print(f"Categories: {categories}")
pythonbatch = CWICRBatchLoader() all_languages = batch.load_all_languages("C:/CWICR/") print(f"Total items across all languages: {len(all_languages)}")
pythonloader = CWICRDataLoader() df = loader.load("cwicr.parquet") # Get concrete work items concrete = loader.filter_by_category(df, "Concrete") print(f"Concrete items: {len(concrete)}")
python# Find all masonry-related items masonry = loader.search_by_description(df, "masonry") print(masonry[['work_item_code', 'description', 'unit_price']])
pythonstats = loader.get_statistics(df) print(f"Total items: {stats['total_work_items']}") print(f"Categories: {stats['categories']}") print(f"Price range: ${stats['price_range']['min']:.2f} - ${stats['price_range']['max']:.2f}")
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→pass | 12,209 | 14,996 | +23% | 1 | 1 | 0% | 2,528 | 7,528 | +198% | 0 | 0 | — |
case-01 | fail→pass | 11,504 | 41,076 | +257% | 1 | 1 | 0% | 2,508 | 6,686 | +167% | 0 | 0 | — |
case-03 | fail→pass | 43,894 | 7,131 | -84% | 1 | 1 | 0% | 3,163 | 5,540 | +75% | 0 | 0 | — |
case-04 | fail→pass | 34,382 | 4,350 | -87% | 1 | 1 | 0% | 6,460 | 4,875 | -25% | 0 | 0 | — |
case-05 | fail→pass | 14,623 | 3,652 | -75% | 1 | 1 | 0% | 2,882 | 4,756 | +65% | 0 | 0 | — |
case-06 | fail→pass | 9,625 | 5,120 | -47% | 1 | 1 | 0% | 1,899 | 5,026 | +165% | 0 | 0 | — |
case-07 | fail→pass | 6,490 | 3,048 | -53% | 1 | 1 | 0% | 1,255 | 4,492 | +258% | 0 | 0 | — |
case-08 | fail→pass | 9,690 | 2,848 | -71% | 1 | 1 | 0% | 1,649 | 4,501 | +173% | 0 | 0 | — |
case-09 | fail→pass | 16,990 | 3,521 | -79% | 1 | 1 | 0% | 2,817 | 4,711 | +67% | 0 | 0 | — |
case-10 | fail→pass | 9,809 | 5,430 | -45% | 1 | 1 | 0% | 1,757 | 5,136 | +192% | 0 | 0 | — |
case-11 | fail→pass | 4,036 | 2,712 | -33% | 1 | 1 | 0% | 659 | 4,476 | +579% | 0 | 0 | — |
case-12 | pass→pass | 9,936 | 3,437 | -65% | 1 | 1 | 0% | 1,659 | 4,593 | +177% | 0 | 0 | — |
case-13 | fail→pass | 7,353 | 5,218 | -29% | 1 | 1 | 0% | 1,418 | 5,048 | +256% | 0 | 0 | — |
case-14 | fail→pass | 18,599 | 4,412 | -76% | 1 | 1 | 0% | 3,464 | 4,819 | +39% | 0 | 0 | — |
case-15 | fail→pass | 9,993 | 6,227 | -38% | 1 | 1 | 0% | 1,659 | 5,225 | +215% | 0 | 0 | — |
case-16 | fail→pass | 5,697 | 9,083 | +59% | 1 | 1 | 0% | 1,099 | 4,603 | +319% | 0 | 0 | — |
case-17 | fail→pass | 8,368 | 3,117 | -63% | 1 | 1 | 0% | 1,425 | 4,563 | +220% | 0 | 0 | — |
case-18 | fail→pass | 12,976 | 2,137 | -84% | 1 | 1 | 0% | 2,391 | 4,406 | +84% | 0 | 0 | — |
case-19 | fail→pass | 9,165 | 3,409 | -63% | 1 | 1 | 0% | 1,489 | 4,582 | +208% | 0 | 0 | — |
case-20 | pass→pass | 10,741 | 11,948 | +11% | 1 | 1 | 0% | 2,216 | 6,527 | +195% | 0 | 0 | — |
case-21 | pass→pass | 7,286 | 10,419 | +43% | 1 | 1 | 0% | 1,501 | 6,261 | +317% | 0 | 0 | — |
case-22 | pass→pass | 8,807 | 7,473 | -15% | 1 | 1 | 0% | 1,654 | 5,419 | +228% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +82 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 8/22/2026 | +55% |
Other measured skills in the registry, with their headline benchmark lift.