# Mapping Supply Chains

An essential part of regulations including EUDR and CSDDD requires organisations to be able to identify the complete value chain of the goods that flow into the organisation. This is something that Interu excels at.

Often your internal system(s) will contain information about your suppliers - typically your tier 1 suppliers. Your internal system(s) will also contain product information. This guide will walk you through how you can automatically send that information into Interu via the Interu API.

## Supplier and Supplier Information

### Data Model

Interu has a simple data model in regards to suppliers and supplier information. We collect only the essential information required to enable end-to-end traceability.


```mermaid
classDiagram
    direction LR
    Organisation "1" -- "*" Location : linked
    Organisation *.. Address
    Location *.. Address
    Location "1" -- "*" LocationType
    
    class Organisation{
        id string
        name string
        website string
        address Address
    }

    class Location {
        id string
        name string
        organisation uri
        types uri[]
        address Address
    }
    
    class Address {
        street string
        region string
        zipCode string
        country string
    }

    class LocationType {
        type string
        pointOfOrigin boolean
    }
```

### Using the API

#### Adding an Supplier/Customer Organisation

From API perspective, organisations are represented as Connections, i.e. organisations that your organisation is connected to.

You can provide your own ID for the connection record. This allows you to use the id that is within your system and so eases integration.

The ID must be unique to the organisation.

#### Adding a Location

Locations represent the physical sites that belong to a given organisation. These are used to link the flow of good with the physical flow of goods.

You can provide your own ID for the connection record. This allows you to use the id that is within your system and so eases integration.

The ID must be unique to the organisation.

##### Location types

Locations have a concept of Location Types, this is to help identify their role within the supply chain. For example if they are a point-of-origin then they have particular importance.

Location Types are also used to help define expectations for information about the location - a 'Forest' location type has different requirements from a 'Processor' location type.

When adding a location you need to specify 1 or more Location Types by referencing the URL of a Location Type Record. (See [Referencing URIs](/docs/tutorials/urireference))

## Product Information

### Data Model


```mermaid
classDiagram
    direction LR
    Product "1" -- "*" Material
    
    class Product{
        id string
        name string
        allowedMaterials uri[]
        baseUnit uri
    }

    class Material{
        name string
        category string
    }
```

### Using the APIs

#### Adding a Product

Products are required with Interu to understand what goods flow through the supply chain. The Products also

##### Materials

Products specify the materials that the product can consistent of. A given product can be made up of multiple Materials. This is defined by included a list of Material [URIs](/docs/tutorials/urireference) as part of the Product Data Model.

br
##### Base Unit of Measurement

Every product also needs to have a base unit of measurement by referencing the [URI](/docs/tutorials/urireference) of a base unit of measurement.

## Attaching Documents

Documents play an important role in Due Diligence. Interu uses a common pattern for documents allowing them to be attached to different records within the system.

### Data Model

Each Document has a Document Type. This is important in specifying rules that determine what documents should appear on which records. The DocumentType is a [URI](/docs/tutorials/urireference) that references Document Types within Interu.


```mermaid
classDiagram
    direction LR
    Document "1" -- "1" DocumentType
    Document "1" -- "*" Attachment
    Attachment "1" -- "1" Product
    Attachment "1" -- "1" Organisation
    Attachment "1" -- "1" Location
    
    class Organisation{
        id string
        name string
        website string
        address Address
    }

    class Location {
        id string
        name string
        organisation uri
        types uri[]
        address Address
    }

    class Product{
        id string
        name string
        allowedMaterials uri[]
        baseUnit uri
    }
    
    class Document {
        name string
        type uri
        issuance? dateTime
        validityStart? dateTime
        validityEnd? dateTime
    }

    class Attachment {
        targetUri uri
        attachmentUri uri
    }
```

### Using the APIs

#### Adding a Document

The Document definition has to be created first before uploading the content. This is because there is key information about the document that is required first.

##### Uploading the Document content

Once the Document Record has been created the content can be uploaded. This is done by posting the content to the endpoint that now exists relative to the Document Record.

#### Attaching a Document to a Record

Attachment of a document to a Record uses a standard pattern irrespective of the record that you wish to attach the document to. It simply requires creating an Attachment Record which specifies the URI of the Document being attached and the URI of the record that you wish to attach the Document to.