qe-refi-qda 0.1.2 0.1.2.9001

Development build 0.1.2.9001, built from main: its README, dependencies and API documentation may describe changes that are not released. For the latest release, see qe-refi-qda 0.1.2.

REFI-QDA projects (.qdpx from NVivo, ATLAS.ti, MAXQDA, QualCoder) as utterance × code tables

Python >=3.9 · License: MIT · API documentation · Source code

Also available for npm: @qe-libs/refi-qda

Install

pip install --extra-index-url https://qe-libs.org/py/dev/simple/ qe-refi-qda
uv add qe-refi-qda --index qe-libs-dev=https://qe-libs.org/py/dev/simple/

Versions

Links in the wheel columns are the Python versions each wheel supports; pip and uv pick the right file automatically.

VersionPublishedSourceWheel
all platforms
0.1.2.90012026-11-11.tar.gzpy3
0.1.22026-11-11.tar.gzpy3
0.1.12026-11-10.tar.gzpy3
0.1.02026-11-10.tar.gzpy3

Dependencies

For 0.1.2.9001.

Description

qe-refi-qda

Reads REFI-QDA projects (.qdpx, exported by NVivo, ATLAS.ti, MAXQDA, QualCoder and others) into the table ENA works on: one row per utterance, a 0/1 column per code. A port of the JavaScript package @qe-libs/refi-qda: the same functions, the same output byte for byte, tested on the same fixtures. Pure Python, no dependencies.

pip install qe-refi-qda --extra-index-url https://qe-libs.org/py/simple/

Then import refi_qda. Releases are on qe-libs.org (the PEP 503 index at py/simple/; dev builds of every push to main at py/dev/simple/), published by cranqe.

Use

from refi_qda import to_csv

r = to_csv("project.qdpx", coder="any")
r.csv          # CSV text
r.fields       # column names
r.rows         # one list per row
r.report       # counts, coders, notes, skipped sources
r.coders       # the project's coders by name

to_csv and read_project take a path, bytes, a bytes-like object or an open binary file.

coder chooses whose coding becomes the code columns, for projects coded by more than one person (see coders_of):

coder Rows A line is 1 for a code when…
'any' (default) one per utterance any coder coded it
'all' one per utterance every coder coded it
'each' one per utterance per coder, with a Coder column that row's coder coded it
'columns' one per utterance; each code once per coder, Code [Coder A] that column's coder coded it
a coder's name or GUID one per utterance that coder coded it

unit="sentence" makes each sentence a row (a Sentence column follows Line); lines="all" keeps lines without a Speaker: prefix, with the previous speaker; min_overlap=2 ignores spans that reach two characters or fewer into a row. They are the JS library's unit, lines and minOverlap, with the same output. unit may also be a callable (text, start) -> [(start, end, text)] that splits a line's text itself.

For pandas:

from refi_qda import read_project, to_table

df = to_table(read_project("project.qdpx"), coder="each").to_pandas()
Function Returns
read_project(data) Project: name, users (GUID → name), codes (Code(guid, name, parent, codable, description, parent_guid)), sources (text, variables, coded spans), skipped
coders_of(project) [Coder(guid, name, spans)]: who coded something, and how many coded spans
to_table(project, coder=, unit=, lines=, min_overlap=) Table(fields, rows, report), with .to_pandas(); report["codebook"] is the hierarchy as [{name, parent}] per code column
to_csv(data, coder=, unit=, lines=, min_overlap=) CSVResult: csv, fields, rows, report, coders, text_column
write_csv(fields, rows) CSV text

The XML inside a .qdpx is parsed with the standard library, with any document type declaration refused: a REFI-QDA project declares no DTD or entities, and refusing them rules out entity-expansion bombs and external entity references from an untrusted file.

Errors are QdaErrors with a .code: not-zip, no-project, bad-xml, no-coder, misaligned, no-sources. Their messages are written for the person importing.

The table's columns, how lines become rows, the codebook hierarchy in report["codebook"], and how coded positions are checked and read are described in the main README.

Develop

cd python
pip install -e '.[test]'
pytest

The tests use ../tests/fixtures/, shared with the JavaScript tests.

Release

The Python package releases on its own tag, apart from the npm package:

# set version = "X.Y.Z" in python/pyproject.toml, commit, then
git tag python/vX.Y.Z && git push origin python/vX.Y.Z

CI checks the tag against python/pyproject.toml, then cranqe builds the wheel and sdist and publishes them to qe-libs.org. A bare vX.Y.Z tag releases only the npm package.

All files and SHA-256 hashes (8)
FileSizeSHA-256
qe_refi_qda-0.1.2.9001.tar.gz17.5 KB9be53196d737a05b25cfeab64f683a454b1266aeea82ad2e6447853cfcff2e0a
qe_refi_qda-0.1.2.9001-py3-none-any.whl12.9 KB136d33bcab8814c9b238fec7c9cdf8f04b0735a92b0ded7812388c37dd461a6c
qe_refi_qda-0.1.2.tar.gz17.5 KB485f80b2fc1a8c8d0c817233764114743103344c315836cc5db0eca3635d3e8a
qe_refi_qda-0.1.2-py3-none-any.whl12.9 KBb141c2182252f9a135d9a45be57e6c7bbf52743daa585c3f8c4c7c475b25d7ca
qe_refi_qda-0.1.1.tar.gz14.3 KB5433dc6f9bf1942e1abbd0b7371cd580ec3a81a81adde1384a787e63dddc0b92
qe_refi_qda-0.1.1-py3-none-any.whl10.9 KB41d62ec581a296f32ef23f3e1dee3772afd95b5fd232e1e31173f62cb53425f9
qe_refi_qda-0.1.0.tar.gz13.2 KB931fe47e9de97a6b5dcb89d61f5f0ec4c3de1fc0da2f63a2b03bcaf68c90e06d
qe_refi_qda-0.1.0-py3-none-any.whl10.5 KB8bd30375c546af1fa2dd6f4eb9c4f5c071b8eee2974be403b57f2a865a5f428c