urschrei / pyzotero

Pyzotero: a Python client for the Zotero API
https://pyzotero.readthedocs.org
Other
908 stars 99 forks source link

Attachment template type #105

Closed skybristol closed 4 years ago

skybristol commented 5 years ago

Fantastic Python package here! My thanks to the contributors for saving me a ton of time this morning. I'm working on a process to link articles in a Zotero library to documents that have been through NLP processing in the xDD library. I found that the item_template function threw an error when I asked for the "attachment" template type, requiring a linkMode parameter. I took a crack at adding this functionality with the commits in this branch and tested it successfully for my use case that you can find in this Notebook.

This might need some additional help from someone on proper use of your error_handler and any insight on pulling available values for linkMode. I found some documentation that I referenced in the index.rst where I pulled together a set of working values, but I did not find a REST API route for this enumeration.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.2%) to 44.469% when pulling 08f5fbcb284258552463c8484e59ff4c39af24aa on skybristol:attachment-template-type into b30775932e6fa94484adf0ac038aea6858323277 on urschrei:dev.

urschrei commented 5 years ago

Thanks for this! IIUC, you were creating URL attachments for existing items? Essentially, you've fallen between the cracks a bit here, because attachment_simple and attachment_both methods are provided, but these only cover file attachments, and, as it turns out, the item_template method doesn't work for attachments (mostly because nobody's ever used Pyzotero for non-file attachments before). I think your PR mostly covers it, though – thanks!

skybristol commented 5 years ago

Great! I hope it will help others as well. In our case, we are adding links to a derivative of the articles in a library that have been processed with NLP to support text and data mining operations. After committing this stuff to your project, I used it to generate additional link attachments on the items in our use case library that pull back a set of biological species names that were extracted from the text content in the articles, encoding some raw information into the note of the attachment and putting the names themselves into tags. This is kind of cool as it immediately injects value into the Zotero library for the group users, from the attachments like this.

The majority of our work in this experiment is then in using the species names (which I pull back out of the Zotero library here), running the names through a series of information gathering steps to assemble a database of all the species associated with this particular work and derived from their literature database for further analysis.

I'm grateful for what you all laid out with pyzotero as it lets us build this distributed information systems architecture in a way that works directly against source records in a Zotero library rather than fiddling with export/import types of garbage. We'll acknowledge your project when we publish this work in a couple months.

Cheers.

urschrei commented 4 years ago

I've just manually merged this into master: see a24e992 and 6304755, and the updated CONTRIBUTORS file. Thanks again!