Conditions | 2 |
Total Lines | 30 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | """ |
||
9 | 1 | @staticmethod |
|
10 | def aggregate(judgments, config): |
||
11 | """ |
||
12 | Aggregates information for each worker about the total number of jobs and units |
||
13 | (s)he contributed to, the total number of judgments submitted, the total |
||
14 | amount of time spent of annotating and the average number of annotations provided |
||
15 | across all the units. |
||
16 | |||
17 | Args: |
||
18 | judgments: Judgments contained in the job. |
||
19 | config: Job configuration as provided as input for the metrics. |
||
20 | |||
21 | Returns: |
||
22 | A dataframe containing all workers that contributed to the jobs and the |
||
23 | statistics relevant for them. |
||
24 | """ |
||
25 | 1 | workers = judgments.copy().groupby('worker') |
|
26 | |||
27 | 1 | agg = { |
|
28 | 'job' : 'nunique', |
||
29 | 'unit' : 'nunique', |
||
30 | 'judgment' : 'nunique', |
||
31 | 'duration' : 'mean' |
||
32 | } |
||
33 | 1 | for col in config.output.values(): |
|
34 | 1 | agg[col+'.count'] = 'mean' |
|
35 | |||
36 | 1 | workers = workers.agg(agg) |
|
37 | |||
38 | return workers |
||
39 |