Skip to main content

A modern, Pydantic-based parser for REFI-QDA (.qdpx) qualitative research files.

Project description

pyrefiqda

PyPI version Python Versions License: MIT

A modern Python library mapping REFI-QDA qualitative research files (.qdpx, .qdc) to strict Pydantic models for seamless programmatic integration.

Created to bridge the gap between qualitative coding software (NVivo, MAXQDA, ATLAS.ti) and Python workflows.

📖 Read the Full Documentation and API Reference here

Core Features

  • 100% Type-Hinted: Built entirely on Pydantic BaseModel classes, ensuring perfect IDE autocomplete and seamless integration with frameworks like PydanticAI.
  • Standard Compliant: Reads and writes .qdpx (Project) and .qdc (Codebook) formats.
  • Media Management: Includes helper functions to abstract away REFI-QDA's internal URI structures, making it easy to read transcripts and package media back into archives.

Installation

pip install pyrefiqda

Why this exists

In qualitative studies, researchers use the REFI-QDA standard to exchange data. However, previous Python tools were GUI-heavy or outdated. pyrefiqda uses xsdata to auto-generate pure Pydantic models directly from the official XML schemas. This abstracts away zipped archives and internal URIs, giving you flawless type-hinting and programmatic access to qualitative data.

Showcase

pyrefiqda makes it incredibly easy to programmatically assemble qualitative coding projects from scratch, package media files, and export standard .qdpx files ready for exchange and review.

import uuid
from pyrefiqda.refiproject import RefiProject
from pyrefiqda.models import (
    Project, UsersType, UserType, ProjectCodeBookType, 
    ProjectCodesType, ProjectCodeType, SourcesType, 
    TextSourceType, PlainTextSelectionType, CodingType, CodeRefType
)

# 1. Import a raw transcript into the REFI-QDA working directory
working_dir = "./temp_project"
internal_uri = RefiProject.import_source_file("raw_data/interview.txt", working_dir)

# 2. Define a Coder and an emergent Code
user = UserType(guid=str(uuid.uuid4()), name="Coder 1")
code = ProjectCodeType(
    guid=str(uuid.uuid4()), name="Theme 1", color="#FF0000"
)

# 3. Create a coding selection (e.g., characters 0 through 100)
selection = PlainTextSelectionType(
    guid=str(uuid.uuid4()),
    name="Identified Segment",
    start_position=0,
    end_position=100,
    creating_user=user.guid,
    coding=[CodingType(
        guid=str(uuid.uuid4()), 
        creating_user=user.guid, 
        code_ref=CodeRefType(target_guid=code.guid)
    )]
)

# 4. Assemble the final Pydantic Project
project = Project(
    name="GTM Study",
    users=UsersType(user=[user]),
    code_book=ProjectCodeBookType(codes=ProjectCodesType(code=[code])),
    sources=SourcesType(text_source=[
        TextSourceType(
            guid=str(uuid.uuid4()), 
            name="Interview 1", 
            plain_text_path=internal_uri, 
            plain_text_selection=[selection]
        )
    ])
)

# 5. Export to a standard .qdpx file (zipping the XML and the media files together)
RefiProject.save(project, "study.qdpx", source_media_dir=working_dir + "/sources")

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

pyrefiqda-0.3.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

pyrefiqda-0.3.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file pyrefiqda-0.3.1.tar.gz.

File metadata

  • Download URL: pyrefiqda-0.3.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pyrefiqda-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e92aab320a3ca9320c17857208dce65c7846f248dfdfeea2b7318bf4198c6526
MD5 14477f143ac50eb5103c39f28cb80862
BLAKE2b-256 f0398b9c196bed705bee6ae6f686ec36060d0955eb7235dfa4d697da54bfbe95

See more details on using hashes here.

File details

Details for the file pyrefiqda-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pyrefiqda-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pyrefiqda-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97911c35aeb86b3305abd94f358dd75a79dc20ab3693e466c231b8e8685eb1c1
MD5 02a3b6bdc173a6b5d7b39add3dcd3ef5
BLAKE2b-256 4d9b5275456def1f72dee8a1d692a60fe97005de9145ed77a729204a86cabad8

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