PASTA-ELN / pasta-eln

PASTA-ELN with new frontend
https://pasta-eln.github.io/pasta-eln/
Other
8 stars 2 forks source link

Importing eln file multiple times #229

Open HTsybenko opened 6 months ago

HTsybenko commented 6 months ago
  1. Create a project.
  2. Add items (non-file items or files)
  3. Export as .eln file
  4. "Configuration- Start analyze and repair"
  5. Import the eln file
  6. Import the eln file again
  7. Open an item in the editor, add a comment and save

After the last step: **ERROR: could not update document. Likely version conflict. Initial and current version: {'_id': 'm-2eb22ef62c7f4820bbb34c5c736000f5', '-name': 'item', '-date': '2024-03-15T15:45:29.634993', '-type': ['measurement'], '-branch': [{'stack': ['x-af779f1fb5ca499aa61d4b4e14e7a81d'], 'child': 9999, 'path': None, 'show': [True, True]}], '-gui': [True, True], '-client': 'startMain()|app.exec()|self.triggered.connect(lambda : widget.execute(command))|status = importELN(self.comm.backend, fileName)|addedDocuments += processPart(part)|addedDocs += processPart(child)|backend.db.saveDoc(doc)', '_rev': '1-718cb560112f3de8b7c1f0816de55ec3', '-tags': ['curated'], '-user': ''} {'_id': 'm-2eb22ef62c7f4820bbb34c5c736000f5', '-name': 'item', '-date': '2024-03-15T15:46:17.300030', '-type': ['measurement'], '-branch': [{'stack': ['x-af779f1fb5ca499aa61d4b4e14e7a81d'], 'child': 9999, 'path': None, 'show': [True, True]}], '-gui': [True, True], '-client': "startMain()|app.exec()|self.comm.formDoc.emit(doc)|ret = formWindow.exec()|self.clicked.connect(lambda: widget.execute(command))|self.comm.backend.editData(self.doc)|self.addData('-edit-', doc)|doc = self.db.updateDoc(doc, doc['_id'])", '_rev': '1-718cb560112f3de8b7c1f0816de55ec3', '-tags': ['_curated'], '-user': 'htsybenko', 'comment': ''} Traceback (most recent call last): File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/guiStyle.py", line 58, in self.clicked.connect(lambda: widget.execute(command)) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/GUI/form.py", line 445, in execute self.comm.backend.editData(self.doc) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/backend.py", line 119, in editData self.addData('-edit-', doc) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/backend.py", line 286, in addData return doc['_id'] KeyError: '_id'

When closing editing field after that:

**ERROR: could not update document. Likely version conflict. Initial and current version: {'_id': 'm-2eb22ef62c7f4820bbb34c5c736000f5', '-name': 'item', '-date': '2024-03-15T15:45:29.634993', '-type': ['measurement'], '-branch': [{'stack': ['x-af779f1fb5ca499aa61d4b4e14e7a81d'], 'child': 9999, 'path': None, 'show': [True, True]}], '-gui': [True, True], '-client': 'startMain()|app.exec()|self.triggered.connect(lambda : widget.execute(command))|status = importELN(self.comm.backend, fileName)|addedDocuments += processPart(part)|addedDocs += processPart(child)|backend.db.saveDoc(doc)', '_rev': '1-718cb560112f3de8b7c1f0816de55ec3', '-tags': ['curated'], '-user': ''} {'_id': 'm-2eb22ef62c7f4820bbb34c5c736000f5', '-name': 'item', '-date': '2024-03-15T15:46:17.300030', '-type': ['measurement'], '-branch': [{'stack': ['x-af779f1fb5ca499aa61d4b4e14e7a81d'], 'child': 9999, 'path': None, 'show': [True, True]}], '-gui': [True, True], '-client': "startMain()|app.exec()|self.comm.formDoc.emit(doc)|ret = formWindow.exec()|self.clicked.connect(lambda: widget.execute(command))|self.comm.backend.editData(self.doc)|self.addData('-edit-', doc)|doc = self.db.updateDoc(doc, doc['_id'])", '_rev': '1-718cb560112f3de8b7c1f0816de55ec3', '-tags': ['_curated'], '-user': 'htsybenko', 'comment': ''} Traceback (most recent call last): File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/guiStyle.py", line 58, in self.clicked.connect(lambda: widget.execute(command)) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/GUI/form.py", line 445, in execute self.comm.backend.editData(self.doc) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/backend.py", line 119, in editData self.addData('-edit-', doc) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/backend.py", line 286, in addData return doc['_id'] KeyError: '_id'

Editing the project metadata:

Traceback (most recent call last): File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/guiStyle.py", line 58, in self.clicked.connect(lambda: widget.execute(command)) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/GUI/form.py", line 445, in execute self.comm.backend.editData(self.doc) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/backend.py", line 119, in editData self.addData('-edit-', doc) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/backend.py", line 273, in addData if self.cwd is not None and doc['-type'][0][0]=='x': KeyError: '-type'

pastaELN issue.log

HTsybenko commented 6 months ago

Interestingly, the issue does not occur when the "Configuration- Start analyze and repair" is not executed (exported project is still present, when its eln file is imported). In this case, the eln file overwrites the original project. #

This case should also be discussed, since data may be lost in the process.

SteffenBrinckmann commented 6 months ago

Interesting and we need to solve it down the road.