Page MenuHomePhabricator

Support "citoid" boolean query string parameter
Closed, ResolvedPublic

Description

If present, after creating the Webpage object for the target, and before running the Domain object's translate method, make the Webpage object fetch its Citoid response.

Then, once translation is ready, and before sending a response, add the raw Citoid citation returned by Citoid at the beginning of the list of citations.

If the request was sent from the Wikipedia's user script (format = json; see T305751), this will enable showing both (Citoid and Web2Cit) results.

If the requested format is html:

  • include citations as embedded metadata (a separate task should be created to handle multiple translation results)
  • add a placeholder translation result in the user-visible html, indicating that raw citation metadata from Citoid is available as embedded metadata (also see T306132)

Event Timeline

Wikipedia's Citoid extension expects a citation in the mediawiki (not mediawikibasefields) format.

However, Web2Cit-Core's uses mediawikibasefields format.

To prevent making two requests to the Citoid service, we will probably have to make a mediawiki request instead, and address T306132.

The goal of having this citoid option was to enable the user script (i.e., integration with Wikipedia) to show both Citoid and Web2Cit results without having to make two separate requests to the Citoid API.

However, as introduced in my previous comment, Citoid results depend on a mediawiki-format Citoid response, wheras Web2Cit results depend on a mediawiki-basefields Citoid response.

It has been discussed previously whether it makes sense that Citoid results depend on a mediawiki-format Citoid response, but this will probably continue to be the case.

As suggested in my previous comment, to deal with this we could (1) have the Web2Cit-Core request mediawiki citations from the Citoid API (instead of mediawiki-basefields), and (2) address T306132 to internally convert from mediawiki to mediawiki-basefields. Remember we want to use mediawiki-basefields in Web2Cit because otherwise Citoid selection steps may have to be revised if the item type returned by Citoid changes.

However, to do so we would require a map between Zotero fields and basefields. In the event that Zotero updates this map, it would be updated in the Citoid API, and if we don't update too, our mediawiki-basefields citation may diverge from that returned by the Citoid API, which users may use to decide how to configure their Citoid selection steps.

For this reason, I think we should move forward without implementing this citoid option, which means we will have to make two separate Citoid requests to show Citoid and Web2Cit results in the custom user script.

We may revise this decision when we have implemented our Web2Cit-Editor, given that at that moment users won't rely on Citoid's mediawiki-basefields response to decide how to configure their Citoid selection steps, but rather on our internal conversion from mediawiki to mediawiki-basefields.

Nonetheless, and having said all of that, we may still consider implementing this citoid option, given how unlikely it may be that the "field to basefield" map changes so often.

diegodlh claimed this task.
diegodlh moved this task from Doing to Done on the Web2Cit-Server board.

After addressing T306132, a "citoid" parameter is now supported by the translation server, which causes it to return two citations per request: the Mediawiki citation returned from Citoid, and the WebToCit citation returned from Web2Cit.

Regarding translation results (as opposed to citation results) returned by html and json formats, adding a placeholder is pending. Opening a separate task for this, and closing this one for now.