> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with the Data Load Controller

> Guide to the Data Load Controller in Atoti Market Risk, covering the operation, topics, and scope parameters, initial load on startup, the data orchestrator pattern, and the REST endpoint that executes load and unload requests.

The Data Load Controller provides an interface between an external ETL layer and Atoti Market Risk, accepting operation, topics, and scope parameters to load or unload specific data sets via REST.

> [!NOTE]
>
> For the Data Load Controller documentation, click [here](https://docs.activeviam.com/engine/java-sdk/6.1/sources/data_sources_introduction.md).

## Overview

The Data Load Controller supports managing data within Atoti Market Risk.
It provides an interface between the ETL (Extract, Transform Load) layer
and the management of what data is loaded into Atoti Market Risk.

There are three main parameters in this interface (all of which are
configurable):

* **Operation**: the operation the DLC performs. Typically, this is
  load or unload.
* **Topics**: the list of data sources defined in the ETL for which to
  perform the operation. Topic aliases are used to easily specify
  groups of topics.
* **Scope**: a filter on the data to be loaded. For example, to
  load/unload data for a particular as-of date.

## Initial load

Starting up the application triggers the initial loading of data. This
is managed programmatically within Atoti Market Risk, with Spring beans
initiating the loading of topics and scopes at startup.

For more information, see [Initial Load](https://docs.activeviam.com/solutions/market-risk/6.0/dev/dev-mr-application/dev-dlc/dlc-mr-config.md#initial-load).

## Data Orchestrator

Beyond the initial data load, the data orchestrator is a custom external
component that is responsible for managing (loading and unloading) data
in Atoti Market Risk.

For example, the same process that copies the data ready for Atoti Market Risk to load can also use the REST service to tell the Data Load
Controller to trigger the loading of the data into Atoti Market Risk.

## REST Service

The DLC provides a REST service which the data orchestrator (or other
external component) can use to manage the loading and unload of data in
Atoti Market Risk.

The DLC REST API has a single endpoint, **execute**, for loading and
unloading data. Its response includes the status of the request, so no
separate endpoint exists to query it again.

### Execute

For `execute`, requests use POST and send JSON objects with the
following fields:

**Operation**: 'load' or 'unload'.

* **load**: load the data according to topic and scope.
* **unload**: delete data from the datastore according to topic and
  scope. This doesn't depend on how or when the data was loaded.

> [!NOTE]
>
> This doesn't delete reference data that was added as part of the data normalization. For example, if you delete sensitivities, the corresponding risk-factors are not removed.

**Topics**: a list of topics to load or unload. In addition to the topic
for each file type (see [Input file formats](../../../input-files)),
aliases are defined to load sets of files. For a list of MR-specific topic
aliases, see [Topic Aliases](https://docs.activeviam.com/solutions/market-risk/6.0/dev/dev-mr-application/dev-dlc/dlc-mr-config.md#topic-aliases).

**Scope**: three scopes are defined in Atoti Market Risk: as-of date,
configuration, and historical. For more information on these, see
[Scopes](https://docs.activeviam.com/solutions/market-risk/6.0/dev/dev-mr-application/dev-dlc/dlc-mr-config.md#scopes).

This example snippet loads FXData for the 27th of September, 2018.

```json theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
{
"operation": "LOAD",
"topics": ["FXData"],
"scope": {
"AsOfDate": "2018-09-27"
}
}
```

This example snippet removes the 27th of September, 2018 from the Sensitivity cube:

```json theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
{
"operation":"UNLOAD",
"topics":[
"Sensitivities"
],
"scope":{
"AsOfDate":"2018-09-27"
}
}
```

#### How to load data into a branch

The `branch` field at the top level of the request body names the branch
that the load or unload writes to. Without it, the operation runs on
master.

For example, here's how to load new FXData on the "test" branch:

```json theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
{
"operation": "LOAD",
"topics":[
"FXData"
],
"scope": {
"AsOfDate": "2018-09-28"
},
"branch": "test"
}
```

### What does the response contain?

The response carries the status of the request, `OK` or `ERROR`. A load
response also carries the parsing reports and any errors, and an unload
response the number of records removed from each store.
