Visitar URL original
sondavi 0.9.0 · MPIB/sondavi-python@bef1ebf · GitHub
Skip to content

Commit bef1ebf

Browse files
committed
sondavi 0.9.0
1 parent 92be6de commit bef1ebf

28 files changed

Lines changed: 4350 additions & 600 deletions

‎NEWS.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# sondavi 0.9.0
2+
3+
## Scale scores of the questionnaire, worked out again
4+
5+
* `scale(data, score="sdq_emo")` works out a scale score the questionnaire computes itself
6+
(Σ in the editor): the codebook now says which rows it counts - those of its subscales, in a
7+
loop those of the same copy -, mean or sum, and how many have to be answered. That is the
8+
way to give responses recorded before a score was added or changed the score of now; the
9+
platform keeps every response's score as it was computed then. Needs a platform that
10+
describes its scale scores (version 0.106 or later); with an older one, name the items.
11+
* `scale()` takes `method="sum"` as well as the mean, and gives whole numbers as the platform
12+
writes them (4, not 4.0) for rows.
13+
* The codebook carries `subscale` on a matrix row and `scale_score` on a scale score.
14+
15+
## Questions with several answers
16+
17+
* `options()` gives one field per option of a multiple-choice question, a tag box, a picture
18+
choice or a ranking, as the export files have them: 1 when the option was chosen, 0 when the
19+
question was answered without it, None when it was not answered; for a ranking the option's
20+
place. In a frame the columns are integers that can be missing (`Int64`).
21+
* `unnest()` adds those fields right after the list (`options=False` leaves them out).
22+
23+
## Tested against more of what researchers ask
24+
25+
The tests now include a study with multiple choice ("None", "Other" with its text), a tag box,
26+
a ranking, a rating, yes/no, a drop-down with "Don't know", text boxes, a constant sum with its
27+
total, an SDQ-like matrix with subscales and the questionnaire's own scale scores, and a loop
28+
with a score per copy - recorded from the platform, and checked value by value against the
29+
platform's own export file. The platform's scale score cases now include sums.
30+
31+
## The files participants uploaded
32+
33+
`con.files(survey_id)` downloads the files of a study's "File Upload" questions and unpacks
34+
them: a folder per question, the files named by response (`drawing/1234-1.png`) rather than by
35+
the name a participant gave them, and a list with one row per file - whose it is
36+
(`response_id`, and `respondent_id` where your token may read it), the original name, type,
37+
size, checksum and `local_path`, where the file now is. Join it to `responses()` over
38+
`response_id`.
39+
40+
In the responses themselves an uploaded file now appears as its name, type, size and a
41+
reference; the file is no longer in the row.
42+
143
# sondavi 0.8.0
244

345
## Verifying a certified dataset

‎README.md‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,46 @@ In a frame the items are Categoricals, and their codes are positions, not answer
8080
"Don't know" and other answers that are no number count as missing here; by default every
8181
item has to be answered, so a mean over fewer items never happens unnoticed.
8282

83+
A scale score the questionnaire computes itself (Σ in the editor, with subscales if the matrix
84+
rows have them) is stored with each response as it was computed then. To work it out again — for
85+
responses recorded before you added or changed it — name it; the codebook supplies its rows,
86+
mean or sum, and its minimum. `method="sum"` adds instead of averaging when you name the items
87+
yourself:
88+
89+
```python
90+
df["sdq_emo_now"] = scale(df, score="sdq_emo") # the emotional subscale, summed
91+
scale(flat, ["sdq.e1", "sdq.e2"], codebook=cb, method="sum") # the same by hand
92+
```
93+
94+
`score=` needs a platform that describes its scale scores in the codebook (version 0.106 or later).
95+
96+
## Questions with several answers
97+
98+
A multiple-choice answer, a tag box or a ranking arrives as the list of options chosen and stays
99+
one field. `unnest()` adds one field per option right after it, as the export files have them —
100+
1 chosen, 0 answered without it, None (NA in a frame) not answered; for a ranking the option's
101+
place. `options(rows, codebook=cb)` does the same without unnesting anything else.
102+
103+
```python
104+
flat = unnest(con.frame(42))
105+
flat["devices.phone"].value_counts()
106+
```
107+
108+
## Uploaded files
109+
110+
A "File Upload" answer in the responses is the file's name, type, size and a reference; the
111+
files themselves come with `files()`:
112+
113+
```python
114+
files = con.files(42) # unpacked into sondavi-files-42/
115+
drawings = [f for f in files if f["question"] == "drawing"]
116+
drawings[0]["local_path"]
117+
```
118+
119+
A folder per question, the files named by response (`drawing/1234-1.png`), never by the name
120+
a participant gave them — so the drawings of one task can be rated without seeing whose they
121+
are. Join to the responses over `response_id`.
122+
83123
## Image marking
84124

85125
An image marking question (participants paint areas or set pins on a map or picture) arrives

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sondavi"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
description = "Read your own study data from the Sondavi survey platform"
55
readme = "README.md"
66
requires-python = ">=3.9"

‎src/sondavi/__init__.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
print(verify("study.csv", "study.certificate.json"))
1818
"""
1919

20-
from .client import Connection, ApiError, connect, unnest, markings, conversations, items, scale
20+
from .client import Connection, ApiError, connect, unnest, options, markings, conversations, items, scale
2121
from .snapshots import Snapshot
2222
from .certificates import Verification, verify
2323

24-
__all__ = ["connect", "Connection", "ApiError", "Snapshot", "unnest", "markings", "conversations", "items", "scale",
24+
__all__ = ["connect", "Connection", "ApiError", "Snapshot", "unnest", "options", "markings", "conversations", "items", "scale",
2525
"verify", "Verification"]
26-
__version__ = "0.8.0"
26+
__version__ = "0.9.0"

0 commit comments

Comments
 (0)