Skip to content

Commit

Permalink
Merge pull request #58 from bd2kccd/development
Browse files Browse the repository at this point in the history
Merge final version 1.3.4 to master.
  • Loading branch information
kvb2univpitt authored May 17, 2017
2 parents 9cc6fdb + f272b7e commit 39cb077
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 41 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ If you want to host the application with your own hardware, follow the instructi
#### Dependencies
Download and uncompress the source code for each of following dependencies:

* [ccd-job-queue-0.1.6](https://github.com/bd2kccd/ccd-job-queue/releases/tag/v0.1.6)
* [ccd-mail-0.2.2](https://github.com/bd2kccd/ccd-mail/releases/tag/v0.2.2)
* [ccd-db-0.6.3](https://github.com/bd2kccd/ccd-db/releases/tag/v0.6.3)
* [ccd-job-queue-0.1.7](https://github.com/bd2kccd/ccd-job-queue/releases/tag/v0.1.7)
* [ccd-mail-0.2.3](https://github.com/bd2kccd/ccd-mail/releases/tag/v0.2.3)
* [ccd-db-0.6.4](https://github.com/bd2kccd/ccd-db/releases/tag/v0.6.4)
* [ccd-commons-0.3.1](https://github.com/bd2kccd/ccd-commons/releases/tag/v0.3.1)
To install the dependencies, go to the top directory of each project and do a maven install by typing **mvn install**.

#### Application
Download and uncompress the application source code [causal-web-1.3.1](https://github.com/bd2kccd/causal-web/releases/tag/v1.3.1). To compile and build the application, go to the directory **causal-web-1.3.1** and type **mvn package**.
Download and uncompress the application source code [causal-web-1.3.4](https://github.com/bd2kccd/causal-web/releases/tag/v1.3.4). To compile and build the application, go to the directory **causal-web-1.3.4** and type **mvn package**.

#### External Dependencies
* [causal-cmd-6.0.1-SNAPSHOT-jar-with-dependencies.jar](https://github.com/cmu-phil/tetrad/releases/tag/v6.0.1-20161122)
* [causal-cmd-0.1.2-jar-with-dependencies.jar](https://github.com/bd2kccd/causal-cmd/releases/tag/v0.1.2)

## Configure the software

### Setup the directory structure and copy libraries
First, you need to create a workspace for the application to work in. Create a directory called **workspace**, for an example ***/home/tuser/workspace***.
Inside the workspace directory, create another folder called **lib**, for example ***/home/tuser/workspace/lib***.

Copy the **causal-cmd-6.0.1.jar** to the **workspace/lib** folder.
Copy the **causal-cmd-0.1.2-jar-with-dependencies.jar** to the **workspace/lib** folder.

### Configure
There are 4 configuration files to configure located in causal-web-1.3.1/src/main/resources folder:
There are 4 configuration files to configure located in causal-web-1.3.4/src/main/resources folder:
1. **application-hsqldb.properties**: HSQLDB database configurations (for testing only).
2. **application-mysql.properties**: MySQL database configurations
3. **application.properties**: Spring Boot configurations
Expand Down Expand Up @@ -74,15 +74,15 @@ spring.profiles.active=scheduler,mysql
Make sure you set **ccd.server.workspace=/home/tuser/workspace** and **ccd.folder.lib=lib** in the **ccd.properties** file.

## Compile the Program
Go to the **causal-web** directory and run the command **mvn clean package**. This will create a jar file called **causal-web-1.3.1.jar** in the **/target** folder.
Go to the **causal-web** directory and run the command **mvn clean package**. This will create a jar file called **causal-web-1.3.4.jar** in the **/target** folder.

### Launch the Program
```java
java -jar causal-web-1.3.1.jar
java -jar causal-web-1.3.4.jar
```
To give the program 4GB of memory to run on, type the follow, using the jvm options:
```java
java -Xmx4G -jar causal-web-1.3.1.jar
java -Xmx4G -jar causal-web-1.3.4.jar
```

To launch app in the browser
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>edu.pitt.dbmi</groupId>
<artifactId>causal-web</artifactId>
<version>1.3.2</version>
<version>1.3.4</version>
<packaging>jar</packaging>

<name>causal-web</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public String showPlot(
String username = appUser.getUsername();
List<String> categoryNames = Arrays.asList("Runtime Parameters", "Dataset", "Filters", "FGS Parameters", "Run Options", "Algorithm Parameters", "Data Validations");
model.addAttribute("categories", algorithmResultService.extractDataCategories(fileName, username, categoryNames));
model.addAttribute("isPag", algorithmResultService.isPagResult(fileName, username));

return PLOT_VIEW;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -172,6 +173,23 @@ public List<ResultFileInfo> listResultFileInfo(final String username) {
return Arrays.asList(array);
}

public boolean isPagResult(final String fileName, final String username) {
boolean isPag = false;

Path file = Paths.get(workspace, username, resultFolder, algorithmResultFolder, fileName);
try (Scanner scanner = new Scanner(Files.newBufferedReader(file))) {
scanner.nextLine(); // skip the first line
String line = scanner.nextLine();
if (line != null) {
isPag = line.trim().contains("GFCI");
}
} catch (IOException exception) {
LOGGER.error(String.format("Unable to read file '%s'.", fileName), exception);
}

return isPag;
}

public Map<String, Map<String, String>> extractDataCategories(final String fileName, final String username, final List<String> categoryNames) {
Map<String, Map<String, String>> info = new LinkedHashMap<>();
categoryNames.forEach(key -> {
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/banner.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

██████╗ █████╗ ██╗ ██╗███████╗ █████╗ ██╗ ██╗ ██╗███████╗██████╗ ██╗ ██████╗ ██████╗
██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗██║ ██║ ██║██╔════╝██╔══██╗ ███║ ╚════██╗ ╚════██╗
██║ ███████║██║ ██║███████╗███████║██║ ██║ █╗ ██║█████╗ ██████╔╝ ╚██║ █████╔╝ █████╔╝
██║ ██╔══██║██║ ██║╚════██║██╔══██║██║ ██║███╗██║██╔══╝ ██╔══██╗ ██║ ╚═══██╗ ██╔═══
╚██████╗██║ ██║╚██████╔╝███████║██║ ██║███████╗ ╚███╔███╔╝███████╗██████╔╝ ██║██╗██████╔╝██╗███████╗
╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═╝╚═╝╚═════╝ ╚═╝╚══════╝
██████╗ █████╗ ██╗ ██╗███████╗ █████╗ ██╗ ██╗ ██╗███████╗██████╗ ██╗ ██████╗ ██╗ ██╗
██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗██║ ██║ ██║██╔════╝██╔══██╗ ███║ ╚════██╗██║ ██║
██║ ███████║██║ ██║███████╗███████║██║ ██║ █╗ ██║█████╗ ██████╔╝ ╚██║ █████╔╝███████║
██║ ██╔══██║██║ ██║╚════██║██╔══██║██║ ██║███╗██║██╔══╝ ██╔══██╗ ██║ ╚═══██╗════██║
╚██████╗██║ ██║╚██████╔╝███████║██║ ██║███████╗ ╚███╔███╔╝███████╗██████╔╝ ██║██╗██████╔╝██╗ ██║
╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═╝╚═╝╚═════╝ ╚═╝═╝
2 changes: 1 addition & 1 deletion src/main/resources/ccd.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ccd.email.admin.sendto=${spring.mail.username}
ccd.acct.reg.activ.required=false

# LABELS
ccd.app.title=Causal Web v1.3.2
ccd.app.title=Causal Web v1.3.4
ccd.app.copyright=University of Pittsburgh and Carnegie Mellon University

ccd.app.agreement=TERMS AND CONDITIONS&#10;&#10;\
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/static/img/pags/ab_direct.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 13 additions & 18 deletions src/main/resources/static/js/algo/d3jsplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@ function plotGraph(links) {

// Default distance accessor is 30
simulation.force("link")
.distance(60);
.distance(50);

// Each node conects to itself, so we can highlight this node when it's selected
for (i = 0; i < nodes.length; i++) {
linkedByIndex[i + "," + i] = 1;
}
;

// Add all the connections based on links
// Must call this after simulation.force("link").links(links)
Expand Down Expand Up @@ -208,29 +207,25 @@ function plotGraph(links) {
function ticked() {
// Position nodes
node.attr("cx", function (d) {
// This makes sure the nodes won't go out of the container
// Bounding box example: http://mbostock.github.io/d3/talk/20110921/bounding.html
return d.x = Math.max(nodeRadius, Math.min(svgWidth - nodeRadius, d.x));
//return d.x;
})
.attr("cy", function (d) {
return d.y = Math.max(nodeRadius, Math.min(svgHeight - nodeRadius, d.y));
//return d.y;
});
return d.x;
})
.attr("cy", function (d) {
return d.y;
});

// Position links
// Use path instead of line since IE 10 doesn't render the links correctly
link.attr("d", positionLink).each(function () {
this.parentNode.insertBefore(this, this);
});
this.parentNode.insertBefore(this, this);
});

// Position node text
text.attr("x", function (d) {
return d.x + nodeRadius;
})
.attr("y", function (d) {
return d.y + nodeRadius / 2;
});
return d.x - (nodeRadius / 2);
})
.attr("y", function (d) {
return d.y - (1.5 * nodeRadius);
});
}

// Position the edge link
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/static/js/algo/d3jsplot.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 39cb077

Please sign in to comment.