[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FJYQZEPYW53A8SS1REMTPX":3,"skill-same:01M6FJYQZEPYW53A8SS1REMTPX":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":41,"install":42,"resources":55},"01M6FJYQZEPYW53A8SS1REMTPX","incident-reporting",null,"Construction safety incident reporting and analysis. Capture incidents, conduct investigations, track corrective actions, and analyze trends for prevention.","kbarbel640-del\u002Fskills","kbarbel640-del","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255315490?v=4","01M6CJPPQGCCESXMG3K7BBGQ5J","01M6CJPPX2PB2BCZERFVM2C2B3",1,"MIT","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Fincident-reporting\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28],"reporting","incident","incident reporting","actions","prevention","Safety","analysis","analyze","capture","trends","incidents","2026-11-10 10:12:30",false,"---\r\nslug: \"incident-reporting\"\r\ndisplay_name: \"Incident Reporting\"\r\ndescription: \"Construction safety incident reporting and analysis. Capture incidents, conduct investigations, track corrective actions, and analyze trends for prevention.\"\r\n---\r\n\r\n# Incident Reporting System\r\n\r\n## Overview\r\n\r\nComprehensive incident reporting system for construction safety. Capture near-misses, injuries, and property damage. Conduct root cause analysis and track corrective actions to prevent recurrence.\r\n\r\n> \"Near-miss reporting prevents 90% of future serious incidents\" — DDC Community\r\n\r\n## Incident Pyramid\r\n\r\n```\r\n                    △\r\n                   \u002F│\\        Fatality (1)\r\n                  \u002F │ \\\r\n                 \u002F  │  \\      Serious Injury (10)\r\n                \u002F   │   \\\r\n               \u002F    │    \\    Minor Injury (30)\r\n              \u002F     │     \\\r\n             \u002F      │      \\  Near Miss (300)\r\n            \u002F       │       \\\r\n           \u002F        │        \\ Unsafe Acts (3000)\r\n          ──────────┴──────────\r\n```\r\n\r\n## Technical Implementation\r\n\r\n```python\r\nfrom dataclasses import dataclass, field\r\nfrom typing import List, Dict, Optional\r\nfrom enum import Enum\r\nfrom datetime import datetime, timedelta\r\nimport json\r\n\r\nclass IncidentType(Enum):\r\n    NEAR_MISS = \"near_miss\"\r\n    FIRST_AID = \"first_aid\"\r\n    MEDICAL_TREATMENT = \"medical_treatment\"\r\n    LOST_TIME = \"lost_time\"\r\n    FATALITY = \"fatality\"\r\n    PROPERTY_DAMAGE = \"property_damage\"\r\n    ENVIRONMENTAL = \"environmental\"\r\n\r\nclass IncidentCategory(Enum):\r\n    FALL = \"fall\"\r\n    STRUCK_BY = \"struck_by\"\r\n    CAUGHT_IN = \"caught_in\"\r\n    ELECTROCUTION = \"electrocution\"\r\n    VEHICLE = \"vehicle\"\r\n    MATERIAL_HANDLING = \"material_handling\"\r\n    TOOL_EQUIPMENT = \"tool_equipment\"\r\n    SLIP_TRIP = \"slip_trip\"\r\n    FIRE = \"fire\"\r\n    CHEMICAL = \"chemical\"\r\n    OTHER = \"other\"\r\n\r\nclass InvestigationStatus(Enum):\r\n    REPORTED = \"reported\"\r\n    UNDER_INVESTIGATION = \"under_investigation\"\r\n    ROOT_CAUSE_IDENTIFIED = \"root_cause_identified\"\r\n    CORRECTIVE_ACTIONS_ASSIGNED = \"corrective_actions_assigned\"\r\n    IN_REMEDIATION = \"in_remediation\"\r\n    CLOSED = \"closed\"\r\n\r\n@dataclass\r\nclass Person:\r\n    name: str\r\n    company: str\r\n    role: str\r\n    contact: str\r\n    years_experience: int = 0\r\n\r\n@dataclass\r\nclass CorrectiveAction:\r\n    id: str\r\n    description: str\r\n    assigned_to: str\r\n    due_date: datetime\r\n    status: str = \"open\"\r\n    completed_date: Optional[datetime] = None\r\n    verification_notes: str = \"\"\r\n\r\n@dataclass\r\nclass Incident:\r\n    id: str\r\n    incident_type: IncidentType\r\n    category: IncidentCategory\r\n    date_time: datetime\r\n    location: str\r\n    project_id: str\r\n    project_name: str\r\n\r\n    # Description\r\n    description: str\r\n    immediate_actions: str\r\n\r\n    # People involved\r\n    injured_person: Optional[Person] = None\r\n    witnesses: List[Person] = field(default_factory=list)\r\n    reported_by: str = \"\"\r\n\r\n    # Investigation\r\n    status: InvestigationStatus = InvestigationStatus.REPORTED\r\n    root_causes: List[str] = field(default_factory=list)\r\n    contributing_factors: List[str] = field(default_factory=list)\r\n    corrective_actions: List[CorrectiveAction] = field(default_factory=list)\r\n\r\n    # Documentation\r\n    photos: List[str] = field(default_factory=list)\r\n    weather_conditions: str = \"\"\r\n    equipment_involved: List[str] = field(default_factory=list)\r\n\r\n    # Metrics\r\n    days_lost: int = 0\r\n    property_damage_cost: float = 0.0\r\n    osha_recordable: bool = False\r\n\r\nclass IncidentManager:\r\n    \"\"\"Manage construction incident reporting and investigation.\"\"\"\r\n\r\n    # 5 Whys root cause categories\r\n    ROOT_CAUSE_CATEGORIES = [\r\n        \"Training\u002FCompetency\",\r\n        \"Procedures\u002FWork Instructions\",\r\n        \"Equipment\u002FTools\",\r\n        \"Supervision\",\r\n        \"Communication\",\r\n        \"Housekeeping\",\r\n        \"PPE\",\r\n        \"Work Environment\",\r\n        \"Physical\u002FMental State\",\r\n        \"Management System\"\r\n    ]\r\n\r\n    def __init__(self):\r\n        self.incidents: Dict[str, Incident] = {}\r\n        self.corrective_actions: Dict[str, CorrectiveAction] = {}\r\n\r\n    def report_incident(self, incident_type: IncidentType,\r\n                       category: IncidentCategory,\r\n                       date_time: datetime,\r\n                       location: str,\r\n                       project_id: str,\r\n                       project_name: str,\r\n                       description: str,\r\n                       immediate_actions: str,\r\n                       reported_by: str,\r\n                       injured_person: Dict = None) -> Incident:\r\n        \"\"\"Report new incident.\"\"\"\r\n        incident_id = f\"INC-{datetime.now().strftime('%Y%m%d%H%M%S')}\"\r\n\r\n        injured = None\r\n        if injured_person:\r\n            injured = Person(**injured_person)\r\n\r\n        incident = Incident(\r\n            id=incident_id,\r\n            incident_type=incident_type,\r\n            category=category,\r\n            date_time=date_time,\r\n            location=location,\r\n            project_id=project_id,\r\n            project_name=project_name,\r\n            description=description,\r\n            immediate_actions=immediate_actions,\r\n            reported_by=reported_by,\r\n            injured_person=injured\r\n        )\r\n\r\n        # Auto-flag OSHA recordable\r\n        if incident_type in [IncidentType.MEDICAL_TREATMENT,\r\n                            IncidentType.LOST_TIME,\r\n                            IncidentType.FATALITY]:\r\n            incident.osha_recordable = True\r\n\r\n        self.incidents[incident_id] = incident\r\n        return incident\r\n\r\n    def add_witness(self, incident_id: str, witness: Dict) -> Incident:\r\n        \"\"\"Add witness to incident.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        self.incidents[incident_id].witnesses.append(Person(**witness))\r\n        return self.incidents[incident_id]\r\n\r\n    def conduct_investigation(self, incident_id: str,\r\n                             root_causes: List[str],\r\n                             contributing_factors: List[str]) -> Incident:\r\n        \"\"\"Record investigation findings.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        incident = self.incidents[incident_id]\r\n        incident.root_causes = root_causes\r\n        incident.contributing_factors = contributing_factors\r\n        incident.status = InvestigationStatus.ROOT_CAUSE_IDENTIFIED\r\n        return incident\r\n\r\n    def five_whys_analysis(self, incident_id: str, whys: List[str]) -> Dict:\r\n        \"\"\"Conduct 5 Whys analysis.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        analysis = {\r\n            \"incident_id\": incident_id,\r\n            \"analysis_date\": datetime.now().isoformat(),\r\n            \"whys\": []\r\n        }\r\n\r\n        for i, why in enumerate(whys):\r\n            analysis[\"whys\"].append({\r\n                \"level\": i + 1,\r\n                \"question\": f\"Why #{i+1}?\",\r\n                \"answer\": why\r\n            })\r\n\r\n        # The last \"why\" is typically the root cause\r\n        if whys:\r\n            self.incidents[incident_id].root_causes.append(whys[-1])\r\n\r\n        return analysis\r\n\r\n    def assign_corrective_action(self, incident_id: str,\r\n                                description: str,\r\n                                assigned_to: str,\r\n                                due_days: int = 7) -> CorrectiveAction:\r\n        \"\"\"Assign corrective action.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        action_id = f\"CA-{datetime.now().strftime('%Y%m%d%H%M%S')}\"\r\n        action = CorrectiveAction(\r\n            id=action_id,\r\n            description=description,\r\n            assigned_to=assigned_to,\r\n            due_date=datetime.now() + timedelta(days=due_days)\r\n        )\r\n\r\n        self.incidents[incident_id].corrective_actions.append(action)\r\n        self.incidents[incident_id].status = InvestigationStatus.CORRECTIVE_ACTIONS_ASSIGNED\r\n        self.corrective_actions[action_id] = action\r\n        return action\r\n\r\n    def complete_corrective_action(self, action_id: str,\r\n                                   verification_notes: str) -> CorrectiveAction:\r\n        \"\"\"Mark corrective action complete.\"\"\"\r\n        if action_id not in self.corrective_actions:\r\n            raise ValueError(f\"Corrective action {action_id} not found\")\r\n\r\n        action = self.corrective_actions[action_id]\r\n        action.status = \"completed\"\r\n        action.completed_date = datetime.now()\r\n        action.verification_notes = verification_notes\r\n        return action\r\n\r\n    def get_incident_metrics(self, project_id: str = None,\r\n                            start_date: datetime = None,\r\n                            end_date: datetime = None) -> Dict:\r\n        \"\"\"Calculate incident metrics.\"\"\"\r\n        incidents = list(self.incidents.values())\r\n\r\n        if project_id:\r\n            incidents = [i for i in incidents if i.project_id == project_id]\r\n        if start_date:\r\n            incidents = [i for i in incidents if i.date_time >= start_date]\r\n        if end_date:\r\n            incidents = [i for i in incidents if i.date_time \u003C= end_date]\r\n\r\n        # Calculate metrics\r\n        total = len(incidents)\r\n        near_misses = len([i for i in incidents if i.incident_type == IncidentType.NEAR_MISS])\r\n        first_aid = len([i for i in incidents if i.incident_type == IncidentType.FIRST_AID])\r\n        recordables = len([i for i in incidents if i.osha_recordable])\r\n        lost_time = len([i for i in incidents if i.incident_type == IncidentType.LOST_TIME])\r\n        total_days_lost = sum(i.days_lost for i in incidents)\r\n\r\n        # Category breakdown\r\n        by_category = {}\r\n        for cat in IncidentCategory:\r\n            count = len([i for i in incidents if i.category == cat])\r\n            if count > 0:\r\n                by_category[cat.value] = count\r\n\r\n        return {\r\n            \"total_incidents\": total,\r\n            \"near_misses\": near_misses,\r\n            \"first_aid_cases\": first_aid,\r\n            \"osha_recordables\": recordables,\r\n            \"lost_time_incidents\": lost_time,\r\n            \"total_days_lost\": total_days_lost,\r\n            \"by_category\": by_category,\r\n            \"near_miss_ratio\": near_misses \u002F recordables if recordables else 0\r\n        }\r\n\r\n    def calculate_trir(self, hours_worked: int, project_id: str = None) -> float:\r\n        \"\"\"Calculate Total Recordable Incident Rate.\"\"\"\r\n        incidents = list(self.incidents.values())\r\n        if project_id:\r\n            incidents = [i for i in incidents if i.project_id == project_id]\r\n\r\n        recordables = len([i for i in incidents if i.osha_recordable])\r\n\r\n        if hours_worked == 0:\r\n            return 0\r\n\r\n        # TRIR = (Recordables × 200,000) \u002F Hours Worked\r\n        return (recordables * 200000) \u002F hours_worked\r\n\r\n    def calculate_dart(self, hours_worked: int, project_id: str = None) -> float:\r\n        \"\"\"Calculate Days Away, Restricted, or Transferred rate.\"\"\"\r\n        incidents = list(self.incidents.values())\r\n        if project_id:\r\n            incidents = [i for i in incidents if i.project_id == project_id]\r\n\r\n        dart_cases = len([i for i in incidents\r\n                         if i.incident_type in [IncidentType.LOST_TIME]])\r\n\r\n        if hours_worked == 0:\r\n            return 0\r\n\r\n        return (dart_cases * 200000) \u002F hours_worked\r\n\r\n    def get_trend_analysis(self, months: int = 6) -> List[Dict]:\r\n        \"\"\"Analyze incident trends over time.\"\"\"\r\n        trends = []\r\n        now = datetime.now()\r\n\r\n        for i in range(months):\r\n            month_start = datetime(now.year, now.month - i, 1) if now.month > i else datetime(now.year - 1, 12 - (i - now.month), 1)\r\n            month_end = month_start.replace(day=28) + timedelta(days=4)\r\n            month_end = month_end - timedelta(days=month_end.day)\r\n\r\n            month_incidents = [inc for inc in self.incidents.values()\r\n                             if month_start \u003C= inc.date_time \u003C= month_end]\r\n\r\n            trends.append({\r\n                \"month\": month_start.strftime(\"%Y-%m\"),\r\n                \"total\": len(month_incidents),\r\n                \"near_misses\": len([i for i in month_incidents if i.incident_type == IncidentType.NEAR_MISS]),\r\n                \"recordables\": len([i for i in month_incidents if i.osha_recordable])\r\n            })\r\n\r\n        return list(reversed(trends))\r\n\r\n    def generate_incident_report(self, incident_id: str) -> str:\r\n        \"\"\"Generate detailed incident report.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            return \"Incident not found\"\r\n\r\n        inc = self.incidents[incident_id]\r\n\r\n        lines = [\r\n            f\"# Incident Report\",\r\n            f\"\",\r\n            f\"**Incident ID:** {inc.id}\",\r\n            f\"**Type:** {inc.incident_type.value}\",\r\n            f\"**Category:** {inc.category.value}\",\r\n            f\"**Date\u002FTime:** {inc.date_time.strftime('%Y-%m-%d %H:%M')}\",\r\n            f\"**Location:** {inc.location}\",\r\n            f\"**Project:** {inc.project_name}\",\r\n            f\"**Status:** {inc.status.value}\",\r\n            f\"**OSHA Recordable:** {'Yes' if inc.osha_recordable else 'No'}\",\r\n            f\"\",\r\n            f\"## Description\",\r\n            f\"{inc.description}\",\r\n            f\"\",\r\n            f\"## Immediate Actions Taken\",\r\n            f\"{inc.immediate_actions}\",\r\n            f\"\",\r\n        ]\r\n\r\n        if inc.injured_person:\r\n            lines.extend([\r\n                f\"## Injured Person\",\r\n                f\"- Name: {inc.injured_person.name}\",\r\n                f\"- Company: {inc.injured_person.company}\",\r\n                f\"- Role: {inc.injured_person.role}\",\r\n                f\"- Experience: {inc.injured_person.years_experience} years\",\r\n                f\"\"\r\n            ])\r\n\r\n        if inc.root_causes:\r\n            lines.extend([\r\n                f\"## Root Causes\",\r\n                *[f\"- {rc}\" for rc in inc.root_causes],\r\n                f\"\"\r\n            ])\r\n\r\n        if inc.corrective_actions:\r\n            lines.extend([\r\n                f\"## Corrective Actions\",\r\n                f\"| Action | Assigned To | Due | Status |\",\r\n                f\"|--------|-------------|-----|--------|\"\r\n            ])\r\n            for ca in inc.corrective_actions:\r\n                lines.append(f\"| {ca.description} | {ca.assigned_to} | {ca.due_date.strftime('%Y-%m-%d')} | {ca.status} |\")\r\n\r\n        return \"\\n\".join(lines)\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\n# Initialize manager\r\nmanager = IncidentManager()\r\n\r\n# Report near-miss\r\nincident = manager.report_incident(\r\n    incident_type=IncidentType.NEAR_MISS,\r\n    category=IncidentCategory.STRUCK_BY,\r\n    date_time=datetime.now(),\r\n    location=\"Level 5, Grid C-4\",\r\n    project_id=\"PRJ-001\",\r\n    project_name=\"Office Tower\",\r\n    description=\"Unsecured tool fell from scaffold, landed 2 feet from worker\",\r\n    immediate_actions=\"Area cordoned off, toolbox talk conducted\",\r\n    reported_by=\"Site Foreman\"\r\n)\r\n\r\n# 5 Whys analysis\r\nanalysis = manager.five_whys_analysis(incident.id, [\r\n    \"Tool fell from scaffold\",\r\n    \"Tool was not secured\",\r\n    \"No tool lanyard was used\",\r\n    \"Worker not trained on tool tethering\",\r\n    \"Tool tethering training not included in orientation\"\r\n])\r\n\r\n# Assign corrective actions\r\nmanager.assign_corrective_action(\r\n    incident.id,\r\n    \"Update orientation to include tool tethering training\",\r\n    \"Safety Manager\",\r\n    due_days=14\r\n)\r\n\r\nmanager.assign_corrective_action(\r\n    incident.id,\r\n    \"Provide tool lanyards to all workers at height\",\r\n    \"Procurement\",\r\n    due_days=7\r\n)\r\n\r\n# Get metrics\r\nmetrics = manager.get_incident_metrics()\r\nprint(f\"Total Incidents: {metrics['total_incidents']}\")\r\nprint(f\"Near Miss Ratio: {metrics['near_miss_ratio']:.1f}\")\r\n\r\n# Generate report\r\nprint(manager.generate_incident_report(incident.id))\r\n```\r\n\r\n## Requirements\r\n\r\n```bash\r\npip install (no external dependencies)\r\n```\r\n","# Incident Reporting System\r\n\r\n## Overview\r\n\r\nComprehensive incident reporting system for construction safety. Capture near-misses, injuries, and property damage. Conduct root cause analysis and track corrective actions to prevent recurrence.\r\n\r\n> \"Near-miss reporting prevents 90% of future serious incidents\" — DDC Community\r\n\r\n## Incident Pyramid\r\n\r\n```\r\n                    △\r\n                   \u002F│\\        Fatality (1)\r\n                  \u002F │ \\\r\n                 \u002F  │  \\      Serious Injury (10)\r\n                \u002F   │   \\\r\n               \u002F    │    \\    Minor Injury (30)\r\n              \u002F     │     \\\r\n             \u002F      │      \\  Near Miss (300)\r\n            \u002F       │       \\\r\n           \u002F        │        \\ Unsafe Acts (3000)\r\n          ──────────┴──────────\r\n```\r\n\r\n## Technical Implementation\r\n\r\n```python\r\nfrom dataclasses import dataclass, field\r\nfrom typing import List, Dict, Optional\r\nfrom enum import Enum\r\nfrom datetime import datetime, timedelta\r\nimport json\r\n\r\nclass IncidentType(Enum):\r\n    NEAR_MISS = \"near_miss\"\r\n    FIRST_AID = \"first_aid\"\r\n    MEDICAL_TREATMENT = \"medical_treatment\"\r\n    LOST_TIME = \"lost_time\"\r\n    FATALITY = \"fatality\"\r\n    PROPERTY_DAMAGE = \"property_damage\"\r\n    ENVIRONMENTAL = \"environmental\"\r\n\r\nclass IncidentCategory(Enum):\r\n    FALL = \"fall\"\r\n    STRUCK_BY = \"struck_by\"\r\n    CAUGHT_IN = \"caught_in\"\r\n    ELECTROCUTION = \"electrocution\"\r\n    VEHICLE = \"vehicle\"\r\n    MATERIAL_HANDLING = \"material_handling\"\r\n    TOOL_EQUIPMENT = \"tool_equipment\"\r\n    SLIP_TRIP = \"slip_trip\"\r\n    FIRE = \"fire\"\r\n    CHEMICAL = \"chemical\"\r\n    OTHER = \"other\"\r\n\r\nclass InvestigationStatus(Enum):\r\n    REPORTED = \"reported\"\r\n    UNDER_INVESTIGATION = \"under_investigation\"\r\n    ROOT_CAUSE_IDENTIFIED = \"root_cause_identified\"\r\n    CORRECTIVE_ACTIONS_ASSIGNED = \"corrective_actions_assigned\"\r\n    IN_REMEDIATION = \"in_remediation\"\r\n    CLOSED = \"closed\"\r\n\r\n@dataclass\r\nclass Person:\r\n    name: str\r\n    company: str\r\n    role: str\r\n    contact: str\r\n    years_experience: int = 0\r\n\r\n@dataclass\r\nclass CorrectiveAction:\r\n    id: str\r\n    description: str\r\n    assigned_to: str\r\n    due_date: datetime\r\n    status: str = \"open\"\r\n    completed_date: Optional[datetime] = None\r\n    verification_notes: str = \"\"\r\n\r\n@dataclass\r\nclass Incident:\r\n    id: str\r\n    incident_type: IncidentType\r\n    category: IncidentCategory\r\n    date_time: datetime\r\n    location: str\r\n    project_id: str\r\n    project_name: str\r\n\r\n    # Description\r\n    description: str\r\n    immediate_actions: str\r\n\r\n    # People involved\r\n    injured_person: Optional[Person] = None\r\n    witnesses: List[Person] = field(default_factory=list)\r\n    reported_by: str = \"\"\r\n\r\n    # Investigation\r\n    status: InvestigationStatus = InvestigationStatus.REPORTED\r\n    root_causes: List[str] = field(default_factory=list)\r\n    contributing_factors: List[str] = field(default_factory=list)\r\n    corrective_actions: List[CorrectiveAction] = field(default_factory=list)\r\n\r\n    # Documentation\r\n    photos: List[str] = field(default_factory=list)\r\n    weather_conditions: str = \"\"\r\n    equipment_involved: List[str] = field(default_factory=list)\r\n\r\n    # Metrics\r\n    days_lost: int = 0\r\n    property_damage_cost: float = 0.0\r\n    osha_recordable: bool = False\r\n\r\nclass IncidentManager:\r\n    \"\"\"Manage construction incident reporting and investigation.\"\"\"\r\n\r\n    # 5 Whys root cause categories\r\n    ROOT_CAUSE_CATEGORIES = [\r\n        \"Training\u002FCompetency\",\r\n        \"Procedures\u002FWork Instructions\",\r\n        \"Equipment\u002FTools\",\r\n        \"Supervision\",\r\n        \"Communication\",\r\n        \"Housekeeping\",\r\n        \"PPE\",\r\n        \"Work Environment\",\r\n        \"Physical\u002FMental State\",\r\n        \"Management System\"\r\n    ]\r\n\r\n    def __init__(self):\r\n        self.incidents: Dict[str, Incident] = {}\r\n        self.corrective_actions: Dict[str, CorrectiveAction] = {}\r\n\r\n    def report_incident(self, incident_type: IncidentType,\r\n                       category: IncidentCategory,\r\n                       date_time: datetime,\r\n                       location: str,\r\n                       project_id: str,\r\n                       project_name: str,\r\n                       description: str,\r\n                       immediate_actions: str,\r\n                       reported_by: str,\r\n                       injured_person: Dict = None) -> Incident:\r\n        \"\"\"Report new incident.\"\"\"\r\n        incident_id = f\"INC-{datetime.now().strftime('%Y%m%d%H%M%S')}\"\r\n\r\n        injured = None\r\n        if injured_person:\r\n            injured = Person(**injured_person)\r\n\r\n        incident = Incident(\r\n            id=incident_id,\r\n            incident_type=incident_type,\r\n            category=category,\r\n            date_time=date_time,\r\n            location=location,\r\n            project_id=project_id,\r\n            project_name=project_name,\r\n            description=description,\r\n            immediate_actions=immediate_actions,\r\n            reported_by=reported_by,\r\n            injured_person=injured\r\n        )\r\n\r\n        # Auto-flag OSHA recordable\r\n        if incident_type in [IncidentType.MEDICAL_TREATMENT,\r\n                            IncidentType.LOST_TIME,\r\n                            IncidentType.FATALITY]:\r\n            incident.osha_recordable = True\r\n\r\n        self.incidents[incident_id] = incident\r\n        return incident\r\n\r\n    def add_witness(self, incident_id: str, witness: Dict) -> Incident:\r\n        \"\"\"Add witness to incident.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        self.incidents[incident_id].witnesses.append(Person(**witness))\r\n        return self.incidents[incident_id]\r\n\r\n    def conduct_investigation(self, incident_id: str,\r\n                             root_causes: List[str],\r\n                             contributing_factors: List[str]) -> Incident:\r\n        \"\"\"Record investigation findings.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        incident = self.incidents[incident_id]\r\n        incident.root_causes = root_causes\r\n        incident.contributing_factors = contributing_factors\r\n        incident.status = InvestigationStatus.ROOT_CAUSE_IDENTIFIED\r\n        return incident\r\n\r\n    def five_whys_analysis(self, incident_id: str, whys: List[str]) -> Dict:\r\n        \"\"\"Conduct 5 Whys analysis.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        analysis = {\r\n            \"incident_id\": incident_id,\r\n            \"analysis_date\": datetime.now().isoformat(),\r\n            \"whys\": []\r\n        }\r\n\r\n        for i, why in enumerate(whys):\r\n            analysis[\"whys\"].append({\r\n                \"level\": i + 1,\r\n                \"question\": f\"Why #{i+1}?\",\r\n                \"answer\": why\r\n            })\r\n\r\n        # The last \"why\" is typically the root cause\r\n        if whys:\r\n            self.incidents[incident_id].root_causes.append(whys[-1])\r\n\r\n        return analysis\r\n\r\n    def assign_corrective_action(self, incident_id: str,\r\n                                description: str,\r\n                                assigned_to: str,\r\n                                due_days: int = 7) -> CorrectiveAction:\r\n        \"\"\"Assign corrective action.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            raise ValueError(f\"Incident {incident_id} not found\")\r\n\r\n        action_id = f\"CA-{datetime.now().strftime('%Y%m%d%H%M%S')}\"\r\n        action = CorrectiveAction(\r\n            id=action_id,\r\n            description=description,\r\n            assigned_to=assigned_to,\r\n            due_date=datetime.now() + timedelta(days=due_days)\r\n        )\r\n\r\n        self.incidents[incident_id].corrective_actions.append(action)\r\n        self.incidents[incident_id].status = InvestigationStatus.CORRECTIVE_ACTIONS_ASSIGNED\r\n        self.corrective_actions[action_id] = action\r\n        return action\r\n\r\n    def complete_corrective_action(self, action_id: str,\r\n                                   verification_notes: str) -> CorrectiveAction:\r\n        \"\"\"Mark corrective action complete.\"\"\"\r\n        if action_id not in self.corrective_actions:\r\n            raise ValueError(f\"Corrective action {action_id} not found\")\r\n\r\n        action = self.corrective_actions[action_id]\r\n        action.status = \"completed\"\r\n        action.completed_date = datetime.now()\r\n        action.verification_notes = verification_notes\r\n        return action\r\n\r\n    def get_incident_metrics(self, project_id: str = None,\r\n                            start_date: datetime = None,\r\n                            end_date: datetime = None) -> Dict:\r\n        \"\"\"Calculate incident metrics.\"\"\"\r\n        incidents = list(self.incidents.values())\r\n\r\n        if project_id:\r\n            incidents = [i for i in incidents if i.project_id == project_id]\r\n        if start_date:\r\n            incidents = [i for i in incidents if i.date_time >= start_date]\r\n        if end_date:\r\n            incidents = [i for i in incidents if i.date_time \u003C= end_date]\r\n\r\n        # Calculate metrics\r\n        total = len(incidents)\r\n        near_misses = len([i for i in incidents if i.incident_type == IncidentType.NEAR_MISS])\r\n        first_aid = len([i for i in incidents if i.incident_type == IncidentType.FIRST_AID])\r\n        recordables = len([i for i in incidents if i.osha_recordable])\r\n        lost_time = len([i for i in incidents if i.incident_type == IncidentType.LOST_TIME])\r\n        total_days_lost = sum(i.days_lost for i in incidents)\r\n\r\n        # Category breakdown\r\n        by_category = {}\r\n        for cat in IncidentCategory:\r\n            count = len([i for i in incidents if i.category == cat])\r\n            if count > 0:\r\n                by_category[cat.value] = count\r\n\r\n        return {\r\n            \"total_incidents\": total,\r\n            \"near_misses\": near_misses,\r\n            \"first_aid_cases\": first_aid,\r\n            \"osha_recordables\": recordables,\r\n            \"lost_time_incidents\": lost_time,\r\n            \"total_days_lost\": total_days_lost,\r\n            \"by_category\": by_category,\r\n            \"near_miss_ratio\": near_misses \u002F recordables if recordables else 0\r\n        }\r\n\r\n    def calculate_trir(self, hours_worked: int, project_id: str = None) -> float:\r\n        \"\"\"Calculate Total Recordable Incident Rate.\"\"\"\r\n        incidents = list(self.incidents.values())\r\n        if project_id:\r\n            incidents = [i for i in incidents if i.project_id == project_id]\r\n\r\n        recordables = len([i for i in incidents if i.osha_recordable])\r\n\r\n        if hours_worked == 0:\r\n            return 0\r\n\r\n        # TRIR = (Recordables × 200,000) \u002F Hours Worked\r\n        return (recordables * 200000) \u002F hours_worked\r\n\r\n    def calculate_dart(self, hours_worked: int, project_id: str = None) -> float:\r\n        \"\"\"Calculate Days Away, Restricted, or Transferred rate.\"\"\"\r\n        incidents = list(self.incidents.values())\r\n        if project_id:\r\n            incidents = [i for i in incidents if i.project_id == project_id]\r\n\r\n        dart_cases = len([i for i in incidents\r\n                         if i.incident_type in [IncidentType.LOST_TIME]])\r\n\r\n        if hours_worked == 0:\r\n            return 0\r\n\r\n        return (dart_cases * 200000) \u002F hours_worked\r\n\r\n    def get_trend_analysis(self, months: int = 6) -> List[Dict]:\r\n        \"\"\"Analyze incident trends over time.\"\"\"\r\n        trends = []\r\n        now = datetime.now()\r\n\r\n        for i in range(months):\r\n            month_start = datetime(now.year, now.month - i, 1) if now.month > i else datetime(now.year - 1, 12 - (i - now.month), 1)\r\n            month_end = month_start.replace(day=28) + timedelta(days=4)\r\n            month_end = month_end - timedelta(days=month_end.day)\r\n\r\n            month_incidents = [inc for inc in self.incidents.values()\r\n                             if month_start \u003C= inc.date_time \u003C= month_end]\r\n\r\n            trends.append({\r\n                \"month\": month_start.strftime(\"%Y-%m\"),\r\n                \"total\": len(month_incidents),\r\n                \"near_misses\": len([i for i in month_incidents if i.incident_type == IncidentType.NEAR_MISS]),\r\n                \"recordables\": len([i for i in month_incidents if i.osha_recordable])\r\n            })\r\n\r\n        return list(reversed(trends))\r\n\r\n    def generate_incident_report(self, incident_id: str) -> str:\r\n        \"\"\"Generate detailed incident report.\"\"\"\r\n        if incident_id not in self.incidents:\r\n            return \"Incident not found\"\r\n\r\n        inc = self.incidents[incident_id]\r\n\r\n        lines = [\r\n            f\"# Incident Report\",\r\n            f\"\",\r\n            f\"**Incident ID:** {inc.id}\",\r\n            f\"**Type:** {inc.incident_type.value}\",\r\n            f\"**Category:** {inc.category.value}\",\r\n            f\"**Date\u002FTime:** {inc.date_time.strftime('%Y-%m-%d %H:%M')}\",\r\n            f\"**Location:** {inc.location}\",\r\n            f\"**Project:** {inc.project_name}\",\r\n            f\"**Status:** {inc.status.value}\",\r\n            f\"**OSHA Recordable:** {'Yes' if inc.osha_recordable else 'No'}\",\r\n            f\"\",\r\n            f\"## Description\",\r\n            f\"{inc.description}\",\r\n            f\"\",\r\n            f\"## Immediate Actions Taken\",\r\n            f\"{inc.immediate_actions}\",\r\n            f\"\",\r\n        ]\r\n\r\n        if inc.injured_person:\r\n            lines.extend([\r\n                f\"## Injured Person\",\r\n                f\"- Name: {inc.injured_person.name}\",\r\n                f\"- Company: {inc.injured_person.company}\",\r\n                f\"- Role: {inc.injured_person.role}\",\r\n                f\"- Experience: {inc.injured_person.years_experience} years\",\r\n                f\"\"\r\n            ])\r\n\r\n        if inc.root_causes:\r\n            lines.extend([\r\n                f\"## Root Causes\",\r\n                *[f\"- {rc}\" for rc in inc.root_causes],\r\n                f\"\"\r\n            ])\r\n\r\n        if inc.corrective_actions:\r\n            lines.extend([\r\n                f\"## Corrective Actions\",\r\n                f\"| Action | Assigned To | Due | Status |\",\r\n                f\"|--------|-------------|-----|--------|\"\r\n            ])\r\n            for ca in inc.corrective_actions:\r\n                lines.append(f\"| {ca.description} | {ca.assigned_to} | {ca.due_date.strftime('%Y-%m-%d')} | {ca.status} |\")\r\n\r\n        return \"\\n\".join(lines)\r\n```\r\n\r\n## Quick Start\r\n\r\n```python\r\n# Initialize manager\r\nmanager = IncidentManager()\r\n\r\n# Report near-miss\r\nincident = manager.report_incident(\r\n    incident_type=IncidentType.NEAR_MISS,\r\n    category=IncidentCategory.STRUCK_BY,\r\n    date_time=datetime.now(),\r\n    location=\"Level 5, Grid C-4\",\r\n    project_id=\"PRJ-001\",\r\n    project_name=\"Office Tower\",\r\n    description=\"Unsecured tool fell from scaffold, landed 2 feet from worker\",\r\n    immediate_actions=\"Area cordoned off, toolbox talk conducted\",\r\n    reported_by=\"Site Foreman\"\r\n)\r\n\r\n# 5 Whys analysis\r\nanalysis = manager.five_whys_analysis(incident.id, [\r\n    \"Tool fell from scaffold\",\r\n    \"Tool was not secured\",\r\n    \"No tool lanyard was used\",\r\n    \"Worker not trained on tool tethering\",\r\n    \"Tool tethering training not included in orientation\"\r\n])\r\n\r\n# Assign corrective actions\r\nmanager.assign_corrective_action(\r\n    incident.id,\r\n    \"Update orientation to include tool tethering training\",\r\n    \"Safety Manager\",\r\n    due_days=14\r\n)\r\n\r\nmanager.assign_corrective_action(\r\n    incident.id,\r\n    \"Provide tool lanyards to all workers at height\",\r\n    \"Procurement\",\r\n    due_days=7\r\n)\r\n\r\n# Get metrics\r\nmetrics = manager.get_incident_metrics()\r\nprint(f\"Total Incidents: {metrics['total_incidents']}\")\r\nprint(f\"Near Miss Ratio: {metrics['near_miss_ratio']:.1f}\")\r\n\r\n# Generate report\r\nprint(manager.generate_incident_report(incident.id))\r\n```\r\n\r\n## Requirements\r\n\r\n```bash\r\npip install (no external dependencies)\r\n```\r\n",{"slug":5,"description":7,"display_name":34},"Incident Reporting","main","e7e336ac628c3e3bd771aff1aaa469c93778f94a","skills\u002Fdatadrivenconstruction\u002Fincident-reporting",0,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del","2026-08-23 22:39:37",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add kbarbel640-del\u002Fskills --skill incident-reporting",{"tool":48,"command":49},"bunx","bunx skills add kbarbel640-del\u002Fskills --skill incident-reporting",{"tool":51,"command":52},"pnpm","pnpm dlx skills add kbarbel640-del\u002Fskills --skill incident-reporting","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Fincident-reporting\u002FSKILL.md",true,[56],{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"_meta.json","REFERENCE","参考文档",304,"https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fdatadrivenconstruction\u002Fincident-reporting\u002F_meta.json",[63,94,122,143,149,169],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":74,"publishedAt":29},"01M6G8J55967D6281ACMKAKTEQ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[69],{"categoryNo":70,"categoryName":71,"taxonomyType":72,"taxonomyTypeDesc":73},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],"crowd prompting","prompting","api","with","tokens","domain","world","prompts","operations","instructions","text","tool","system","improve","productivity","marketplace","https","content","ai agents",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":105,"publishedAt":29},"01M6G8J0PKPAYVET6BWE8W4C26","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[100],{"categoryNo":101,"categoryName":102,"taxonomyType":103,"taxonomyTypeDesc":104},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[106,77,107,25,108,109,110,111,112,113,114,115,116,117,118,119,120,82,121],"dilemm ai","arena","browser","openclaw agent","create","automation","browser automation","bot","openclaw","design","strategy","headless","compete","submit","matchmaking","use",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":131,"publishedAt":29},"01M6G8HWAF3K9SW7NP3Z83CPJ6","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, or submitting paper reviews via API at http:\u002F\u002F150.158.152.82:8000.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Fweak-accept\u002FSKILL.md",[128],{"categoryNo":129,"categoryName":130,"taxonomyType":103,"taxonomyTypeDesc":104},"01JBSEEDCAT000000000000021","资料检索与研究",[132,133,134,135,136,137,138,78,139,119,121,140,77,141,142],"arxiv paper reviews","reviews","arxiv","paper","crawler","papers","comments","fetch","read","http","via",{"skillNo":144,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":148,"publishedAt":29},"01M6G8HQJ7N7WMY6YV7D7SSJ16","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[147],{"categoryNo":129,"categoryName":130,"taxonomyType":103,"taxonomyTypeDesc":104},[135,134,133,132,142,137,138,78,136,119,121,139,140,77,141],{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":29},"01M6G8HM95Y64JNVFC2HN4E2BG","git-summary","Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fzweack\u002Fgit-summary\u002FSKILL.md",[],[156,157,158,159,160,161,162,163,164,165,166,167,168],"git","summary","git summary","commits","repository","win32","status","linux","contributors","true","quick","get","branches",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":179,"publishedAt":29},"01M6G8HGEGF05CNEJCGVYFSC4R","agent-constitution","Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.","https:\u002F\u002Fgithub.com\u002Fkbarbel640-del\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fztsalexey\u002Fagent-constitution\u002FSKILL.md",[175,176],{"categoryNo":101,"categoryName":102,"taxonomyType":103,"taxonomyTypeDesc":104},{"categoryNo":177,"categoryName":178,"taxonomyType":72,"taxonomyTypeDesc":73},"01JBSEEDCAT000000000000037","律师与法务",[180,181,182,183,78,184,185,35,186,140,187,188,189,190,21,91,191,192,193],"agent constitution","constitution","contracts","tree","query","base","log","check","Rules","projects","compliance","state","governance","github"]