garment-dhu-calculator
DHU (Defects Per Hundred Units) calculator for garment industry quality control.
The standard daily QC metric used across CMT factories worldwide. Built and used in production by Scan ERP.
Install
pip install garment-dhu-calculator
What is DHU?
DHU = (Total defects found / Total garments inspected) × 100
CRITICAL distinction: DHU counts defects, not defective pieces. One garment can have multiple defects — all are counted.
Example: A checker inspects 250 garments, finds 20 defective pieces with 35 total defects. DHU = (35 / 250) × 100 = 14
Usage
from garment_dhu_calculator import (
calculate_dhu,
calculate_dhu_by_type,
aggregate_daily_dhu,
classify_dhu,
)
# Basic DHU
calculate_dhu(defects_found=35, garments_inspected=250)
# → 14.0
# DHU broken down by defect type
calculate_dhu_by_type(
defects_by_type={"broken-stitch": 12, "sizing": 8, "color-shade": 15},
garments_inspected=250,
)
# → {"total": 14.0, "by_type": {"broken-stitch": 4.8, "sizing": 3.2, "color-shade": 6.0}, ...}
# Daily aggregate across multiple checkers
aggregate_daily_dhu([
{"defects_found": 12, "garments_inspected": 80, "checker": "Sita"},
{"defects_found": 18, "garments_inspected": 120, "checker": "Ram"},
{"defects_found": 5, "garments_inspected": 50, "checker": "Gita"},
])
# → {"total_defects": 35, "total_garments": 250, "dhu": 14.0,
# "by_checker": {"Sita": 15.0, "Ram": 15.0, "Gita": 10.0}}
# Industry benchmark classification
classify_dhu(14) # → 'ACCEPTABLE'
classify_dhu(3) # → 'EXCELLENT'
classify_dhu(30) # → 'CRITICAL'
Industry benchmarks
| DHU range | Classification |
|---|---|
| ≤ 5% | EXCELLENT |
| ≤ 10% | GOOD |
| ≤ 15% | ACCEPTABLE |
| ≤ 25% | POOR |
| > 25% | CRITICAL |
Related
- garment-aql-calculator — ISO 2859-1 AQL sampling
- garment-smv-calculator — SMV / SAM calculation
- garment-piece-rate — piece-rate payment
License
MIT © Santosh Rijal / Scan ERP
Release files for garment-dhu-calculator 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| garment_dhu_calculator-1.0.0.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| garment_dhu_calculator-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 kB
Release files / garment_dhu_calculator-1.0.0.tar.gz
| Download URL | garment_dhu_calculator-1.0.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67e88319ad3cebec99eabdb5d7e0ed607bc78149a4f57bafd5a01c45da0fe940
|
|
BLAKE2b-256 checksum How to use checksums |
ddd2b6bfbd185203806d4ee56e739694d164820cd2fcededda50d2e4215af836
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.1
|
Release files / garment_dhu_calculator-1.0.0-py3-none-any.whl
| Download URL | garment_dhu_calculator-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41d5775eb171f0e92a729771952b1061f2957c69db28d190f731b45d0c7a04f1
|
|
BLAKE2b-256 checksum How to use checksums |
645343a6dfeac931ee74184ae103d513bf0288f3da2a49a503e02e504fdbc13f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.1
|