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
"documents": [
30
{
31
"name": "Best Seller Books",
32
"file": null,
33
"fileName": "Book Review.csv",
34
"settings": {
35
"guidelineID": "1",
36
"questions": [
37
{
38
"type": "HIERARCHICAL_DROPDOWN",
39
"config": {
40
"multiple": false,
41
"options": [
42
{
43
"label": "Penguin Publisher",
44
"id": 1
45
},
46
{
47
"label": "First edition",
48
"id": 2,
49
"parentId": 1
50
},
51
{
52
"label": "Second edition",
53
"id": 3,
54
"parentId": 1
55
},
56
{
57
"label": "J. B. Lippincott & Co.",
58
"id": 4
59
},
60
{
61
"label": "First edition",
62
"id": 5,
63
"parentId": 4
64
},
65
{
66
"label": "Second edition",
67
"id": 6,
68
"parentId": 4
69
}
70
]
71
},
72
"bindToColumn": "Publisher",
73
"name": "Q1",
74
"label": "Publisher",
75
"required": true
76
},
77
{
78
"type": "TEXT",
79
"config": {},
80
"bindToColumn": "Author",
81
"name": "Q2",
82
"label": "Author",
83
"required": true
84
},
85
{
86
"type": "DROPDOWN",
87
"config": {
88
"multiple": false,
89
"options": [
90
{
91
"id": "1",
92
"label": "Fiction"
93
},
94
{
95
"id": "2",
96
"label": "Non finction"
97
}
98
]
99
},
100
"bindToColumn": "Genre",
101
"name": "Q3",
102
"label": "Genre",
103
"required": true
104
},
105
{
106
"type": "NESTED",
107
"config": {
108
"multiple": true,
109
"questions": [
110
{
111
"type": "TEXT",
112
"config": {},
113
"name": "Q4.1",
114
"label": "Original",
115
"required": true
116
},
117
{
118
"type": "TEXT",
119
"config": {
120
"multiline": true
121
},
122
"name": "Q4.2",
123
"label": "Translation",
124
"required": true
125
}
126
]
127
},
128
"bindToColumn": "Language",
129
"name": "Q4",
130
"label": "Language",
131
"required": true
132
},
133
{
134
"type": "DATE",
135
"config": {
136
"format": "DD/MM/YYYY"
137
},
138
"bindToColumn": "Publication Date",
139
"name": "Q5",
140
"label": "Publication Date",
141
"required": true
142
},
143
{
144
"type": "TIME",
145
"config": {
146
"format": "HH:mm"
147
},
148
"bindToColumn": "Best Time Reading",
149
"name": "Q6",
150
"label": "Best Time Reading",
151
"required": true
152
},
153
{
154
"type": "TEXT",
155
"config": {
156
"multiline": true
157
},
158
"bindToColumn": "Quick Review",
159
"name": "Q7",
160
"label": "Quick Review",
161
"required": true
162
},
163
{
164
"type": "SLIDER",
165
"config": {
166
"min": 1,
167
"max": 10,
168
"step": 1
169
},
170
"bindToColumn": "Rate",
171
"name": "Q8",
172
"label": "How would you rate this book?",
173
"required": true
174
}
175
]
176
},
177
"docFileOptions": {
178
"customHeaderColumns": [
179
"Book Title",
180
"Publisher",
181
"Author",
182
"Genre",
183
"Language",
184
"Publication Date",
185
"Best Time Reading",
186
"Quick Review",
187
"Rate"
188
],
189
"firstRowAsHeader": true
190
}
191
}
192
]
193
}
194
},
195
"query": "mutation LaunchTextProjectMutation($input: LaunchTextProjectInput!) { launchTextProject(input: $input) { id rootDocumentId settings { consensus enableEditLabelSet enableEditSentence __typename } __typename }}"
196
}' \
197
--form 'map={"1":["variables.input.documents.0.file"]}' \
198
--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.
      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
          guidelineID: Put guideline ID here.
          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 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.
Last modified 3mo ago