doccano-client
                                
                                 doccano-client copied to clipboard
                                
                                    doccano-client copied to clipboard
                            
                            
                            
                        Add ability to create a new project via api
Feature description
Often I need to create multiple, very similar projects. Currently the workflow is to go into the UI and manually create these - it's very repetitive and time consuming. It would be great to have the ability to create a new project using the API, including the ability to upload a dataset, labels, and assign members.
@LizMcQuillan This is currently possible using a series of different functions in the base object, the DoccanoClient has a function create_project for initializing a project. To Attach members to the project the post_members function can be used. Uploading a dataset uses the post_doc_upload function. Adding in the labels will use functions based on the project type, for example a SequenceLabeling project uses the post_span_type_upload . The general flow is
- Initialize a DoccanoClient object
- Pick a project_type and a resource_type (SequenceLabeling & SequenceLabelingProject etc.)
- Get the Username/s and Role Name/s that should be attached to the project
- Set a upload Document Path
- Set a label upload path
...
project = doccano_client.create_project(name=...., description=...., project_type=...., resourcetype=..., collaborative_annoation=...)
project_id = project["id"]
users = [user]
roles = [role]
_result = doccano_client.post_members(project_id=project_id, usernames=users, roles=roles)
doccano_client.post_span_type_upload(project_id=project_id, file_name=..., file_path=...)
doccano_client.post_doc_upload(project_id=project_id, file_name=..., file_path=...)
Hope this helps!