Skip to content
v0.1.3latest release121 skills4 categories6 sub-categories247 tested scripts397 reference docsContact us
scripts/ppap_package.py
#!/usr/bin/env python3
"""List the 18 PPAP elements to submit or retain for a submission level (AIAG PPAP 4th edition, Table 4.2)
and check which are missing.

S = submit to the customer, R = retain at the supplier and make available, * = as the customer defines
(level 4). Level 5 means complete data reviewed at the supplier's site.

Usage:
    python ppap_package.py --level 3
    python ppap_package.py --level 3 --have have.txt            # one element number or name per line
    python ppap_package.py --level 2 --no-appearance --no-design

Exit codes: 0 package complete (or no --have given), 1 elements to submit are missing, 2 usage error.
"""

import argparse
import re
import sys

# (number, element, requirement per level 1..5)
ELEMENTS = [
    (1, "Design records", "RSS*R"),
    (2, "Authorized engineering change documents", "RSS*R"),
    (3, "Customer engineering approval", "RRS*R"),
    (4, "Design FMEA", "RRS*R"),
    (5, "Process flow diagram", "RRS*R"),
    (6, "Process FMEA", "RRS*R"),
    (7, "Control plan", "RRS*R"),
    (8, "Measurement system analysis studies", "RRS*R"),
    (9, "Dimensional results", "RSS*R"),
    (10, "Material and performance test results", "RSS*R"),
    (11, "Initial process studies", "RRS*R"),
    (12, "Qualified laboratory documentation", "RSS*R"),
    (13, "Appearance approval report", "SSS*R"),
    (14, "Sample production parts", "RSS*R"),
    (15, "Master sample", "RRR*R"),
    (16, "Checking aids", "RRR*R"),
    (17, "Customer-specific requirements records", "RRS*R"),
    (18, "Part submission warrant (PSW)", "SSSSR"),
]
LEVELS = {1: "PSW only (plus appearance approval report for appearance items)",
          2: "PSW with product samples and limited supporting data",
          3: "PSW with product samples and complete supporting data (default)",
          4: "PSW and other requirements as defined by the customer",
          5: "PSW with product samples and complete supporting data reviewed at the supplier's site"}
ALIASES = {"psw": 18, "aar": 13, "dfmea": 4, "pfmea": 6, "msa": 8, "gage r&r": 8, "pfd": 5, "cp": 7,
           "ecn": 2, "cpk": 11, "ppk": 11, "csr": 17}
WORD = {"S": "submit", "R": "retain", "*": "as customer defines"}


def parse_have(path):
    text = sys.stdin.read() if path == "-" else open(path, encoding="utf-8").read()
    have = set()
    for line in text.splitlines():
        line = line.strip().lower()
        if not line:
            continue
        m = re.match(r"^(\d{1,2})\b", line)
        if m:
            have.add(int(m.group(1)))
            continue
        if line in ALIASES:
            have.add(ALIASES[line])
            continue
        have.update(n for n, name, _ in ELEMENTS if line in name.lower() or name.lower() in line)
    return have


def main():
    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    ap.add_argument("--level", type=int, choices=range(1, 6), default=3)
    ap.add_argument("--have", help="file listing elements already prepared (number or name per line), or -")
    ap.add_argument("--no-appearance", action="store_true", help="part has no appearance requirements (element 13 n/a)")
    ap.add_argument("--no-design", action="store_true", help="supplier has no design responsibility (element 4 n/a)")
    a = ap.parse_args()
    try:
        have = parse_have(a.have) if a.have else None
    except OSError as e:
        print(f"error: {e}", file=sys.stderr)
        return 2
    print(f"PPAP level {a.level}: {LEVELS[a.level]}\n")
    print(f"{'#':>2}  {'Element':<42}{'Requirement':<22}" + ("Status" if have is not None else ""))
    missing_s, missing_r = [], []
    for n, name, req in ELEMENTS:
        r = req[a.level - 1]
        if (n == 13 and a.no_appearance) or (n == 4 and a.no_design):
            print(f"{n:>2}  {name:<42}{'n/a':<22}")
            continue
        status = ""
        if have is not None:
            status = "ready" if n in have else "MISSING"
            if n not in have:
                (missing_s if r == "S" else missing_r).append(f"{n} {name}")
        print(f"{n:>2}  {name:<42}{WORD[r]:<22}{status}")
    if a.level == 4:
        print("\nLevel 4: confirm with the customer which elements to submit (marked 'as customer defines').")
    if have is None:
        return 0
    print()
    if missing_s:
        print("Missing, must be SUBMITTED: " + "; ".join(missing_s))
    if missing_r:
        print("Missing, must be RETAINED and available: " + "; ".join(missing_r))
    if not (missing_s or missing_r):
        print("Package complete for this level.")
    return 1 if missing_s else 0


if __name__ == "__main__":
    sys.exit(main())
More in Quality Management & ISO 9001

8d-problem-solving-report-writer

Write and review 8D problem-solving reports for customer complaints and serious nonconformities (automotive and aerospace practice: Ford Global 8D, VDA, GM, Stellantis formats): D0 emergency response, D1 cross-functional team and champion, D2 problem description with 5W2H and is / is-not and no cause in the statement, D3 interim containment within 24 hours with verification and clean point, D4 verified occurrence and escape (non-detection) root causes plus systemic cause, D5 permanent corrective actions for each cause verified before implementation, D6 implementation, validation with production data and removal of containment, D7 PFMEA, control plan and read-across to similar products, D8 closure and recognition. Checks an 8D discipline by discipline for missing content, human-error root causes, missing escape cause or action, late containment and dates out of order.

acceptance-sampling-plan-selector

Select and evaluate acceptance sampling plans for incoming, in-process and final inspection: ANSI/ASQ Z1.4 / ISO 2859-1 single sampling under normal inspection (code letter from lot size and inspection level I, II, III, S-1 to S-4; sample size, Ac and Re from AQL, following the table's arrows to the correct plan; 100% when n reaches the lot size; AQLs above 10 per 100 units), operating characteristic curves (Pa at any quality, producer's quality level, indifference point, LTPD, AOQ and AOQL, binomial or hypergeometric), plans designed from producer and consumer risk, and c = 0 zero-acceptance plans. Covers AQL choice by defect class, switching rules between normal, tightened and reduced inspection, when sampling is not appropriate, and random sampling.

approved-supplier-list-manager

Manage and audit an approved supplier list (ASL) / external provider register for ISO 9001 8.4.1, IATF 16949 8.4 and AS9100 8.4.1: supplier status (approved, conditional, probation, pending, disqualified), scope of approval by commodity and process, risk class, certification and expiry, re-evaluation intervals by risk, conditions with end dates, single-source contingency, approver and customer-directed sources. Audits the list for expired or expiring certificates, overdue re-evaluations, conditional or probation status past its decision date, high-risk suppliers without the required certification, single-source suppliers without backup and missing approvers, and checks purchase orders for suppliers that are off-list, disqualified or pending, or buying outside the approved scope. Covers ERP blocks, PO requirements, off-list and emergency purchases.

apqp-phase-planner

Plan and track Advanced Product Quality Planning (AIAG APQP 3rd edition, IATF 16949) for a new or changed automotive part: back-schedule the five phases (plan and define, product design, process design, product and process validation, launch and feedback) from the start-of-production date by program complexity, with overlap, PPAP lead and safe-launch period; list the deliverables and gate for each phase (DFMEA, DVP&R, feasibility, process flow, PFMEA, control plans, MSA, Ppk, run at rate, PPAP, safe launch, lessons learned); adjust for build-to-print suppliers; flag compressed timelines and late or untracked deliverables against a status list. Covers gate reviews, red/yellow/green status reporting, run at rate and safe-launch exit criteria.

as9100-gap-analyzer

Run an AS9100D / EN 9100:2018 gap analysis for aviation, space and defence suppliers on the requirements added to ISO 9001: on-time delivery and conformity focus, management representative, ethics and human-factors awareness, operational planning and operational risk management, configuration management, product safety, counterfeit-part prevention, special requirements, critical items and key characteristics, external provider register and flow-down, FOD prevention, tooling and NC program control, special process validation, first article inspection (AS9102), traceability, in-service data and nonconforming product control. Generates and scores a worksheet, grades missing core controls as major, and checks invalid n/a claims. Covers AS9101/AS9104, OASIS, AS9102 FAI forms, counterfeit standards (AS5553, AS6174, AS6081), NADCAP and the planned IA9100 transition.

audit-report-writer

Write internal, supplier and pre-certification audit reports with the content ISO 19011:2018 6.5 expects: audit objectives, scope, criteria with revisions, dates, team and auditees, method and sampling statement, specific strengths, findings table and three-part finding details (requirement, evidence, statement), conclusion on the degree of fulfilment of criteria, diverging opinions, follow-up deadlines and distribution. Builds a Markdown report from a JSON audit record, generates the conclusion from the findings (major / minor / none) and flags reports missing required content or findings without clause or evidence. Covers conclusion wording, closing meetings, response expectations and verifying corrective actions.