# 008. Order size and fulfillment workload

**Question:** How does product variety per invoice relate to order value and units to handle?

## Result

The largest computed metric is 384 for (50.0, inf]; the smallest is 12 for (0.0, 1.0]. Metric: median_units (Units per invoice).

Distinct codes measure variety, not package count; bulk buyers can dominate units.

![Order size and fulfillment workload](outputs/chart.png)

| item_band | orders | median_units | median_value_gbp |
| --- | --- | --- | --- |
| (0.0, 1.0] | 1641 | 12 | 45 |
| (1.0, 5.0] | 2867 | 56 | 122.4 |
| (10.0, 25.0] | 6660 | 172 | 309.4 |
| (25.0, 50.0] | 3711 | 255 | 453.1 |
| (5.0, 10.0] | 2979 | 98 | 189.2 |
| (50.0, inf] | 2102 | 384 | 836.4 |

The chart shows 6 of 6 result rows; the table previews the first 6 in the analysis-defined order. [Download the full result table](outputs/results.csv). Numerical values are computed from the source; missing results stay unavailable.

## Method

Aggregate invoice lines before calculating order-size bands.

The study uses shared source preparation and reusable statistical routines. Its specific transformations are in [analysis.py](analysis.py), and common model/evaluation code is in [portfolio/methods.py](../../portfolio/methods.py). The [notebook](analysis.ipynb) executes the study and displays the saved results.

## Decision and limitations

Compare handling effort across order types once packing-time and fulfillment-cost records are available.

Historical invoice lines; credits are not reliably matched to original sales. Gross purchases are not profit. Unidentified customers cannot support customer-level conclusions. Exact repeated lines remain unless the study explicitly compares removal. 

Related studies may share observations or holdouts. These are focused analytical studies, not independent replications or deployed business systems. Any model refinements informed by these results need new untouched evaluation data. No commercial impact is inferred from an association or backtest.

## Reproduce

From the repository root, after installing `requirements.txt`:

```powershell
python projects/008-order-size-and-fulfillment-workload/analysis.py
```

Source data are downloaded automatically if absent. Original archives are retained unchanged and checked by SHA-256. The cleaned cache normalizes column names; field-specific changes are visible in [data preparation](../../portfolio/data.py). Runtime evidence is in [receipt.json](outputs/receipt.json).

## Source

[Online Retail](https://archive.ics.uci.edu/dataset/352/online+retail), Chen (2015). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/retail.json) and [prepared-data audit](../../data/provenance/retail_prepared.json) record the downloaded files, field coverage and hashes.
