# Excessive disqualified bids (R038)

The ratio of disqualified bids to submitted bids is a high outlier per buyer, procuring entity or tenderer.

:::{seealso}
{doc}`035`
:::

## Methodology

For each buyer, the **ratio** is calculated as $numberOfBidsDisqualifiedByBuyer \over numberOfBidsSubmittedToBuyer$ across all contracting processes. A buyer is flagged if its ratio 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 ratios.

For each procuring entity, the **ratio** is calculated the same as for buyers.

For each tenderer, the **ratio** is calculated as $numberOfBidsDisqualifiedForTenderer \over numberOfBidsSubmittedByTenderer$ across all contracting processes. A tenderer is flagged if its ratio 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 ratios.

:::{admonition} Example for a buyer or procuring entity
:class: seealso

25% ($Q_1$) of buyers in Atlantis disqualify at most 2% of bids received. 75% ($Q_3$) of buyers disqualify at most 22% of bids received. This yields an upper fence of 52%.

The State Water Corporation disqualified 59% of bids received. This is more than the upper fence of 52%. Therefore, the State Water Corporation is flagged.
:::

:::{admonition} Example for a tenderer
:class: seealso

25% ($Q_1$) of bidders in Atlantis have no disqualified bids. 75% ($Q_3$) of bidders have at most 24% disqualified bids. This yields an upper fence of 60%.

73% of the bids submitted by MisconductCorp were disqualified. This is higher than the upper fence of 60%. Therefore, MisconductCorp is flagged.
:::

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

A corrupt buyer or procuring entity can award pre-determined bidders by disqualifying other bidders' bids.

A colluding bidder can mimic competition by submitting deliberately unqualified bids.
:::

<small>Based on "Excluding qualified bidders" in [*Guide to Combating Corruption & Fraud in Infrastructure Development Projects*](https://guide.iacrc.org/potential-scheme-excluding-qualified-bidders/) and [*Behind the Scenes of ProZorro: Does Ukrainian business trust public procurement?*](https://ti-ukraine.org/wp-content/uploads/2019/11/Behind-the-Scenes-of-ProZorro.-Does-Ukrainian-business-trust-public-procurement.pdf).</small>

## Output

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

If the ``--map`` command-line flag is set, the ``Maps`` key contains:

ocid_buyer_r038
: The buyer for each `ocid` in which at least one bid is disqualified.

ocid_procuringentity_r038
: The procuring entity for each `ocid` in which at least one bid is disqualified.

## Configuration

All configuration is optional.

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

```ini
[R038]
threshold = 0.5
```

Tenderers with fewer than 2 submitted bids are excluded. If you observe many false positives among tenderers with few submitted bids, you can increase this minimum. To override this minimum number, add to your settings file, as an integer:

```ini
[R038]
minimum_submitted_bids = 2 # default
```

Buyers and procuring entities with fewer than 2 contracting processes are excluded. If you observe many false positives among organizations with few contracting processes, you can increase this minimum. To override this minimum number, add to your settings file, as an integer:

```ini
[R038]
minimum_contracting_processes = 2 # default
```

:::{hint}
Put all properties under one `[R038]` section.
:::

## Assumptions

This indicator assumes that `/buyer/id`, `/tender/procuringEntity/id` and `/bids/details[]/tenderers[]/id` are stable across contracting processes.

:::{note}
Is this assumption not true for your data? Please contribute to GitHub issue [#32](https://github.com/open-contracting/cardinal-rs/issues/32).
:::

## Demonstration

*Input*

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

*Output*

```console
$ ocdscardinal indicators --settings docs/examples/settings.ini --no-meta docs/examples/R/038.jsonl
{"Buyer":{"B":{"R038":0.5}}}

```
