Skip to content

Commit

Permalink
Merge pull request #221 from JULIELab/download_link
Browse files Browse the repository at this point in the history
Fix #220.
  • Loading branch information
khituras authored Dec 23, 2022
2 parents 52017a6 + 7b35ec1 commit c04c13e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion gepi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ FROM jetty:10.0.9-jre11-slim-openjdk as production
USER root
RUN apt-get update -y && apt-get install -y python3.9 && apt-get install -y python3-pip && pip install pandas==1.3.2 openpyxl==3.0.9 xlsxwriter==3.0.1
USER jetty
RUN java -jar "$JETTY_HOME/start.jar" --add-modules=ssl,https
#RUN java -jar "$JETTY_HOME/start.jar" --add-modules=ssl,https
COPY gepi-webapp/target/gepi-webapp.war /var/lib/jetty/webapps/ROOT.war
4 changes: 2 additions & 2 deletions gepi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Update the new version number in the following places:
* `README.md` (by executing `mvn clean package -DskipTests=true` to filter the `readme-raw/README.md` file to automatically set the current version to the `README.md` file)
* `AppModule.java` in `gepi-webapp`
* set `PRODUCTION_MODE` to true for releases
* the Docker image version in the `docker-compose-*.yml`
* the Docker image version in the `docker-compose.yml`
* the DB version in `gene-database.xml` in the `gepi-concept-database` module
* in `gepi-indexing-base` execute `python ../../../../jcore-misc/jcore-scripts/createMetaDescriptors.py -c -i -r manual -v 1.0 .` given that `jcore-misc` has been cloned to the same directory as GePI
* in execute `python ../../jcore-misc/jcore-scripts/createMetaDescriptors.py -c -i -r manual -v 1.0 gepi-indexing/gepi-indexing-base` given that `jcore-misc` has been cloned to the same directory as GePI
* this updates the description file for the use with the JCoRe pipeline builder
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,22 @@ public class GePiDataService implements IGePiDataService {
public static final String GEPI_TMP_DIR_NAME = "gepi";
public static final String GEPI_EXCEL_FILE_PREFIX_NAME = "gepi-excel-";
public static final String GEPI_EXCEL_STATUS_FILE_PREFIX = "gepi-excel-status-";
private static final Logger log = LoggerFactory.getLogger(GePiDataService.class);
public static final String EXCEL_FILE_SUCCESS_STATE = "GePI interactions have been successfully saved in Excel format.";
private Cache<Long, GePiData> dataCache;
protected static final HashMap<Integer, String> likelihoodNames;
private static final Logger log = LoggerFactory.getLogger(GePiDataService.class);

static {
likelihoodNames = new HashMap<>();
likelihoodNames.put(1, "negation");
likelihoodNames.put(2, "low");
likelihoodNames.put(3, "investigation");
likelihoodNames.put(4, "moderate");
likelihoodNames.put(5, "high");
likelihoodNames.put(6, "assertion");
}

private final Path gepiTmpDir;
private Cache<Long, GePiData> dataCache;
private String excelFilePrefix;
/**
* This string is the scripts itself, not a reference to a file.
Expand Down Expand Up @@ -254,15 +266,21 @@ public JSONArray convertToJson(List<Event> eventList) {
public Path getOverviewExcel(Future<EventRetrievalResult> eventRetrievalResult, long dataSessionId, EnumSet<InputMode> inputMode, String sentenceFilterString, String paragraphFilterString, String sectionNameFilterString) throws IOException, ExecutionException, InterruptedException {
long time = System.currentTimeMillis();
log.info("Creating event statistics Excel file for dataSessionId {}", dataSessionId);
updateDownloadFileCreationsStatus( "Step 1 of 3: Retrieving and storing all interactions for Excel sheet creation.", dataSessionId);
final Path tempStatusFile = getTempStatusFile(dataSessionId);
if (!Files.exists(tempStatusFile)) {
if (!Files.exists(tempStatusFile.getParent()))
Files.createDirectories(tempStatusFile.getParent());
Files.createFile(tempStatusFile);
}
updateDownloadFileCreationsStatus("Step 1 of 3: Retrieving and storing all interactions for Excel sheet creation.", dataSessionId);
Path tsvFile = getTempTsvDataFile(dataSessionId);
Path xlsFile = getTempXlsDataFile(dataSessionId);
writeOverviewTsvFile(eventRetrievalResult.get().getEventList(), tsvFile);
updateDownloadFileCreationsStatus( "Step 2 of 3: Retrieval of all interactions has finished. Creating Excel file.", dataSessionId);
updateDownloadFileCreationsStatus("Step 2 of 3: Retrieval of all interactions has finished. Creating Excel file.", dataSessionId);
createExcelSummaryFile(tsvFile, xlsFile, inputMode, sentenceFilterString, paragraphFilterString, sectionNameFilterString);
updateDownloadFileCreationsStatus(EXCEL_FILE_SUCCESS_STATE + " The file is ready for download.", dataSessionId);
time = System.currentTimeMillis() - time;
log.info("Excel sheet creation took {} seconds", time/1000);
log.info("Excel sheet creation took {} seconds", time / 1000);
return xlsFile;
}

Expand Down Expand Up @@ -305,17 +323,7 @@ private void createExcelSummaryFile(Path tsvFile, Path xlsFile, EnumSet<InputMod
if (!Files.exists(xlsFile))
throw new FileNotFoundException("The Excel file " + xlsFile.toAbsolutePath() + " does not exist.");
}
protected static final HashMap<Integer, String> likelihoodNames;

static {
likelihoodNames = new HashMap<>();
likelihoodNames.put(1, "negation");
likelihoodNames.put(2, "low");
likelihoodNames.put(3, "investigation");
likelihoodNames.put(4, "moderate");
likelihoodNames.put(5, "high");
likelihoodNames.put(6, "assertion");
}
private void writeOverviewTsvFile(List<Event> events, Path file) throws IOException {
log.debug("Writing event statistics tsv file to {}", file);
try (BufferedWriter bw = new BufferedWriter(new FileWriter(file.toFile(), UTF_8))) {
Expand Down
4 changes: 2 additions & 2 deletions gepi/gepi-webapp/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<logger name="de.julielab.elastic.query.components.data.ElasticServerResponse" level="INFO"/>
<logger name="de.julielab" level="INFO" />
<!-- <logger name="de.julielab.gepi.webapp" level="DEBUG"/>-->
<logger name="de.julielab.gepi.webapp.pages.Index" level="debug"/>
<!-- <logger name="de.julielab.gepi.webapp.pages.Index" level="debug"/>-->
<logger name="de.julielab.gepi.webapp.components.GepiWidgetLayout" level="INFO"/>
<!-- <logger name="de.julielab.gepi.core.services.GepiCoreModule.IGeneIdService" level="DEBUG"/>-->
<logger name="de.julielab.gepi.core.services.GepiCoreModule.IGePiDataService" level="DEBUG"/>
<!-- <logger name="de.julielab.gepi.core.services.GepiCoreModule.IEventRetrievalService" level="DEBUG"/>-->
<logger name="de.julielab.elastic.query.services.ElasticQueryComponentsModule.ElasticSearchComponent" level="TRACE" />
<!-- <logger name="de.julielab.elastic.query.services.ElasticQueryComponentsModule.ElasticSearchComponent" level="TRACE" />-->
<!--
<logger name="de.julielab.gepi.webapp.pages.Index" level="DEBUG"/>
<logger name="de.julielab.gepi.webapp.components.GepiInput" level="DEBUG"/>
Expand Down

0 comments on commit c04c13e

Please sign in to comment.