CSL JSON export: populate PMID field from Zotero extra field

For the following zotero JSON data notice that Zotero has encoded the PubMed ID in the `extra` field with `PMID: 1`.

```json
[
{
"key": "SLTYU46W",
"itemType": "journalArticle",
"title": "Formate assay in body fluids: application in methanol poisoning",
"DOI": "10.1016/0006-2944(75)90147-7",
"extra": "PMID: 1",
"libraryCatalog": "PubMed",
}
]
```

Exporting this Zotero JSON to CSL JSON using translation-server, results in the following:

```json
[
{
"key": "SLTYU46W",
"itemType": "journalArticle",
"title": "Formate assay in body fluids: application in methanol poisoning",
"DOI": "10.1016/0006-2944(75)90147-7",
"extra": "PMID: 1",
"libraryCatalog": "PubMed"
}
]
```

Notice that `PMID: 1` is still in the extra field, despite the [CSL JSON schema](https://github.com/citation-style-language/schema/blob/f01ba9c5ec2055e381a38598919a379255c496c5/csl-data.json#L380-L382) supporting a `PMID` field. We should also see if this issue affects PMCIDs as well.

It seems that this case should be handled by the extraToCSL function proposed (or maybe implemented) by @dstillman at https://github.com/zotero/zotero/pull/1451#issuecomment-369750809.
  • extraToCSL is called during citation generation, it's not called in the CSL JSON export. @dstillman would the function be available to the export translator? Seems like that'd be a better place
  • extraToCSL isn't exposed to translators, but it's also irrelevant here — all that does is allow more user-friendly field names in Extra. The values are still passed through to citeproc-js as part of the Extra field.

    In any case, this isn't really within scope for Zotero. The Extra "cheater syntax" is primarily a feature of citeproc-js, and while we look in Extra for a couple things (e.g., when looking for DOIs) within Zotero itself, it's not meant to be a replacement for real fields, and I don't want to add more hacks for this. We're almost ready to add new fields, and when we do, we'll migrate Extra values to the new fields, at which point we'll be able to pass these through properly. Until then, consumers of CSL-JSON that uses these will need to parse them the same as citeproc-js.
  • FWIW, BBTs CSL exports do move these cheater-syntax lines into CSL fields.
Sign In or Register to comment.