Skip to content

Commit f9e2c33

Browse files
authoredJun 12, 2019
Merge pull request #359 from wcmc-its/development
Release of 1.1
2 parents ed91318 + 6a70dca commit f9e2c33

29 files changed

+711027
-362
lines changed
 

‎Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: java -jar reciter-0.0.1-SNAPSHOT.jar
1+
web: java -jar reciter-1.1.jar

‎buildspec.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ version: 0.2
22
# https://docs.aws.amazon.com/codebuild/latest/userguide/getting-started.html
33
phases:
44
install:
5-
commands:
6-
- echo Nothing to do in the install phase...
5+
runtime-versions:
6+
java: openjdk8
77
pre_build:
88
commands:
99
- echo Nothing to do in the pre_build phase...
1010
build:
1111
commands:
1212
- echo Build started on `date`
1313
- mvn clean install -Dmaven.test.skip=true
14-
- cp target/reciter-0.0.1-SNAPSHOT.jar .
14+
- cp target/reciter-1.1.jar .
1515
post_build:
1616
commands:
1717
- echo Build completed on `date`
1818
artifacts:
1919
files:
20-
- reciter-0.0.1-SNAPSHOT.jar
20+
- reciter-1.1.jar
2121
- .ebextensions/**/*
2222
- Procfile

‎pom.xml

+9-45
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>edu.cornell.weill.reciter</groupId>
66
<artifactId>reciter</artifactId>
7-
<version>0.0.1-SNAPSHOT</version>
7+
<version>1.1</version>
88
<name>ReCiter</name>
99
<description>ReCiter is a publication suggestions engine</description>
1010
<url>https://github.com/wcmc-its/ReCiter</url>
@@ -124,59 +124,28 @@
124124
</dependencies>
125125
</dependencyManagement>
126126
<dependencies>
127+
<dependency>
128+
<groupId>org.springframework.boot</groupId>
129+
<artifactId>spring-boot-starter-test</artifactId>
130+
<scope>test</scope>
131+
</dependency>
127132
<dependency>
128133
<groupId>com.google.code.gson</groupId>
129134
<artifactId>gson</artifactId>
130135
</dependency>
131-
<!--&lt;!&ndash; https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 &ndash;&gt;-->
132-
<!--<dependency>-->
133-
<!--<groupId>org.springframework.security.oauth</groupId>-->
134-
<!--<artifactId>spring-security-oauth2</artifactId>-->
135-
<!--<version>2.2.1.RELEASE</version>-->
136-
<!--</dependency>-->
137-
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
138-
<!--<dependency>-->
139-
<!--<groupId>org.springframework.boot</groupId>-->
140-
<!--<artifactId>spring-boot-starter-security</artifactId>-->
141-
<!--<version>1.5.10.RELEASE</version>-->
142-
<!--</dependency>-->
143-
<!-- https://mvnrepository.com/artifact/com.auth0/auth0-spring-security-api -->
144-
<!--<dependency>-->
145-
<!--<groupId>com.auth0</groupId>-->
146-
<!--<artifactId>auth0-spring-security-api</artifactId>-->
147-
<!--<version>1.0.0</version>-->
148-
<!--</dependency>-->
149-
<!--&lt;!&ndash; https://mvnrepository.com/artifact/com.auth0/auth0 &ndash;&gt;-->
150-
<!--<dependency>-->
151-
<!--<groupId>com.auth0</groupId>-->
152-
<!--<artifactId>auth0</artifactId>-->
153-
<!--<version>1.5.0</version>-->
154-
<!--</dependency>-->
155-
<!--&lt;!&ndash; https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt &ndash;&gt;-->
156-
<!--<dependency>-->
157-
<!--<groupId>io.jsonwebtoken</groupId>-->
158-
<!--<artifactId>jjwt</artifactId>-->
159-
<!--<version>0.9.0</version>-->
160-
<!--</dependency>-->
161-
<!--https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-websocket-->
162-
163-
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-config -->
164136
<dependency>
165137
<groupId>org.springframework.security</groupId>
166138
<artifactId>spring-security-config</artifactId>
167-
<version>5.1.4.RELEASE</version>
168139
</dependency>
169140
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
170141
<dependency>
171142
<groupId>org.springframework.security</groupId>
172143
<artifactId>spring-security-web</artifactId>
173-
<version>5.1.4.RELEASE</version>
174144
</dependency>
175145
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
176146
<dependency>
177147
<groupId>org.springframework.security</groupId>
178148
<artifactId>spring-security-core</artifactId>
179-
<version>5.1.4.RELEASE</version>
180149
</dependency>
181150
<dependency>
182151
<groupId>org.springframework.boot</groupId>
@@ -186,7 +155,6 @@
186155
<dependency>
187156
<groupId>org.apache.commons</groupId>
188157
<artifactId>commons-lang3</artifactId>
189-
<version>3.5</version>
190158
</dependency>
191159
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
192160
<dependency>
@@ -202,7 +170,6 @@
202170
<dependency>
203171
<groupId>com.unboundid</groupId>
204172
<artifactId>unboundid-ldapsdk</artifactId>
205-
<version>3.2.0</version>
206173
</dependency>
207174
<!-- https://mvnrepository.com/artifact/ch.mfrey.jackson/jackson-antpathfilter -->
208175
<dependency>
@@ -213,7 +180,6 @@
213180
<dependency>
214181
<groupId>org.projectlombok</groupId>
215182
<artifactId>lombok</artifactId>
216-
<version>1.16.16</version>
217183
<scope>provided</scope>
218184
</dependency>
219185
<!-- https://mvnrepository.com/artifact/com.github.derjust/spring-data-dynamodb -->
@@ -261,7 +227,6 @@
261227
<dependency>
262228
<groupId>com.amazonaws</groupId>
263229
<artifactId>aws-java-sdk-sqs</artifactId>
264-
<version>1.11.405</version>
265230
</dependency>
266231
<dependency>
267232
<groupId>com.amazonaws</groupId>
@@ -293,17 +258,17 @@
293258
<dependency>
294259
<groupId>edu.cornell.weill.reciter</groupId>
295260
<artifactId>reciter-identity-model</artifactId>
296-
<version>2.0.3</version>
261+
<version>2.0.5</version>
297262
</dependency>
298263
<dependency>
299264
<groupId>edu.cornell.weill.reciter</groupId>
300265
<artifactId>reciter-article-model</artifactId>
301-
<version>2.0.9</version>
266+
<version>2.0.10</version>
302267
</dependency>
303268
<dependency>
304269
<groupId>edu.cornell.weill.reciter</groupId>
305270
<artifactId>reciter-dynamodb-model</artifactId>
306-
<version>2.0.2</version>
271+
<version>2.0.3</version>
307272
</dependency>
308273
<dependency>
309274
<groupId>com.github.bohnman</groupId>
@@ -313,7 +278,6 @@
313278
<dependency>
314279
<groupId>org.mockito</groupId>
315280
<artifactId>mockito-core</artifactId>
316-
<version>2.27.0</version>
317281
</dependency>
318282
</dependencies>
319283
<repositories>

‎src/main/java/reciter/Application.java

+17
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,20 @@
5252
import com.google.common.collect.Iterables;
5353

5454
import lombok.extern.slf4j.Slf4j;
55+
import reciter.database.dyanmodb.files.GenderFileImport;
5556
import reciter.database.dyanmodb.files.IdentityFileImport;
5657
import reciter.database.dyanmodb.files.InstitutionAfidFileImport;
5758
import reciter.database.dyanmodb.files.MeshTermFileImport;
5859
import reciter.database.dyanmodb.files.ScienceMetrixDepartmentCategoryFileImport;
5960
import reciter.database.dyanmodb.files.ScienceMetrixFileImport;
61+
import reciter.database.dynamodb.model.Gender;
6062
import reciter.database.dynamodb.model.InstitutionAfid;
6163
import reciter.database.dynamodb.model.MeshTerm;
6264
import reciter.database.dynamodb.model.ScienceMetrix;
6365
import reciter.database.dynamodb.model.ScienceMetrixDepartmentCategory;
6466
import reciter.engine.EngineParameters;
6567
import reciter.security.APIKey;
68+
import reciter.service.GenderService;
6669
import reciter.service.ScienceMetrixDepartmentCategoryService;
6770
import reciter.service.ScienceMetrixService;
6871
import reciter.service.dynamo.DynamoDbInstitutionAfidService;
@@ -98,6 +101,9 @@ public class Application {
98101
@Autowired
99102
private DynamoDbInstitutionAfidService dynamoDbInstitutionAfidService;
100103

104+
@Autowired
105+
private GenderService genderService;
106+
101107
@Value("${use.scopus.articles}")
102108
private boolean useScopusArticles;
103109

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

241+
GenderFileImport genderFileImport = ApplicationContextHolder.getContext().getBean(GenderFileImport.class);
242+
genderFileImport.importGender();
243+
235244
if(useScopusArticles) {
236245
InstitutionAfidFileImport institutionAfidFileImport = ApplicationContextHolder.getContext().getBean(InstitutionAfidFileImport.class);
237246
institutionAfidFileImport.importInstitutionAfids();
@@ -263,6 +272,12 @@ public void populateStaticEngineParameters() {
263272
}
264273
EngineParameters.setMeshCountMap(meshCountMap);
265274
}
275+
log.info("Loading GenderProbability to Engine Parameters");
276+
List<Gender> genders = genderService.findAll();
277+
if(genders != null && !genders.isEmpty()) {
278+
EngineParameters.setGenders(genders);
279+
}
280+
266281
if(useScopusArticles) {
267282
log.info("Loading ScopusInstitutionalAfids to Engine Parameters");
268283
List<InstitutionAfid> instAfids = dynamoDbInstitutionAfidService.findAll();
@@ -271,6 +286,8 @@ public void populateStaticEngineParameters() {
271286
EngineParameters.setAfiliationNameToAfidMap(institutionAfids);
272287
}
273288
}
289+
290+
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.");
274291
}
275292

276293

‎src/main/java/reciter/algorithm/cluster/article/scorer/ReCiterArticleScorer.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import reciter.algorithm.evidence.targetauthor.department.strategy.DepartmentStringMatchStrategy;
3636
import reciter.algorithm.evidence.targetauthor.email.EmailStrategyContext;
3737
import reciter.algorithm.evidence.targetauthor.email.strategy.EmailStringMatchStrategy;
38+
import reciter.algorithm.evidence.targetauthor.gender.GenderStrategyContext;
39+
import reciter.algorithm.evidence.targetauthor.gender.strategy.GenderStrategy;
3840
import reciter.algorithm.evidence.targetauthor.grant.GrantStrategyContext;
3941
import reciter.algorithm.evidence.targetauthor.grant.strategy.GrantStrategy;
4042
import reciter.algorithm.evidence.targetauthor.journalcategory.JournalCategoryStrategyContext;
@@ -150,9 +152,14 @@ public class ReCiterArticleScorer extends AbstractArticleScorer {
150152
private StrategyContext personTypeStrategyContext;
151153

152154
/**
153-
* Accpeted Rejected .
155+
* Accepted Rejected .
154156
*/
155157
private StrategyContext acceptedRejectedStrategyContext;
158+
159+
/**
160+
* Gender Strategy
161+
*/
162+
private GenderStrategyContext genderStrategyContext;
156163

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

190198
// Using the following strategy contexts in sequence to reassign individual articles
191199
// to selected clusters.
@@ -238,6 +246,10 @@ public ReCiterArticleScorer(Map<Long, ReCiterCluster> clusters, Identity identit
238246
if(strategyParameters.isAverageClustering()) {
239247
this.strategyContexts.add(this.averageClusteringStrategyContext);
240248
}
249+
250+
if(strategyParameters.isGender()) {
251+
this.strategyContexts.add(this.genderStrategyContext);
252+
}
241253
}
242254

243255

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

308+
if(strategyParameters.isGender()) {
309+
((TargetAuthorStrategyContext) genderStrategyContext).executeStrategy(reCiterArticles, identity);
310+
}
311+
296312
if (strategyParameters.isAverageClustering()) {
297313
((ClusterStrategyContext) averageClusteringStrategyContext).executeStrategy(entry.getValue());
298314
}

‎src/main/java/reciter/algorithm/evidence/cluster/averageclustering/strategy/AverageClusteringStrategy.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public double executeStrategy(ReCiterCluster reCiterCluster) {
3636
if(ReCiterArticleScorer.strategyParameters.isUseGoldStandardEvidence()) {
3737
double totalArticleScoreWithoutClustering = ((reCiterArticle.getAuthorNameEvidence() != null)?(reCiterArticle.getAuthorNameEvidence().getNameScoreTotal()):0) +
3838
((reCiterArticle.getEmailEvidence() != null)?reCiterArticle.getEmailEvidence().getEmailMatchScore():0) +
39+
((reCiterArticle.getGenderEvidence() != null && reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy() != null)?reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy():0) +
3940
reCiterArticle.getGrantEvidenceTotalScore() +
40-
reCiterArticle.getRelationshipEvidencesTotalScore() +
41+
((reCiterArticle.getRelationshipEvidence() != null)?reCiterArticle.getRelationshipEvidence().getRelationshipEvidenceTotalScore():0) +
4142
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearBachelorScore():0) +
4243
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearDoctoralScore():0) +
4344
reCiterArticle.getOrganizationalEvidencesTotalScore() +
@@ -53,8 +54,9 @@ public double executeStrategy(ReCiterCluster reCiterCluster) {
5354
} else {
5455
double totalArticleScoreWithoutClustering = ((reCiterArticle.getAuthorNameEvidence() != null)?(reCiterArticle.getAuthorNameEvidence().getNameScoreTotal()):0) +
5556
((reCiterArticle.getEmailEvidence() != null)?reCiterArticle.getEmailEvidence().getEmailMatchScore():0) +
57+
((reCiterArticle.getGenderEvidence() != null && reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy() != null)?reCiterArticle.getGenderEvidence().getGenderScoreIdentityArticleDiscrepancy():0) +
5658
reCiterArticle.getGrantEvidenceTotalScore() +
57-
reCiterArticle.getRelationshipEvidencesTotalScore() +
59+
((reCiterArticle.getRelationshipEvidence() != null)?reCiterArticle.getRelationshipEvidence().getRelationshipEvidenceTotalScore():0) +
5860
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearBachelorScore():0) +
5961
((reCiterArticle.getEducationYearEvidence() != null)?reCiterArticle.getEducationYearEvidence().getDiscrepancyDegreeYearDoctoralScore():0) +
6062
reCiterArticle.getOrganizationalEvidencesTotalScore() +

0 commit comments

Comments
 (0)