Skip to content

Commit

Permalink
Now using CDM v5.0 in Rabbit In A Hat
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Oct 14, 2014
1 parent 73381bf commit 9be027e
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 158 deletions.
17 changes: 14 additions & 3 deletions src/org/ohdsi/rabbitInAHat/FetchCDMModelFromServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,27 @@
import org.ohdsi.utilities.files.Row;
import org.ohdsi.utilities.files.WriteCSVFileWithHeader;

/**
* This class is used as a stand-alone to fetch the structure of the CDM from the server and format it for insertion into Rabbit-In-A-Hat.
* It is not intended to be used by non-developers.
* @author MSCHUEMI
*
*/
public class FetchCDMModelFromServer {

public static void main(String[] args) {
RichConnection connection = new RichConnection("127.0.0.1/ohdsi", null, "postgres", "F1r3starter", DbType.POSTGRESQL);
connection.use("cdm5");

WriteCSVFileWithHeader out = new WriteCSVFileWithHeader("c:/temp/CDMV5Model.csv");
String query = "SELECT table_name,COLUMN_NAME,IS_NULLABLE,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'cdm5';";
for (Row row : connection.query(query))
out.write(row);
String query = "SELECT table_name,column_name,is_nullable,data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'cdm5';";
for (Row row : connection.query(query)){
row.upperCaseFieldNames();
Row newRow = new Row();
for (String field : row.getFieldNames())
newRow.add(field, row.get(field).toUpperCase());
out.write(newRow);
}
out.close();

}
Expand Down
12 changes: 6 additions & 6 deletions src/org/ohdsi/rabbitInAHat/RabbitInAHat.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ private JMenuBar createMenuBar() {
generateDocItem.setActionCommand("Generate ETL document");
fileMenu.add(generateDocItem);

JMenu editMenu = new JMenu("Edit");
menuBar.add(editMenu);
// JMenu editMenu = new JMenu("Edit");
// menuBar.add(editMenu);

JMenu viewMenu = new JMenu("View");
menuBar.add(viewMenu);
// JMenu viewMenu = new JMenu("View");
// menuBar.add(viewMenu);

JMenu helpMenu = new JMenu("Help");
menuBar.add(helpMenu);
// JMenu helpMenu = new JMenu("Help");
// menuBar.add(helpMenu);
return menuBar;
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/ohdsi/rabbitInAHat/dataModel/CDMV4Model.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TABLE_NAME,COLUMN_NAME,IS_NULLABLE,COLUMN_TYPE
TABLE_NAME,COLUMN_NAME,IS_NULLABLE,DATA_TYPE
location,LOCATION_ID,NO,int(11)
location,ADDRESS_1,YES,varchar(50)
location,ADDRESS_2,YES,varchar(50)
Expand Down
Loading

0 comments on commit 9be027e

Please sign in to comment.