DEV Community

laikodev
laikodev

Posted on

Modelling a SWMS Template as Structured Data: Tasks, Hazards and Controls

If you build software for trades, sooner or later someone asks you for a SWMS template. In Australia, a Safe Work Method Statement is the document required before high risk construction work starts, and most of them still live as Word files full of merged cells and copy-pasted rows. Treating the SWMS as structured data instead makes it easier to generate, check and render.

This post is about the shape of that data. It isn't a description of how any particular product works internally. It is a way of reasoning about the document so that the output is something a site supervisor would actually sign.

The core relationship

Strip away the formatting and a SWMS is a tree:

  • A job has one or more high risk construction work categories.
  • A job has an ordered list of tasks (the method).
  • Each task has zero or more hazards.
  • Each hazard has one or more controls.
  • Each control has an owner and sits somewhere on the hierarchy of controls.
type ControlLevel =
  | 'eliminate'
  | 'substitute'
  | 'isolate'
  | 'engineer'
  | 'administrative'
  | 'ppe';

interface Control 
  description: string;
  level: ControlLevel;
  responsible: string; // role or name


interface Hazard 
  description: string;
  controls: Control[];


interface Task 
  order: number;
  description: string;
  hazards: Hazard[];


interface Swms 
  site: string;
  pcbu: string;
  hrcwCategories: string[];
  plant: string[];
  tasks: Task[];
  reviewTriggers: string[];
  preparedOn: string; // ISO date

Enter fullscreen mode Exit fullscreen mode

Note that tasks are a sequence, not a set. Swapping 'isolate supply' and 'remove switchboard cover' changes the safety meaning completely, so order is part of the data.

Validation rules worth encoding

A valid shape doesn't make a good statement. A few rules catch the most common problems:

  1. Every hazard has at least one control. An identified hazard with nothing against it is a liability.
  2. Flag hazards controlled only by PPE. PPE is the lowest level of the hierarchy. It can be the right answer, but it should be a deliberate one.
  3. Every control has an owner. 'Exclusion zone established' means nothing without someone responsible for it.
  4. At least one high risk category. If there are none, the job may not need a SWMS, though it still needs risk management.
  5. Plant appears in the tasks. If the plant list includes an excavator but no task mentions it, something is missing.
  6. Review triggers exist. Weather, scope change, incident, new worker.
function lint(s: Swms): string[] 
  const issues: string[] = [];
  if (s.hrcwCategories.length === 0) issues.push('No high risk category listed');
  if (s.reviewTriggers.length === 0) issues.push('No review triggers');
  for (const t of s.tasks) 
    for (const h of t.hazards) 
      if (h.controls.length === 0) issues.push('Task ' + t.order + ': hazard with no control');
      if (h.controls.length > 0 && h.controls.every(c => c.level === 'ppe')) 
        issues.push('Task ' + t.order + ': PPE-only controls for ' + h.description);

      for (const c of h.controls) 
        if (!c.responsible) issues.push('Task ' + t.order + ': control without owner');



  return issues;

Enter fullscreen mode Exit fullscreen mode

Generating from a description

The natural input for this structure is a plain-language job description, because that is how tradespeople already talk about work. That choice has consequences:

  • The generator has to infer categories from conditions. A '1.8 metre deep trench' implies the trench category; 'eaves at 3 metres' implies a fall risk over 2 metres.
  • Missing input means missing hazards. If nobody mentions the overhead power line, nothing downstream can know about it. Good UX nudges users toward detail.
  • A human review step is not optional. Responsibility for the statement stays with the business doing the work.

laikodev took the description-first approach with its free SWMS template builder for Australia: describe the job, the SWMS agent drafts the tasks, hazards and controls for high risk construction work, and the result can be printed or saved as a PDF. If you are designing something in this space, it is worth trying from the user's side to feel how a description-first flow compares with a form.

Rendering for site

The final consumer is usually paper or a PDF on a phone, not a dashboard. A few rendering rules help:

  • One table row per hazard: Task, Hazard, Controls, Responsible.
  • Avoid splitting a row across pages.
  • Put the sign-on sheet at the end, with space for names, signatures and dates.
  • Keep the language plain. The reader may be an apprentice reading it on a tailgate.

Wrap-up

Model the SWMS as an ordered tree, lint it for the obvious failures and render it for the place it will actually be read. To see a working builder from the tradie's side: https://laiko.dev/swms-template

Top comments (0)