Skip to main content
personality_questionnaire

Administer, score and record validated personality and affect questionnaires.

GitHub Release PyPI CI Coverage Docs
Python Code style: ruff License


What this is

Collecting validated self-reports is the unglamorous half of an affective-computing pipeline. This package administers published psychometric instruments, scores them correctly, and records every response with the provenance needed to reproduce the score months later.

It is built around one idea: an instrument is data, not code. Items, response ranges, subscale membership and reverse keys are declared as values; a single vectorised scorer turns responses into scores without knowing which questionnaire it is holding. Adding an instrument adds no arithmetic.

Instruments

Key Instrument Items Scale Scores
bfi2 Big Five Inventory-2 60 1–5 5 domains, 15 facets
bfi2-xs BFI-2 Extra-Short Form 15 1–5 5 domains
bfi10 Big Five Inventory-10 10 1–5 5 domains
panas Positive and Negative Affect Schedule 20 1–5 Positive/Negative Affect
vasf Visual Analogue Scale to Evaluate Fatigue Severity 18 0–10 Fatigue, Energy, composite

BFI-2 and BFI-2-XS: Soto & John (2017). BFI-10: Rammstedt & John (2007). PANAS: Watson, Clark & Tellegen (1988). VAS-F: Lee, Hicks & Nino-Murcia (1991). See docs/instruments.md for full citations and licence notes.


Landing page of the Personality Questionnaire application: Landing page of the Personality Questionnaire application
BFI-10 loaded on the Questionnaire tab: BFI-10 loaded on the Questionnaire tab

Quickstart

Score responses you already have:

pip install personality_questionnaire
import personality_questionnaire as pq

result = pq.score(pq.get("bfi2"), answers)  # answers: (n_participants, 60)
result.by_level("domain")  # {"openness": array([...]), ...}
result.as_dict()  # one participant, every subscale

Administer one at the terminal:

pq list                                  # what is available
pq info bfi2                             # items, subscales, citation
pq run bfi2 --participant P01            # ask, score, and store
pq score bfi2 --input answers.csv        # score a file

Collect and export a study:

pip install "personality_questionnaire[ui]"          # adds the record store
pq run bfi2 --participant P01 --experiment study-a
pq records                                            # what is stored
pq export --shape long --output study-a.csv

Records go to ~/.personality_questionnaire/records.db unless PQ_DATABASE_URL says otherwise. See docs/storage.md.

Or collect through the application, which binds to localhost and never reaches the network:

pq ui        # http://127.0.0.1:8080

Five tabs: an overview, setup, the questionnaire itself, the computed scores, and every record collected so far with its exports. See docs/ui.md.

Try it without installing anything

A separate, stateless demo -- pick an instrument, answer it, see the scores plotted (a radar for the Big Five forms, a bar chart for PANAS and VAS-F). Nothing entered is stored. Local-first is the primary, supported way to run it -- both Hugging Face Space deployments below exist as optional extras and currently sit unpublished (see note).

Gradio version (demo/ -- never imports the database layer above, and tests/demo_app/test_isolation.py enforces that at CI time, not just in prose):

pip install "personality_questionnaire[demo]"
pq demo        # http://127.0.0.1:7860

React/TypeScript version (demo-react/ -- scoring reimplemented in TypeScript rather than running Python client-side; see docs/design.md for why):

make react-demo   # http://localhost:5173
Gradio demo: BFI-10 scored as a Big Five radar chart React demo: BFI-10 scored as a Big Five radar chart

Gradio demo (left) and React/TypeScript demo (right), both scoring the same BFI-10 responses.

Both are deployable to Hugging Face Spaces (make push-space for the Docker Gradio Space, make push-space-react for the static React Space), and both paths are implemented and tested. Deployment is currently on hold: as of 2026-09, Hugging Face requires billing credits on the account to run a Space's build step, even on the nominally-free static SDK tier, so neither Space is published right now. Once credits are added (or the React Space is switched to shipping a pre-built dist/ with no build step), either make target above publishes it.

How it works

flowchart LR
    I["instruments/<br/><i>pure data</i>"] --> R[registry]
    R --> S["scoring<br/><i>one vectorised scorer</i>"]
    S --> C[cli]
    S --> D[db]
    S --> U[ui]
Module Responsibility
registry.py Item, Subscale, Questionnaire — what an instrument is, plus validation
instruments/ One module per questionnaire. Data only, no arithmetic
scoring.py The single scorer: reverse-keying, subscale means, normalisation, pre/post deltas
io.py Reading and writing responses and scores
provenance.py Package version, git SHA, instrument hash for each record
db/ SQLAlchemy record store, and the JSON/wide/long export shapes
core/ Theme tokens, runtime settings, and the application's state
pages/, app.py The localhost data-collection application
cli/ pq list | info | run | score | records | export | ui

Design decisions

Instruments are Python literals, not data files. A literal is checked by the type checker, validated at import, and present in the wheel by construction. A shipped CSV is checked by nothing until a participant has already answered every item — and the two scale files this repo used to carry were never read by any code path and misspelled neuroticism, which is exactly how unread data drifts.

Reverse-keying belongs to the subscale, not the item. The VAS-F scores its five energy items forward in Energy and reversed in Fatigue (composite), so a per-item mask cannot express both. The reflection is folded into a signed weight matrix, which also means every subscale at every level is computed by one matrix multiplication.

Both hierarchy levels are declared flat. The BFI-2's five domains and fifteen facets are siblings, each listing its own item numbers, rather than domains being composed from facets. The arithmetic is identical and the flat form scores both levels in a single pass.

Polarity is recorded as data. Every subscale carries a higher_is string, so no consumer has to infer direction from a name — the inference that produced the bug below.

Development

make dev          # install everything
make fix          # format and autofix
make check        # lint, type-check, test, docs -- mirrors CI
make check-ci     # the same, in a throwaway venv built like CI's

Tests are unittest under coverage, mirroring the package layout in tests/.

Related work

PersonalityLinMulT predicts perceived Big Five traits from video. This package sits on the other side of that problem: it collects self-reported ground truth, on the same [0, 1] scale and in the same openness, conscientiousness, extraversion, agreeableness, neuroticism column order, so an exported BFI-2 record drops into a self-report-versus-perception comparison. The two are deliberately uncoupled in code — this package has no ML dependencies.

Citation

@software{fodor_personality_questionnaire,
  author = {Fodor, Ádám},
  title  = {personality_questionnaire: administering and scoring validated psychometric instruments},
  url    = {https://github.com/fodorad/personality_questionnaire},
}

Contact

Metadata

Release files for personality-questionnaire 2.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for personality-questionnaire 2.7.0
File Size Uploaded Provenance Actions
personality_questionnaire-2.7.0.tar.gz 78.3 kB With provenance Details for personality_questionnaire-2.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for personality-questionnaire 2.7.0
File Interpreter ABI Platform Actions
personality_questionnaire-2.7.0-py3-none-any.whl Python 3 none any Details for personality_questionnaire-2.7.0-py3-none-any.whl

Total release size: 180.1 kB

Release files / personality_questionnaire-2.7.0.tar.gz

Download URL personality_questionnaire-2.7.0.tar.gz
Size 78.3 kB
Tags Source
SHA-256 checksum
How to use checksums
438e546e41838a526bbcd576d5298ca5dd6209a1090148c78ab3f26c4835c613
BLAKE2b-256 checksum
How to use checksums
7d70b92daa385538c85108e8a8e72603ebb39859901717ce6f832e0236771a9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Release files / personality_questionnaire-2.7.0-py3-none-any.whl

Download URL personality_questionnaire-2.7.0-py3-none-any.whl
Size 101.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ee2d78d3347ad34e80466a394fb5a7663786f5c23da5e0fb298611e6eb66256
BLAKE2b-256 checksum
How to use checksums
848b00099ccedae2240c83e4eb7cf876202799978c1a09e3c651b092d98da7e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

Security for personality-questionnaire 2.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for personality_questionnaire-2.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page