Skip to content

Commit

Permalink
Merge pull request #263 from OHDSI/release-0.10.2
Browse files Browse the repository at this point in the history
Release 0.10.2
  • Loading branch information
Maxim Moinat authored Aug 15, 2020
2 parents cb4df14 + 246f594 commit ac7cefc
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 30 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ dist/
/.classpath
*.iml
.idea/
target/
*.class

# Repo specific ignores
/ScanReport.xlsx
*swp
tmp/*
Try*
/examples/
/examples/
.DS_Store
7 changes: 7 additions & 0 deletions docs/WhiteRabbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ Once the scan report is created, this report can then be used in the Rabbit-In-A

Note: on releases earlier than version 0.8.0, open the respective WhiteRabbit.jar or RabbitInAHat.jar files instead.

### Memory
WhiteRabbit possibly does not start when the memory allocated by the JVM is too big or too small.
By default this is set to 1200m.
To increase the memory (in this example to 2400m), either set the environment variable `EXTRA_JVM_ARGUMENTS=-Xmx2400m` before starting or edit in `bin/WhiteRabbit.bat` the line `%JAVACMD% %JAVA_OPTS% -Xmx2400m...`.
To lower the memory, set one of these variables to e.g. `-Xmx600m`.
If you have a 32-bit Java VM installed and problems persist, consider installing 64-bit Java.

## Support
All source code, descriptions and input/output examples are available on GitHub: <https://github.com/OHDSI/WhiteRabbit>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>org.ohdsi</groupId>
<artifactId>leporidae</artifactId>
<packaging>pom</packaging>
<version>0.10.1</version>
<version>0.10.2</version>
<modules>
<module>rabbitinahat</module>
<module>whiterabbit</module>
Expand Down
12 changes: 6 additions & 6 deletions rabbit-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>leporidae</artifactId>
<groupId>org.ohdsi</groupId>
<version>0.10.1</version>
<version>0.10.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -30,7 +30,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
<version>8.0.16</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
Expand All @@ -40,17 +40,17 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>3.9</version>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
Expand All @@ -70,7 +70,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1204-jdbc41</version>
<version>42.2.5</version>
</dependency>
<dependency>
<groupId>com.cedarsoftware</groupId>
Expand Down
15 changes: 11 additions & 4 deletions rabbit-core/src/main/java/org/ohdsi/databases/RichConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,22 @@ public List<String> getTableNames(String database) {
if (dbType == DbType.MYSQL) {
query = "SHOW TABLES IN " + database;
} else if (dbType == DbType.MSSQL || dbType == DbType.PDW || dbType == DbType.AZURE) {
query = "SELECT CONCAT(schemas.name, '.', tables.name) FROM " + database + ".sys.tables INNER JOIN " + database + ".sys.schemas ON tables.schema_id = schemas.schema_id ORDER BY schemas.name, tables.name";
query = "SELECT CONCAT(schemas.name, '.', tables_views.name) FROM " +
"(SELECT schema_id, name FROM %1$s.sys.tables UNION ALL SELECT schema_id, name FROM %1$s.sys.views) tables_views " +
"INNER JOIN %1$s.sys.schemas ON tables_views.schema_id = schemas.schema_id " +
"ORDER BY schemas.name, tables_views.name";
query = String.format(query, database);
System.out.println(query);
} else if (dbType == DbType.ORACLE) {
query = "SELECT table_name FROM all_tables WHERE owner='" + database.toUpperCase() + "'";
query = "SELECT table_name FROM " +
"(SELECT table_name, owner FROM all_tables UNION ALL SELECT view_name, owner FROM all_views) tables_views " +
"WHERE owner='" + database.toUpperCase() + "'";
} else if (dbType == DbType.POSTGRESQL || dbType == DbType.REDSHIFT) {
query = "SELECT table_name FROM information_schema.tables WHERE table_schema = '" + database.toLowerCase() + "' ORDER BY table_name";
} else if (dbType == DbType.MSACCESS) {
query = "SELECT Name FROM sys.MSysObjects WHERE Type=1 AND Flags=0;";
query = "SELECT Name FROM sys.MSysObjects WHERE (Type=1 OR Type=5) AND Flags=0;";
} else if (dbType == DbType.TERADATA) {
query = "SELECT TableName from dbc.tables WHERE tablekind = 'T' and databasename='" + database + "'";
query = "SELECT TableName from dbc.tables WHERE tablekind IN ('T','V') and databasename='" + database + "'";
} else if (dbType == DbType.BIGQUERY) {
query = "SELECT table_name from " + database + ".INFORMATION_SCHEMA.TABLES ORDER BY table_name;";
}
Expand Down
2 changes: 1 addition & 1 deletion rabbitinahat/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>leporidae</artifactId>
<groupId>org.ohdsi</groupId>
<version>0.10.1</version>
<version>0.10.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.ohdsi.rabbitInAHat.dataModel.*;
import org.ohdsi.rabbitInAHat.dataModel.ETL.FileFormat;

// TODO: use templating to generate the R code (e.g. Jinja/Apache FreeMarker/Mustache). At least put static R code in separate (.R) files.
public class ETLTestFrameWorkGenerator {

private static int DEFAULT = 0;
Expand Down Expand Up @@ -260,7 +261,7 @@ private void createAddFunctions() {
writer.println(" frameworkContext$sourceFieldsTested <- c(frameworkContext$sourceFieldsTested, '" + convertFieldToFullName(field) + "')");
writer.println(" }");
writer.println(" fields <- c(fields, \"" + sqlFieldName + "\")");
writer.println(" values <- c(values, " + createSqlValueCode(rFieldName) + ")");
writer.println(" values <- c(values, " + createValueCode(rFieldName) + ")");
writer.println("");
}
writer.println(" inserts <- list(testId = frameworkContext$testId, testDescription = frameworkContext$testDescription, table = \"" + sqlTableName
Expand Down Expand Up @@ -335,7 +336,7 @@ private void createLookupFunctions() {
writer.println(" } else {");
writer.println(" statement <- paste0(statement, \" AND\")");
writer.println(" }");
writer.println(" statement <- paste0(statement, \" " + sqlFieldName + " = \", " + createSqlValueCode(rFieldName) + ")");
writer.println(" statement <- paste0(statement, \" " + sqlFieldName + "\"," + createSqlValueCode(rFieldName) + ")");
writer.println(" }");
writer.println("");
}
Expand Down Expand Up @@ -454,7 +455,7 @@ private void createGenerateTestSqlFunction() {
writer.println(" \"' AS test, CASE WHEN (SELECT COUNT(*) FROM @cdm_database_schema.\",");
writer.println(" expect$table,");
writer.println(" \" WHERE \",");
writer.println(" paste(paste(expect$fields, operators, expect$values), collapse = \" AND \"),");
writer.println(" paste(paste(expect$fields, expect$values), collapse = \" AND \"),");
writer.println(" \") \",");
writer.println(" if (expect$type == " + DEFAULT + ") \"= 0\" else if (expect$type == " + NEGATE
+ ") \"!= 0\" else paste(\"!=\", expect$rowCount),");
Expand Down Expand Up @@ -581,7 +582,14 @@ private String convertToRName(String name) {
return name;
}

private String createSqlValueCode(String rFieldName) {
private String createSqlValueCode(String rFieldName) {
return "if (is.null(" + rFieldName + ")) \" IS NULL\" " +
"else if (is(" + rFieldName + ", \"subQuery\")) " +
"paste0(\" = (\", as.character(" + rFieldName + "), \")\") " +
"else paste0(\" = '\", as.character(" + rFieldName + "), \"'\")";
}

private String createValueCode(String rFieldName) {
return "if (is.null(" + rFieldName + ")) \"NULL\" " +
"else if (is(" + rFieldName + ", \"subQuery\")) " +
"paste0(\"(\", as.character(" + rFieldName + "), \")\") " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import org.ohdsi.rabbitInAHat.ResizeListener;

Expand All @@ -16,6 +18,7 @@
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;
import javax.swing.WindowConstants;

public class FilterDialog extends JDialog implements ActionListener, ResizeListener {

Expand All @@ -24,6 +27,7 @@ public class FilterDialog extends JDialog implements ActionListener, ResizeListe
*
*/
private static final long serialVersionUID = 7009265246652874341L;
private static FilterDialog instance;


private JTextField sourceSearchField;
Expand All @@ -34,9 +38,11 @@ public class FilterDialog extends JDialog implements ActionListener, ResizeListe

Container contentPane = this.getContentPane();

public FilterDialog(Window parentWindow){

super(parentWindow,"Filter",ModalityType.MODELESS);
public FilterDialog(Window parentWindow) throws ExceptionInInitializerError{
super(parentWindow,"Filter",ModalityType.MODELESS);
if (alreadyOpened()) {
throw new ExceptionInInitializerError("An instance of FilterDialog already exists");
}
this.setResizable(false);
this.setLocation(parentWindow.getX()+parentWindow.getWidth()/2, parentWindow.getY()+100);

Expand Down Expand Up @@ -96,7 +102,28 @@ public FilterDialog(Window parentWindow){
layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, targetClearBtn);

this.pack();
};

// Make sure the instance is reset to null when the search dialog window is closed
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
instance = null;
}
});

instance = this;
}

public static boolean alreadyOpened(){
return (instance != null);
}

public static void bringToFront(){
if (alreadyOpened()) {
instance.toFront();
}
}

public void setFilterPanel(MappingPanel aFilterPanel){
if (filterPanel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,14 @@ private void doSetTargetCDM(CDMVersion cdmVersion) {
}

private void doOpenFilterDialog() {
FilterDialog filter;
filter = new FilterDialog(frame);

filter.setFilterPanel(tableMappingPanel);

filter.setVisible(true);
if (FilterDialog.alreadyOpened()){
FilterDialog.bringToFront();
}
else {
FilterDialog filter = new FilterDialog(frame);
filter.setFilterPanel(tableMappingPanel);
filter.setVisible(true);
}
}

private void doMakeMappings() {
Expand Down
5 changes: 2 additions & 3 deletions whiterabbit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>leporidae</artifactId>
<groupId>org.ohdsi</groupId>
<version>0.10.1</version>
<version>0.10.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -24,8 +24,7 @@
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<assembleDirectory>${project.parent.basedir}/dist</assembleDirectory>
<!-- <extraJvmArguments>-Xmx1200m</extraJvmArguments> -->
<extraJvmArguments>-Xmx2400m</extraJvmArguments>
<extraJvmArguments>-Xmx1200m</extraJvmArguments>
<programs>
<program>
<mainClass>org.ohdsi.whiteRabbit.WhiteRabbitMain</mainClass>
Expand Down

0 comments on commit ac7cefc

Please sign in to comment.