# Heterogeneous supplier (R048)

The variety of items supplied by a tenderer is a high outlier.

## Methodology

This indicator requires awarded items to be classified using a hierarchy of numeric codes. For example, [UNSPSC](https://www.unspsc.org) and [CPV](https://simap.ted.europa.eu/cpv) have four primary levels.

::::{grid} 1 2 2 2

:::{grid-item-card} UNSPSC

| Digits | Level |
| - | - |
| **XX**000000 | Segment |
| **XXXX**0000 | Family |
| **XXXXXX**00 | Class |
| **XXXXXXXX** | Commodity |
:::

:::{grid-item-card} CPV

| Digits | Level |
| - | - |
| **XX**000000 | Division |
| **XXX**00000 | Group |
| **XXXX**0000 | Class |
| **XXXXX**000 | Category |
:::

::::

For each tenderer, the **variety** is calculated as the number of distinct first-level classifications across all items awarded to the tenderer, across all contracting processes. A tenderer is flagged if its variety is greater than or equal to the **upper fence** of $Q_3 + 1.5(IQR)$, where $Q_3$ is the third quartile and $IQR$ is the interquartile range for the set of varieties among tenderers awarded in at least 20 contracting processes.

:::{admonition} Example
:class: seealso

25% ($Q_1$) of bidders in Atlantis supply items in 1 product category. 75% ($Q_3$) of bidders supply items in at most 4 product categories. This yields an upper fence of 8.5 (9 in effect).

RentSeekers Inc. supplies items in 20 product categories. This is higher than the upper fence of 8.5. Therefore, RentSeekers Inc. is flagged.

:::

:::{admonition} Why is this a red flag?
:class: hint

A heterogeneous supplier is more likely to be unsuitable, increasing the risk of low value for money, low quality of delivery, and/or rent extraction.
:::

<small>Based on "Component C1B" in [*Design and measurement of a corruption risk index from a supplier perspective in the context of COVID-19 emergency*](https://www.estudiosanticorrupcion.org/wp-content/uploads/2021/02/IA-OCP-Working-PaperV3.pdf).</small>

## Output

The indicator's value is the **variety**, as a decimal.

## Configuration

All configuration is optional.

To override the default **upper fence**, add to your settings file, as a natural number:

```ini
[R048]
threshold = 10
```

If the first level of the classification hierarchy isn't coded as two digits, or if the first level is too broad, you can increase the number of digits. To override the default number of **digits**, add to your settings file, as a natural number:

```ini
[R048]
digits = 2 # default
```

If a tenderer is awarded in a small number of contracting processes, its variety is expected to be small. To minimize this correlation, the calculation of the upper fence considers only tenderers awarded in at least 20 contracting processes. To override this minimum number, add to your settings file, as a natural number:

```ini
[R048]
minimum_contracting_processes = 20 # default
```

## Exclusions

An active award is excluded if it is made to multiple suppliers.

## Demonstration

*Input*

:::{literalinclude} ../../../examples/R/048.jsonl
:language: json
:::

*Output*

```console
$ ocdscardinal indicators --settings docs/examples/R/048.ini --no-meta docs/examples/R/048.jsonl
{"Tenderer":{"F":{"R048":2.0}}}

```
