Skip to main content

A Python parser for the Q-DAS ASCII Transfer Format (V12). Reads .dfd description files and .dfx/.dfb value files, decodes K-Field metadata, and returns structured pandas DataFrames for downstream quality analysis.

Project description

qdas-parser

A Python parser for the Q-DAS ASCII Transfer Format (V12).
Reads .dfd description files paired with .dfx (process) or .dfb (batch) value files, decodes K-Field metadata, and returns structured pandas DataFrames ready for downstream quality analysis.


Features

  • Parse Q-DAS .dfd + .dfx/.dfb file pairs into tidy pandas DataFrames
  • Full K-Field decoding — field names and coded values translated via bundled qdas.toml
  • MultiIndex columns (module, feature) for easy slicing across assembly lines
  • Production order normalisation via format_order() / ProductionOrder
  • Optional test-cell detection through an injected module map
  • Pure Python — no compiled extensions required
  • Typed API with __slots__ throughout for low-memory footprint

Requirements

Dependency Version
Python ≥ 3.13
pandas ≥ 3.0
numpy ≥ 2.4
python-dateutil ≥ 2.8

Installation

pip install qdas-parser

Quick start

from pathlib import Path
from qdas_parser import QDASFileParser

qdas = QDASFileParser(
    Path("data/bd/m01/2603160002.dfd"),
    product="ACT1",
)
qdas.parse_description()
qdas.parse_values()

df  = qdas.dataframe()   # measurement data as MultiIndex DataFrame
dfm = qdas.metadata()    # feature metadata as MultiIndex DataFrame

The DataFrame index is ['Teilenummer', 'Auftrag', 'Teile ID'].
Columns are a two-level MultiIndex: (module_name, feature_label).


File format overview

A Q-DAS measurement set consists of two files sharing the same stem:

File Role
<stem>.dfd Description file — K-Field header and feature metadata
<stem>.dfx Value file for process data (.dfx)
<stem>.dfb Value file for batch data (.dfb)

Each line in the .dfd file is a K-Field:

K0100 3               ← number of features
K1001 1234567         ← part number (Teilenummer)
K2002/1 Diameter      ← feature 1 label
K2142/1 mm            ← feature 1 unit

Public API

QDASFileParser

Main entry point.

from qdas_parser import QDASFileParser

parser = QDASFileParser(
    description_file="2603160002.dfd",
    product="ACT1",
    kind="bd",                          # 'bd' | 'pc' — inferred from path if omitted
    tc_modules={"ACT1": {"as1": ["tc1_bd", "tc2_bd"]}},
    tc_shortcut="TC",
)
parser.parse_description()
parser.parse_values()

df  = parser.dataframe()
dfm = parser.metadata()

format_order

Normalise raw order numbers from any source to a 12-digit zero-padded string:

from qdas_parser import format_order

df["order"] = df["order"].map(format_order)
# '1234567'  →  '000001234567'
# 1234567    →  '000001234567'
# ''         →  ''

ProductionOrder

A lightweight value object wrapping a formatted order number:

from qdas_parser import ProductionOrder

po = ProductionOrder("1234567")
str(po)       # '000001234567'
int(po)       # 1234567
bool(po)      # True
po == 1234567 # True  — comparison normalises both sides

KField

Low-level K-Field model, useful for custom description-file processing:

from qdas_parser import KField

kf = KField.from_line("K2002/1 Diameter\n")
kf.key            # 'K2002'
kf.value          # 'Diameter'
kf.feature_number # 1
kf.feature_index  # 0  (zero-based)

name, value = kf.decode()

QDAS constants

from qdas_parser import QDAS

QDAS.SEP_F          # feature separator character (ASCII 15)
QDAS.SEP_E          # extension separator character (ASCII 20)
QDAS.INDEX_COLUMNS  # ['Teilenummer', 'Auftrag', 'Teile ID']
QDAS.ORDER          # 'Auftrag'
QDAS.PART_ID        # 'Teile ID'

Running the tests

pip install pytest pytest-benchmark
pytest tests/

Benchmarks only:

pytest tests/bench_fast.py --benchmark-only -v

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qdas_parser-0.1.0.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qdas_parser-0.1.0-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file qdas_parser-0.1.0.tar.gz.

File metadata

  • Download URL: qdas_parser-0.1.0.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.8 CPython/3.12.3 Windows/11

File hashes

Hashes for qdas_parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d575059c80b5493724a66724278ae67214318bc48b95c5f1e6423a6bace5b53d
MD5 17cfef69344d9313a9fb0b14b56a46ac
BLAKE2b-256 d111943967a812f9cde0daa1be7130fe7f09b7e2695be432c3b3ac5158283b7a

See more details on using hashes here.

File details

Details for the file qdas_parser-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qdas_parser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.8 CPython/3.12.3 Windows/11

File hashes

Hashes for qdas_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c66cc2ab7a6c04877e46111e98590e7bae7b31e84fc96f0492bf4d863aa196b
MD5 47e38b2f4e8657096bc1215e69f63a57
BLAKE2b-256 c8b52bd9047b4271528829a2e5b94c5a19198b94a8ef8c14bf8cb459b9935018

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page