Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create project with new name #1

Open
ofersabo opened this issue Jan 28, 2021 · 7 comments
Open

Create project with new name #1

ofersabo opened this issue Jan 28, 2021 · 7 comments
Assignees
Labels
⭐️ Enhancement New feature or request
Milestone

Comments

@ofersabo
Copy link

Hi,

We use the API suggested by Pycaprio.
Assuming that we have a large number of documents to annotate, and we want to split them among our annotators.
To enable splitting the documents between them, we create multiple projects where each annotator is assigned to one of these projects.
These projects are identical in the configuration just with different documents.

To create such identical projects, we generated a single template project and we want to duplicate it using the API.
The way we duplicate it is by downloading the project and uploading a new identical project with a different set of documents. However we can't find a way to change the name of the project?

Can this be done using the API? if not, is there any workaround? we tried to change the zip file name but this didn't help. we also tried to change the name in the log file.

Thanks

@reckart
Copy link
Member

reckart commented Jan 28, 2021

The project name is in the JSON file that lies within the ZIP file and which contains the project configuration/metadata.

There is currently no way to change the name via the remote API or during import.

@ofersabo
Copy link
Author

So the process becomes:

  1. unzip project
  2. change the value in the json file
  3. zip directory
  4. upload the new zip file as a project.
    when doing this process we get an error saying that:
    image

Any idea, why this is happening?

@reckart
Copy link
Member

reckart commented Jan 28, 2021

Ok, so here an example of how a project should look in the ZIP:

% unzip -l Example+Frame+annotation_project_2021-01-24_2333.zip
Archive:  Example+Frame+annotation_project_2021-01-24_2333.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
      712  01-24-2021 23:33   constraints/Category constraints
      897  01-24-2021 23:33   source/document.tsv
     4617  01-24-2021 23:33   annotation/document.tsv/webanno5734117578598220111export.zip
     9202  01-24-2021 23:33   log/project-315.log
    20836  01-24-2021 23:33   annotation_ser/document.tsv/admin.ser
    20733  01-24-2021 23:33   annotation_ser/document.tsv/INITIAL_CAS.ser
     4492  01-24-2021 23:33   event.log
    11315  01-24-2021 23:33   exportedproject8092587949076490682.json
---------                     -------
    72804                     8 files

This is directly after the export.

Now when I extract the ZIP in my file manager (macOS Finder), it creates a folder Example+Frame+annotation_project_2021-01-24_2333 and puts the files inside it.

Screenshot 2021-01-28 at 19 57 49

Now I compress the extracted folder again in the file manager by right-clicking and choosing "compress" - it creates a new file Example+Frame+annotation_project_2021-01-24_2333 2.zip - so let's see how that new file looks internally (macOS adds extra entries in a __MACOSX folder which I am filtering out here):

% unzip -l Example+Frame+annotation_project_2021-01-24_2333\ 2.zip | grep -v "__"
Archive:  Example+Frame+annotation_project_2021-01-24_2333 2.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/constraints/
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/source/
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/annotation/
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/log/
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/annotation_ser/
     4492  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/event.log
    11315  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/exportedproject8092587949076490682.json
      712  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/constraints/Category constraints
      897  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/source/document.tsv
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/annotation/document.tsv/
     9202  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/log/project-315.log
        0  01-28-2021 19:57   Example+Frame+annotation_project_2021-01-24_2333/annotation_ser/document.tsv/
     4617  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/annotation/document.tsv/webanno5734117578598220111export.zip
    20836  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/annotation_ser/document.tsv/admin.ser
    20733  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/annotation_ser/document.tsv/INITIAL_CAS.ser
---------                     -------
    76296                     32 files

So see the difference - the folder into which the file manager extracted is suddenly part of the ZIP which makes it invalid:

Original:
    11315  01-24-2021 23:33   exportedproject8092587949076490682.json

Repacked:
    11315  01-24-2021 23:33   Example+Frame+annotation_project_2021-01-24_2333/exportedproject8092587949076490682.json

To package correctly, you can

  • go into the folder of the extracted project cd Example+Frame+annotation_project_2021-01-24_2333
  • zip the folder up into a ZIP file in the parent folder: zip -r ../Example3.zip *
  • check that the ZIP has the proper structure: unzip -l ../Example3.zip

@ofersabo
Copy link
Author

Thanks @reckart!

This works! And I think that it also answers some other questions about how to assign users to projects, it's all in this json file!
Again thanks for the quick replay!

@reckart
Copy link
Member

reckart commented Jan 28, 2021

We have been playing around a bit with creating a bit of a python utility code to access exported projects:

https://gist.github.com/reckart/925950f2b489e9e75c54bc44a37548e8

Would you find such a thing useful? Would you care to contribute should we turn it into a proper GitHub repo/pypi package?

@ofersabo
Copy link
Author

ofersabo commented Feb 1, 2021

We would find this very useful, and yes we would definitely want to contribute.
We are working on our implementation for these utility functions. would update once we get to a more stable point.

@reckart reckart added the ⭐️ Enhancement New feature or request label Mar 19, 2024
@reckart reckart self-assigned this Mar 19, 2024
@reckart reckart added this to the 0.1.0 milestone Mar 19, 2024
@reckart
Copy link
Member

reckart commented Mar 19, 2024

@ofersabo Getting back wrt these utility functions - still interested in contributing those?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants