Counting annotations#

zoonyper.project.Project.classification_counts() is a useful method for retrieving the number of different classifications per subject ID for any given workflow. It takes two arguments, the workflow ID (passed as workflow_id) and the task number (task_number) that you want to extract:

project.classification_counts(workflow_id=12038, task_number=0)

Note

The method currently works best with text annotations.

Using classification_counts, we can also easily check for “agreement”, say when all annotators have agreed on one classification:

1classifications = project.classification_counts(workflow_id=12038, task_number=0)
2
3agreement = {
4    subject_id: len(unique_classifications) == 1
5    for subject_id, unique_classifications in classifications.items()
6}
7
8print(agreement)

Similarly, we can construct a code block for whenever at least four annotators have agreed on one response for a subject:

1classifications = project.classification_counts(workflow_id=12038, task_number=0)
2
3agreement = {
4    subject_id: len([classification for classification, count in unique_classifications.items() if count > 4]) == 1
5    for subject_id, unique_classifications in classifications.items()
6}
7
8print(agreement)