# Build a model from data

Draft a model from tables or an event log, or translate one from another tool.

## naga generate

```text
usage: naga generate [-h] [-o OUTPUT] [--template FILE] [source]

Generate a model from Stations/Products/Routings tables (an .xlsx workbook or
a folder of CSVs).

positional arguments:
  source                an .xlsx workbook, or a folder of CSVs

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        write the generated model JSON here (default: stdout)
  --template FILE       write an empty .xlsx workbook with header rows and
                        exit
```

## naga discover

```text
usage: naga discover [-h] [--check] [-o OUTPUT] [--report REPORT]
                     [--format {csv,xes,xlsx}] [--sheet SHEET]
                     [--time-unit {seconds,minutes,hours,days}]
                     [--routing {auto,markov,variants}] [--idle-waits]
                     [--case COLUMN] [--activity COLUMN] [--timestamp COLUMN]
                     [--lifecycle COLUMN] [--resource COLUMN] [--start COLUMN]
                     [--complete COLUMN]
                     log

Draft a model from an event log (CSV, .xlsx or XES): arrivals, activity times,
routing and resources as the log shows them, with a report of what was
inferred, assumed and dropped.

positional arguments:
  log                   the event log: a CSV file, an .xlsx or .xes file, or
                        the name of a bundled sample (job_shop_log)

options:
  -h, --help            show this help message and exit
  --check               only check the log: what it holds and what that means
                        for a draft; no model is written
  -o OUTPUT, --output OUTPUT
                        write the draft model here (default: stdout)
  --report REPORT       write the report as JSON here
  --format {csv,xes,xlsx}
                        the log's format (default: by the file's suffix)
  --sheet SHEET         the sheet of an .xlsx log (default: the first)
  --time-unit {seconds,minutes,hours,days}
                        the draft's time unit; a numeric timestamp is taken as
                        in it
  --routing {auto,markov,variants}
                        markov: chances to the next activity; variants: one
                        routing per observed sequence; auto picks by a test on
                        the log
  --idle-waits          give each activity that waits long at mostly idle
                        resources a DELAY before it, fitted to its waits (off:
                        no such delay)
  --case COLUMN         the column holding the case (default: found by name)
  --activity COLUMN     the column holding the activity (default: found by
                        name)
  --timestamp COLUMN    the column holding the timestamp (default: found by
                        name)
  --lifecycle COLUMN    the column holding the lifecycle (default: found by
                        name)
  --resource COLUMN     the column holding the resource (default: found by
                        name)
  --start COLUMN        the column holding the start (default: found by name)
  --complete COLUMN     the column holding the complete (default: found by
                        name)
```

## naga sdimport

```text
usage: naga sdimport [-h] [-o OUT] source

Translate an XMILE (.xmile/.stmx) or Vensim (.mdl) file into a Naga model
JSON.

positional arguments:
  source             path to the .xmile/.stmx/.mdl file

options:
  -h, --help         show this help message and exit
  -o OUT, --out OUT  write the model JSON here instead of stdout
```
