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 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.

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.2.0.tar.gz (38.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.2.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qdas_parser-0.2.0.tar.gz
  • Upload date:
  • Size: 38.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.2.0.tar.gz
Algorithm Hash digest
SHA256 a39d07f9726a49f234c037524485adb7cb7a1d9574911003a1d149ea89e44e0d
MD5 ea9c398b2e45c939f93126178ffac942
BLAKE2b-256 73de6e0764900840b3461df8d844deeff97cdf3b2ddf3285f7884bf38c41d5d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qdas_parser-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f05d0a523d0c6d05f86191eba563d54cb7326ac843f5c55cbc9cf6b43a2cebb
MD5 d8d3b1d0f7a679d5c0da4ec9650db69a
BLAKE2b-256 d0aaa071faae1c5896bdad5f2173f7a106d24194b3f9d3667d98bbd93c7fd950

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