Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cumbof committed Aug 25, 2020
1 parent eae87ed commit ba669f1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/opengdc/Settings.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package opengdc;

import java.io.File;
import java.net.URISyntaxException;
import java.nio.file.Paths;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/opengdc/UpdateScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(String[] args) {
//String inputDiseaseAbbreviation = "ACC";
//String inputDisease = (inputProgram+"-"+inputDiseaseAbbreviation).toLowerCase();

files_datetime = Settings.getFilesDatetime();
String files_datetime = Settings.getFilesDatetime();
if (args.length == 2) {
//args[0];
files_datetime = args[1];
Expand Down
2 changes: 1 addition & 1 deletion src/opengdc/UpdateTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void run() {
System.out.println("----------------------------------------");
System.out.println("Timer task started at: " + new Date());
//updateTask();
Settings.setFilesDatetime(files_datetime)
Settings.setFilesDatetime(files_datetime);
Main.runMain();
System.out.println("Timer task finished at: " + new Date());
System.out.println("----------------------------------------");
Expand Down
10 changes: 6 additions & 4 deletions src/opengdc/test/FilterAttributesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ public static void main(String[] args) {
attributes.add("manually_curated__associated_entities__case_id");
attributes.add("manually_curated__cases__case_id");

String selected_attribute = MetadataHandler.selectAttribute(attributes);
System.err.println(selected_attribute);
ArrayList<String> selected_attributes = MetadataHandler.selectAttributes(attributes);
for (String attr: selected_attributes)
System.err.println(attr);

attributes = new ArrayList<>();
attributes.add("manually_curated__associated_entities__entity_id");
attributes.add("manually_curated__annotations__entity_id");

selected_attribute = MetadataHandler.selectAttribute(attributes);
System.err.println(selected_attribute);
selected_attributes = MetadataHandler.selectAttributes(attributes);
for (String attr: selected_attributes)
System.err.println(attr);
}

}
28 changes: 14 additions & 14 deletions src/opengdc/util/GDCQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class GDCQuery {

public static String query(String disease, String dataType, int recursive_iteration) {
try {
String files_datetime = Settings.getFilesDatetime()
String files_datetime = Settings.getFilesDatetime();
String payload_top = "{" +
"\"filters\":{" +
"\"op\":\"and\"," +
Expand Down Expand Up @@ -89,15 +89,15 @@ public static String query(String disease, String dataType, int recursive_iterat
"}" +
"}";

payload_datetime = ",{" +
"\"op\":\">=\"," +
"\"content\":{" +
String payload_datetime = ",{" +
"\"op\":\">=\"," +
"\"content\":{" +
"\"field\":\"files.created_datetime\"," +
"\"value\":[" +
"\""+files_datetime+"\"" +
"]" +
"}" +
"}";
"}" +
"}";

if (dataType.toLowerCase().contains("clinical") || dataType.toLowerCase().contains("biospecimen")) {
payload_datetime = ",{" +
Expand All @@ -122,17 +122,17 @@ public static String query(String disease, String dataType, int recursive_iterat
"}" +
"}" +
"]" +
"}"
"}";
}

payload_bottom = "]" +
"}," +
"\"format\":\"json\"," +
"\"size\":\""+SIZE_LIMIT+"\"," +
"\"pretty\":\"true\"" +
"}";
String payload_bottom = "]" +
"}," +
"\"format\":\"json\"," +
"\"size\":\""+SIZE_LIMIT+"\"," +
"\"pretty\":\"true\"" +
"}";

payload = payload_top + payload_datetime + payload_bottom;
String payload = payload_top + payload_datetime + payload_bottom;

String url = BASE_SEARCH_URL;
URL obj = new URL(url);
Expand Down

0 comments on commit ba669f1

Please sign in to comment.