Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translator for new NASA ADS #2055

Merged
merged 5 commits into from Dec 5, 2019

Conversation

@thostetler
Copy link
Contributor

thostetler commented Nov 11, 2019

New translator for the new NASA ADS site, using the same RIS export endpoint as the old translator.

@thostetler thostetler force-pushed the thostetler:add-nasa-ads-2-translator branch from c8ab752 to 7351483 Nov 11, 2019
@thostetler thostetler force-pushed the thostetler:add-nasa-ads-2-translator branch from d9794b2 to 1be1530 Nov 12, 2019
if (url.includes("/search/")) {
return "multiple";
}
else if (url.includes("/abs/")) {

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 13, 2019

Collaborator

How hard would it be to detect some of the other content types here? It's not super critical to detect the right type, but if e.g. matching by the id would get us mostly there, it's worth the effort (e.g. it looks like all PhD Thesis have PhDT in the ID etc.

This comment has been minimized.

Copy link
@thostetler

thostetler Nov 20, 2019

Author Contributor

Yep, I can make that change. I know for sure we can extract PhDT and MsT

@zuphilip

This comment has been minimized.

Copy link
Collaborator

zuphilip commented Nov 17, 2019

Is the old translator for NASA ADS then still working? Or should we rather replace the old one with the code here? I don't like the label here "NASA ADS 2".

@thostetler

This comment has been minimized.

Copy link
Contributor Author

thostetler commented Nov 20, 2019

@zuphilip The old system has been shutdown now, so the other translator won't work.
We could replace the old translator I believe

@dstillman

This comment has been minimized.

Copy link
Member

dstillman commented Nov 20, 2019

OK, if this is a replacement let's do this as a modification of the existing file with the same translatorID and title. (You can make that change in this PR without opening a new one.)

@thostetler

This comment has been minimized.

Copy link
Contributor Author

thostetler commented Nov 20, 2019

@dstillman sure I can make that change

@thostetler thostetler force-pushed the thostetler:add-nasa-ads-2-translator branch from 21702af to 5a07668 Nov 20, 2019
Copy link
Collaborator

adam3smith left a comment

Great, thanks. A couple of remaining nits, after that this is ready from my end

NASA ADS.js Outdated
@@ -1,22 +1,22 @@
{
"translatorID": "7987b420-e8cb-4bea-8ef7-61c2377cd686",
"label": "NASA ADS",
"creator": "Philipp Zumstein, Asa Kusuma and Ramesh Srigiriraju",
"target": "^https?://(ukads|cdsads|ads|adsabs|esoads|adswww|www\\.ads)\\.(inasan|iucaa\\.ernet|nottingham\\.ac|harvard|eso|u-strasbg|nao\\.ac|astro\\.puc|bao\\.ac|on|kasi\\.re|grangenet|lipi\\.go|mao\\.kiev)\\.(edu|org|net|fr|jp|cl|id|uk|cn|ua|in|ru|br|kr)/(cgi-bin|abs)/",
"creator": "Philipp Zumstein, Asa Kusuma, Ramesh Srigiriraju and Tim Hostetler",

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 21, 2019

Collaborator

Since this is a rewrite, you should be the only creator I think

NASA ADS.js Outdated
}

/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2018 Philipp Zumstein
Copyright © 2019 Philipp Zumstein

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 21, 2019

Collaborator

this should be you accordingly

NASA ADS.js Outdated
translator.translate();
});
if (bibstem.startsWith("MsT")) {
return "Masters thesis";

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 21, 2019

Collaborator

Only thesis is a valid Zotero item type. You could see if you can get the Master vs. Ph.D. thesis into the type field in Zotero

This comment has been minimized.

Copy link
@thostetler

thostetler Nov 21, 2019

Author Contributor

So I have a question on this, I updated the itemType returned here to be thesis.

const bibstem = extractId(url).slice(4);
if (bibstem.startsWith("MsT") || bibstem.startsWith("PhDT")) {
  return "thesis";
}
return "journalArticle";

I can get the correct output: detectWeb returned type "thesis" when running detectWeb from the editor. But when I run the doWeb function I always get:

Returned item:
{
  "itemType": "journalArticle"
  ...
}

Is this being set by the RIS importer? or is there something that I'm forgetting to set prior to passing that text?

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 21, 2019

Collaborator

Yes, I'm pretty sure that's the RIS importer. You have
TY - Thesis/Dissertation in the RIS, which isn't valid and Zotero uses journalArticle as a generic fallback for those cases. It should instead be
TY - THES It'd be best to change it in the RIS so that everyone benefits, but if that's impossible, you can overried the importers item type in the translator.

This comment has been minimized.

Copy link
@thostetler

thostetler Nov 25, 2019

Author Contributor

@adam3smith So I talked with some people on the team about this, it seems like the THES is just an abbreviation and that the longer version is also valid (at least this is what I've heard) so I don't think it will be changing on our end.
I've updated the PR though to do it manually, hopefully I did it the right way.
Thanks!

NASA ADS.js Outdated
"url": "https://ui.adsabs.harvard.edu/abs/2019PhDT........69B/abstract",
"items": [
{
"itemType": "Ph.D. thesis",

This comment has been minimized.

Copy link
@adam3smith

adam3smith Nov 21, 2019

Collaborator

And this test would need to update accordingly

@zuphilip

This comment has been minimized.

Copy link
Collaborator

zuphilip commented Nov 21, 2019

Thank you for replacing the file now as the old system is down. I let the remaining review to @adam3smith .

@adam3smith adam3smith merged commit 42086cd into zotero:master Dec 5, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@adam3smith

This comment has been minimized.

Copy link
Collaborator

adam3smith commented Dec 5, 2019

Great, thanks so much @thostetler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.