Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/JULIELab/gepi
Browse files Browse the repository at this point in the history
  • Loading branch information
khituras committed Dec 22, 2022
2 parents 8e08786 + 1f53517 commit 55e6bc2
Show file tree
Hide file tree
Showing 30 changed files with 357 additions and 168 deletions.
10 changes: 5 additions & 5 deletions gepi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ The `production` stage expects that the complete GePI project has been built in
Run the following commands to create a `development` container:

```bash
DOCKER_BUILDKIT=1 docker build -t gepi:0.11.0 --target development .
docker run -dp 8080:8080 -v {/path/to/gepi/directory}:/var/gepi/dev -e GEPI_CONFIGURATION=<path to config file> gepi:0.11.0
DOCKER_BUILDKIT=1 docker build -t gepi:0.11.1 --target development .
docker run -dp 8080:8080 -v {/path/to/gepi/directory}:/var/gepi/dev -e GEPI_CONFIGURATION=<path to config file> gepi:0.11.1
```

The first command builds an image of the `development` stage. This will also build the `dependencies` stage where all the Java dependencies of the GePI application are downloaded and cached. This will take a while on the first execution but should be faster afterwards thanks to caching.
Expand All @@ -38,8 +38,8 @@ To run the `production` container, run

```bash
mvn clean package --projects gepi-webapp --also-make
DOCKER_BUILDKIT=1 docker build -t gepi:0.11.0 --target production .
docker run -dp 8080:8080 --name gepi gepi:0.11.0
DOCKER_BUILDKIT=1 docker build -t gepi:0.11.1 --target production .
docker run -dp 8080:8080 --name gepi gepi:0.11.1
```

These commands
Expand Down Expand Up @@ -68,7 +68,7 @@ gepi.neo4j.bolt.url=bolt://<host>:<port>

A production environment has a few requirements that are of lesser importance during development. This section explains requirements and solutions that may come up during GePI deployment with the Docker container. While detailed explanations come below, the full Docker `run` command we use for deployment looks like the following:
```
docker run -dp 80:8080 -p 443:8443 -v /host/path/to/certificate.p12:/var/lib/jetty/etc/keystore.p12 -v /host/path/to/configuration.properties:/gepi-webapp-configuration.properties --add-host=host.docker.internal:host-gateway --name gepi -e GEPI_CONFIGURATION=/gepi-webapp-configuration.properties gepi:0.11.0 jetty.sslContext.keyStorePassword=<changeit>
docker run -dp 80:8080 -p 443:8443 -v /host/path/to/certificate.p12:/var/lib/jetty/etc/keystore.p12 -v /host/path/to/configuration.properties:/gepi-webapp-configuration.properties --add-host=host.docker.internal:host-gateway --name gepi -e GEPI_CONFIGURATION=/gepi-webapp-configuration.properties gepi:0.11.1 jetty.sslContext.keyStorePassword=<changeit>
```
Alternatively, the `docker-compose-webapp.yml` file can be used with a few additions.

Expand Down
2 changes: 1 addition & 1 deletion gepi/docker-compose-webapp.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.2"
services:
gepi:
image: gepi:0.11.0
image: gepi:0.11.1
container_name: gepi
ports:
- 0.0.0.0:80:8080
Expand Down
2 changes: 1 addition & 1 deletion gepi/docker-compose-with-es.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
gepi:
image: gepi:0.11.0
image: gepi:0.11.1
container_name: gepi
ports:
- 0.0.0.0:80:8080
Expand Down
2 changes: 1 addition & 1 deletion gepi/gepi-concept-database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.julielab</groupId>
<artifactId>gepi</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
</parent>
<artifactId>gepi-concept-database</artifactId>
<name>GePi Concept Database</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
http://www.julielab.de/conceptdb/facets/default http://www.julielab.de/conceptdb/facets/defaultfacet-1.1.0.xsd
http://julielab.de/conceptdb/concepts/bioportal http://www.julielab.de/conceptdb/concepts/bioportalconcepts-1.1.0.xsd">
<versioning>
<version>0.11.0</version>
<version>0.11.1</version>
</versioning>
<connection>
<uri>http://localhost:7474</uri>
Expand Down
2 changes: 1 addition & 1 deletion gepi/gepi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>de.julielab</groupId>
<artifactId>gepi</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ public class GepiRequestData implements Cloneable {
private String paragraphFilterString;
private String filterFieldsConnectionOperator = "AND";
private EnumSet<InputMode> inputMode;
private String docId;
private long dataSessionId;
private boolean includeUnary;
private int eventLikelihood;
private String[] taxId;
private String sectionNameFilterString;
private int pageSize = 10;
public GepiRequestData(List<String> eventTypes, boolean includeUnary, int eventLikelihood, Future<IdConversionResult> listAGePiIds, Future<IdConversionResult> listBGePiIds, String[] taxId, String sentenceFilterString, String paragraphFilterString, String filterFieldsConnectionOperator, String sectionNameFilterString, EnumSet<InputMode> inputMode, long dataSessionId) {

public GepiRequestData(List<String> eventTypes, boolean includeUnary, int eventLikelihood, Future<IdConversionResult> listAGePiIds, Future<IdConversionResult> listBGePiIds, String[] taxId, String sentenceFilterString, String paragraphFilterString, String filterFieldsConnectionOperator, String sectionNameFilterString, EnumSet<InputMode> inputMode, String docId, long dataSessionId) {
this.includeUnary = includeUnary;
this.eventLikelihood = eventLikelihood;
this.taxId = taxId;
Expand All @@ -35,13 +37,18 @@ public GepiRequestData(List<String> eventTypes, boolean includeUnary, int eventL
this.paragraphFilterString = paragraphFilterString;
this.filterFieldsConnectionOperator = filterFieldsConnectionOperator;
this.inputMode = inputMode;
this.docId = docId;
this.dataSessionId = dataSessionId;
}

public GepiRequestData() {

}

public String getDocId() {
return docId;
}

public boolean isIncludeUnary() {
return includeUnary;
}
Expand Down Expand Up @@ -114,6 +121,7 @@ public GepiRequestData withIncludeUnary(boolean includeUnary) {
this.includeUnary = includeUnary;
return this;
}

public GepiRequestData withEventTypes(List<String> eventTypes) {
this.eventTypes = eventTypes;
return this;
Expand Down Expand Up @@ -177,6 +185,11 @@ public GepiRequestData withSectionNameFilterString(String sectionNameFilterStrin
return this;
}

public GepiRequestData withDocId(String docid) {
this.docId = docid;
return this;
}

@Override
public String toString() {
return "GepiRequestData{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public static BoolQuery getClosedQuery(GepiRequestData requestData, Set<String>
taxIdFilterClause.addQuery(taxQuery);
eventQuery.addClause(taxIdFilterClause);
}
if (requestData.getDocId() != null && !requestData.getDocId().isBlank()) {
final MultiMatchQuery docIdQuery = new MultiMatchQuery();
docIdQuery.query = requestData.getDocId();
docIdQuery.fields = List.of(FIELD_PMID, FIELD_PMCID);
final BoolClause docIdFilterClause = new BoolClause();
docIdFilterClause.addQuery(docIdQuery);
docIdFilterClause.occur = FILTER;
eventQuery.addClause(docIdFilterClause);
}
return eventQuery;
}

Expand Down Expand Up @@ -155,6 +164,15 @@ public static BoolQuery getOpenQuery(GepiRequestData requestData) throws Interru
taxIdFilterClause.addQuery(taxQuery);
eventQuery.addClause(taxIdFilterClause);
}
if (requestData.getDocId() != null && !requestData.getDocId().isBlank()) {
final MultiMatchQuery docIdQuery = new MultiMatchQuery();
docIdQuery.query = requestData.getDocId();
docIdQuery.fields = List.of(FIELD_PMID, FIELD_PMCID);
final BoolClause docIdFilterClause = new BoolClause();
docIdFilterClause.addQuery(docIdQuery);
docIdFilterClause.occur = FILTER;
eventQuery.addClause(docIdFilterClause);
}

return eventQuery;
}
Expand All @@ -169,9 +187,19 @@ private static void addEventLikelihoodFilter(BoolQuery eventQuery, int likelihoo
eventQuery.addClause(likelihoodFilterClause);
}

public static BoolQuery getFulltextQuery(List<String> eventTypes, int eventLikelihood, String sentenceFilter, String paragraphFilter, String sectionNameFilter, String filterFieldsConnectionOperator, String[] taxIds, boolean includeUnary) {
public static BoolQuery getFulltextQuery(GepiRequestData requestData) {
BoolQuery eventQuery = new BoolQuery();

final List<String> eventTypes = requestData.getEventTypes();
final boolean includeUnary = requestData.isIncludeUnary();
final String filterFieldsConnectionOperator = requestData.getFilterFieldsConnectionOperator();
final String sentenceFilter = requestData.getSentenceFilterString();
final String paragraphFilter = requestData.getParagraphFilterString();
final String sectionNameFilter = requestData.getSectionNameFilterString();
final int eventLikelihood = requestData.getEventLikelihood();
final String[] taxIds = requestData.getTaxId();
final String docId = requestData.getDocId();

if (eventTypes != null && !eventTypes.isEmpty()) {
TermsQuery eventTypesQuery = new TermsQuery(new ArrayList<>(eventTypes));
eventTypesQuery.field = FIELD_EVENT_ALL_EVENTTYPES;
Expand Down Expand Up @@ -216,6 +244,15 @@ public static BoolQuery getFulltextQuery(List<String> eventTypes, int eventLikel
taxIdFilterClause.addQuery(taxQuery);
eventQuery.addClause(taxIdFilterClause);
}
if (docId != null && docId.isBlank()) {
final MultiMatchQuery docIdQuery = new MultiMatchQuery();
docIdQuery.query = docId;
docIdQuery.fields = List.of(FIELD_PMID, FIELD_PMCID);
final BoolClause docIdFilterClause = new BoolClause();
docIdFilterClause.addQuery(docIdQuery);
docIdFilterClause.occur = FILTER;
eventQuery.addClause(docIdFilterClause);
}
return eventQuery;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ private HighlightCommand getHighlightCommand(String hlTerm, String hlClass, Stri
public CompletableFuture<EventRetrievalResult> getFulltextFilteredEvents(GepiRequestData requestData, int from, int numRows, boolean forCharts) {
log.debug("Returning async result");
return CompletableFuture.supplyAsync(() -> {
BoolQuery eventQuery = EventQueries.getFulltextQuery(requestData.getEventTypes(), requestData.getEventLikelihood(), requestData.getSentenceFilterString(), requestData.getParagraphFilterString(), requestData.getSectionNameFilterString(), requestData.getFilterFieldsConnectionOperator(), requestData.getTaxId(), requestData.isIncludeUnary());
BoolQuery eventQuery = EventQueries.getFulltextQuery(requestData);

boolean downloadAll = forCharts || numRows == Integer.MAX_VALUE;

Expand Down
2 changes: 1 addition & 1 deletion gepi/gepi-indexing/gepi-indexing-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi-indexing</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions gepi/gepi-indexing/gepi-indexing-debug/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi-indexing</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>de.julielab</groupId>
<artifactId>gepi-indexing-base</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions gepi/gepi-indexing/gepi-indexing-pmc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi-indexing</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>de.julielab</groupId>
<artifactId>gepi-indexing-base</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions gepi/gepi-indexing/gepi-indexing-pubmed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi-indexing</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>de.julielab</groupId>
<artifactId>gepi-indexing-base</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions gepi/gepi-indexing/gepi-indexing-testdata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi-indexing</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -15,7 +15,7 @@
<dependency>
<groupId>de.julielab</groupId>
<artifactId>gepi-indexing-base</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion gepi/gepi-indexing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion gepi/gepi-test-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>gepi</artifactId>
<groupId>de.julielab</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion gepi/gepi-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
<parent>
<groupId>de.julielab</groupId>
<artifactId>gepi</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.11.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import de.julielab.gepi.core.retrieval.data.Argument;
import de.julielab.gepi.core.retrieval.data.Event;
import de.julielab.gepi.core.retrieval.data.EventRetrievalResult;
import de.julielab.gepi.core.retrieval.data.GepiRequestData;
import de.julielab.gepi.core.retrieval.services.EventRetrievalService;
import de.julielab.gepi.core.retrieval.services.IEventRetrievalService;
import de.julielab.gepi.core.services.IGeneIdService;
import de.julielab.gepi.webapp.data.FilteredGepiRequestData;
import org.apache.tapestry5.grid.GridDataSource;
import org.apache.tapestry5.grid.SortConstraint;
import org.slf4j.Logger;
Expand All @@ -22,13 +22,13 @@

public class EventPagesDataSource implements GridDataSource {
private final IEventRetrievalService eventRetrievalService;
private final FilteredGepiRequestData requestData;
private final GepiRequestData requestData;
private IGeneIdService geneIdService;
private Logger log;
private Future<EventRetrievalResult> events;
private int start;

public EventPagesDataSource(Logger log, Future<EventRetrievalResult> events, IEventRetrievalService eventRetrievalService, IGeneIdService geneIdService, FilteredGepiRequestData requestData) {
public EventPagesDataSource(Logger log, Future<EventRetrievalResult> events, IEventRetrievalService eventRetrievalService, IGeneIdService geneIdService, GepiRequestData requestData) {
this.log = log;
this.events = events;
this.eventRetrievalService = eventRetrievalService;
Expand Down
Loading

0 comments on commit 55e6bc2

Please sign in to comment.