# Risk Calculation Setup Guide

## What's New

The RA (Risk Assessment) module now includes automatic risk calculations with color coding:

- **Degree of Risk (Before Controls)**: L × C = Degree of Risk
  - Likelihood (1-5)
  - Consequence (1-5)
  - Degree of Risk Score with color coding

- **Residual Risk (After Controls)**: L × C = Residual Risk
  - Residual Likelihood (1-5)
  - Residual Consequence (1-5)
  - Residual Risk Score with color coding

## Risk Color Coding

- **Low (Green)**: Score 1-3
- **Medium (Orange)**: Score 4-6
- **High (Red)**: Score 7-12
- **Critical (Dark Red)**: Score 13+

## Database Setup

Run the SQL file to add the necessary columns to your database:

```sql
ALTER TABLE ra_hazard_analysis
ADD COLUMN likelihood INT DEFAULT 1 AFTER current_controls,
ADD COLUMN consequence INT DEFAULT 1 AFTER likelihood,
ADD COLUMN residual_likelihood INT DEFAULT 1 AFTER residual_risk,
ADD COLUMN residual_consequence INT DEFAULT 1 AFTER residual_likelihood;
```

### Steps:

1. Open phpMyAdmin or your MySQL client
2. Select your database
3. Go to SQL tab
4. Copy and paste the SQL from `add_risk_calculation_fields.sql`
5. Click Execute

## Using the New Features

When creating or editing an RA:

1. Add hazard analysis rows
2. For each hazard:
   - Enter Likelihood (1-5) and Consequence (1-5)
   - The system automatically calculates **L × C** with color coding
   - Enter Residual Likelihood and Consequence (after controls)
   - The system automatically calculates residual **L × C** with color coding
3. Actions are displayed alongside the residual risk

## Scale Reference

### Likelihood Scale (1-5)
- 1 = Remote/Almost impossible
- 2 = Low
- 3 = Medium
- 4 = High
- 5 = Very High/Almost certain

### Consequence Scale (1-5)
- 1 = Insignificant
- 2 = Minor
- 3 = Moderate
- 4 = Major
- 5 = Catastrophic

## Example Calculation

| Hazard | Likelihood | Consequence | Degree of Risk | Status |
|--------|-----------|-------------|---|---|
| Slip hazard | 3 | 2 | 6 | Medium |
| Chemical exposure | 2 | 5 | 10 | High |
| Fall from height | 1 | 5 | 5 | Medium |

After implementing controls:

| Hazard | Res. Likelihood | Res. Consequence | Residual Risk | Status |
|--------|---|---|---|---|
| Slip hazard | 2 | 1 | 2 | Low |
| Chemical exposure | 1 | 4 | 4 | Medium |
| Fall from height | 1 | 4 | 4 | Medium |

---

**Last Updated:** June 2026
