Skip to content

Commit

Permalink
Merge pull request #13 from bd2kccd/v0.0.7
Browse files Browse the repository at this point in the history
V0.0.7
  • Loading branch information
yuanzhou authored Dec 13, 2016
2 parents 8f51fd5 + 9447916 commit 5165f1f
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 138 deletions.
68 changes: 34 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Causal REST API V1
# Causal REST API v0.0.7

This RESTful API is designed for causal web. And it implements the [JAX-RS](https://en.wikipedia.org/wiki/Java_API_for_RESTful_Web_Services) specifications using Jersey.

Expand Down Expand Up @@ -60,17 +60,15 @@ git checkout tags/v0.3.1
mvn clean install
````

You'll also need to download [ccd-db-0.6.2](https://github.com/bd2kccd/ccd-db) branch:
You'll also need to download released [ccd-db-0.6.2](https://github.com/bd2kccd/ccd-db/releases/tag/v0.6.2):

````
git clone https://github.com/bd2kccd/ccd-db.git
cd ccd-db
git checkout v0.6.2
git checkout tags/v0.6.2
mvn clean install
````

**Note: we'll use the the 0.6.2 tagged release once it's released, only use the branch for now.**

Then you can go get and install `causal-rest-api`:

````
Expand All @@ -84,6 +82,7 @@ mvn clean package
There are 4 configuration files to configure located at `causal-rest-api/src/main/resources`:
- **application-hsqldb.properties**: HSQLDB database configurations (for testing only).
- **application-mysql.properties**: MySQL database configurations
- **application-slurm.properties**: Slurm setting for HPC
- **application.properties**: Spring Boot application settings
- **causal.properties**: Data file directory path and folder settings

Expand Down Expand Up @@ -665,29 +664,29 @@ GET /ccd-api/22/algorithms HTTP/1.1
Host: cloud.ccd.pitt.edu
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2Nsb3VkLmNjZC5waXR0LmVkdS8iLCJuYW1lIjoiemh5MTkiLCJleHAiOjE0NzU4NTA2NzY4MDQsImlhdCI6MTQ3NTg0NzA3NjgwNH0.8azVEoNPfETczXb-vn7dfyDd98eRt7iiLBXehGpPGzY
````
Currently we support "FGS continuous" and "FGS discrete".
Currently we support "FGES continuous" and "FGES discrete".

````javascript
[
{
"id": 1,
"name": "fgsc",
"description": "FGS continuous"
"name": "FGESc",
"description": "FGES continuous"
},
{
"id": 2,
"name": "fgsd",
"description": "FGS discrete"
"name": "FGESd",
"description": "FGES discrete"
},
{
"id": 3,
"name": "gfcic",
"name": "GFCIc",
"description": "GFCI continuous"
}
]
````

Currently we support "FGS continuous", "FGS discrete" and "GFCI continuous". They also share a common JSON structure as of their input, for example:
Currently we support "FGES continuous", "FGES discrete" and "GFCI continuous". They also share a common JSON structure as of their input, for example:

| Input JSON Fields | Description |
| --- | --- |
Expand All @@ -699,7 +698,7 @@ Currently we support "FGS continuous", "FGS discrete" and "GFCI continuous". The

Below are the data validation flags and parameters that you can use for each algorithm.

**FGS continuous**
**FGES continuous**

Data validation:

Expand All @@ -717,7 +716,7 @@ Algorithm parameters:
| `penaltyDiscount` | Penalty discount | 4.0 |
| `verbose` | Print additional information | true |

**FGS discrete**
**FGES discrete**

Data validation:

Expand Down Expand Up @@ -763,13 +762,13 @@ This is a POST request and the algorithm details and data file id will need to b
API Endpoint URI pattern:

````
POST https://cloud.ccd.pitt.edu/ccd-api/{userId}/jobs/fgsc
POST https://cloud.ccd.pitt.edu/ccd-api/{userId}/jobs/FGESc
````

Generated HTTP request code example:

````
POST /ccd-api/22/jobs/fgsc HTTP/1.1
POST /ccd-api/22/jobs/FGESc HTTP/1.1
Host: cloud.ccd.pitt.edu
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2Nsb3VkLmNjZC5waXR0LmVkdS8iLCJuYW1lIjoiemh5MTkiLCJleHAiOjE0NzU4NTA2NzY4MDQsImlhdCI6MTQ3NTg0NzA3NjgwNH0.8azVEoNPfETczXb-vn7dfyDd98eRt7iiLBXehGpPGzY
Content-Type: application/json
Expand All @@ -791,32 +790,33 @@ Content-Type: application/json
}
````

In this example, we are running the "FGS continuous" algorithm on the file with ID 8. And this call will return the job info with a 201 Created response status code.
In this example, we are running the "FGES continuous" algorithm on the file with ID 8. And this call will return the job info with a 201 Created response status code.

````
{
"id": 5,
"algorithmName": "fgsc",
"algorithmName": "FGESc",
"status": 0,
"addedTime": 1472742564355,
"resultFileName": "fgs_data_small.txt_1472742564353.txt",
"errorResultFileName": "error_fgs_data_small.txt_1472742564353.txt"
"resultFileName": "FGESc_data_small.txt_1472742564353.txt",
"errorResultFileName": "error_FGESc_data_small.txt_1472742564353.txt"
}
````

From this response we can tell that the job ID is 5, and the result file name will be `fgs_data_small.txt_1472742564353.txt` if everything goes well. If something is wrong an error result file with name `error_fgs_data_small.txt_1472742564353.txt` will be created.
From this response we can tell that the job ID is 5, and the result file name will be `FGESc_data_small.txt_1472742564353.txt` if everything goes well. If something is wrong an error result file with name `error_FGEsc_data_small.txt_1472742564353.txt` will be created.

When you need to run "FGS discrete", just send the request to a different endpont URI:
When you need to run "FGES discrete", just send the request to a different endpont URI:

API Endpoint URI pattern:

````
POST https://cloud.ccd.pitt.edu/ccd-api/{userId}/jobs/fgsd
POST https://cloud.ccd.pitt.edu/ccd-api/{userId}/jobs/FGESd
````

Generated HTTP request code example:

````
POST /ccd-api/22/jobs/fgsd HTTP/1.1
POST /ccd-api/22/jobs/FGESd HTTP/1.1
Host: cloud.ccd.pitt.edu
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2Nsb3VkLmNjZC5waXR0LmVkdS8iLCJuYW1lIjoiemh5MTkiLCJleHAiOjE0NzU4NTA2NzY4MDQsImlhdCI6MTQ3NTg0NzA3NjgwNH0.8azVEoNPfETczXb-vn7dfyDd98eRt7iiLBXehGpPGzY
Content-Type: application/json
Expand Down Expand Up @@ -863,12 +863,12 @@ Then you'll see the information of all jobs that are currently running:
[
{
"id": 32,
"algorithmName": "fgsc",
"algorithmName": "FGESc",
"addedTime": 1468436085000
},
{
"id": 33,
"algorithmName": "fgsd",
"algorithmName": "FGESd",
"addedTime": 1468436087000
}
]
Expand Down Expand Up @@ -937,13 +937,13 @@ The response to this request will look like this:
````javascript
[
{
"name": "fgs_sim_data_20vars_100cases.csv_1466171729046.txt",
"name": "FGESc_sim_data_20vars_100cases.csv_1466171729046.txt",
"creationTime": 1466171732000,
"lastModifiedTime": 1466171732000,
"fileSize": 1660
},
{
"name": "fgs_data_small.txt_1466172140585.txt",
"name": "FGESc_data_small.txt_1466172140585.txt",
"creationTime": 1466172145000,
"lastModifiedTime": 1466172145000,
"fileSize": 39559
Expand All @@ -962,7 +962,7 @@ GET https://cloud.ccd.pitt.edu/ccd-api/{userId}/results/{result_file_name}
Generated HTTP request code example:

````
GET /ccd-api/22/results/fgs_data_small.txt_1466172140585.txt HTTP/1.1
GET /ccd-api/22/results/FGESc_data_small.txt_1466172140585.txt HTTP/1.1
Host: cloud.ccd.pitt.edu
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2Nsb3VkLmNjZC5waXR0LmVkdS8iLCJuYW1lIjoiemh5MTkiLCJleHAiOjE0NzU4NTA2NzY4MDQsImlhdCI6MTQ3NTg0NzA3NjgwNH0.8azVEoNPfETczXb-vn7dfyDd98eRt7iiLBXehGpPGzY
````
Expand All @@ -976,7 +976,7 @@ The response to this request will look like this:
"status": 404,
"error": "Not Found",
"message": "Resource not found.",
"path": "/22/results/fgs_data_small.txt_146172140585.txt"
"path": "/22/results/FGESc_data_small.txt_146172140585.txt"
}
````

Expand All @@ -1002,15 +1002,15 @@ Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL
{
"resultFiles": [
"gs_sim_data_20vars_100cases.csv_1466171729046.txt",
"fgs_data_small.txt_1467305104859.txt"
"FGESc_sim_data_20vars_100cases.csv_1466171729046.txt",
"FGESc_data_small.txt_1467305104859.txt"
]
}
````
When you specify multiple file names, use the `!!` as a delimiter. This request will generate a result comparison file with the following content (shortened version):

````
fgs_sim_data_20vars_100cases.csv_1466171729046.txt fgs_data_small.txt_1467305104859.txt
FGESc_sim_data_20vars_100cases.csv_1466171729046.txt FGESc_data_small.txt_1467305104859.txt
Edges In All Same End Point
NR4A2,FOS 0 0
X5,X17 0 0
Expand Down Expand Up @@ -1088,7 +1088,7 @@ Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL
Then it returns the content of that comparison file (shorted version):

````
fgs_sim_data_20vars_100cases.csv_1466171729046.txt fgs_data_small.txt_1467305104859.txt
FGESc_sim_data_20vars_100cases.csv_1466171729046.txt FGESc_data_small.txt_1467305104859.txt
Edges In All Same End Point
NR4A2,FOS 0 0
X5,X17 0 0
Expand Down
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>edu.pitt.dbmi.ccd</groupId>
<artifactId>causal-rest-api</artifactId>
<version>0.0.6</version>
<version>0.0.7</version>
<packaging>jar</packaging>

<name>causal-rest-api</name>
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
<version>1.4.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

Expand Down Expand Up @@ -48,18 +48,19 @@
<dependency>
<groupId>edu.pitt.dbmi</groupId>
<artifactId>ccd-db</artifactId>
<version>0.6.2</version>
<version>0.6.3</version>
</dependency>
<dependency>
<groupId>edu.pitt.dbmi</groupId>
<artifactId>ccd-commons</artifactId>
<version>0.3.1</version>
</dependency>

<!-- Shiro -->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.5</version>
<version>1.3.2</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
*
* @author Zhou Yuan ([email protected])
*/
public class FgsContinuousDataValidation extends BasicDataValidation {
public class FgesContinuousDataValidation extends BasicDataValidation {

// Skip check for zero variance variables
protected boolean skipNonzeroVariance;

public FgsContinuousDataValidation() {
public FgesContinuousDataValidation() {
}

public boolean isSkipNonzeroVariance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@
*
* @author Zhou Yuan ([email protected])
*/
public class FgsContinuousNewJob extends NewJob {
public class FgesContinuousNewJob extends NewJob {

// Algorithm parameters
private FgsContinuousParameters algorithmParameters;
private FgesContinuousParameters algorithmParameters;

// Data validation flag
private FgsContinuousDataValidation dataValidation;
private FgesContinuousDataValidation dataValidation;

public FgsContinuousNewJob() {
public FgesContinuousNewJob() {
}

public FgsContinuousParameters getAlgorithmParameters() {
public FgesContinuousParameters getAlgorithmParameters() {
return algorithmParameters;
}

public void setAlgorithmParameters(FgsContinuousParameters algorithmParameters) {
public void setAlgorithmParameters(FgesContinuousParameters algorithmParameters) {
this.algorithmParameters = algorithmParameters;
}

public FgsContinuousDataValidation getDataValidation() {
public FgesContinuousDataValidation getDataValidation() {
return dataValidation;
}

public void setDataValidation(FgsContinuousDataValidation dataValidation) {
public void setDataValidation(FgesContinuousDataValidation dataValidation) {
this.dataValidation = dataValidation;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
*
* @author Zhou Yuan ([email protected])
*/
public class FgsContinuousParameters extends FgsParameters {
public class FgesContinuousParameters extends FgesParameters {

private double penaltyDiscount;

public FgsContinuousParameters() {
public FgesContinuousParameters() {
}

public double getPenaltyDiscount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
*
* @author Zhou Yuan ([email protected])
*/
public class FgsDiscreteDataValidation extends BasicDataValidation {
public class FgesDiscreteDataValidation extends BasicDataValidation {

// Skip 'limit number of categories' check
private boolean skipCategoryLimit;

public FgsDiscreteDataValidation() {
public FgesDiscreteDataValidation() {
}

public boolean isSkipCategoryLimit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@
*
* @author Zhou Yuan ([email protected])
*/
public class FgsDiscreteNewJob extends NewJob {
public class FgesDiscreteNewJob extends NewJob {

// Algorithm parameters
private FgsDiscreteParameters algorithmParameters;
private FgesDiscreteParameters algorithmParameters;

// Data validation flag
private FgsDiscreteDataValidation dataValidation;
private FgesDiscreteDataValidation dataValidation;

public FgsDiscreteNewJob() {
public FgesDiscreteNewJob() {
}

public FgsDiscreteParameters getAlgorithmParameters() {
public FgesDiscreteParameters getAlgorithmParameters() {
return algorithmParameters;
}

public void setAlgorithmParameters(FgsDiscreteParameters algorithmParameters) {
public void setAlgorithmParameters(FgesDiscreteParameters algorithmParameters) {
this.algorithmParameters = algorithmParameters;
}

public FgsDiscreteDataValidation getDataValidation() {
public FgesDiscreteDataValidation getDataValidation() {
return dataValidation;
}

public void setDataValidation(FgsDiscreteDataValidation dataValidation) {
public void setDataValidation(FgesDiscreteDataValidation dataValidation) {
this.dataValidation = dataValidation;
}

Expand Down
Loading

0 comments on commit 5165f1f

Please sign in to comment.