garment-aql-calculator
AQL (Acceptable Quality Limit) sampling calculator for garment industry quality control. Implements ISO 2859-1 — the universal standard for inspection by attributes used by every garment QC team globally.
Built and used in production by Scan ERP — a garment manufacturing ERP running on a 100+ machine CMT factory in Nepal.
Install
npm install garment-aql-calculator
Why this exists
Every garment factory QC team runs AQL sampling on every shipment. Existing tools (QIMA, HQTS, Tetra Inspection) are web-only — no programmatic library. This package fills that gap so ERP systems, QC apps, and custom dashboards can run AQL calculations natively.
Quick start
const { calculateAQL } = require('garment-aql-calculator');
const result = calculateAQL({
lotSize: 2400,
inspectionLevel: 'GII',
aql: 2.5,
});
console.log(result);
// {
// lotSize: 2400,
// inspectionLevel: 'GII',
// aql: 2.5,
// codeLetter: 'K',
// sampleSize: 125,
// acceptNumber: 7,
// rejectNumber: 8,
// decision: [Function]
// }
// Use the decision function with actual defects found
console.log(result.decision(5)); // 'ACCEPT' (5 ≤ 7)
console.log(result.decision(8)); // 'REJECT' (8 ≥ 8)
Full garment inspection (critical + major + minor)
Standard garment QC runs three AQL sampling plans simultaneously. Use the convenience function:
const { calculateGarmentInspection } = require('garment-aql-calculator');
const inspection = calculateGarmentInspection({
lotSize: 2400,
inspectionLevel: 'GII',
// Defaults — standard garment industry values
criticalAQL: 0.65,
majorAQL: 2.5,
minorAQL: 4.0,
});
console.log('Critical:', inspection.critical.sampleSize, 'accept', inspection.critical.acceptNumber);
console.log('Major:', inspection.major.sampleSize, 'accept', inspection.major.acceptNumber);
console.log('Minor:', inspection.minor.sampleSize, 'accept', inspection.minor.acceptNumber);
API
calculateAQL({ lotSize, inspectionLevel, aql })
| Param | Type | Default | Notes |
|---|---|---|---|
lotSize |
number | required | Total units in the production lot (≥ 2) |
inspectionLevel |
string | 'GII' |
One of S1, S2, S3, S4, GI, GII, GIII |
aql |
number | 2.5 |
One of 0.65, 1.0, 1.5, 2.5, 4.0, 6.5 |
Returns { codeLetter, sampleSize, acceptNumber, rejectNumber, decision }.
calculateGarmentInspection({ lotSize, inspectionLevel, criticalAQL, majorAQL, minorAQL })
Returns three AQL results — one for each defect tier.
getCodeLetter(lotSize, inspectionLevel)
Lower-level utility: returns just the ISO 2859 code letter.
ISO 2859 reference
| Inspection level | Use case |
|---|---|
| GI | Lower-risk products, smaller sample |
| GII | Default — most garment inspections |
| GIII | Higher-risk products, larger sample |
| S1, S2, S3, S4 | Special inspection levels for destructive or expensive testing |
| Garment defect tier | Standard AQL |
|---|---|
| Critical (safety, regulatory) | 0.65 |
| Major (workmanship affecting function) | 2.5 |
| Minor (cosmetic only) | 4.0 |
License
MIT — © 2026 Santosh Rijal / Scan ERP — https://scanerp.pro
Related packages
garment-smv-calculator— SMV/SAM time-studygarment-piece-rate— Piece-rate payment calculationgarment-bundle-id— Bundle ID generationgarment-dhu-calculator— Defects Per Hundred Unitsgarment-line-efficiency— Sewing line efficiencygarment-fabric-consumption— Fabric consumptiongarment-cmt-cost— CMT cost calculation
Metadata
Release files for garment-aql-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 | Provenance | Actions |
|---|---|---|---|---|
| garment_aql_calculator-1.0.0.tar.gz | 5.6 kB | Without provenance | Details for garment_aql_calculator-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| garment_aql_calculator-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for garment_aql_calculator-1.0.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / garment_aql_calculator-1.0.0.tar.gz
| Download URL | garment_aql_calculator-1.0.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be63c0e7654d5d95e7859f495fc4e13ea7666a1c9f49e86affa0bf8a0b1c6fa7
|
|
BLAKE2b-256 checksum How to use checksums |
ac761e5b06b206a68f32fe8091201966265ba51e7ed2e4abd351e525dc80b811
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.1
|
Release files / garment_aql_calculator-1.0.0-py3-none-any.whl
| Download URL | garment_aql_calculator-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5bf0ce566a120d35249ce3c8bbd9a53275b966f0b3f1d231349a8591767633f
|
|
BLAKE2b-256 checksum How to use checksums |
71d28f198edf6a2bacedb92193db8ed6323c259fcdf2479e08567964b1040fda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.1
|
Security for garment-aql-calculator 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.