Datasaur
Search…
Row-Based Projects
This section will explain how to create new Row Based Labeling Project

Basic Project

By following this sample, we will create a basic project from a csv file.

cURL

Replace access_token, teamId, assignees, and file upload fields as appropriate.
1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--form 'operations={
4
"operationName": "LaunchTextProjectMutation",
5
"variables": {
6
"input": {
7
"teamId": "1",
8
"name": "Best Seller Books",
9
"documentSettings": {
10
"kind": "ROW_BASED",
11
"displayedRows": -1,
12
"mediaDisplayStrategy": "THUMBNAIL"
13
},
14
"assignees": [
15
{
16
"email": "[email protected]",
17
"documentNames": [
18
"Book Review.csv"
19
],
20
"role": "LABELER"
21
}
22
],
23
"projectSettings": {
24
"consensus": 1,
25
"enableEditLabelSet": true,
26
"enableEditSentence": true
27
},
28
"tagNames": ["ProjectA"],
29
"guidelineId": "1",
30
"documents": [
31
{
32
"name": "Best Seller Books",
33
"file": null,
34
"fileName": "Book Review.csv",
35
"settings": {
36
"guidelineID": "1",
37
"questions": [
38
{
39
"type": "HIERARCHICAL_DROPDOWN",
40
"config": {
41
"multiple": false,
42
"options": [
43
{
44
"label": "Penguin Publisher",
45
"id": 1
46
},
47
{
48
"label": "First edition",
49
"id": 2,
50
"parentId": 1
51
},
52
{
53
"label": "Second edition",
54
"id": 3,
55
"parentId": 1
56
},
57
{
58
"label": "J. B. Lippincott & Co.",
59
"id": 4
60
},
61
{
62
"label": "First edition",
63
"id": 5,
64
"parentId": 4
65
},
66
{
67
"label": "Second edition",
68
"id": 6,
69
"parentId": 4
70
}
71
]
72
},
73
"bindToColumn": "Publisher",
74
"name": "Q1",
75
"label": "Publisher",
76
"required": true
77
},
78
{
79
"type": "TEXT",
80
"config": {},
81
"bindToColumn": "Author",
82
"name": "Q2",
83
"label": "Author",
84
"required": true
85
},
86
{
87
"type": "DROPDOWN",
88
"config": {
89
"multiple": false,
90
"options": [
91
{
92
"id": "1",
93
"label": "Fiction"
94
},
95
{
96
"id": "2",
97
"label": "Non finction"
98
}
99
]
100
},
101
"bindToColumn": "Genre",
102
"name": "Q3",
103
"label": "Genre",
104
"required": true
105
},
106
{
107
"type": "NESTED",
108
"config": {
109
"multiple": true,
110
"questions": [
111
{
112
"type": "TEXT",
113
"config": {},
114
"name": "Q4.1",
115
"label": "Original",
116
"required": true
117
},
118
{
119
"type": "TEXT",
120
"config": {
121
"multiline": true
122
},
123
"name": "Q4.2",
124
"label": "Translation",
125
"required": true
126
}
127
]
128
},
129
"bindToColumn": "Language",
130
"name": "Q4",
131
"label": "Language",
132
"required": true
133
},
134
{
135
"type": "DATE",
136
"config": {
137
"format": "DD/MM/YYYY"
138
},
139
"bindToColumn": "Publication Date",
140
"name": "Q5",
141
"label": "Publication Date",
142
"required": true
143
},
144
{
145
"type": "TIME",
146
"config": {
147
"format": "HH:mm"
148
},
149
"bindToColumn": "Best Time Reading",
150
"name": "Q6",
151
"label": "Best Time Reading",
152
"required": true
153
},
154
{
155
"type": "TEXT",
156
"config": {
157
"multiline": true
158
},
159
"bindToColumn": "Quick Review",
160
"name": "Q7",
161
"label": "Quick Review",
162
"required": true
163
},
164
{
165
"type": "SLIDER",
166
"config": {
167
"min": 1,
168
"max": 10,
169
"step": 1
170
},
171
"bindToColumn": "Rate",
172
"name": "Q8",
173
"label": "How would you rate this book?",
174
"required": true
175
}
176
]
177
},
178
"docFileOptions": {
179
"customHeaderColumns": [
180
"Book Title",
181
"Publisher",
182
"Author",
183
"Genre",
184
"Language",
185
"Publication Date",
186
"Best Time Reading",
187
"Quick Review",
188
"Rate"
189
],
190
"firstRowAsHeader": true
191
}
192
}
193
]
194
}
195
},
196
"query": "mutation LaunchTextProjectMutation($input: LaunchTextProjectInput!) { launchTextProject(input: $input) { id rootDocumentId settings { consensus enableEditLabelSet enableEditSentence __typename } __typename }}"
197
}' \
198
--form 'map={"1":["variables.input.documents.0.file"]}' \
199
--form '1=@bookcover.csv'
Copied!
  • operationName: you can fill any alphanumeric string in as the operationName. Refer this page for best practices on choosing an operationName .
  • variables
    • teamId: id of the team where we want to create the project.
    • name: Name for the project.
    • documentSettings
      • displayedRows: This determines how many rows displayed in the editor. Use -1 to show all rows at once.
      • mediaDisplayStrategy: This determines how media displayed in editor.
        • NONE. Any media will not be displayed and expanded.
        • THUMBNAIL. Media will be displayed as a thumbnail.
        • FULL. Media will be displayed at its original size.
      • kind: Use ROW_BASED as the value here since we want to create row-based labeling project.
        • TOKEN_BASED
        • ROW_BASED
        • DOCUMENT_BASED
    • projectSettings
      • consensus: peer review / labeler consensus. This determines how many labelers must agree in order for the system to automatically accept the label.
      • enableEditLabelSet: labelers will be restricted from adding or removing labels from the label set while labeling.
      • enableEditSentence: labelers will be able to edit the original text while labeling.
    • assignees
      • email: this refers to the user's email. Datasaur will throw an error if the email is not found on the team.
      • documentNames: Optional. List of document names. It refers to the field documents.fileName below. If not specified, all documents will be assigned to the team member above.
      • role: Optional. This determines the assignment role.
        • LABELER
        • REVIEWER
    • tagNames: a list of tag names to apply to a project. This parameter is optional and the type is string array.
    • guidelineId: Put guideline ID here.
    • documents: list of documents or files to be attached to this project. Every document must have the fields: name and fileName. There are optional fields, such as settings and fileUrl. Please see GraphQL schema for more information.
      • name: Document name.
      • fileName: File name. This can be used in the documentNames field above.
      • file: Use null.
      • settings
        • questions: Add the list of questions here. Refer to this page for more information about questions.
      • docFileOptions:
        • customHeaderColumns: Optional. Override column headers by using these values.
        • firstRowAsHeader: Optional. If the csv or xlsx file has a header as the first row, Datasaur will use it as the column header.
  • query: Copy this from the cURL example.
💡 You can check this page to see how to upload file in GraphQL.

Sample File

We provide this file as an example for the main text for your cURL command above.
book-review.csv
231B
Binary
Book Review.csv

Response

Here is the response you can expect after issuing the cURL command.
1
{
2
"data": {
3
"launchTextProject": {
4
"id": "525",
5
"rootDocumentId": "caa436bd-848c-4151-b5d4-ca57530c47b5",
6
"settings": {
7
"consensus": 0,
8
"enableEditLabelSet": false,
9
"enableEditSentence": false,
10
"__typename": "ProjectSettings"
11
},
12
"__typename": "Project"
13
}
14
},
15
"extensions": {}
16
}
Copied!

Project Referencing External Image Files

Some projects may need to load data from other URLs. For example, some projects may include images that are stored on Amazon S3.
You can upload a csv file that contains all the image URLs. In this example, we will create a Book Cover Review Project. The images are loaded from the Amazon S3 bucket.

cURL

Replace access_token, teamId, assignees, and file upload fields as appropriate.
1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--form 'operations={
4
"operationName": "LaunchTextProjectMutation",
5
"variables": {
6
"input": {
7
"teamId": "1",
8
"name": "Book Cover Review",
9
"documentSettings": {
10
"kind": "ROW_BASED",
11
"displayedRows": -1,
12
"mediaDisplayStrategy": "THUMBNAIL"
13
},
14
"assignees": [
15
{
16
"email": "[email protected]"
17
}
18
],
19
"projectSettings": {
20
"consensus": 1,
21
"enableEditLabelSet": true,
22
"enableEditSentence": true
23
},
24
"documents": [
25
{
26
"name": "book-cover-review.csv",
27
"file": null,
28
"fileName": "book-cover-review.csv",
29
"settings": {
30
"guidelineID": "1",
31
"questions": [
32
{
33
"type": "DROPDOWN",
34
"config": {
35
"multiple": true,
36
"options": [
37
{
38
"id": "1",
39
"label": "Good"
40
},
41
{
42
"id": "2",
43
"label": "Bad"
44
},
45
{
46
"id": "3",
47
"label": "Neutral"
48
}
49
]
50
},
51
"name": "Impression",
52
"label": "What is your impression about this cover?",
53
"required": true
54
}
55
]
56
},
57
"docFileOptions": {
58
"customHeaderColumns": [
59
"Book Cover"
60
],
61
"firstRowAsHeader": true
62
}
63
}
64
]
65
}
66
},
67
"query": "mutation LaunchTextProjectMutation($input: LaunchTextProjectInput!) { launchTextProject(input: $input) { id rootDocumentId settings { consensus enableEditLabelSet enableEditSentence __typename } __typename }}"
68
}' \
69
--form 'map={"1":["variables.input.documents.0.file"]}' \
70
--form '1=@book-cover-review.csv'
Copied!
  • operationName: you can fill any alphanumeric string in as the operationName. LaunchTextProjectMutation is fine as a default. Refer this page to organise operationName properly.
  • variables
    • teamId: Team id that we want to create the project for.
    • name: Project name.
    • documentSettings
      • displayedRows: This determines how many rows displayed in the editor. Use -1 to show all rows at once.
      • mediaDisplayStrategy: This determines how media displayed in editor.
        • NONE. Any media will not be displayed and expanded.
        • THUMBNAIL. Media will be displayed as a thumbnail.
        • FULL. Media will be displayed at its original size.
      • kind: Use ROW_BASED as the value here since we want to create row-based labeling project.
        • TOKEN_BASED
        • ROW_BASED
        • DOCUMENT_BASED
    • projectSettings
      • consensus: peer review / labeler consensus. This determines how many labelers must agree in order for the system to automatically accept the label.
      • enableEditLabelSet: labelers will be restricted from adding or removing labels from the label set while labeling.
      • enableEditSentence: labelers will be able to edit the original text while labeling.
    • assignees
      • email: this refers to the user's email. Datasaur will throw an error if the email is not found on the team.
      • documentNames: Optional. List of document names. It refers to field documents below. Do not specify it to assign all documents to the team member.
    • documents: list of documents or files to be attached to this project. Every document must have the fields: name and fileName. There are optional fields, such as settings and fileUrl. See GraphQL schema for more information.
      • name: Document name. It can be referred at documentNames field above.
      • fileName: File name.
      • file: Use null.
      • settings
        • questions: Add the list of questions here. Refer to this page for more information about questions.
      • docFileOptions:
        • customHeaderColumns: Optional. Override column headers by using these values.
        • firstRowAsHeader: Optional. If the csv or xlsx file has a header as the first row, Datasaur will use it as the column header.
  • query: Copy it from cURL example.

Sample File

We provide this file as an example for the main text for your cURL command above.
book-cover-review.csv
217B
Binary

Response

Here is the response you can expect after issuing the cURL command.
1
{
2
"data": {
3
"launchTextProject": {
4
"id": "525",
5
"rootDocumentId": "caa436bd-848c-4151-b5d4-ca57530c47b5",
6
"settings": {
7
"consensus": 0,
8
"enableEditLabelSet": false,
9
"enableEditSentence": false,
10
"__typename": "ProjectSettings"
11
},
12
"__typename": "Project"
13
}
14
},
15
"extensions": {}
16
}
Copied!

Project with the Viewer

You can change the behavior of how the editor display the content by setting the viewer parameter to TABULAR or URL.
Here's how the project will look like on each different view.
TABULAR Viewer
Project with TABULAR viewer
URL Viewer
Project with URL viewer
The column Book as the URL source will be displayed as browser URL
The other columns like Book Tittle and Author will be shown in the Document Labeling extension as its metadata.

cURL

In this example, we will create a project with URL view. The only required fields are viewer and viewerConfig.
1
"input": {
2
...
3
"documentSettings": {
4
...
5
"viewer": "URL",
6
"viewerConfig": {
7
"urlColumnNames": ["Book"]
8
}
9
...
10
}
11
}
Copied!
For the full example, please see code below. Replace access_token, teamId, assignees, and file upload fields as appropriate.
1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--form 'operations={
4
"operationName": "LaunchTextProjectMutation",
5
"variables": {
6
"input": {
7
"teamId": "1",
8
"name": "Book Cover Review",
9
"documentSettings": {
10
"kind": "ROW_BASED",
11
"displayedRows": -1,
12
"mediaDisplayStrategy": "THUMBNAIL",
13
"viewer": "URL",
14
"viewerConfig": {
15
"urlColumnNames": ["Book"]
16
}
17
},
18
"assignees": [
19
{
20
"email": "[email protected]"
21
}
22
],
23
"projectSettings": {
24
"consensus": 1,
25
"enableEditLabelSet": true,
26
"enableEditSentence": true
27
},
28
"documents": [
29
{
30
"name": "book-cover-review.csv",
31
"file": null,
32
"fileName": "book-cover-review.csv",
33
"settings": {
34
"guidelineID": "1",
35
"questions": [
36
{
37
"type": "DROPDOWN",
38
"config": {
39
"multiple": true,
40
"options": [
41
{
42
"id": "1",
43
"label": "Good"
44
},
45
{
46
"id": "2",
47
"label": "Bad"
48
},
49
{
50
"id": "3",
51
"label": "Neutral"
52
}
53
]
54
},
55
"name": "Impression",
56
"label": "What is your impression about this cover?",
57
"required": true
58
}
59
]
60
},
61
"docFileOptions": {
62
"customHeaderColumns": [
63
"Book Cover"
64
],
65
"firstRowAsHeader": true
66
}
67
}
68
]
69
}
70
},
71
"query": "mutation LaunchTextProjectMutation($input: LaunchTextProjectInput!) { launchTextProject(input: $input) { id rootDocumentId settings { consensus enableEditLabelSet enableEditSentence __typename } __typename }}"
72
}' \
73
--form 'map={"1":["variables.input.documents.0.file"]}' \
74
--form '1=@book-cover-review.csv'
Copied!

Sample File

We provide this file as an example for the main text for your cURL command above.
book-cover-review (1).csv
356B
Binary

Project By Uploading Multiple Files

In this example, we will create a new project named Book Review with two different csv files.

cURL

Replace the access_token, teamId, assignees, and file upload fields as appropriate.
1
curl --location --request POST 'https://datasaur.ai/graphql' \
2
--header 'Authorization: Bearer access_token' \
3
--form 'operations={
4
"operationName": "CreateProject",
5
"variables": {
6
"input": {
7
"teamId": "1",
8
"name": "Book Review",
9
"documentSettings": {
10
"kind": "ROW_BASED",
11
"displayedRows": -1,
12
"mediaDisplayStrategy": "FULL"
13
},
14
"projectSettings": {
15
"consensus": 1,
16
"enableEditLabelSet": true,
17
"enableEditSentence": true
18
},
19
"assignees": [
20
{
21
"email": "[email protected]",
22
"documentNames": [
23
"book-review-1.csv",
24
"book-review-2.csv"
25
]
26
},
27
{
28
"email": "[email protected]",
29
"documentNames": [
30
"book-review-2.csv"
31
]
32
}
33
],
34
"documents": [
35
{
36
"fileName": "book-review-1.csv",
37
"file": null,
38
"settings": {
39
"guidelineID": "1",
40
"questions": [
41
{
42
"type": "TEXT",
43
"config": {
44
"multiple": false
45
},
46
"name": "Author",
47
"label": "Author",
48
"required": true
49
},
50
{
51
"type": "TEXT",
52
"config": {
53
"multiline": true,
54
"multiple": false
55
},
56
"name": "Review",
57
"label": "Review",
58
"required": true
59
},
60
{
61
"type": "DROPDOWN",
62
"config": {
63
"multiple": true,
64
"options": [
65
{
66
"id": "1",
67
"label": "Positive"
68
},
69
{
70
"id": "2",
71
"label": "Negative"
72
}
73
]
74
},
75
"name": "Polarity",
76
"label": "Polarity",
77
"required": true
78
}
79
]
80
},
81
"docFileOptions": {
82
"customHeaderColumns": ["Book Title"],
83
"firstRowAsHeader": true
84
}
85
},
86
{
87
"fileName": "book-review-2.csv",
88
"file": null,
89
"docFileOptions": {
90
"customHeaderColumns": ["Book Title"],
91
"firstRowAsHeader": true
92
}
93
}
94
]
95
}
96
},
97
"query": "mutation CreateProject($input: LaunchTextProjectInput!) {project: launchTextProject(input: $input) { id __typename }}"
98
}' \
99
--form 'map={"1":["variables.input.documents.0.file"], "2":["variables.input.documents.1.file"]}' \
100
--form '1=@book-review-1.csv' \
101
--form '2=@book-review-2.csv'
Copied!
  • operationName: you can fill any alphanumeric string in as the operationName. LaunchTextProjectMutation is fine as a default. Refer this page to organise operationName properly.
  • variables
    • teamId: Team id that we want to create the project for.
    • name: Project name.
    • documentSettings
      • displayedRows: This determines how many rows displayed in the editor. Use -1 to show all rows at once.
      • mediaDisplayStrategy: This determines how media displayed in editor.
        • NONE. Any media will not be displayed and expanded.
        • THUMBNAIL. Media will be displayed as a thumbnail.
        • FULL. Media will be displayed at its original size.
      • kind: Use ROW_BASED as the value here since we want to create row-based labeling project.
        • TOKEN_BASED
        • ROW_BASED
        • DOCUMENT_BASED
    • projectSettings
      • consensus: peer review / labeler consensus. This determines how many labelers must agree in order for the system to automatically accept the label.
      • enableEditLabelSet: labelers will be restricted from adding or removing labels from the label set while labeling.
      • enableEditSentence: labelers will be able to edit the original text while labeling.
    • assignees
      • email: this refers to the user's email. Datasaur will throw an error if the email is not found on the team.
      • documentNames: Optional. List of document names. It refers to field documents below. Do not specify it to assign all documents to the team member.
    • documents: list of documents or files to be attached to this project. Every document must have the fields: name and fileName. There are optional fields, such as settings and fileUrl. See GraphQL schema for more information.
      • name: Document name. It can be referred at documentNames field above.
      • fileName: File name.
      • file: Use null.
      • settings
        • questions: Add the list of questions here. Refer to this page for more information about questions.
      • docFileOptions:
        • customHeaderColumns: Optional. Override column headers by using these values.
        • firstRowAsHeader: Optional. If the csv or xlsx file has a header as the first row, Datasaur will use it as the column header.
  • query: Copy it from cURL example.

Sample Files

We provide these files as examples for the main texts for your cURL command above.
book-review-1.csv
66B
Binary
book-review-1.csv
book-review-2.csv
82B
Binary
book-review-2.csv

Response

Here is the response you can expect after issuing the cURL command.
1
{
2
"data": {
3
"launchTextProject": {
4
"id": "575",
5
"rootDocumentId": "caa436bd-848c-4151-b5d4-ca57530c47b5",
6
"settings": {
7
"consensus": 0,
8
"enableEditLabelSet": false,
9
"enableEditSentence": false,
10
"__typename": "ProjectSettings"
11
},
12
"__typename": "Project"
13
}
14
},
15
"extensions": {}
16
}
Copied!

💡 You can check this page on our GraphQL Schema to see what parameters available.