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

# What happens after upload

> How Variable processes your BOM data and creates products, materials, and relationships

When you submit a BOM import, Variable performs several operations to create your product structure. This guide explains what happens behind the scenes.

## Import processing overview

```mermaid theme={"system"}
flowchart TD
    A[BOM File Submitted] --> B[Create Root Products]
    B --> C[Create Supplier Parts]
    C --> D[Create Materials]
    D --> E[Link Inputs to Products]
    E --> F[Assign Suppliers]
    F --> G[Calculate Footprints]

    style A fill:#d1edff,stroke:#d1edff,color:#003540
    style B fill:#ede5ff,stroke:#ede5ff,color:#003540
    style C fill:#ede5ff,stroke:#ede5ff,color:#003540
    style D fill:#ede5ff,stroke:#ede5ff,color:#003540
    style E fill:#e8f2a1,stroke:#e8f2a1,color:#003540
    style F fill:#e8f2a1,stroke:#e8f2a1,color:#003540
    style G fill:#f7edcf,stroke:#f7edcf,color:#003540
```

## What gets created

### Level 0: Root products

Rows with `bomLevel: 0` or no parent reference become root **Products**. These are your company's own products that you manufacture or assemble.

```csv theme={"system"}
bomLevel,productSku,productName
0,BIKE-001,Mountain Bike
```

Creates a Product:

* Type: LIVE (or UNKNOWN if incomplete)
* Owned by your company
* Ready to receive inputs from child rows

<Note>
  If a product with the same SKU already exists, Variable reuses it instead of creating a duplicate.
</Note>

### Level 1+: Supplier parts and materials

Child rows create a chain of related items. Variable uses a **3-level structure** to accurately model your supply chain:

```mermaid theme={"system"}
flowchart TB
    A[Your Product] --> B[Supplier Part]
    B --> C[Material]
    C --> D[Dataset]

    style A fill:#d1edff,stroke:#d1edff,color:#003540
    style B fill:#ede5ff,stroke:#ede5ff,color:#003540
    style C fill:#e8f2a1,stroke:#e8f2a1,color:#003540
    style D fill:#f7edcf,stroke:#f7edcf,color:#003540
```

| Level         | What it represents                     | Example                        |
| :------------ | :------------------------------------- | :----------------------------- |
| Product       | Your finished good or assembly         | Mountain Bike                  |
| Supplier Part | Specific part from a specific supplier | "Alloy Rim from RimSupply"     |
| Material      | Generic material type                  | Aluminum Alloy 6061            |
| Dataset       | Emission factors from database         | ecoinvent: Aluminum production |

## The 3-level BOM structure explained

### Why three levels?

Consider this scenario: you buy an "Alloy Rim" from "RimSupply". That part is made of aluminum. To calculate its carbon footprint, you need to:

1. Know the **part** (Alloy Rim) and **quantity** you're using
2. Know the **supplier** (RimSupply) to track your supply chain
3. Know the **material** (aluminum) to assign the correct impact data

Variable maintains all three pieces of information.

### How supplier parts work

When you import a BOM row with supplier information:

```csv theme={"system"}
productSku,supplierName,supplierPartId,materialName,quantity,unitCode
RIM-001,RimSupply,RS-RIM-42,Aluminum Alloy,0.3,kg
```

Variable creates:

1. **Supplier Part** - A Material node representing "RS-RIM-42 from RimSupply"
   * Linked to the supplier company
   * Stores the supplier's part number

2. **Material** - A Material node representing "Aluminum Alloy"
   * Generic material type
   * Where you'll assign the dataset

3. **Input relationships**
   * Your Product uses the Supplier Part (quantity from BOM)
   * The Supplier Part contains the Material (weight from BOM)

## Weight assignment rules

How Variable assigns weights depends on the chain depth:

### 3-level chain (Part to Supplier Part to Material)

When the supplier part has an associated material:

* **Supplier Part** gets quantity from BOM (e.g., 1 piece)
* **Material** gets weight from BOM (e.g., 0.3 kg)

```csv theme={"system"}
productSku,supplierPartId,materialName,quantity,weightAmount,weightUnitCode
PEDAL-001,SUP-PEDAL-1,Aluminum Alloy,2,0.15,kg
```

Result: The product uses 2 pedals, each pedal contains 0.15 kg of aluminum.

### 2-level chain (Part to Supplier Part only)

When there's no separate material:

* **Supplier Part** gets both the quantity and the weight unit
* The supplier part IS the material input

```csv theme={"system"}
productSku,supplierPartId,quantity,weightAmount,weightUnitCode
FRAME-COAT-001,SUP-COAT-1,1,0.8,kg
```

Result: The product uses 0.8 kg of frame coating (the supplier part itself is the material input).

<Info>
  Variable detects the chain depth automatically by checking if any row for a given supplier part also has a `materialId` or `materialName`.
</Info>

## Supplier relationships

When you include supplier columns:

| Column           | What happens                              |
| :--------------- | :---------------------------------------- |
| `supplierName`   | Creates or matches a Company node         |
| `supplierId`     | Uses your internal ID for matching        |
| `supplierPartId` | Stored on the supplier part for reference |

Supplier matching:

* First tries to match by `supplierId`
* Then by `supplierName`
* Creates a new supplier if no match found

## Idempotency: safe re-imports

BOM imports are designed to be re-run safely:

### Product deduplication

* Products matched by SKU within your company
* Existing products are **reused, not recreated** - and not updated either. Variable leaves existing matches alone; it won't overwrite their name, supplier, or other fields with newer values from your file.

### Input deduplication

New inputs are only added when:

* The product was created during this import, OR
* The product has type UNKNOWN, OR
* The product has no existing inputs

Products that are already LIVE with inputs are considered "fully modeled" and won't receive additional inputs from a re-import.

<Warning>
  If you need to add inputs to an existing LIVE product, you can either change it to UNKNOWN first, or add inputs manually through the UI.
</Warning>

### Duplicate detection

Within the same import, duplicate inputs are detected by comparing:

* Source product ID
* Quantity
* Unit code

## After import completes

### Automatic calculations

Variable automatically triggers CO2e recalculation for all affected products. This cascades through your product hierarchy.

### What you need to do next

Materials are created but not yet linked to datasets. Assign a dataset to each one in the app to complete your footprint calculations.

## Related relationships created

After a BOM import, these relationships exist in Variable:

```mermaid theme={"system"}
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#d1edff','primaryBorderColor':'#BDB8B2','primaryTextColor':'#003540','lineColor':'#BDB8B2'}}}%%
erDiagram
    DataImport ||--o{ Product : "IMPORTED_WITH"
    DataImport ||--o{ Material : "IMPORTED_WITH"
    DataImport ||--o{ Input : "IMPORTED_WITH"
    Product ||--o{ Input : "HAS_INPUT"
    Input ||--|| Material : "USING_SOURCE"
    Material ||--o| Company : "SUPPLIED_BY"
    Material ||--o| Dataset : "REFERENCES (after assignment)"
```

## Next steps

* [Troubleshooting](/docs/import/import-troubleshooting) - Resolve common import issues
