Hse Risk Analyzer
When to Use
- Assessing operator safety performance before investment decisions
- Analyzing incident trends for specific fields, facilities, or operators
- Calculating risk-adjusted economic metrics (NPV with safety factors)
- Supporting ESG (Environmental, Social, Governance) compliance requirements
- Benchmarking operator safety records across similar assets
- Identifying high-risk operators or facilities for due diligence
- Generating safety-integrated investment analysis reports
Core Pattern
Query Parameters → HSE Database → Aggregate → Score → Integrate with Economics → Report
Implementation
Data Models
from dataclasses import dataclass, field
from datetime import datetime, date
from typing import Optional, List, Dict, Any
from enum import Enum
import pandas as pd
import numpy as np
class IncidentType(Enum):
"""HSE incident classification types."""
*See sub-skills for full details.*
### HSE Risk Analyzer
```python
from pathlib import Path
from typing import Optional, List, Dict, Generator
import pandas as pd
import logging
from datetime import datetime, timedelta
logger = logging.getLogger(__name__)
class HSERiskAnalyzer:
*See sub-skills for full details.*
### HSE Report Generator
```python
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from pathlib import Path
from datetime import datetime
class HSEReportGenerator:
"""
Generate interactive HTML reports for HSE risk analysis.
*See sub-skills for full details.*
## YAML Configuration
```yaml
hse_analysis:
data_source: "data/modules/hse"
operator_analysis:
operator: "Chevron"
years: 5
include_subsidiaries: true
field_analysis:
fields:
- "Thunder Horse"
- "Mars"
- "Atlantis"
years: 5
risk_adjustment:
include_penalty_exposure: true
include_insurance_adjustment: true
custom_discount_factors:
LOW: 0.0
MODERATE: 0.05
ELEVATED: 0.10
HIGH: 0.20
*See sub-skills for full details.*
## Integration with NPV Analysis
```python
from worldenergydata.hse import HSERiskAnalyzer
from worldenergydata.economics import NPVCalculator
# Initialize components
hse_analyzer = HSERiskAnalyzer()
npv_calc = NPVCalculator()
# Calculate base NPV
base_result = npv_calc.calculate(
production_profile=production_df,
price_assumptions=prices,
fiscal_terms=terms,
discount_rate=0.10
)
# Apply HSE risk adjustment
risk_metrics = hse_analyzer.calculate_risk_adjusted_npv(
base_npv=base_result.npv,
operator="Shell"
)
print(f"Base NPV: ${base_result.npv:,.0f}")
print(f"Risk-Adjusted NPV: ${risk_metrics.risk_adjusted_npv:,.0f}")
print(f"Safety Risk Category: {risk_metrics.risk_category}")
ESG Compliance Output
# Generate ESG-compliant safety summary
def generate_esg_summary(analyzer: HSERiskAnalyzer, operator: str) -> Dict[str, Any]:
"""Generate ESG-compliant safety summary for reporting."""
profile = analyzer.get_operator_profile(operator)
return {
"operator": operator,
"reporting_period_years": profile.years_analyzed,
"safety_metrics": {
"total_recordable_incident_rate": profile.trir,
"fatalities": profile.fatalities,
"lost_time_incidents": profile.lost_time_incidents,
"recordable_incidents": profile.recordable_incidents,
"safety_score": profile.safety_score,
"risk_classification": profile.risk_category
},
"environmental_metrics": {
"total_spill_volume_bbls": profile.total_spill_volume,
"regulatory_penalties_usd": profile.total_penalties
},
"governance_metrics": {
"compliance_status": "COMPLIANT" if profile.safety_score >= 70 else "REVIEW_REQUIRED"
}
}
Notes
- Requires HSE incident data in CSV format or database connection
- Safety scores are normalized 0-100 (higher = safer)
- Risk discount factors are configurable for organization-specific policies
- Integrates with existing NPV and economic analysis modules
- Supports ESG reporting requirements for institutional investors
- TRIR calculations require exposure hours data for accuracy
Sub-Skills
- Basic Operator Safety Assessment (+4)
1---2name: hse-risk-analyzer3description: Analyze BSEE HSE (Health, Safety, Environment) incident data for risk assessment. Use for operator safety scoring, incident trend analysis, compliance tracking, and ESG-integrated economic evaluation.4---56# Hse Risk Analyzer78## When to Use910- Assessing operator safety performance before investment decisions11- Analyzing incident trends for specific fields, facilities, or operators12- Calculating risk-adjusted economic metrics (NPV with safety factors)13- Supporting ESG (Environmental, Social, Governance) compliance requirements14- Benchmarking operator safety records across similar assets15- Identifying high-risk operators or facilities for due diligence16- Generating safety-integrated investment analysis reports1718## Core Pattern1920```21Query Parameters → HSE Database → Aggregate → Score → Integrate with Economics → Report22```2324## Implementation2526### Data Models2728```python29from dataclasses import dataclass, field30from datetime import datetime, date31from typing import Optional, List, Dict, Any32from enum import Enum33import pandas as pd34import numpy as np3536class IncidentType(Enum):37 """HSE incident classification types."""3839*See sub-skills for full details.*40### HSE Risk Analyzer4142```python43from pathlib import Path44from typing import Optional, List, Dict, Generator45import pandas as pd46import logging47from datetime import datetime, timedelta4849logger = logging.getLogger(__name__)5051class HSERiskAnalyzer:5253*See sub-skills for full details.*54### HSE Report Generator5556```python57import plotly.express as px58import plotly.graph_objects as go59from plotly.subplots import make_subplots60from pathlib import Path61from datetime import datetime6263class HSEReportGenerator:64 """65 Generate interactive HTML reports for HSE risk analysis.6667*See sub-skills for full details.*6869## YAML Configuration7071```yaml72hse_analysis:73 data_source: "data/modules/hse"7475 operator_analysis:76 operator: "Chevron"77 years: 578 include_subsidiaries: true7980 field_analysis:81 fields:82 - "Thunder Horse"83 - "Mars"84 - "Atlantis"85 years: 58687 risk_adjustment:88 include_penalty_exposure: true89 include_insurance_adjustment: true90 custom_discount_factors:91 LOW: 0.092 MODERATE: 0.0593 ELEVATED: 0.1094 HIGH: 0.20959697*See sub-skills for full details.*9899## Integration with NPV Analysis100101```python102from worldenergydata.hse import HSERiskAnalyzer103from worldenergydata.economics import NPVCalculator104105# Initialize components106hse_analyzer = HSERiskAnalyzer()107npv_calc = NPVCalculator()108109# Calculate base NPV110base_result = npv_calc.calculate(111 production_profile=production_df,112 price_assumptions=prices,113 fiscal_terms=terms,114 discount_rate=0.10115)116117# Apply HSE risk adjustment118risk_metrics = hse_analyzer.calculate_risk_adjusted_npv(119 base_npv=base_result.npv,120 operator="Shell"121)122123print(f"Base NPV: ${base_result.npv:,.0f}")124print(f"Risk-Adjusted NPV: ${risk_metrics.risk_adjusted_npv:,.0f}")125print(f"Safety Risk Category: {risk_metrics.risk_category}")126```127128## ESG Compliance Output129130```python131# Generate ESG-compliant safety summary132def generate_esg_summary(analyzer: HSERiskAnalyzer, operator: str) -> Dict[str, Any]:133 """Generate ESG-compliant safety summary for reporting."""134 profile = analyzer.get_operator_profile(operator)135136 return {137 "operator": operator,138 "reporting_period_years": profile.years_analyzed,139 "safety_metrics": {140 "total_recordable_incident_rate": profile.trir,141 "fatalities": profile.fatalities,142 "lost_time_incidents": profile.lost_time_incidents,143 "recordable_incidents": profile.recordable_incidents,144 "safety_score": profile.safety_score,145 "risk_classification": profile.risk_category146 },147 "environmental_metrics": {148 "total_spill_volume_bbls": profile.total_spill_volume,149 "regulatory_penalties_usd": profile.total_penalties150 },151 "governance_metrics": {152 "compliance_status": "COMPLIANT" if profile.safety_score >= 70 else "REVIEW_REQUIRED"153 }154 }155```156157## Notes158159- Requires HSE incident data in CSV format or database connection160- Safety scores are normalized 0-100 (higher = safer)161- Risk discount factors are configurable for organization-specific policies162- Integrates with existing NPV and economic analysis modules163- Supports ESG reporting requirements for institutional investors164- TRIR calculations require exposure hours data for accuracy165166## Sub-Skills167168- [Basic Operator Safety Assessment (+4)](basic-operator-safety-assessment/SKILL.md)