productivity-analyzer
Analyze labor productivity from site data. Compare planned vs actual, identify trends, benchmark against industry standards.
What this skill does
# Productivity Analyzer
## Business Case
### Problem Statement
Understanding productivity requires:
- Tracking actual output rates
- Comparing to planned rates
- Identifying problem areas
- Forecasting project completion
### Solution
Analyze labor productivity data to identify trends, compare to benchmarks, and provide actionable insights.
## Technical Implementation
```python
import pandas as pd
import numpy as np
from typing import Dict, Any, List, Optional
from dataclasses import dataclass
from datetime import date, timedelta
from enum import Enum
class ProductivityStatus(Enum):
EXCELLENT = "excellent" # >110% of planned
ON_TARGET = "on_target" # 90-110%
BELOW = "below" # 70-90%
CRITICAL = "critical" # <70%
@dataclass
class ProductivityRecord:
date: date
activity_code: str
description: str
planned_output: float
actual_output: float
unit: str
manhours: float
crew_size: int
conditions: str # weather, access issues
@dataclass
class ProductivityAnalysis:
activity_code: str
description: str
total_planned: float
total_actual: float
total_manhours: float
planned_rate: float # unit per manhour
actual_rate: float
efficiency: float # percentage
status: ProductivityStatus
trend: str # improving, declining, stable
class ProductivityAnalyzer:
"""Analyze construction productivity data."""
# Industry benchmark rates (unit per manhour)
BENCHMARKS = {
'concrete_pour': 0.5, # m3/MH
'rebar_install': 15, # kg/MH
'formwork': 0.8, # m2/MH
'brick_laying': 35, # bricks/MH
'drywall': 1.5, # m2/MH
'painting': 3.0, # m2/MH
'conduit': 8, # m/MH
'pipe': 3, # m/MH
'excavation': 2.5, # m3/MH
'backfill': 3.0, # m3/MH
}
def __init__(self):
self.records: List[ProductivityRecord] = []
def add_record(self,
date: date,
activity_code: str,
description: str,
planned_output: float,
actual_output: float,
unit: str,
manhours: float,
crew_size: int,
conditions: str = "normal"):
"""Add productivity record."""
self.records.append(ProductivityRecord(
date=date,
activity_code=activity_code,
description=description,
planned_output=planned_output,
actual_output=actual_output,
unit=unit,
manhours=manhours,
crew_size=crew_size,
conditions=conditions
))
def import_from_dataframe(self, df: pd.DataFrame):
"""Import records from DataFrame."""
for _, row in df.iterrows():
self.add_record(
date=pd.to_datetime(row['date']).date(),
activity_code=row['activity_code'],
description=row.get('description', ''),
planned_output=float(row['planned_output']),
actual_output=float(row['actual_output']),
unit=row.get('unit', 'unit'),
manhours=float(row['manhours']),
crew_size=int(row.get('crew_size', 1)),
conditions=row.get('conditions', 'normal')
)
def _get_status(self, efficiency: float) -> ProductivityStatus:
"""Determine productivity status."""
if efficiency >= 110:
return ProductivityStatus.EXCELLENT
elif efficiency >= 90:
return ProductivityStatus.ON_TARGET
elif efficiency >= 70:
return ProductivityStatus.BELOW
else:
return ProductivityStatus.CRITICAL
def _calculate_trend(self, records: List[ProductivityRecord]) -> str:
"""Calculate productivity trend."""
if len(records) < 3:
return "insufficient_data"
# Sort by date
sorted_records = sorted(records, key=lambda x: x.date)
# Calculate efficiency for first and last third
n = len(sorted_records)
third = n // 3
early_efficiency = []
late_efficiency = []
for i, r in enumerate(sorted_records):
if r.manhours > 0:
eff = (r.actual_output / r.planned_output * 100) if r.planned_output > 0 else 0
if i < third:
early_efficiency.append(eff)
elif i >= n - third:
late_efficiency.append(eff)
if not early_efficiency or not late_efficiency:
return "stable"
early_avg = np.mean(early_efficiency)
late_avg = np.mean(late_efficiency)
if late_avg > early_avg * 1.05:
return "improving"
elif late_avg < early_avg * 0.95:
return "declining"
else:
return "stable"
def analyze_activity(self, activity_code: str) -> Optional[ProductivityAnalysis]:
"""Analyze productivity for specific activity."""
activity_records = [r for r in self.records if r.activity_code == activity_code]
if not activity_records:
return None
total_planned = sum(r.planned_output for r in activity_records)
total_actual = sum(r.actual_output for r in activity_records)
total_manhours = sum(r.manhours for r in activity_records)
planned_rate = total_planned / total_manhours if total_manhours > 0 else 0
actual_rate = total_actual / total_manhours if total_manhours > 0 else 0
efficiency = (total_actual / total_planned * 100) if total_planned > 0 else 0
return ProductivityAnalysis(
activity_code=activity_code,
description=activity_records[0].description,
total_planned=round(total_planned, 2),
total_actual=round(total_actual, 2),
total_manhours=round(total_manhours, 1),
planned_rate=round(planned_rate, 3),
actual_rate=round(actual_rate, 3),
efficiency=round(efficiency, 1),
status=self._get_status(efficiency),
trend=self._calculate_trend(activity_records)
)
def analyze_all_activities(self) -> List[ProductivityAnalysis]:
"""Analyze all activities."""
activities = set(r.activity_code for r in self.records)
return [self.analyze_activity(code) for code in activities if self.analyze_activity(code)]
def compare_to_benchmark(self, activity_code: str) -> Dict[str, Any]:
"""Compare activity to industry benchmark."""
analysis = self.analyze_activity(activity_code)
if not analysis:
return {}
# Find matching benchmark
benchmark = None
for key, value in self.BENCHMARKS.items():
if key in activity_code.lower():
benchmark = value
break
if benchmark is None:
return {
'activity': activity_code,
'actual_rate': analysis.actual_rate,
'benchmark': 'Not available',
'vs_benchmark': 'N/A'
}
vs_benchmark = (analysis.actual_rate / benchmark * 100) if benchmark > 0 else 0
return {
'activity': activity_code,
'actual_rate': analysis.actual_rate,
'benchmark_rate': benchmark,
'vs_benchmark_pct': round(vs_benchmark, 1),
'recommendation': 'Above benchmark' if vs_benchmark >= 100 else 'Below benchmark - investigate'
}
def identify_problem_areas(self) -> List[Dict[str, Any]]:
"""Identify activities with productivity issues."""
problems = []
for analysis in self.analyze_all_activities():
if analysis.status in [ProductivityStatus.BELOW, ProductivityStatus.CRITICAL]:
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.