Elixir library to generate AVETMISS reports


Add avetmiss to your list of dependencies in mix.exs:

def deps do
    {:avetmiss, "~> 0.1.0"}


import Avetmiss.Report
alias Avetmiss.Nat.{Nat010, Nat020, Nat030, Nat060 ...}

# define your generate_report function that exports all required files
def generate_report(destination) do
  files = [
    {'./nat00010.txt', generate_nat010()},
    {'./nat00020.txt', generate_nat020()},
    {'./nat00030.txt', generate_nat030()},
    {'./nat00060.txt', generate_nat060()},

  :zip.create("#{destination}/report.zip", files)

defp generate_nat010() do
  # collect the necessary data (typically from the db)
  rtos = ...

  # create your rows by feeding a Nat010 Struct into the nat010_row function
  Enum.map(rtos, fn rto ->
          training_organisation_id: rto.id,
          training_organisation_name: rto.name,
          contact_name: rto.contact_name,
          telephone_number: rto.telephone_number,
          facsimile_number: rto.facsimile_number,
          email_address: rto.email_address
    # join your rows with Line Feeds to create the file content
    |> Enum.join("\n")

# ... repeat for other NAT files

NAT Structs

As we saw above, the NAT Structs are at the core of the library's API. They are located in the ./lib/nat folder.

I recommend to alias the NAT Structs that you need:

alias Avetmiss.Nat.{Nat010, Nat020, Nat030, Nat060 ...}

Once imported, all that's left to do is populate them with your data and feed them into the nat*_row functions as seen above.

NAT row functions

The NAT Structs are then fed into nat*_row functions located in ./lib/report.ex. I recommend to import them:

import Avetmiss.Report


There is a config file exposed in ./lib/config.ex in a [{code, name}] list of tuple format.

It exposes the standard AVETMISS config that you'll need for reporting such as genders, indigenous statuses, disabilities etc.


To learn more about what AVETMISS is and how it works, read What is AVETMISS, and how does it work? A technical dive

Developed for the needs of the Tradie Training White Card course.

The White Card course is a mandatory requirement for anyone whishing to enter construction sites in Australia. It teaches basic safety concepts such as identifying hazards, identifying risks, fitting & wearing PPE etc.

Tradie Training is a registered training organisation in Brisbane, Australia.