# Internal Traceability

One of the big challenges for organisations implementing EUDR is internal traceability, that is linking *inbound* goods with *outbound* goods. This is essential for a few key reasons:

1. Where your customers require you to share DDS Reference Numbers you need to be able to identify the DDS Reference(s) associated on inbound delivery(ies).
2. Where you have to generate a DDS for an outbound delivery you need to be able to identify all the inbound deliveries so you can ultimately identify all the point's of origin related to those deliveries so you can provide the information requires for the DDS statement.
3. When you need to be able to share end-to-end traceability information to your customers.


## Reality

Whilst this seems great on paper, the reality of how to achieve is very dependent on your internal systems and processes. Often the data needed for this level of traceability is not immediately available and so the challenge of fulfilling end-to-end traceability without causing disruption to your existing processes is challenging.

## Approach

Interu provides mechanisms to capture the data needed for end-end-end traceability. This can be broken down as follows:




```mermaid
flowchart LR 
  in(Inbound Deliveries)
  pro("Process(es)")
  out(Outbound Deliveries)
  in-- items --> pro
  pro-- items -->out
```

br

Items that arrive in deliveries need to be linked to processes that happen within your organisation and items that come out of those proceess need to be linked with outbound deliveries.

## Examples

Note that for all these examples the assumption is that this flow is for the same product, there is no processing or conversion.

1-to-1 mapping
This is a simplistic model which doesn't involve any processing but purely picking of goods that come in to send out to customers. It assumes that the specific goods can be identified as part of the picking process.

br

```mermaid
flowchart TB
 inA("`**Delivery 1**
 (DDS Ref:ABC)
  *- Item001*
    Qty: 100`")
 inB("`**Delivery 2**
 (DDS Ref:DEF)
  *- Item002*
 Qty: 200`")
 inC("`**Delivery 3**
(DDS Ref:GHI)
*- Item003*
 Qty: 150`")
 procA("`**Process001**
 picking process`")
 procB("`**Process002**
 picking process`")
 outA("`**Delivery 4**
 (DDS Refs: ABC, DEF)
 *- Item004*
 Qty: 150`")
 outB("`**Delivery 5**
 (DDS Refs: DEF, GHI)
 *- Item005*
 Qty: 200`")
 inA -- 100 --> procA
 inB -- 50 --> procA
 inB -- 150 --> procB
 inC -- 50 --> procB
 procA -- 150 --> outA
 procB -- 200 --> outB
```

br

As you can see, for each outbound delivery, because you can identify the specific items that went into the picking process then Interu is able to link everything required to support EUDR and other traceability requirements.

Batching approach
A potentially more likely scenario is one where you cannot definitely link the items that come in with the items that go out. This may be determined by what information is available at the time of picking, whether or not you can operate a *FIFO* (First In First Out) or a *LIFO* (Last In Last Out) approach to the flow of goods internally.

br

```mermaid
flowchart TB
 inA("`**Delivery 1**
 (DDS Ref:ABC)
  *- Item001*
    Qty: 100`")
 inB("`**Delivery 2**
 (DDS Ref:DEF)
  *- Item002*
 Qty: 200`")
 inC("`**Delivery 3**
(DDS Ref:GHI)
*- Item003*
 Qty: 150`")
 procA("`**Batch**
 Item 'Bucket'`")
 outA("`**Delivery 4**
 (DDS Refs: ABC, DEF, GHI)
 *- Item004*
 Qty: 150`")
 outB("`**Delivery 5**
 (DDS Refs: ABC, DEF, GHI)
 *- Item005*
 Qty: 200`")
 inA -- 100 --> procA
 inB -- 200 --> procA
 inC -- 150 --> procA
 procA -- pick 150 --> outA
 procA -- pick 200 --> outB
```

br

In this approach, all the goods flow into a single 'bucket' from which the deliveries are picked. This means that outbound deliveries will be linked with all inbound deliveries where the items in those deliveries have been added to the bucket. In the context of EUDR this means all inbound DDS References will be associated with a given *outbound* delivery.

Cut off point
This bucket cannot continue indefinitely, you need to determine a bounding factor - typically this would be time. It makes sense for this to coincide with a *stock take* where the items that still remain within stock can be identified and moved to a new bucket.

## The Data Model


```mermaid
classDiagram
    direction LR
    Item "1" .. "1" Product : references
    Item "1" .. "many" Material : references
    Item "1" .. "1" Location : references
    Process "1" .. "1" Location : references
    Delivery "1" *-- "many" DeliveryItem : contains
    DeliveryItem "1" .. "1" Item : references
    ProcessType "1" .. "1" Process :references 
    Process "1" .. "many" InputItem : /inputs
    Process "1" .. "many" OutputItem : /outputs
    InputItem "1" .. "1" Item : references
    OutputItem "1" .. "1" Item : references
    
    class Item {
    }

    class Delivery {
    }

    class DeliveryItem {
    }

    class Process {
    }

    class InputItem {
    }

    class OutputItem {

    }

    class ProcessType {
    }

namespace Static {
    class Product {

    }

    class Location {

    }

    class Material {

    }
}
```

Item
Delivery
Process
Process Input
Process Output
## Using the API

### Adding Materials

Materials represent the raw materials that are incorporated into goods. This is of particular importance in regards to EUDR as it provides the means to specify the Common and Scientific names as required by the regulation.

Upcoming change
We currently capture Scientific Name and Common Name custom fields. This is about to be replaced with standard fields within the Material model.

Material Schema
### Adding Products

Products represent the type of goods that are flowing through the system. If you are submitting DDS Statements to the EU Traces NT system then the Product definition must have an HS Code attached.

Upcoming change
We currently capture HS Codes through a custom field. This is about to be replaced with a standard field within the Product model.

Product Schema
### Adding Items

Items represent goods flowing through the supply chain. Each item represents a quantity of a Product. It can also define the Materials that were used to make that Item.

### Adding Deliveries

Deliveries represent the movement of items (or goods) between two locations.

#### Adding items to deliveries.

Items are referenced within the Delivery model by providing the URIs to each Item within the delivery.items collection:

br
Delivery Item Schema
### Adding Processes

Processes are used to represent what goes on within an organisation, that may be manufacturing or it may simply be used to represent goods that are picked to send to a customer in the case of a trader. They are needed to link inbound goods with outbound goods to maintain end-to-end traceability.

Processes can be long lasting and they are linked to a location where they happened.

#### Inputs & Outputs

Items that enter and exit processes are added by linking them to the process via the .../inputs and .../outputs endpoints.