ratersheet 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ratersheet-0.1.0/.gitignore +24 -0
- ratersheet-0.1.0/CHANGELOG.md +40 -0
- ratersheet-0.1.0/CITATION.cff +18 -0
- ratersheet-0.1.0/CONTRIBUTING.md +46 -0
- ratersheet-0.1.0/DESIGN.md +454 -0
- ratersheet-0.1.0/LICENSE +21 -0
- ratersheet-0.1.0/PKG-INFO +442 -0
- ratersheet-0.1.0/README.md +414 -0
- ratersheet-0.1.0/examples/demo/README.md +24 -0
- ratersheet-0.1.0/examples/demo/items.csv +13 -0
- ratersheet-0.1.0/examples/demo/study.toml +32 -0
- ratersheet-0.1.0/pyproject.toml +75 -0
- ratersheet-0.1.0/src/ratersheet/__init__.py +62 -0
- ratersheet-0.1.0/src/ratersheet/__main__.py +10 -0
- ratersheet-0.1.0/src/ratersheet/_example.py +81 -0
- ratersheet-0.1.0/src/ratersheet/_store.py +194 -0
- ratersheet-0.1.0/src/ratersheet/assign.py +231 -0
- ratersheet-0.1.0/src/ratersheet/build.py +320 -0
- ratersheet-0.1.0/src/ratersheet/cli.py +427 -0
- ratersheet-0.1.0/src/ratersheet/collect.py +665 -0
- ratersheet-0.1.0/src/ratersheet/config.py +614 -0
- ratersheet-0.1.0/src/ratersheet/errors.py +19 -0
- ratersheet-0.1.0/src/ratersheet/integrity.py +35 -0
- ratersheet-0.1.0/src/ratersheet/leaks.py +405 -0
- ratersheet-0.1.0/src/ratersheet/methods.py +594 -0
- ratersheet-0.1.0/src/ratersheet/py.typed +0 -0
- ratersheet-0.1.0/src/ratersheet/rng.py +74 -0
- ratersheet-0.1.0/src/ratersheet/unblind.py +280 -0
- ratersheet-0.1.0/src/ratersheet/workbook.py +571 -0
- ratersheet-0.1.0/tests/conftest.py +515 -0
- ratersheet-0.1.0/tests/test_assign.py +495 -0
- ratersheet-0.1.0/tests/test_build.py +517 -0
- ratersheet-0.1.0/tests/test_cli.py +902 -0
- ratersheet-0.1.0/tests/test_collect.py +1068 -0
- ratersheet-0.1.0/tests/test_config.py +704 -0
- ratersheet-0.1.0/tests/test_exports.py +28 -0
- ratersheet-0.1.0/tests/test_integrity.py +107 -0
- ratersheet-0.1.0/tests/test_leaks.py +706 -0
- ratersheet-0.1.0/tests/test_methods.py +403 -0
- ratersheet-0.1.0/tests/test_methods_states.py +488 -0
- ratersheet-0.1.0/tests/test_record_keeping.py +155 -0
- ratersheet-0.1.0/tests/test_rng.py +221 -0
- ratersheet-0.1.0/tests/test_stability.py +53 -0
- ratersheet-0.1.0/tests/test_unblind.py +405 -0
- ratersheet-0.1.0/tests/test_workbook.py +635 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
.venv/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.mypy_cache/
|
|
11
|
+
.coverage
|
|
12
|
+
htmlcov/
|
|
13
|
+
|
|
14
|
+
# Editors and OS
|
|
15
|
+
.DS_Store
|
|
16
|
+
.idea/
|
|
17
|
+
.vscode/
|
|
18
|
+
|
|
19
|
+
# ratersheet study outputs: these can contain an unblinding key and study data.
|
|
20
|
+
# Never commit them to a repository that raters can read.
|
|
21
|
+
ratersheet-out/
|
|
22
|
+
demo-out/
|
|
23
|
+
**/private/key.json
|
|
24
|
+
~$*.xlsx
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
|
|
5
|
+
follows [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-11-27
|
|
8
|
+
|
|
9
|
+
First release.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Study definition from a TOML study file and a CSV items file, with strict validation:
|
|
14
|
+
unknown keys, badly quoted CSV fields, texts beyond the 32,767-character cell limit and
|
|
15
|
+
sources that differ only in letter case are errors.
|
|
16
|
+
- Balanced assignment of items to raters: the number of items per rater differs by at most
|
|
17
|
+
one, overall and within each source, and co-rating is spread over pairs of raters as evenly
|
|
18
|
+
as those quotas allow. Each rater gets an independent random order; items can be grouped by
|
|
19
|
+
case.
|
|
20
|
+
- Randomness from a generator specified in the documentation and pinned by tests, keyed by
|
|
21
|
+
the study seed and a 256-bit secret drawn at build time, so that a design can be
|
|
22
|
+
regenerated from its key on any Python version and cannot be predicted from the seed.
|
|
23
|
+
- One Excel workbook per rater, with items identified only by random codes, texts stored as
|
|
24
|
+
text (never as formulas), drop-down rating cells, optional comments and protected
|
|
25
|
+
non-rating cells.
|
|
26
|
+
- An unblinding key kept in a private folder, with a SHA-256 commitment to it embedded in
|
|
27
|
+
every sheet and recorded in a manifest that contains nothing derived from the sources.
|
|
28
|
+
- Leak checks for source names, self-identifying phrases, text length and markup that could
|
|
29
|
+
reveal the source, with a report of the comparisons that could not be made.
|
|
30
|
+
- Validation of returned workbooks (altered texts, invalid values, missing or duplicated
|
|
31
|
+
rows, wrong study, wrong rater, altered sheet description), with a report and blinded CSV
|
|
32
|
+
outputs that are written only when no error was found.
|
|
33
|
+
- Unblinding into `ratings.csv` and `comments.csv`, with key verification and a record of
|
|
34
|
+
when the key was first used and how complete collection was at that moment.
|
|
35
|
+
- A methods text that states only what the tool did or measured, with explicit
|
|
36
|
+
`[AUTHOR: ...]` placeholders for everything else.
|
|
37
|
+
- A command-line interface: `init`, `check`, `build`, `collect`, `verify`, `unblind`
|
|
38
|
+
and `methods`.
|
|
39
|
+
|
|
40
|
+
[0.1.0]: https://github.com/sumesh-ramasamy/ratersheet/releases/tag/v0.1.0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it using the metadata below."
|
|
3
|
+
title: ratersheet
|
|
4
|
+
abstract: "ratersheet builds blinded rating spreadsheets for human raters, keeps a verifiable unblinding key, validates returned sheets and writes a methods paragraph that states only what the tool did."
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: "Ramasamy"
|
|
7
|
+
given-names: "Sumesh Bharathi"
|
|
8
|
+
version: 0.1.0
|
|
9
|
+
date-released: 2026-11-27
|
|
10
|
+
license: MIT
|
|
11
|
+
repository-code: "https://github.com/sumesh-ramasamy/ratersheet"
|
|
12
|
+
type: software
|
|
13
|
+
keywords:
|
|
14
|
+
- blinded evaluation
|
|
15
|
+
- human rating
|
|
16
|
+
- inter-rater reliability
|
|
17
|
+
- spreadsheet
|
|
18
|
+
- research software
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributing to ratersheet
|
|
2
|
+
|
|
3
|
+
Thanks for helping. This is a small tool, and small, focused changes are the easiest to review.
|
|
4
|
+
|
|
5
|
+
## Set up
|
|
6
|
+
|
|
7
|
+
You need [uv](https://docs.astral.sh/uv/) and Python 3.11 or newer.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
git clone https://github.com/sumesh-ramasamy/ratersheet
|
|
11
|
+
cd ratersheet
|
|
12
|
+
uv sync
|
|
13
|
+
uv run pytest
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Ground rules
|
|
17
|
+
|
|
18
|
+
These keep the tool trustworthy for research use. Changes that break them will not be merged.
|
|
19
|
+
|
|
20
|
+
- No network access. The tool never sends data anywhere.
|
|
21
|
+
- Never modify a study's texts. Leak checks report problems; they do not rewrite anything.
|
|
22
|
+
- Every random choice in a design comes from the project's own generator (`DeterministicRNG`),
|
|
23
|
+
keyed by the study seed and the secret stored in the key, never from the `random` module,
|
|
24
|
+
so a design can be regenerated exactly from its key on any Python version. The secret
|
|
25
|
+
itself is drawn with `secrets`.
|
|
26
|
+
- Nothing a rater receives, and nothing described as safe to share, may depend on the seed
|
|
27
|
+
alone or carry anything derived from the sources.
|
|
28
|
+
- The methods text asserts only what the tool itself did or measured. Anything the tool
|
|
29
|
+
cannot know stays an explicit `[AUTHOR: ...]` placeholder.
|
|
30
|
+
|
|
31
|
+
Statistical or methodological changes (for example to the assignment algorithm or the leak
|
|
32
|
+
checks) need a reference: a paper, a standard or a documented method that the change follows.
|
|
33
|
+
|
|
34
|
+
## Issues
|
|
35
|
+
|
|
36
|
+
A good issue says what you did, what you expected and what happened. Include the version
|
|
37
|
+
(`ratersheet --version`), your Python version and operating system, and a small synthetic
|
|
38
|
+
study file that reproduces the problem. Please do not attach real rater data or real patient
|
|
39
|
+
or participant content.
|
|
40
|
+
|
|
41
|
+
## Pull requests
|
|
42
|
+
|
|
43
|
+
- Keep one change per pull request, and explain why it is needed.
|
|
44
|
+
- Add or update tests, and make sure `uv run pytest` passes.
|
|
45
|
+
- Update `CHANGELOG.md` for anything a user would notice.
|
|
46
|
+
- Use only synthetic example content.
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
# Design decisions
|
|
2
|
+
|
|
3
|
+
This document explains why ratersheet works the way it does. Each section states a decision,
|
|
4
|
+
the reason for it, what it costs, and what was rejected. It is written so that every choice
|
|
5
|
+
can be questioned and defended.
|
|
6
|
+
|
|
7
|
+
## 1. Scope: the design side of a rating study, and nothing else
|
|
8
|
+
|
|
9
|
+
**Decision.** ratersheet covers what happens before and around the ratings: who rates what,
|
|
10
|
+
in which order, under which codes, what comes back, and what can honestly be written about it.
|
|
11
|
+
It does not compute agreement statistics.
|
|
12
|
+
|
|
13
|
+
**Why.** Libraries for kappa, Krippendorff's alpha, Gwet's AC and the ICC already exist and
|
|
14
|
+
are maintained (`krippendorff`, `irrCAC`, `statsmodels`, `pingouin`). Adding another
|
|
15
|
+
implementation would add risk and no capability. What nobody packages is the step before:
|
|
16
|
+
studies rebuild the blinded sheets by hand each time, and the hand-made versions share the
|
|
17
|
+
same defects (see the README).
|
|
18
|
+
|
|
19
|
+
**Cost.** A user needs a second tool for the analysis. `ratings.csv` is a plain long-format
|
|
20
|
+
table so that any of those libraries can read it.
|
|
21
|
+
|
|
22
|
+
## 2. Spreadsheets, not a web application
|
|
23
|
+
|
|
24
|
+
**Decision.** Each rater gets one XLSX file. There is no server, account or browser form.
|
|
25
|
+
|
|
26
|
+
**Why.** Raters in these studies are often clinicians. A spreadsheet opens on any computer,
|
|
27
|
+
works offline, and can be sent through whatever channel the institution already approves.
|
|
28
|
+
Only one person on the team, the one who runs the tool, needs Python.
|
|
29
|
+
|
|
30
|
+
**Why XLSX and not CSV.** XLSX lets the tool mark each text as text (so a text beginning with
|
|
31
|
+
`=` cannot become a formula), offer the allowed values as a drop-down list, and lock the
|
|
32
|
+
cells a rater should not change. CSV can do none of these and its encoding and separator are
|
|
33
|
+
guessed differently by different programs.
|
|
34
|
+
|
|
35
|
+
**Cost.** Server-based tools can do things a file cannot, such as timing each rating or
|
|
36
|
+
preventing a rater from going back. Teams that need those should use one.
|
|
37
|
+
|
|
38
|
+
## 3. A study file in TOML, where a typo is an error
|
|
39
|
+
|
|
40
|
+
**Decision.** The study is described in one TOML file plus one CSV of items. Unknown keys and
|
|
41
|
+
tables are rejected.
|
|
42
|
+
|
|
43
|
+
**Why TOML.** Python reads it from the standard library, so there is no extra dependency, and
|
|
44
|
+
it has none of YAML's silent type conversions (`no` becoming `false`, `1.10` becoming `1.1`).
|
|
45
|
+
|
|
46
|
+
**Why reject unknown keys.** A misspelled option that is silently ignored changes the study
|
|
47
|
+
without anyone noticing: `rater_per_item = 2` would quietly give a fully crossed design.
|
|
48
|
+
|
|
49
|
+
**The items file is read strictly.** A badly quoted field is an error, not something to be
|
|
50
|
+
repaired by guessing: a lenient reader drops stray quote marks and can swallow the following
|
|
51
|
+
rows into one text, and the rater would then see a text that is not in the file. Source and
|
|
52
|
+
case labels are compared after Unicode normalisation, and two sources whose labels differ
|
|
53
|
+
only in letter case are refused, because that is nearly always one source typed two ways.
|
|
54
|
+
|
|
55
|
+
**Extra columns in the items file are ignored, and listed.** Researchers keep notes in their
|
|
56
|
+
item tables. Only `context` and `text` are ever shown to a rater, so an extra column cannot
|
|
57
|
+
leak. `ratersheet check` lists what was ignored.
|
|
58
|
+
|
|
59
|
+
## 4. Randomness: reproducible from the key, unpredictable from the seed
|
|
60
|
+
|
|
61
|
+
**Decision.** Every random choice comes from a small generator built on SHA-256. Python's
|
|
62
|
+
`random` module is not used. The generator is keyed by two things: the seed in the study file,
|
|
63
|
+
and a 256-bit random secret drawn when the sheets are built and stored only in the key.
|
|
64
|
+
|
|
65
|
+
**Why our own generator.** A study's design should be reproducible years later by a reviewer
|
|
66
|
+
on another machine. Python guarantees the stream of `random.random()` for a given seed, but
|
|
67
|
+
the algorithms behind `shuffle` and `sample` have changed between versions. The generator
|
|
68
|
+
here is specified in a few lines (hash a counter, read 8 bytes, reject values that would bias
|
|
69
|
+
the result, take the remainder), and a test pins its output with an independent
|
|
70
|
+
reimplementation and fixed expected values.
|
|
71
|
+
|
|
72
|
+
**Why a secret as well as a seed.** The first draft keyed everything on the seed alone, and
|
|
73
|
+
review showed that this breaks blinding. Seeds that people choose are small numbers, the tool
|
|
74
|
+
is open source, and a single rating id is enough to test a guess. A reviewer recovered the
|
|
75
|
+
seed from one rater's sheet in about a second, replayed that rater's shuffle, and so learned
|
|
76
|
+
each row's position in the items file. In a typical items file (cases in order, sources in a
|
|
77
|
+
fixed order within each case) the position gives away which texts share a source. With the
|
|
78
|
+
secret mixed into every stream, nothing a rater or a blind analyst holds follows from the
|
|
79
|
+
seed. A test replays the attack.
|
|
80
|
+
|
|
81
|
+
**Cost.** A study is no longer reproducible from the study file alone. It is reproducible
|
|
82
|
+
from the key, which holds both the seed and the secret and can be published after
|
|
83
|
+
unblinding. `ratersheet check` therefore cannot preview who will rate what; it reports what
|
|
84
|
+
is certain before the build (how many items each rater gets, overall and per source), and
|
|
85
|
+
`ratersheet build` prints the design that was actually drawn. Building the same study twice
|
|
86
|
+
gives two different designs.
|
|
87
|
+
|
|
88
|
+
**Why keep the seed at all.** It is the part of the randomisation the researcher chooses and
|
|
89
|
+
can state in a protocol. Stating it reveals nothing, because the design also depends on the
|
|
90
|
+
secret.
|
|
91
|
+
|
|
92
|
+
**Three separate streams.** Who rates what, the order per rater, and the codes each draw from
|
|
93
|
+
their own stream, so that a presentation option such as `group_by_case` does not change who
|
|
94
|
+
rates what when the same key is replayed.
|
|
95
|
+
|
|
96
|
+
## 5. Assignment: balanced loads, guaranteed; balanced pairs, best effort
|
|
97
|
+
|
|
98
|
+
**Decision.** Items are handled one source at a time, in random order. For each source, every
|
|
99
|
+
rater first gets a quota: the source's rating slots (items times raters per item) are divided
|
|
100
|
+
equally, and any remainder goes, one extra item each, to the raters who so far have the
|
|
101
|
+
fewest items overall (among raters with equal totals, to those with the fewest items in
|
|
102
|
+
common with the raters already given an extra, which is what spreads co-rating when sources
|
|
103
|
+
have a single item each). Each item is then given to raters who still have quota for that source.
|
|
104
|
+
A rater whose remaining quota equals the number of items left must take every one of them.
|
|
105
|
+
The other seats go, one at a time, to the rater with the fewest items in common with the
|
|
106
|
+
raters already chosen for this item, then the most quota left, with ties broken at random.
|
|
107
|
+
|
|
108
|
+
**What is guaranteed.** Every item gets exactly the requested number of distinct raters. For
|
|
109
|
+
every source, the number of items of that source per rater differs by at most one. The total
|
|
110
|
+
number of items per rater differs by at most one. Tests check these over several thousand
|
|
111
|
+
study shapes.
|
|
112
|
+
|
|
113
|
+
**Why they hold.** Per source, quotas are either the base number or one more, and every
|
|
114
|
+
quota is used up exactly: that is the per-source guarantee. Before each source the totals
|
|
115
|
+
differ by at most one, and the extra items go to the raters with the lowest totals, so the
|
|
116
|
+
totals still differ by at most one afterwards. The assignment can never get stuck: the
|
|
117
|
+
remaining quotas always add up to (raters per item) times (items left) and none exceeds the
|
|
118
|
+
items left, so there are never more raters who must be chosen than seats, and always enough
|
|
119
|
+
raters with quota to fill them.
|
|
120
|
+
|
|
121
|
+
**What is best effort.** Because the quotas alone secure the loads, the choice among eligible
|
|
122
|
+
raters is free to spread co-rating over pairs of raters, so that agreement can be estimated
|
|
123
|
+
for every pair. This is a greedy rule, not a balanced incomplete block design. In a study
|
|
124
|
+
with 4 raters, 2 raters per item and two sources of 25 items, the pair counts came out within
|
|
125
|
+
one of each other in 200 of 200 runs. When there are few items and many raters, some pairs
|
|
126
|
+
still share nothing (7 raters, 3 per item, 7 items is an example). `ratersheet build` prints
|
|
127
|
+
the pair counts and says so when a pair shares no item.
|
|
128
|
+
|
|
129
|
+
**What the per-source guarantee costs.** When not every rater rates every item, the rule
|
|
130
|
+
"each rater gets an equal share of every source" is public, and the pattern of who rated what
|
|
131
|
+
is visible to anyone who sees several sheets or the blinded ratings. Together they rule out
|
|
132
|
+
most ways of grouping the items into sources. A second review measured this: with 4 sources
|
|
133
|
+
of 2 items, 4 raters and 2 raters per item, the 105 possible groupings shrank to a median of
|
|
134
|
+
2. In the shape of the bundled example (3 sources of 4 items, 3 raters, 2 per item) 5,775
|
|
135
|
+
groupings shrank only to 1,728, and the effect fades as studies grow. It reveals which items
|
|
136
|
+
belong together, not which group is which source, and a single rater with only their own
|
|
137
|
+
sheet learns very little. No assignment rule can both balance sources across raters and hide
|
|
138
|
+
this. A fully crossed design has no such pattern, and `build` prints a note when the design
|
|
139
|
+
is not fully crossed. Report it as a limitation of a small partial design.
|
|
140
|
+
|
|
141
|
+
**How this changed in review.** The first draft chose raters by one combined rule: fewest
|
|
142
|
+
items of this source, then fewest overall, then fewest in common. The loads were right, but
|
|
143
|
+
the first two parts almost always decided the choice, so the pair rule never applied: the
|
|
144
|
+
same study gave pair counts of 4, 4, 4, 4, 17 and 17. Separating the load guarantee (quotas)
|
|
145
|
+
from the pair rule fixed it.
|
|
146
|
+
|
|
147
|
+
**Rejected alternatives.** Pure random assignment gives unequal workloads and, in small
|
|
148
|
+
studies, raters who see almost nothing from one source. A fixed rotation gives equal loads
|
|
149
|
+
but always pairs the same raters. Textbook block designs exist only for particular
|
|
150
|
+
combinations of items, raters and raters per item; real studies rarely have those numbers.
|
|
151
|
+
|
|
152
|
+
## 6. Codes: one per rater and item, carrying no information
|
|
153
|
+
|
|
154
|
+
**Decision.** Each row of a sheet has a rating id of the form `XXXX-XXXX`, unique to that rater
|
|
155
|
+
and that item. A separate item code (`I-XXXXXX`) identifies the item across raters in the
|
|
156
|
+
blinded dataset.
|
|
157
|
+
|
|
158
|
+
**Why not one letter per source.** A common hand-made scheme labels every answer from one
|
|
159
|
+
model "A". A rater who recognises a single answer then knows all of that model's answers.
|
|
160
|
+
Here no code is shared between items.
|
|
161
|
+
|
|
162
|
+
**Why a different code per rater.** Two raters comparing sheets cannot match items by code,
|
|
163
|
+
and a row pasted into the wrong rater's file is detected.
|
|
164
|
+
|
|
165
|
+
**Why the alphabet has no I, L, O, 0 or 1.** Codes are sometimes read aloud or retyped when a
|
|
166
|
+
rater reports a problem.
|
|
167
|
+
|
|
168
|
+
## 7. The key commitment: what it proves and what it does not
|
|
169
|
+
|
|
170
|
+
**Decision.** The unblinding key is a JSON file kept by the study lead. Its SHA-256 hash is
|
|
171
|
+
written into every rating sheet when the sheets are generated, and into the manifest.
|
|
172
|
+
|
|
173
|
+
**What it proves.** The raters hold the hash before any rating exists. If the key were
|
|
174
|
+
altered afterwards (to move a favourable rating from one source to another, say), its hash
|
|
175
|
+
would no longer match the value in the sheets already sent out. Anyone can check this without
|
|
176
|
+
ratersheet: compute the SHA-256 of `key.json` and compare it with the line on the
|
|
177
|
+
Instructions sheet.
|
|
178
|
+
|
|
179
|
+
**Why there is a nonce.** The key contains a random 256-bit value. Without it, someone who
|
|
180
|
+
knew the items and could guess the labels could hash their guesses and confirm one. With it,
|
|
181
|
+
the hash reveals nothing about the key.
|
|
182
|
+
|
|
183
|
+
**What the tool's own check compares.** `ratersheet verify` compares the key with the
|
|
184
|
+
manifest, and with the commitment inside any sheet it is given. The manifest sits beside the
|
|
185
|
+
key and could be edited with it, so the comparison that matters is with a sheet that was
|
|
186
|
+
sent out. The methods text says which comparison was made.
|
|
187
|
+
|
|
188
|
+
**What it does not prove.** It does not show that nobody read the key. Blinding still depends
|
|
189
|
+
on the study lead keeping `private/` away from the raters; the methods text therefore asks
|
|
190
|
+
the author to state who held the key. It also does not protect a study in which no sheet was
|
|
191
|
+
ever sent: someone who can edit both the key and the manifest is only caught by a sheet in
|
|
192
|
+
someone else's hands.
|
|
193
|
+
|
|
194
|
+
**Rejected alternative.** Digital signatures or a public timestamping service would be
|
|
195
|
+
stronger, and would need accounts, keys or network access. A hash that anyone can recompute
|
|
196
|
+
fits a tool that runs offline on one laptop.
|
|
197
|
+
|
|
198
|
+
## 8. Text integrity by hash, compared after light normalisation
|
|
199
|
+
|
|
200
|
+
**Decision.** The key stores a SHA-256 hash of every text and context. When a sheet comes
|
|
201
|
+
back, each text cell is hashed again; a mismatch is an error (`text_changed`).
|
|
202
|
+
|
|
203
|
+
**Why.** A rating is only meaningful for the text that was shown. A cell edited by accident
|
|
204
|
+
(or autocorrected, or truncated) silently changes what was rated.
|
|
205
|
+
|
|
206
|
+
**Normalisation.** Before hashing, text is converted to Unicode NFC, Windows and old Mac line
|
|
207
|
+
endings become `\n`, and leading and trailing white space is removed. Spreadsheet programs
|
|
208
|
+
change exactly these things on save without changing what a rater reads. Anything else is a
|
|
209
|
+
real difference.
|
|
210
|
+
|
|
211
|
+
**The one change the tool makes to a text.** Windows line endings (CR LF) are written to the
|
|
212
|
+
sheets as plain line breaks, because that is what a spreadsheet cell uses and the file format
|
|
213
|
+
cannot carry a bare carriage return. The hash comparison ignores that difference. Nothing
|
|
214
|
+
else in a text is altered.
|
|
215
|
+
|
|
216
|
+
## 9. Returned workbooks are untrusted input
|
|
217
|
+
|
|
218
|
+
**Decision.** Nothing in a returned workbook is evaluated. Formulas are read as text and
|
|
219
|
+
reported as invalid. XML is parsed with `defusedxml`. A sheet that extends beyond 100,000
|
|
220
|
+
rows is refused.
|
|
221
|
+
|
|
222
|
+
**Why.** Returned files come from other people's machines. A formula in a rating cell is at
|
|
223
|
+
best a mistake. `defusedxml` blocks the XML tricks that make a small file expand to gigabytes
|
|
224
|
+
in memory; openpyxl uses it automatically when it is installed, so it is a declared
|
|
225
|
+
dependency and ratersheet refuses to read workbooks without it.
|
|
226
|
+
|
|
227
|
+
**Comments in CSV.** A rater's free-text comment that begins with `=`, `+`, `-` or `@` is
|
|
228
|
+
written to the CSV with a leading apostrophe. Without it, a spreadsheet program opening the
|
|
229
|
+
CSV would try to run the comment as a formula. The cost is that such a comment is stored with
|
|
230
|
+
one extra character. Ratings are never affected: they are checked against the scale.
|
|
231
|
+
|
|
232
|
+
**The sheet's own description is not trusted either.** Each workbook carries a hidden sheet
|
|
233
|
+
that says which column is which. `collect` compares it with what `build` wrote for this
|
|
234
|
+
study; a returned file whose description differs is rejected, so nobody can swap two scales
|
|
235
|
+
or point the text check at another column.
|
|
236
|
+
|
|
237
|
+
**Escaped characters.** The XLSX format treats a sequence such as `_x0041_` inside a string
|
|
238
|
+
as an escaped character. Texts that contain such a sequence literally are escaped when
|
|
239
|
+
written and decoded when read, so that the rater sees the text as it is and the hash still
|
|
240
|
+
matches after a spreadsheet program has saved the file.
|
|
241
|
+
|
|
242
|
+
**Known gap.** There is no limit on the size of a returned file before it is opened. A
|
|
243
|
+
deliberately huge workbook could still exhaust memory.
|
|
244
|
+
|
|
245
|
+
## 10. Sheet protection is a guard rail, not security
|
|
246
|
+
|
|
247
|
+
**Decision.** The Ratings sheet is protected without a password. Rating and comment cells are
|
|
248
|
+
unlocked; texts and codes are locked.
|
|
249
|
+
|
|
250
|
+
**Why.** It prevents the common accident of typing over a text. Anyone can remove the
|
|
251
|
+
protection in two clicks, and the documentation says so. What actually detects changes is the
|
|
252
|
+
hash comparison in section 8.
|
|
253
|
+
|
|
254
|
+
## 11. Leak checks report; they never rewrite
|
|
255
|
+
|
|
256
|
+
**Decision.** Before building, the tool looks for four kinds of cue to the source in what a
|
|
257
|
+
rater will read: a source label in a text, a phrase by which a model names itself or its
|
|
258
|
+
vendor, a marked difference in length between two sources, and a marked difference in the use
|
|
259
|
+
of markup between two sources. It prints warnings. It never changes a text.
|
|
260
|
+
|
|
261
|
+
**What is compared.** Names and phrases are searched in the text and in the context, after
|
|
262
|
+
folding typographic variants (curly apostrophes, the several kinds of hyphen and dash,
|
|
263
|
+
invisible characters), because language models often write "GPT‑4" with a non-breaking
|
|
264
|
+
hyphen. Length and markup are compared for the text and, separately, for the context.
|
|
265
|
+
|
|
266
|
+
**Saying what was not checked.** Length and markup are only compared between two sources that
|
|
267
|
+
have at least 5 texts each, and source labels shorter than 3 characters are not searched for.
|
|
268
|
+
When a comparison cannot run, `check` and `build` print it under "Not checked", and the
|
|
269
|
+
methods text states how many labels were searched and how many pairs were compared. "No
|
|
270
|
+
warnings" must never be read as "checked and clean" when nothing was compared.
|
|
271
|
+
|
|
272
|
+
**Why report only.** The texts are the study's stimuli. Removing "As an AI language model"
|
|
273
|
+
or stripping markdown changes what is being rated, and whether to do that is a
|
|
274
|
+
methodological decision that belongs to the researcher and must be reported.
|
|
275
|
+
|
|
276
|
+
**The thresholds are judgement calls.** The length rule fires when, taking one random text
|
|
277
|
+
from each of two sources, the longer one comes from the same source at least 9 times in 10.
|
|
278
|
+
The markup rule fires when at least 80% of one source's texts use markup and at most 20% of
|
|
279
|
+
the other's do. Both need at least 5 texts per source. These numbers are meant to catch cues a
|
|
280
|
+
rater would notice without drowning small studies in warnings. They are not derived from a
|
|
281
|
+
published standard, and they are module constants so that they can be argued with.
|
|
282
|
+
|
|
283
|
+
**Limits.** These are heuristics. They cannot detect a model's writing style, and no warning
|
|
284
|
+
does not mean no cue. The methods text says this in the same words.
|
|
285
|
+
|
|
286
|
+
## 12. Collection fails closed
|
|
287
|
+
|
|
288
|
+
**Decision.** `collect` writes a dataset only if there is no error in any returned sheet.
|
|
289
|
+
With errors, it writes the report and nothing else.
|
|
290
|
+
|
|
291
|
+
**Why.** The alternative, writing the good rows and skipping the bad ones, produces a dataset
|
|
292
|
+
that looks complete and is not. A researcher should have to resolve a damaged sheet (usually
|
|
293
|
+
by asking the rater) before any analysis file exists.
|
|
294
|
+
|
|
295
|
+
**Lenient about representation, strict about meaning.** A 4 arrives as `4`, `4.0` or `"4"`
|
|
296
|
+
depending on the program and the cell format; all are accepted. `4.5`, `TRUE`, a date or a
|
|
297
|
+
formula are not. Nominal values are matched ignoring case and stored in the scale's own
|
|
298
|
+
spelling.
|
|
299
|
+
|
|
300
|
+
**Rows are matched by code, not position.** A rater who sorts the sheet does no harm.
|
|
301
|
+
|
|
302
|
+
**Missing is not wrong.** An empty required rating, or a rater who has not returned a file
|
|
303
|
+
yet, is a warning, so that a study can be collected in stages. `--require-complete` turns
|
|
304
|
+
these into errors for the final run. Collection counts as complete only when every required
|
|
305
|
+
rating is in and every rater with assignments has returned a sheet; counting ratings alone
|
|
306
|
+
would call a study with no required scale complete before any sheet came back.
|
|
307
|
+
|
|
308
|
+
**Nominal values are matched as a person would read them.** Case, the style of an
|
|
309
|
+
apostrophe, the form of an accented letter and spacing are ignored, and the value is stored
|
|
310
|
+
in the scale's own spelling. Nominal rating cells are formatted as text so that a value such
|
|
311
|
+
as `TRUE` or `0.5` is not turned into a boolean or a number by the spreadsheet program.
|
|
312
|
+
|
|
313
|
+
**A failed run leaves nothing that looks valid.** The old report is removed first and the new
|
|
314
|
+
one is written last, so an interrupted run cannot leave a passing report beside an older
|
|
315
|
+
dataset. When a folder is scanned, files whose names start with a dot or with `~$` are
|
|
316
|
+
skipped; they are lock files and the hidden companion files some systems write.
|
|
317
|
+
|
|
318
|
+
**Two files from one rater: neither is used.** The tool cannot know which one the rater
|
|
319
|
+
meant, and guessing would be a silent choice about data.
|
|
320
|
+
|
|
321
|
+
## 13. Records that cannot be quietly rewritten
|
|
322
|
+
|
|
323
|
+
**Decision.** `unblind` refuses to run unless the last `collect` passed, and refuses an
|
|
324
|
+
incomplete collection unless told otherwise. It records when the key was first used and how
|
|
325
|
+
complete collection was at that moment. That first record is kept through every later run.
|
|
326
|
+
`collect` never deletes it. Every `collect` run removes `ratings.csv`, so the unblinded file
|
|
327
|
+
can never be older than the report beside it.
|
|
328
|
+
|
|
329
|
+
**Why.** In a blinded study the important fact is when the key was first opened. If a later
|
|
330
|
+
run could overwrite the record, opening the key early could be made to disappear by simply
|
|
331
|
+
unblinding again after collection was complete. The methods text reports the first
|
|
332
|
+
unblinding and how many times the step was run.
|
|
333
|
+
|
|
334
|
+
The record is written before any unblinded file, so a failure part-way cannot leave sources
|
|
335
|
+
on disk with no record that the key was used. Each collection run has its own random id, and
|
|
336
|
+
the unblinding record notes which run it followed; that, not the clock, is how the methods
|
|
337
|
+
text knows whether the sheets were checked again after the key was first used. The
|
|
338
|
+
collection report also records the hash of the blinded files it wrote, and `unblind` refuses
|
|
339
|
+
a blinded file that is no longer the one the last collection wrote. If ratings are collected again after the first
|
|
340
|
+
unblinding, the methods text says so and asks the author to state whether any rating changed.
|
|
341
|
+
|
|
342
|
+
**Limit.** This records what the tool did. It cannot know whether someone opened `key.json`
|
|
343
|
+
in a text editor.
|
|
344
|
+
|
|
345
|
+
## 14. The blinded dataset contains no group labels
|
|
346
|
+
|
|
347
|
+
**Decision.** `ratings_blinded.csv` has item codes, rater ids, scales and values. It has no
|
|
348
|
+
source, not even a masked one such as "group A".
|
|
349
|
+
|
|
350
|
+
**Why.** Agreement between raters can be computed without knowing sources. Masked group
|
|
351
|
+
labels would let whoever holds the file see which items belong together, and in small teams
|
|
352
|
+
the analyst is often also a rater.
|
|
353
|
+
|
|
354
|
+
**Cost.** Analyses that compare sources need the unblinded file. That is intended: comparing
|
|
355
|
+
sources is the moment of unblinding.
|
|
356
|
+
|
|
357
|
+
**Limit.** The file does show who rated which item and in which position. In a design that is
|
|
358
|
+
not fully crossed that pattern narrows which items share a source (section 5), and with
|
|
359
|
+
`group_by_case` the positions show which items belong to one case. An analyst who must stay
|
|
360
|
+
fully blind in a small partial design should be given the ratings without the rater ids, or
|
|
361
|
+
the design should be fully crossed.
|
|
362
|
+
|
|
363
|
+
## 15. The methods text says only what the tool knows
|
|
364
|
+
|
|
365
|
+
**Decision.** `ratersheet methods` drafts a methods section from the records in the study
|
|
366
|
+
folder. Every statement in it is something the tool did or measured. Everything else is an
|
|
367
|
+
explicit placeholder beginning `[AUTHOR: ...]`: who the raters were, how the sample size was
|
|
368
|
+
chosen, who held the key, whether raters worked independently, what was done about each leak
|
|
369
|
+
warning.
|
|
370
|
+
|
|
371
|
+
**Why.** A generated paragraph that says "raters were blinded and worked independently" would
|
|
372
|
+
be pasted into papers whether or not it was true. The tool can state that the sheets carried
|
|
373
|
+
no source field; it cannot state that nobody told the raters.
|
|
374
|
+
|
|
375
|
+
**Reporting guidelines.** The text ends with a table that maps its statements to items of the
|
|
376
|
+
CHART and GRRAS reporting guidelines. The items are paraphrased, the author is told to check
|
|
377
|
+
them against the published checklists, and the table says that it is not a claim that either
|
|
378
|
+
checklist has been satisfied.
|
|
379
|
+
|
|
380
|
+
## 16. The manifest is safe to share; the key is not
|
|
381
|
+
|
|
382
|
+
**Decision.** `manifest.json` describes the study without source labels, item ids, case ids or
|
|
383
|
+
the seed, and without anything derived from the sources. What `build` writes that could
|
|
384
|
+
unblind lives under `private/`, which is created readable only by its owner on macOS and
|
|
385
|
+
Linux.
|
|
386
|
+
|
|
387
|
+
**Why.** Files get attached to emails and committed to repositories. One folder to keep away
|
|
388
|
+
from raters is a rule people can follow. A test searches the manifest for every source label
|
|
389
|
+
and item id. An earlier draft listed the kinds of leak warning in the manifest; review
|
|
390
|
+
pointed out that "the sources differ in length" is itself a hint, so they moved to the
|
|
391
|
+
private leak report.
|
|
392
|
+
|
|
393
|
+
**Files outside `private/` that name sources.** `ratings.csv` and `comments.csv`, written by
|
|
394
|
+
`unblind`, and `methods.md`, whenever it is written (it can be drafted straight after
|
|
395
|
+
`build`), name sources and sit at the top of the study folder, because that is where an
|
|
396
|
+
analyst looks for them. `unblind` and `methods` print a caution when they write them. They
|
|
397
|
+
must be kept from anyone still rating.
|
|
398
|
+
|
|
399
|
+
## 17. Few dependencies
|
|
400
|
+
|
|
401
|
+
**Decision.** Two runtime dependencies (`openpyxl`, `defusedxml`), the standard library for
|
|
402
|
+
everything else (`argparse`, `tomllib`, `csv`, `hashlib`), Python 3.11 or later.
|
|
403
|
+
|
|
404
|
+
**Why.** A research tool should still install in five years. Every dependency is a way for
|
|
405
|
+
that to fail. Python 3.11 is the first version with a TOML reader in the standard library.
|
|
406
|
+
|
|
407
|
+
## 18. Refusing to rebuild over a study in progress
|
|
408
|
+
|
|
409
|
+
**Decision.** `build` stops if the output folder already holds any file it would replace or
|
|
410
|
+
delete, unless `--overwrite` is given. A plain build never deletes anything.
|
|
411
|
+
|
|
412
|
+
**Why.** A rebuild creates a new key. Sheets already sent to raters would then fail
|
|
413
|
+
collection as belonging to another study. This is the most damaging mistake the tool makes
|
|
414
|
+
possible, so it requires an explicit flag. The check looks at every output file, not only
|
|
415
|
+
the manifest: an earlier draft checked the manifest alone, and a folder that had lost its
|
|
416
|
+
manifest would have had its key silently replaced.
|
|
417
|
+
|
|
418
|
+
## Known limitations
|
|
419
|
+
|
|
420
|
+
- The generated workbooks are tested by reading them back with openpyxl, including a copy
|
|
421
|
+
stored the way Excel stores strings. They have not been tested automatically in Excel,
|
|
422
|
+
LibreOffice, Numbers or Google Sheets. Open one sheet in the program your raters use before
|
|
423
|
+
sending them out.
|
|
424
|
+
- A rater can often recognise a model from its style. No tool can prevent that; report it as
|
|
425
|
+
a limitation of the study.
|
|
426
|
+
- Only single-item rating is supported. Side-by-side comparison, ranking and repeated items
|
|
427
|
+
for intra-rater reliability are not.
|
|
428
|
+
- `build`, `collect` and `unblind` are the names of both a function and a module in the
|
|
429
|
+
package. `from ratersheet import collect` gives the function, and
|
|
430
|
+
`from ratersheet.collect import Problem` works, but `import ratersheet.collect as m` gives
|
|
431
|
+
the function, not the module.
|
|
432
|
+
- On a shared computer, another user of the same machine cannot read `private/`. A team that
|
|
433
|
+
shares a study folder through a group must widen those permissions themselves.
|
|
434
|
+
- Titles, source labels and scale labels are written into the methods text as given. Keep
|
|
435
|
+
them short and free of markup.
|
|
436
|
+
|
|
437
|
+
## How this was tested, and what review changed
|
|
438
|
+
|
|
439
|
+
The library and its tests were written separately from one written contract: the tests were
|
|
440
|
+
written without sight of the implementation, so that they check the contract and not the
|
|
441
|
+
code. The result was then reviewed from five angles (blinding, returned sheets, assignment
|
|
442
|
+
and randomness, robustness, and the truth of every generated sentence). Each reported
|
|
443
|
+
problem had to be reproduced independently before it was accepted, and each fix has a test
|
|
444
|
+
that fails without it.
|
|
445
|
+
|
|
446
|
+
That review found three serious faults in the first draft, all described above: codes and
|
|
447
|
+
order that could be predicted from a guessable seed (section 4), co-rating that was badly
|
|
448
|
+
unbalanced (section 5), and a rebuild that could replace a key without being asked to
|
|
449
|
+
(section 18). It also found about twenty-five smaller ones, most of them sentences in the
|
|
450
|
+
methods text that were false in some state of a study, for example "the items were rated by
|
|
451
|
+
3 raters" before any sheet had come back. A second review of the fixed code confirmed those fixes and found smaller problems, one of
|
|
452
|
+
them introduced by a fix (a text near the cell-size limit could be cut off); those were fixed
|
|
453
|
+
too. It also measured the limit described in section 5, which is a property of the design
|
|
454
|
+
and is documented, not removed.
|
ratersheet-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sumesh Bharathi Ramasamy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|