MicheleTobias / LiteratureMapper

A QGIS plugin to add geoJSON geometries to records in a Zotero library
GNU General Public License v2.0
28 stars 7 forks source link

Date field in Zotero causing trouble if besides year it also includes month, days #7

Closed ecodiv closed 5 years ago

ecodiv commented 9 years ago

The plugin seems to only except / deal with entries for which the date is filled in with the year only. When opening, it shows all entries till the first one that has e.g., month and year, instead of only the year. Removing the month, reloading, and it shows all entries in the collection till the next entry with in the 'date' field more than the year only. This is the error message:

2015-10-30T21:54:59 1 Traceback (most recent call last): File "/home/paulo/.qgis2/python/plugins/LiteratureMapper/literature_mapper.py", line 407, in run year = QTableWidgetItem(record['data']['date']) KeyError: 'date'

wildintellect commented 8 years ago

I hit this too, but only on an attachment that doesn't have Date field at all. Step 1 seems to be to skip all attachments only loading actual citations. Then we should recheck if it really doesn't handle missing dates. So far I can put anything in the Date field and it still works. However objects without it like attachments/snapshots cause an issue.

MicheleTobias commented 8 years ago

I have also run into a similar problem when you have an attachment. Does the record that's causing you the problem have an attachment like a pdf?

ecodiv commented 8 years ago

Yes, all records have an attachment. Removing them seems indeed to solve the issue. I still get an error message. Yet, this time the records are shown in QGIS nonetheless:

2015-11-16T14:25:00 1 Traceback (most recent call last): File "/home/paulo/.qgis2/python/plugins/LiteratureMapper/literature_mapper.py", line 407, in run year = QTableWidgetItem(record['data']['date']) KeyError: 'date'

So it seems removing the attachment seems to offer a partial solution, but obviously it would be better if it is possible to use records with attachment. Otherwise one need to copy double entries for all 'georeferenced' records.

MicheleTobias commented 5 years ago

It's been a long time, but I believe we have solved this one. The code will now skip over attachments and notes.

MicheleTobias commented 5 years ago

I had declared the year field as an integer, but now it's a string so it doesn't break. There eventually could be a more elegant way of handling the dates, but for now, this should solve it.