> For the complete documentation index, see [llms.txt](https://docs.tracr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tracr.com/tracr-user-guide/11.-tracr-loader.md).

# 11. Tracr Loader

Tracr Loader is a command line tool to upload diamond data to Tracr using the same CSV files as the Integration Tool.

## Install and configure Tracr Loader

{% stepper %}
{% step %}

### Deploy the executable file

The executable file is available in the Integration toolkit (go to **Tracr Management Portal > Integration > Integration Tool > Integration toolkit**).

Once downloaded, move the file to the target folder.

For example, on Windows:

{% code title="Windows example" %}

```
C:\tools\tracr
```

{% endcode %}
{% endstep %}

{% step %}

### Setup the environment variables

#### Add Tracr Loader to the PATH

On Windows, open a **Command Prompt** and type:

{% code title="Add to PATH (Windows)" %}

```bat
setx PATH "%PATH%;C:\tools\tracr\"
```

{% endcode %}

#### Declare the following variables

* TRACR\_TC\_APPROVAL\
  You must set this variable to yes. It means you accept and agree to the Terms and Conditions (<https://www.tracr.com/legal/terms-and-conditions>).
* TRACR\_SECRET\
  Authentication Token. Please contact <support@project-tracr.com> for more details.
* TRACR\_URL\
  The URL to the Data Integration Tool service. Please contact <support@project-tracr.com> for more details.

On Windows, open a **Command Prompt** and type:

{% code title="Set required variables (Windows)" %}

```bat
setx TRACR_TC_APPROVAL "yes"    
setx TRACR_SECRET "<TOKEN_PROVIDED_BY_TRACR>"
setx TRACR_URL "<URL_PROVIDED_BY_TRACR>"
```

{% endcode %}
{% endstep %}
{% endstepper %}

## Usage

On Windows, open a **Command Prompt** and type:

{% code title="Basic usage" %}

```
tracer-loader.exe --integration <integration_type> --csv <full_path_of_csv_file> --batch <internal_reference> --session_id <session_id_of_a_previous_session>
```

{% endcode %}

Command-line arguments

Required:

* -i, --integration \[rough,split,polished,transfer]
* -c, --csv full path to the csv file

Optional:

* -h, --help show this help message and exit
* -v, --version show program's version number and exit
* -b BATCH, --batch BATCH
* -s SESSION\_ID, --session\_id SESSION\_ID

## Upload new data with Tracr Loader

{% stepper %}
{% step %}

#### Prepare the data

Like the Data Integration Tool, create a CSV file to declare all the metadata of the diamonds to register.

Create the CSV file in a folder per session. The folder needs to contain all the additional files to be submitted (images, scans, reports, videos, and so on). You can organise the additional files in subfolders, or place all files together in the main folder.
{% endstep %}

{% step %}

#### Call Tracr Loader

For example, on Windows, open a **Command Prompt** and type:

{% code title="Upload example" %}

```
tracr-loader.exe --csv C:\data\tracr\box_341\rough_box_341.csv --integration rough
```

{% endcode %}

Where:

* C:\data\tracr\box\_341 is the folder which contains the CSV file and the additional files for rough diamonds.
* rough\_box\_341.csv is the CSV file.
  {% endstep %}
  {% endstepper %}

## Logs and output

Once a job is completed, the logs will be available in the subfolder **tracr\_output**.

For example:

{% code title="Log file example" %}

```
C:\data\tracr\box_341\tracr_output\tracr-loader-<date>.log
```

{% endcode %}

## Recover a failed session

If Tracr Loader is interrupted when uploading files to Tracr, you can call Tracr Loader in recovery mode.

{% stepper %}
{% step %}

#### Find the session ID of the failed attempt

Open the logs of the jobs in the **tracr\_output** subfolder and identify the line with the session ID.

For example:

{% code title="Log excerpt" %}

```
.\tracr_output\tracr-loader_20201204-131417.log
...
04-Dec-20 13:14:18 - INFO - Tracr session id for new loader run is 44c978ad-957a-4bf6-9ce8-e2b63ddac305
...
```

{% endcode %}
{% endstep %}

{% step %}

#### Pass the session ID

Tracr Loader accepts an additional parameter --session\_id to recover a previous run.

{% code title="Recover command" %}

```
tracer-loader.exe --csv <path_to_csv> --integration <stage> --session_id 44c978ad-957a-4bf6-9ce8-e2b63ddac305
```

{% endcode %}

Once Tracr Loader starts in recovery mode, it will identify the files to upload and complete the process. When all files are uploaded, Tracr Loader submits the session automatically.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tracr.com/tracr-user-guide/11.-tracr-loader.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
