Datasaur
Search…
Document-Based Projects

Create New Document Based Project

In this example, we will create a new document-based labeling project. We are going to label some book cover images and determine the title of the book. Additionally, we will use a Hierarchical Dropdown for our question.
Book Cover Project

cURL

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",
9
"documentSettings": {
10
"kind": "DOCUMENT_BASED"
11
},
12
"projectSettings": {
13
"consensus": 1,
14
"enableEditLabelSet": true,
15
"enableEditSentence": true
16
},
17
"assignees": [
18
{
19
"email": "[email protected]"
20
}
21
],
22
"tagNames": ["ProjectB"],
23
"documents": [
24
{
25
"name": "cover-1.jpg",
26
"file": null,
27
"fileName": "cover-1.jpg",
28
"settings": {
29
"guidelineID": "1",
30
"questions": [
31
{
32
"type": "HIERARCHICAL_DROPDOWN",
33
"config": {
34
"multiple": false,
35
"options": [
36
{
37
"label": "Novel",
38
"id": 1
39
},
40
{
41
"label": "Sherlock Holmes",
42
"id": 2,
43
"parentId": 1
44
},
45
{
46
"label": "A Study in Scarlet",
47
"id": 3,
48
"parentId": 2
49
},
50
{
51
"label": "A Scandal in Bohemia",
52
"id": 4,
53
"parentId": 2
54
},
55
{
56
"label": "Harry Potter",
57
"id": 5,
58
"parentId": 1
59
},
60
{
61
"label": "Philosopher'\''s Stone",
62
"id": 6,
63
"parentId": 5
64
},
65
{
66
"label": "Chamber of Secrets",
67
"id": 7,
68
"parentId": 5
69
},
70
{
71
"label": "Drama",
72
"id": 8
73
},
74
{
75
"label": "William Shakespeare",
76
"id": 9,
77
"parentId": 8
78
},
79
{
80
"label": "Hamlet",
81
"id": 10,
82
"parentId": 9
83
},
84
{
85
"label": "Macbeth",
86
"id": 11,
87
"parentId": 9
88
},
89
{
90
"label": "Molière",
91
"id": 12,
92
"parentId": 8
93
},
94
{
95
"label": "Tartuffe",
96
"id": 13,
97
"parentId": 12
98
},
99
{
100
"label": "The Misanthrope",
101
"id": 14,
102
"parentId": 12
103
}
104
]
105
},
106
"name": "Book Title",
107
"label": "What is the book title?",
108
"required": true
109
}
110
]
111
}
112
},
113
{
114
"name": "cover-2.jpg",
115
"file": null,
116
"fileName": "cover-2.jpg",
117
"settings": {"guidelineID": "1"}
118
},
119
{
120
"name": "cover-3.jpg",
121
"file": null,
122
"fileName": "cover-3.jpg",
123
"settings": {"guidelineID": "1"}
124
},
125
{
126
"name": "cover-4.jpg",
127
"file": null,
128
"fileName": "cover-4.jpg",
129
"settings": {"guidelineID": "1"}
130
},
131
{
132
"name": "cover-5.jpg",
133
"file": null,
134
"fileName": "cover-5.jpg",
135
"settings": {"guidelineID": "1"}
136
}
137
]
138
}
139
},
140
"query": "mutation LaunchTextProjectMutation($input: LaunchTextProjectInput!) { launchTextProject(input: $input) { id rootDocumentId settings { consensus enableEditLabelSet enableEditSentence __typename } __typename }}"
141
}' \
142
--form 'map={"1":["variables.input.documents.0.file"], "2":["variables.input.documents.1.file"], "3":["variables.input.documents.2.file"], "4":["variables.input.documents.3.file"], "5":["variables.input.documents.4.file"]}' \
143
--form '1=@cover-1.jpg' \
144
--form '2=@cover-2.jpg' \
145
--form '3=@cover-3.jpg' \
146
--form '4=@cover-4.jpg' \
147
--form '5=@cover-5.jpg'
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
        kind: Use DOCUMENT_BASED as the value here since we want to create document-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.
    query: Copy this from the cURL example.

Sample Files

Extract cover.zip to get sample files. You could use these images to execute cURL command above.
cover.zip
688KB
Binary
cover.zip
💡 You can check this page to see how to upload file in GraphQL.

Response

Here is the response you can expect after issuing the cURL command.
1
{
2
"data": {
3
"launchTextProject": {
4
"id": "580",
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 to see what parameters available.
Last modified 3mo ago