Using the fact application

The fact-models packages provides an executable for working with fact files within the event-data-model directory.

Building the application

There are two ways to use the application:

  1. Run with cabal run

  2. Install via cabal

Instead of installing fact in your $PATH, you can use cabal run:

cabal run fact-models:exe:fact -- --help

You should then see something like:

Usage: fact COMMAND [--dir ARG]

Available options:
  -h,--help                Show this help text

Available commands:
  build                    Build facts
  check                    Check that a fact's artifacts are up-to-date
  list                     List available facts

This approach ensures that you’re using the latest version of the app without having to reinstall new updates.

Install via cabal

From the root directory of the event-data-model project, run the following commands:

cabal install fact-models:exe:fact

This will install the application in your $PATH, which you can confirm by:

fact --help


The application currenlty has three commmands:

  • build: Build artifacts for fact(s)

  • check: Check that fact artifacts are up-to-date

  • list: List available facts

Commands are invoked at the command-line as in:

cabal run fact-models:exe:fact -- build --help
cabal run fact-models:exe:fact -- check --help
cabal run fact-models:exe:fact -- list --help


Dry-run build of a fact

The following command prints a preview of the files that will be created when the --dry-run flag is removed.

% cabal run fact-models:exe:fact -- build --fact=ServiceLocation --dry-run
-- DO NOT EDIT: this file is auto-generated
{- tag::doc[] -}
< Inpatient | Outpatient >
{- end::doc[] -}

<<rest snipped>>
Check of a fact

You can check that a fact’s artifacts are up-to-date with the following:

% cabal run fact-models:exe:fact -- check --fact=Claim

The command should produce no output if the files are up-to-date.