afya-medqol
Computes the Afya MedQoL Physician quality-of-life index from instrument responses — practicing physicians (13 items, 3 domains) — with 100% deterministic scoring (fixed quadrature, no random seed).
Calibration parameters are frozen in source code
(parameters_physician.py) —
there is no external file (CSV/Excel) read at runtime.
Installation
pip install afya-medqol
Three-dimensional Samejima GRM (Graded Response Model) with EAP (Expected A Posteriori) scoring. Calibration frozen at 2024_2 (Gobbo Jr M et al., BMJ Open 2025;15:e102783), with independent domains (Σ = I): each domain (F1, F2, F3) works as its own ruler — zeroing or excluding items from one domain does not affect the others.
| Domain | Construct | Items |
|---|---|---|
| F1 | Quality of Life | 6 items (F1_1_enjoymentoflife, F1_2_financialsufficiency, F1_3_accesstoinformation, F1_4_leisureopportunities, F1_5_mobilitypast2weeks, F1_6_accesstohealthservices) |
| F2 | Institutional Support / Work Perception | 4 items (F2_1_technicaltraining, F2_2_mentalhealthsupport, F2_3_coworkersupportnetwork, F2_4_educationalhandlingoferrors) |
| F3 | Perceived Stress | 3 items (F3_1_stresshurtsperformance, F3_2_stressledtoerrors, F3_3_stresshurtsrelationships) |
The global score combines the three domains (F3 reversed only in this composite) with weights proportional to each factor's discrimination (Σ|a|).
Library usage
import pandas as pd
from afya_medqol import MedQoLPhysicianCalculator
df_responses = pd.read_csv("responses.csv")
calc = MedQoLPhysicianCalculator()
result = calc.score_batch(df_responses)
print(result[["theta_global", "T_score_global"]])
Scoring a single respondent:
result = calc.score_physician({
"F1_1_enjoymentoflife": 4,
"F1_2_financialsufficiency": 3,
# ... remaining items (see afya_medqol.ITENS_TODOS)
})
print(result["theta_global"], result["T_score_global"])
To look up the original questionnaire wording for any item, use
ITEM_QUESTIONS (a plain dict keyed by item, then by language code —
"en" or "pt") or the item_questions(lang="en") method on a calculator
instance, which returns the flat item -> text dict for the requested
language (English by default):
from afya_medqol import ITEM_QUESTIONS
print(ITEM_QUESTIONS["F1_1_enjoymentoflife"]["pt"])
print(calc.item_questions()["F1_1_enjoymentoflife"]) # English (default)
print(calc.item_questions(lang="pt")["F1_1_enjoymentoflife"]) # Portuguese
MedQoLPhysicianCalculator precomputes the quadrature grid and item probabilities
once at construction time — reuse the same instance when scoring multiple
batches.
Command line
afya-medqol responses.csv
afya-medqol responses.csv --saida result.csv
Output
theta1_quality_of_life,theta2_institutional_support,theta3_perceived_stress,theta_globalT_score_global(50 + 10·θ_global)
License
Apache License 2.0 — see LICENSE.
Metadata
Release files for afya-medqol 1.30.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 | |
|---|---|---|---|
| afya_medqol-1.30.0.tar.gz | 17.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| afya_medqol-1.30.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.2 kB
Release files / afya_medqol-1.30.0.tar.gz
| Download URL | afya_medqol-1.30.0.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
673dc9100d79c7a1363ff5dade4d40d9de827741423a2e0d4b124d095997e87f
|
|
BLAKE2b-256 checksum How to use checksums |
71f5301f9ee4c132d52518eac2015a02c2437137e427d8bb4e96578f7d054ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / afya_medqol-1.30.0-py3-none-any.whl
| Download URL | afya_medqol-1.30.0-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1313c7fde453809c5ccd455bf5a0308b6270dde93e69da44a3d254848a0d5947
|
|
BLAKE2b-256 checksum How to use checksums |
4011de26a21e00c7f66eedf34014568052eca1ea4b9d3df369d8936dae4de276
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|