doccano / doccano

Open source annotation tool for machine learning practitioners.
MIT License
9.1k stars 1.67k forks source link

Include annotator names or unique IDs in label field #2329

Open Zeen0 opened 2 months ago

Zeen0 commented 2 months ago

Feature description

When exporting annotations made by multiple annotators on a single project, there is no way to discern who made which annotation. This would allow for projects to be more centralized for downstream tasks.

I notice that in the admin panel the names user IDs are associated with spans, but not in data export.

github-actions[bot] commented 2 months ago

Would you write your environment? Thank you!

Zeen0 commented 2 months ago

v1.8.4

Zeen0 commented 2 months ago
class Labels(abc.ABC):
    label_class = ExportedLabel
    column = "labels"
    fields: Tuple[str, ...] = ("example", "label")  # To boost performance

    def __init__(self, examples: QuerySet[ExportedExample], user=None):
        self.label_groups = defaultdict(list)
        labels = self.label_class.objects.filter(example__in=examples)
        if user:
            labels = labels.filter(user=user)
        for label in labels.select_related(*self.fields):
            self.label_groups[label.example.id].append(label)

    def find_by(self, example_id: int) -> Dict[str, List[ExportedLabel]]:
        return {self.column: self.label_groups[example_id]}

It looks like this might exist in the form of user binary, but can't seem to find any settings in /admin/ or the UI to activate it.