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/.dfbfile pairs into tidy pandas DataFrames - Full K-Field decoding — field names and coded values translated via typed Python registries (
REQUIRED,DEFINED,SUPPORTED,CATALOG) - 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 ['Auftragsnummer', 'Seriennummer'].
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",
index_columns=["Auftragsnummer", "Seriennummer"], # default; customise as needed
)
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.TIMESTAMP # 'Zeitstempel'
QDAS.ORDER # 'Auftragsnummer'
QDAS.PART_ID # 'Seriennummer'
Running the tests
pip install pytest pytest-benchmark
pytest tests/
Benchmarks only:
pytest tests/bench_fast.py --benchmark-only -v
License
MIT — see LICENSE.
Metadata
Release files for qdas-parser 0.3.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 | |
|---|---|---|---|
| qdas_parser-0.3.0.tar.gz | 39.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qdas_parser-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.0 kB
Release files / qdas_parser-0.3.0.tar.gz
| Download URL | qdas_parser-0.3.0.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd5d87db35f778a2d4d38dcdd872d4b8d3f8ed931f8c53b38826a08421303bbc
|
|
BLAKE2b-256 checksum How to use checksums |
e10957fb912cddb39a2212eefe3612b051a42ded1c14d9c6817c614406d4f086
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.28.0 CPython/3.12.3 Windows/11
|
Release files / qdas_parser-0.3.0-py3-none-any.whl
| Download URL | qdas_parser-0.3.0-py3-none-any.whl |
|---|---|
| Size | 34.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c2b93fcf7357f2355f2dfe478c28c51779191b1cf50c88a158dbd8ab7246ada
|
|
BLAKE2b-256 checksum How to use checksums |
71320945e8f0451e9020a906e5e463823e59ebb23d3c59369796fddc0449ef2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.28.0 CPython/3.12.3 Windows/11
|