# Risk Assessments Overview

The risk assessment feature was redesigned to use the latest Module Builder and Workflow Engine components. The interface now consists of modular screens stored in `ui_modals` and a streamlined workflow for capturing hazards, controls and approvals.

## Module Structure

- **Assessment List** – displays saved assessments in a table with filters for department, location and status.
- **Assessment Wizard** – a multi-step form generated by the Module Builder. It collects administrative details, task information and hazard ratings.
- **Hazard Matrix** – embedded in the wizard so each hazard can be scored before and after controls.
- **Review Screen** – shows the completed assessment and allows managers to add comments or request changes.

All module definitions are editable through the **Module Builder** card. Import the JSON layouts from version control and adjust fields or labels as required.

## Workflow

1. Open **Risk Assessments** from the dashboard. The Assessment List modal loads via `ModuleLoader`.
2. Click **New Assessment** to launch the wizard. Complete each section of the form.
3. After submission a `risk_assessment_created` event is emitted. The Workflow Engine uses this event to notify safety officers and create follow‑up tasks.
4. Managers review the entry in the Review Screen. Approving the record triggers the `risk_assessment_approved` event which can send confirmation emails or schedule periodic reviews.

Workflows are configured through the **Workflow Builder** and stored in `workflows` and `workflow_steps`. Events can perform actions such as sending emails, creating tasks or updating related modules.

## Customising Forms

Form layouts come from the Module Builder. To modify field order or add new inputs:

1. Open the **Module Builder** card and load the relevant modal by its identifier.
2. Drag components onto the canvas or edit properties in the inspector.
3. Save the updated JSON. The wizard will reflect the changes immediately.

See [FormBuilder.md](FormBuilder.md) for more information on dynamic form fields.

## Risk Rating Matrix

The scoring grid in the Hazard Matrix uses rows and columns from `ohs_risk_matrices`. Severity multiplied by probability calculates the risk value. The table below summarises the standard bands:

| Risk Value | Category  |
|-----------:|-----------|
| 1–4        | Low       |
| 5–9        | Moderate  |
| 10–16      | High      |
| 17–25      | Extreme   |

Use this matrix both before and after implementing controls to determine the residual risk.

## Wizard Step 1: Assessment Type

The first step in the wizard prompts users to choose the **risk assessment type**
and the **location** where the work will be performed. Both fields are standard
select inputs backed by the `risk_assessment_types` and `locations` tables. Once
a selection is made the form shows an **Open Form** button.

Clicking **Open Form** uses the `open-form` action to load the specific form
linked to the chosen type. The button's payload works the same way as the
example in [MultiStepForms.md](MultiStepForms.md): it resolves the form ID from
the selected type and then opens that form. Any fields listed in `prefillFields`
are passed to the opened form so values such as the chosen location appear
pre‑filled.

The loaded form (IDs 85–90) captures the rest of the administrative details
including **Title**, **Assessment Date**, **Assessor Names**, **Review Date** and
other information like the work description or permit requirements. These fields
are stored on the main `risk_assessments` record along with any
type‑specific hazard inputs.
