Skip to content

Commit

Permalink
Merge pull request #509 from wcmc-its/development
Browse files Browse the repository at this point in the history
Added publication types and remove JSON web tokens
  • Loading branch information
paulalbert1 authored Aug 31, 2023
2 parents 4b16b4d + f7ed272 commit 6630751
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
<dependency>
<groupId>edu.cornell.weill.reciter</groupId>
<artifactId>reciter-pubmed-model</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand All @@ -298,7 +298,7 @@
<dependency>
<groupId>edu.cornell.weill.reciter</groupId>
<artifactId>reciter-article-model</artifactId>
<version>2.0.16</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>edu.cornell.weill.reciter</groupId>
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/reciter/algorithm/util/ArticleTranslator.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand Down Expand Up @@ -162,6 +164,7 @@ public static ReCiterArticle translate(PubMedArticle pubmedArticle, ScopusArticl
ReCiterAuthor reCiterAuthor = new ReCiterAuthor(authorName, affiliation);
reCiterAuthor.setRank(i++);
reCiterAuthor.setOrcid(author.getOrcid());
reCiterAuthor.setEqualContrib(author.getEqualContrib());
reCiterCoAuthors.addAuthor(reCiterAuthor);
}
}
Expand Down Expand Up @@ -445,6 +448,10 @@ private static void determinePublicationTypeCanonical(ReCiterArticle reCiterArti
publicationTypeCanonical = "Letter";
} else if(reCiterArticle.getPublicationTypePubmed().contains("Comment")) {
publicationTypeCanonical = "Comment";
} else if(reCiterArticle.getPublicationTypePubmed().contains("Preprint")) {
publicationTypeCanonical = "Preprint";
} else if(reCiterArticle.getPublicationTypePubmed().contains("Published Erratum")) {
publicationTypeCanonical = "Erratum";
} else if(reCiterArticle.getPublicationTypePubmed().contains("Consensus Development Conference")
||
reCiterArticle.getPublicationTypePubmed().contains("Consensus Development Conference, NIH")
Expand Down Expand Up @@ -501,6 +508,8 @@ private static void determinePublicationTypeCanonical(ReCiterArticle reCiterArti
||
reCiterArticle.getPublicationTypePubmed().contains("Comparative Study")
||
reCiterArticle.getPublicationTypePubmed().contains("Clinical Trial")
||
reCiterArticle.getPublicationTypePubmed().contains("Technical Report")) {
publicationTypeCanonical = "Academic Article";
} else {
Expand Down
28 changes: 17 additions & 11 deletions src/main/java/reciter/engine/ReCiterFeatureGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ public ReCiterFeature computeFeatures(UseGoldStandard mode,

reCiterFeature.setCountSuggestedArticles(selectedArticles.size());

//Count of pending publications
// Count of pending publications
List<ReCiterArticle> pendingArticles = selectedArticles
.stream()
.filter(reCiterArticle -> reCiterArticle.getTotalArticleScoreStandardized() >= filterScore && reCiterArticle.getGoldStandard() == 0)
.collect(Collectors.toList());
.stream()
.filter(reCiterArticle -> reCiterArticle.getTotalArticleScoreStandardized() >= filterScore && reCiterArticle.getGoldStandard() == 0)
.collect(Collectors.toList());
reCiterFeature.setCountPendingArticles(pendingArticles.size());

List<Long> filteredArticles = selectedArticles.stream().map(article -> article.getArticleId()).collect(Collectors.toList());
Expand All @@ -133,20 +133,21 @@ public ReCiterFeature computeFeatures(UseGoldStandard mode,
log.info("Analysis for uid=[" + identity.getUid() + "]");
log.info("Precision=" + analysis.getPrecision());
log.info("Recall=" + analysis.getRecall());

double accuracy = (analysis.getPrecision() + analysis.getRecall()) / 2.0;


// Calculate accuracy using the new formula
double accuracy = (double)(analysis.getTruePositiveList().size() + analysis.getTrueNegativeList().size()) / (double)(analysis.getTruePositiveList().size() + analysis.getTrueNegativeList().size() + analysis.getFalsePositiveList().size() + analysis.getFalseNegativeList().size());

log.info("Accuracy=" + accuracy);

log.info("True Positive List [" + analysis.getTruePositiveList().size() + "]: " + analysis.getTruePositiveList());
log.info("True Negative List: [" + analysis.getTrueNegativeList().size() + "]: " + analysis.getTrueNegativeList());
log.info("False Positive List: [" + analysis.getFalsePositiveList().size() + "]: " + analysis.getFalsePositiveList());
log.info("False Negative List: [" + analysis.getFalseNegativeList().size() + "]: " + analysis.getFalseNegativeList());
log.info("\n");

// overall accuracy
reCiterFeature.setOverallAccuracy((analysis.getPrecision() + analysis.getRecall()) / 2);
// Set overall accuracy using the new formula
reCiterFeature.setOverallAccuracy(accuracy);

// precision
reCiterFeature.setPrecision(analysis.getPrecision());

Expand Down Expand Up @@ -364,6 +365,11 @@ else if (reCiterArticle.getGoldStandard() == -1) {
reCiterArticleAuthorFeature.setOrcid(matcher.group());
}
}
//EqualContrib
if(reCiterArticleAuthor.getEqualContrib()!=null && !reCiterArticleAuthor.getEqualContrib().isEmpty())
{
reCiterArticleAuthorFeature.setEqualContrib(reCiterArticleAuthor.getEqualContrib());
}


reCiterArticleAuthorFeatures.add(reCiterArticleAuthorFeature);
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/reciter/security/SecurityConstants.java

This file was deleted.

0 comments on commit 6630751

Please sign in to comment.