Skip to content

Commit

Permalink
Merge pull request #359 from wcmc-its/development
Browse files Browse the repository at this point in the history
Release of 1.1
  • Loading branch information
paulalbert1 authored Jun 12, 2019
2 parents ed91318 + 6a70dca commit f9e2c33
Show file tree
Hide file tree
Showing 29 changed files with 711,027 additions and 362 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: java -jar reciter-0.0.1-SNAPSHOT.jar
web: java -jar reciter-1.1.jar
8 changes: 4 additions & 4 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ version: 0.2
# https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started.html
phases:
install:
commands:
- echo Nothing to do in the install phase...
runtime-versions:
java: openjdk8
pre_build:
commands:
- echo Nothing to do in the pre_build phase...
build:
commands:
- echo Build started on `date`
- mvn clean install -Dmaven.test.skip=true
- cp target/reciter-0.0.1-SNAPSHOT.jar .
- cp target/reciter-1.1.jar .
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- reciter-0.0.1-SNAPSHOT.jar
- reciter-1.1.jar
- .ebextensions/**/*
- Procfile
54 changes: 9 additions & 45 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.cornell.weill.reciter</groupId>
<artifactId>reciter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.1</version>
<name>ReCiter</name>
<description>ReCiter is a publication suggestions engine</description>
<url>https://github.com/wcmc-its/ReCiter</url>
Expand Down Expand Up @@ -124,59 +124,28 @@
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!--&lt;!&ndash; https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>org.springframework.security.oauth</groupId>-->
<!--<artifactId>spring-security-oauth2</artifactId>-->
<!--<version>2.2.1.RELEASE</version>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-security</artifactId>-->
<!--<version>1.5.10.RELEASE</version>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/com.auth0/auth0-spring-security-api -->
<!--<dependency>-->
<!--<groupId>com.auth0</groupId>-->
<!--<artifactId>auth0-spring-security-api</artifactId>-->
<!--<version>1.0.0</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; https://mvnrepository.com/artifact/com.auth0/auth0 &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>com.auth0</groupId>-->
<!--<artifactId>auth0</artifactId>-->
<!--<version>1.5.0</version>-->
<!--</dependency>-->
<!--&lt;!&ndash; https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt &ndash;&gt;-->
<!--<dependency>-->
<!--<groupId>io.jsonwebtoken</groupId>-->
<!--<artifactId>jjwt</artifactId>-->
<!--<version>0.9.0</version>-->
<!--</dependency>-->
<!--https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-websocket-->

<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-config -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -186,7 +155,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
Expand All @@ -202,7 +170,6 @@
<dependency>
<groupId>com.unboundid</groupId>
<artifactId>unboundid-ldapsdk</artifactId>
<version>3.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.mfrey.jackson/jackson-antpathfilter -->
<dependency>
Expand All @@ -213,7 +180,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.derjust/spring-data-dynamodb -->
Expand Down Expand Up @@ -261,7 +227,6 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sqs</artifactId>
<version>1.11.405</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
Expand Down Expand Up @@ -293,17 +258,17 @@
<dependency>
<groupId>edu.cornell.weill.reciter</groupId>
<artifactId>reciter-identity-model</artifactId>
<version>2.0.3</version>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>edu.cornell.weill.reciter</groupId>
<artifactId>reciter-article-model</artifactId>
<version>2.0.9</version>
<version>2.0.10</version>
</dependency>
<dependency>
<groupId>edu.cornell.weill.reciter</groupId>
<artifactId>reciter-dynamodb-model</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>com.github.bohnman</groupId>
Expand All @@ -313,7 +278,6 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.27.0</version>
</dependency>
</dependencies>
<repositories>
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/reciter/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,20 @@
import com.google.common.collect.Iterables;

import lombok.extern.slf4j.Slf4j;
import reciter.database.dyanmodb.files.GenderFileImport;
import reciter.database.dyanmodb.files.IdentityFileImport;
import reciter.database.dyanmodb.files.InstitutionAfidFileImport;
import reciter.database.dyanmodb.files.MeshTermFileImport;
import reciter.database.dyanmodb.files.ScienceMetrixDepartmentCategoryFileImport;
import reciter.database.dyanmodb.files.ScienceMetrixFileImport;
import reciter.database.dynamodb.model.Gender;
import reciter.database.dynamodb.model.InstitutionAfid;
import reciter.database.dynamodb.model.MeshTerm;
import reciter.database.dynamodb.model.ScienceMetrix;
import reciter.database.dynamodb.model.ScienceMetrixDepartmentCategory;
import reciter.engine.EngineParameters;
import reciter.security.APIKey;
import reciter.service.GenderService;
import reciter.service.ScienceMetrixDepartmentCategoryService;
import reciter.service.ScienceMetrixService;
import reciter.service.dynamo.DynamoDbInstitutionAfidService;
Expand Down Expand Up @@ -98,6 +101,9 @@ public class Application {
@Autowired
private DynamoDbInstitutionAfidService dynamoDbInstitutionAfidService;

@Autowired
private GenderService genderService;

@Value("${use.scopus.articles}")
private boolean useScopusArticles;

Expand Down Expand Up @@ -232,6 +238,9 @@ public void loadDynamoDbTablesAfterStartUp() {
IdentityFileImport identityFileImport = ApplicationContextHolder.getContext().getBean(IdentityFileImport.class);
identityFileImport.importIdentity();

GenderFileImport genderFileImport = ApplicationContextHolder.getContext().getBean(GenderFileImport.class);
genderFileImport.importGender();

if(useScopusArticles) {
InstitutionAfidFileImport institutionAfidFileImport = ApplicationContextHolder.getContext().getBean(InstitutionAfidFileImport.class);
institutionAfidFileImport.importInstitutionAfids();
Expand Down Expand Up @@ -263,6 +272,12 @@ public void populateStaticEngineParameters() {
}
EngineParameters.setMeshCountMap(meshCountMap);
}
log.info("Loading GenderProbability to Engine Parameters");
List<Gender> genders = genderService.findAll();
if(genders != null && !genders.isEmpty()) {
EngineParameters.setGenders(genders);
}

if(useScopusArticles) {
log.info("Loading ScopusInstitutionalAfids to Engine Parameters");
List<InstitutionAfid> instAfids = dynamoDbInstitutionAfidService.findAll();
Expand All @@ -271,6 +286,8 @@ public void populateStaticEngineParameters() {
EngineParameters.setAfiliationNameToAfidMap(institutionAfids);
}
}

log.info("ReCiter is up and ready to use. Please make sure its other components such as Pubmed-Retrieval-Tool is also setup if you wish to do retrieval.");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import reciter.algorithm.evidence.targetauthor.department.strategy.DepartmentStringMatchStrategy;
import reciter.algorithm.evidence.targetauthor.email.EmailStrategyContext;
import reciter.algorithm.evidence.targetauthor.email.strategy.EmailStringMatchStrategy;
import reciter.algorithm.evidence.targetauthor.gender.GenderStrategyContext;
import reciter.algorithm.evidence.targetauthor.gender.strategy.GenderStrategy;
import reciter.algorithm.evidence.targetauthor.grant.GrantStrategyContext;
import reciter.algorithm.evidence.targetauthor.grant.strategy.GrantStrategy;
import reciter.algorithm.evidence.targetauthor.journalcategory.JournalCategoryStrategyContext;
Expand Down Expand Up @@ -150,9 +152,14 @@ public class ReCiterArticleScorer extends AbstractArticleScorer {
private StrategyContext personTypeStrategyContext;

/**
* Accpeted Rejected .
* Accepted Rejected .
*/
private StrategyContext acceptedRejectedStrategyContext;

/**
* Gender Strategy
*/
private GenderStrategyContext genderStrategyContext;

/**
* Remove clusters based on cluster information.
Expand Down Expand Up @@ -186,6 +193,7 @@ public ReCiterArticleScorer(Map<Long, ReCiterCluster> clusters, Identity identit
this.journalCategoryStrategyContext = new JournalCategoryStrategyContext(new JournalCategoryStrategy());
this.knownRelationshipsStrategyContext = new KnownRelationshipStrategyContext(new KnownRelationshipStrategy());
this.affiliationStrategyContext = new AffiliationStrategyContext(new CommonAffiliationStrategy());
this.genderStrategyContext = new GenderStrategyContext(new GenderStrategy());

// Using the following strategy contexts in sequence to reassign individual articles
// to selected clusters.
Expand Down Expand Up @@ -238,6 +246,10 @@ public ReCiterArticleScorer(Map<Long, ReCiterCluster> clusters, Identity identit
if(strategyParameters.isAverageClustering()) {
this.strategyContexts.add(this.averageClusteringStrategyContext);
}

if(strategyParameters.isGender()) {
this.strategyContexts.add(this.genderStrategyContext);
}
}


Expand Down Expand Up @@ -293,6 +305,10 @@ public void runArticleScorer(Map<Long, ReCiterCluster> clusters, Identity identi
((ReCiterArticleStrategyContext) acceptedRejectedStrategyContext).executeStrategy(reCiterArticles);
}

if(strategyParameters.isGender()) {
((TargetAuthorStrategyContext) genderStrategyContext).executeStrategy(reCiterArticles, identity);
}

if (strategyParameters.isAverageClustering()) {
((ClusterStrategyContext) averageClusteringStrategyContext).executeStrategy(entry.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ public double executeStrategy(ReCiterCluster reCiterCluster) {
if(ReCiterArticleScorer.strategyParameters.isUseGoldStandardEvidence()) {
double totalArticleScoreWithoutClustering = ((reCiterArticle.getAuthorNameEvidence() != null)?(reCiterArticle.getAuthorNameEvidence().getNameScoreTotal()):0) +
((reCiterArticle.getEmailEvidence() != null)?reCiterArticle.getEmailEvidence().getEmailMatchScore():0) +
((reCiterArticle.getGenderEvidence() != null && reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy() != null)?reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy():0) +
reCiterArticle.getGrantEvidenceTotalScore() +
reCiterArticle.getRelationshipEvidencesTotalScore() +
((reCiterArticle.getRelationshipEvidence() != null)?reCiterArticle.getRelationshipEvidence().getRelationshipEvidenceTotalScore():0) +
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearBachelorScore():0) +
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearDoctoralScore():0) +
reCiterArticle.getOrganizationalEvidencesTotalScore() +
Expand All @@ -53,8 +54,9 @@ public double executeStrategy(ReCiterCluster reCiterCluster) {
} else {
double totalArticleScoreWithoutClustering = ((reCiterArticle.getAuthorNameEvidence() != null)?(reCiterArticle.getAuthorNameEvidence().getNameScoreTotal()):0) +
((reCiterArticle.getEmailEvidence() != null)?reCiterArticle.getEmailEvidence().getEmailMatchScore():0) +
((reCiterArticle.getGenderEvidence() != null && reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy() != null)?reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy():0) +
reCiterArticle.getGrantEvidenceTotalScore() +
reCiterArticle.getRelationshipEvidencesTotalScore() +
((reCiterArticle.getRelationshipEvidence() != null)?reCiterArticle.getRelationshipEvidence().getRelationshipEvidenceTotalScore():0) +
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearBachelorScore():0) +
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearDoctoralScore():0) +
reCiterArticle.getOrganizationalEvidencesTotalScore() +
Expand Down
Loading

0 comments on commit f9e2c33

Please sign in to comment.