Developing a translator - unable to snapshot?

I am developing a translator for www.medicines.org.uk/emc

Everything behaves exactly as I expect it to in the scaffolding.

Once I push it into live, I am offered a "book button" (I'm counting a page as a chapter of a book similar to UpToDate suggest they are referenced) - But when I click on the button I get an error message:


![Screenshot-2022-03-29-221531a9f05b3f66286abd.png](https://pic.li/images/2022/03/29/Screenshot-2022-03-29-221531a9f05b3f66286abd.png)

A second attempt looks marginally different...

![Screenshot-2022-03-29-221425131ddc5ee96b4dd4.png](https://pic.li/images/2022/03/29/Screenshot-2022-03-29-221425131ddc5ee96b4dd4.png)

I can save these as a webpage with a snapshot.

Perhaps its not the snapshot that fails?

I've tried disabling snapshots but it seems to still want one (and I'd want one in the finished solution)

In Scaffold Test Frame I get this:

22:30:10 Returned item:
{
"itemType": "bookSection"
"creators": {
"firstName": "Roche Products"
"lastName": "Limited"
"creatorType": "author"
}
"notes": []
"tags": []
"seeAlso": []
"attachments": []
"url": "https://www.medicines.org.uk/emc/product/3856/smpc"
"title": "Summary of Product Characteristics Herceptin 150mg Powder for concentrate for solution for infusion"
"abstractNote": "Herceptin 150mg Powder for concentrate for solution for infusion - Summary of Product Characteristics (SmPC) by Roche Products Limited"
"language": "en"
"libraryCatalog": "www.medicines.org.uk"
"accessDate": "CURRENT_TIMESTAMP"
"bookTitle": "Electronic Medicines Compendium"
"publisher": "Datapharm"
"place": "Surrey, UK"
"date": "28 Sep 2021"
}

The only odd issue is that the url comes through as a amazon web services url, and I didn't want that on my citation so I used doc.location.href to get the version in the address bar. Everything else is fairly basic.

Can anyone suggest where I begin to debug this?

My current code is at:

https://github.com/polc1410/translators/blob/master/medicines.org.uk.js
  • Have you checked the error log and looked at debug output in the connector? That'd be where you're most likely to find clues about what's going on.
  • Looking at the creators, though, those look wrong. That should be an array of objects, not just an object.
  • Thanks @adamsmith
    Too many places to look - (dev in Zotero is new for me) - I am getting a error message:

    [JavaScript Error: "ID not provided" {file: "chrome://zotero/content/xpcom/connector/server_connector.js" line: 173}]

    In the error console. (Plus 100's of warningns about webkit stuff which I assume IO can ignore)

    Will try with no creator set.
  • It doesn't look like you're saving a snapshot at all in your Scaffold output. Would you be able to paste the code you use to add the attachment in a <code> tag here or a GitHub Gist?
  • Ah yes. That's probably a butchered version where I ended up deleting the snapshot in an attempt to get something to save!

    However, following Adams advice re creator needing to be an array I went and adjusted some code. My initial attempts failed so I went looking for code doing similar to what I wanted to do. The clinical trials gov translation is not too far off so I have used their code as a basic backbone (mine is far less sophisticated).

    https://github.com/polc1410/translators/blob/ff1a96bcc4d818772c1f2d894c2072cb5b85537b/Save as Summary of Product Characteristics.js

    So I now have a working version that is saving, complete with a snapshot. I have some minor tweaks to apply and I will send a pull request to add to the official stuff.

    I've removed all the Async stuff - I'm saving a single citation from a single webpage - I doubt Async is adding a noticeable performance advantage.

    Many thanks for both of you taking a look at this. A little nudge in the right direction is often helpful

Sign In or Register to comment.