Skip to content
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

Story/cite-177 There needs to be an import from Crossref #22

Closed
wants to merge 38 commits into from

Conversation

PradnyaC11
Copy link

@PradnyaC11 PradnyaC11 commented Jun 13, 2024

Guidelines for Pull Requests

If you haven't yet read our code review guidelines, please do so, You can find them here.

Please confirm the following by adding an x for each item (turn [ ] into [x]).

  • I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
  • I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
  • I do not have any sysout statements in my code or commented out code that isn’t needed anymore
  • I am not reformatting any files in the wrong format or without cause.
  • I am not changing file encoding or line endings to something else than UTF-8, LF
  • My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
  • I have added Javadoc/documentation where appropriate
  • I have added test cases where appropriate
  • I have explained any part of my code/implementation decisions that is not be self-explanatory

Please provide a brief description of your ticket

The user should be able to search in crossref to references to import. whatever search results from Crossref a user selects should then be imported into citesphere. This could be all search results or just a few or one.

For now, let's put add an entry to the import menu and let the user select which group to import the results into from a dropdown menu.

The importing should be done from Citesphere Importer (not Citesphere), similar how entries from files are imported.

For querying crossref, this library should be used: https://github.com/diging/crossref-connect. However, this is not yet released into maven central, so talk to Julia before picking up this ticket.

... Put ticket description here and add link to ticket ...
https://diging.atlassian.net/browse/CITE-177

Are there any other pull requests that this one depends on?

diging/citesphere-messages#12
diging/citesphere#271

Anything else the reviewer needs to know?

... describe here ...

@diging-jenkins
Copy link

Can one of the admins verify this patch?

@PradnyaC11 PradnyaC11 changed the title Story/cite 177 Story/cite-177 There needs to be an import from Crossref Jun 13, 2024
@jdamerow jdamerow closed this Jul 12, 2024
@PradnyaC11 PradnyaC11 reopened this Jul 23, 2024
}
return file;
}
protected abstract BibEntryIterator getbibIterator(KafkaJobMessage message, JobInfo info);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be getBibEntryIterator

public final static String EDITED_BOOK = "edited-book";
public final static String PROCEEDINGS_ARTICLE = "proceedings-article";
public final static String DISSERTATION = "dissertation";
public final static String BOOK_SECTION = "book-section";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this already exists (BOOK_CHAPTER)

@@ -12,6 +12,34 @@ public class Publication implements BibEntry {
public final static String NEWS_ITEM = "newspaperArticle";
public final static String PROCEEDINGS_PAPER = "conferencePaper";
public final static String DOCUMENT = "document";
// publication types in CrossRef
public final static String MONOGRAPH = "monograph";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use BOOK instead

public final static String POSTED_CONTENT = "posted-content";
public final static String COMPONENT = "component";
public final static String EDITED_BOOK = "edited-book";
public final static String PROCEEDINGS_ARTICLE = "proceedings-article";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same as PROCEEDINGS_PAPER I believe

@@ -81,45 +65,105 @@ public void init() {
itemTypeMapping.put(Publication.NEWS_ITEM, ItemType.NEWSPAPER_ARTICLE);
itemTypeMapping.put(Publication.PROCEEDINGS_PAPER, ItemType.CONFERENCE_PAPER);
itemTypeMapping.put(Publication.DOCUMENT, ItemType.DOCUMENT);
itemTypeMapping.put(Publication.MONOGRAPH, ItemType.BOOK);
itemTypeMapping.put(Publication.JOURNAL_ISSUE, ItemType.JOURNAL_ARTICLE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong I believe, an issue is not an article. I think we will simply not deal with those and not import issues.

meta.setIssns(issnList);

List<Contributor> contributors = new ArrayList<>();
if(item.getChair() != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


private ArticleMeta parseArticleMeta(Item item) {
ArticleMeta meta = new ArticleMeta();
meta.setArticleTitle(String.join(", ", item.getTitle()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

ref.setReferenceId(itemRef.getKey());
ref.setReferenceString(itemRef.getUnstructured());
ref.setReferenceStringRaw(itemRef.getUnstructured());
references.add(ref);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

BibEntry nextEntry = new Publication();;

try {
Item item = crossrefService.get(info.getDois().get(currentIndex));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of keeping an int around, just get an interator from the dois list and keep that

@@ -13,6 +13,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;

import edu.asu.diging.citesphere.importer.core.model.BibEntry;
import edu.asu.diging.citesphere.importer.core.model.impl.Publication;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

@jdamerow jdamerow closed this Aug 1, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the abstract import processor should still stay in the impl package, it's part implementation after all.


private ArticleMeta parseArticleMeta(Item item) {
ArticleMeta meta = new ArticleMeta();
meta.setArticleTitle(String.join(", ", item.getTitle()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still

ref.setReferenceId(itemRef.getKey());
ref.setReferenceString(itemRef.getUnstructured());
ref.setReferenceStringRaw(itemRef.getUnstructured());
references.add(ref);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still

@jdamerow jdamerow closed this Sep 4, 2024
@PradnyaC11 PradnyaC11 reopened this Sep 5, 2024
Copy link
Member

@jdamerow jdamerow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unaddressed comments

@jdamerow jdamerow closed this Sep 6, 2024
@PradnyaC11 PradnyaC11 reopened this Sep 20, 2024
@jdamerow
Copy link
Member

Looks fine. Once the Citesphere PR is ready to be tested, I'll deploy this.

private ArticleMeta parseArticleMeta(Item item) {
ArticleMeta meta = new ArticleMeta();
meta.setArticleTitle(item.getTitle().get(0));
meta.setShortTitle(String.join(", ", item.getTitle().subList(1, item.getTitle().size())));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem right. Why would the short title be a concatenation of all other titles? If zotero doesn't allow additional titles, then we might just want to drop them for now.

contributors.addAll(mapPersonToContributor(item.getTranslator(), ContributionType.TRANSLATOR));
}
// List of chair
if(item.getChair() != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that all contributor types that crossref knows?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. crossref has 4 types of contributors - authors, editors, translators & chair

}
meta.setContributors(contributors);

meta.setAuthorNotesCorrespondence(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that the default?

meta.setLanguage(item.getLanguage());
ReviewInfo review = new ReviewInfo();
if (item.getReview() != null) {
review.setFullDescription(item.getReview().getCompetingInterestStatement());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is full description the same as competing interest statement?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

private Reference mapSingleReference(edu.asu.diging.crossref.model.Reference itemRef) {
Reference ref = new Reference();
ref.setAuthorString(itemRef.getAuthor());
ref.setContributors(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before, isn't that the default value?

@jdamerow jdamerow closed this Nov 26, 2024
@PradnyaC11 PradnyaC11 reopened this Dec 9, 2024
@PradnyaC11 PradnyaC11 requested a review from jdamerow December 9, 2024 23:32
@@ -81,45 +66,99 @@ public void init() {
itemTypeMapping.put(Publication.NEWS_ITEM, ItemType.NEWSPAPER_ARTICLE);
itemTypeMapping.put(Publication.PROCEEDINGS_PAPER, ItemType.CONFERENCE_PAPER);
itemTypeMapping.put(Publication.DOCUMENT, ItemType.DOCUMENT);
itemTypeMapping.put(Publication.BOOK, ItemType.BOOK);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate of line 63

itemTypeMapping.put(Publication.EDITED_BOOK, ItemType.BOOK);
itemTypeMapping.put(Publication.PROCEEDINGS_PAPER, ItemType.CONFERENCE_PAPER);
itemTypeMapping.put(Publication.DISSERTATION, ItemType.THESIS);
itemTypeMapping.put(Publication.BOOK_CHAPTER, ItemType.BOOK_SECTION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate

@@ -0,0 +1,157 @@
package edu.asu.diging.citesphere.importer.core.service.parse.crossref;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be moved to an impl package

import edu.asu.diging.crossref.model.Person;

@Component
public class CrossRefParser implements ICrossRefParser {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs javadoc and tests

@jdamerow jdamerow closed this Jan 9, 2025
@PradnyaC11 PradnyaC11 reopened this Jan 14, 2025
@PradnyaC11 PradnyaC11 requested a review from jdamerow January 14, 2025 23:25
}

@Test
public void testParseJournalMeta_WithValidData() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test method names should follow our naming convention (documented in confluence)

// we might want to devise a way to decide if the
// service might be down and we should stop sending requests.
}
return nextEntry;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this return null if there was an exception? Otherwise it would just return an empty publication, which doesn't seem to make much sense.

@jdamerow jdamerow closed this Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants