Skip to content

Commit bc0fd0f

Browse files
feat: FIT-761: New user stats prediction endpoint for multiple users (#642)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 037011c commit bc0fd0f

File tree

11 files changed

+430
-239
lines changed

11 files changed

+430
-239
lines changed

.mock/definition/dashboard.yml

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,6 @@ types:
2121
docs: Total number of tasks
2222
source:
2323
openapi: openapi/openapi.yaml
24-
ApiProjectsDashboardMembersRetrieveResponseStatsItem:
25-
docs: User statistics
26-
properties:
27-
accepted:
28-
type: optional<integer>
29-
docs: Number of annotations marked as "Accepted" by reviewer
30-
finished:
31-
type: optional<integer>
32-
gt:
33-
type: optional<double>
34-
docs: Average agreement with Ground Truth annotations
35-
mean_time:
36-
type: optional<double>
37-
docs: Average mean time spent on annotation
38-
median_time:
39-
type: optional<double>
40-
docs: Average median time spent on annotation
41-
predictions:
42-
type: optional<double>
43-
docs: Average agreement with predictions
44-
progress:
45-
type: optional<integer>
46-
docs: Fraction of annotation work done so far
47-
rejected:
48-
type: optional<integer>
49-
docs: Number of annotations marked as "Rejected" by reviewer
50-
review_score:
51-
type: optional<double>
52-
docs: >-
53-
Average reviewing score, when calling with "per_label=true", returns
54-
dictionary with labels to score breakdown
55-
skipped:
56-
type: optional<integer>
57-
source:
58-
openapi: openapi/openapi.yaml
59-
inline: true
60-
ApiProjectsDashboardMembersRetrieveResponse:
61-
docs: Task creation response
62-
properties:
63-
similarity:
64-
type: optional<list<map<string, unknown>>>
65-
docs: Consensus statistics between different users
66-
stats:
67-
type: optional<list<ApiProjectsDashboardMembersRetrieveResponseStatsItem>>
68-
docs: Number of annotated (completed) tasks
69-
users:
70-
type: optional<list<map<string, unknown>>>
71-
docs: List of users
72-
source:
73-
openapi: openapi/openapi.yaml
7424
service:
7525
auth: false
7626
base-path: ''
@@ -102,72 +52,5 @@ service:
10252
tasks: 1
10353
audiences:
10454
- internal
105-
api_projects_dashboard_members_retrieve:
106-
path: /api/projects/{id}/dashboard-members
107-
method: GET
108-
auth: true
109-
docs: >-
110-
Get dashboard for members, including similarity matrix, user statistics
111-
and users list.
112-
source:
113-
openapi: openapi/openapi.yaml
114-
path-parameters:
115-
id: integer
116-
display-name: Get dashboard data for members
117-
request:
118-
name: ApiProjectsDashboardMembersRetrieveRequest
119-
query-parameters:
120-
action:
121-
type: optional<string>
122-
docs: >-
123-
All data objects will be filtered by updated_at or created_at
124-
field
125-
end_date:
126-
type: optional<string>
127-
docs: >-
128-
End date for dashboard stats calculation. UTC timezone by default.
129-
Use iso format (yyyy-mm-dd-hh-mm) to specify timezone.
130-
per_label:
131-
type: optional<boolean>
132-
docs: Per label calculation
133-
start_date:
134-
type: optional<string>
135-
docs: >-
136-
Start date for dashboard stats calculation. UTC timezone by
137-
default. Use iso format (yyyy-mm-dd-hh-mm) to specify timezone.
138-
updated_by:
139-
type: optional<string>
140-
docs: >-
141-
All task objects will be filtered by updated_by field. Only tasks
142-
that were updated by concrete user will be taken in account.
143-
use_kappa:
144-
type: optional<boolean>
145-
docs: Use kappa statistics for calculation
146-
response:
147-
docs: Successful response returns project-related annotation statistics
148-
type: ApiProjectsDashboardMembersRetrieveResponse
149-
availability: deprecated
150-
examples:
151-
- path-parameters:
152-
id: 1
153-
response:
154-
body:
155-
similarity:
156-
- key: value
157-
stats:
158-
- accepted: 1
159-
finished: 1
160-
gt: 1.1
161-
mean_time: 1.1
162-
median_time: 1.1
163-
predictions: 1.1
164-
progress: 1
165-
rejected: 1
166-
review_score: 1.1
167-
skipped: 1
168-
users:
169-
- key: value
170-
audiences:
171-
- internal
17255
source:
17356
openapi: openapi/openapi.yaml

.mock/definition/projects/stats.yml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,29 @@ types:
175175
- StatsTotalAgreementResponseOne
176176
source:
177177
openapi: openapi/openapi.yaml
178+
StatsUsersPredictionAgreementResponseAgreementValue:
179+
discriminated: false
180+
union:
181+
- type: double
182+
docs: >-
183+
Average prediction agreement score for the user (0-1) when
184+
per_label=False
185+
- type: map<string, double>
186+
docs: >-
187+
Average prediction agreement score per label for the user (0-1) when
188+
per_label=True
189+
source:
190+
openapi: openapi/openapi.yaml
191+
inline: true
192+
StatsUsersPredictionAgreementResponse:
193+
properties:
194+
agreement:
195+
type: >-
196+
optional<map<string,
197+
StatsUsersPredictionAgreementResponseAgreementValue>>
198+
docs: Dictionary mapping user IDs to their prediction agreement scores
199+
source:
200+
openapi: openapi/openapi.yaml
178201
StatsUserPredictionAgreementResponseAveragePredictionAgreementPerUser:
179202
discriminated: false
180203
union:
@@ -497,7 +520,7 @@ service:
497520
ids:
498521
type: string
499522
docs: >-
500-
Comma-separated list of annotator user IDs to get agreement scores
523+
Comma separated list of annotator user IDs to get agreement scores
501524
for
502525
response:
503526
docs: Multiple annotator agreement statistics
@@ -660,6 +683,50 @@ service:
660683
key: value
661684
audiences:
662685
- public
686+
users_prediction_agreement:
687+
path: /api/projects/{id}/user-stats/prediction
688+
method: GET
689+
auth: true
690+
docs: >-
691+
<Card href="https://humansignal.com/goenterprise">
692+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
693+
<p style="margin-top: 10px; font-size: 14px;">
694+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
695+
</p>
696+
</Card>
697+
Get prediction agreement statistics for multiple annotators within a
698+
project.
699+
source:
700+
openapi: openapi/openapi.yaml
701+
path-parameters:
702+
id: integer
703+
display-name: Get prediction agreement statistics for multiple annotators
704+
request:
705+
name: StatsUsersPredictionAgreementRequest
706+
query-parameters:
707+
ids:
708+
type: string
709+
docs: >-
710+
Comma separated list of annotator user IDs to get agreement scores
711+
for
712+
per_label:
713+
type: optional<boolean>
714+
default: false
715+
docs: Per label
716+
response:
717+
docs: Prediction agreement statistics for multiple annotators
718+
type: StatsUsersPredictionAgreementResponse
719+
examples:
720+
- path-parameters:
721+
id: 1
722+
query-parameters:
723+
ids: ids
724+
response:
725+
body:
726+
agreement:
727+
key: 1.1
728+
audiences:
729+
- public
663730
user_prediction_agreement:
664731
path: /api/projects/{id}/user-stats/{user_pk}/prediction
665732
method: GET

0 commit comments

Comments
 (0)