Skip to content

Commit

Permalink
Merge branch 'sas-labels'
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Moinat committed Jan 16, 2020
2 parents 18e6a3c + 296e57a commit b387479
Show file tree
Hide file tree
Showing 14 changed files with 562 additions and 301 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ dist/
/Error.txt
/.gitignore
/Error1.txt
/ScanReport.xlsx
/.classpath
target/
*.iml
.idea/

/ScanReport.xlsx
*ScanReport*
*swp
tmp/*
Try*
/examples/
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
![alt text](https://github.com/OHDSI/WhiteRabbit/blob/master/whiterabbit/src/main/resources/org/ohdsi/whiteRabbit/WhiteRabbit64.png) WhiteRabbit
![WR logo](https://github.com/OHDSI/WhiteRabbit/blob/master/whiterabbit/src/main/resources/org/ohdsi/whiteRabbit/WhiteRabbit64.png) White Rabbit
===========

![RiaH logo](https://github.com/OHDSI/WhiteRabbit/blob/master/rabbitinahat/src/main/resources/org/ohdsi/rabbitInAHat/RabbitInAHat64.png) Rabbit in a Hat
===========

Introduction
========
WhiteRabbit is a small application that can be used to analyse the structure and contents of a database as preparation for designing an ETL. It comes with RabbitInAHat, an application for interactive design of an ETL to the OMOP Common Data Model with the help of the the scan report generated by White Rabbit.
**WhiteRabbit** is a small application that can be used to analyse the structure and contents of a database as preparation for designing an ETL. It comes with **RabbitInAHat**, an application for interactive design of an ETL to the OMOP Common Data Model with the help of the the scan report generated by White Rabbit.

Features
========
- Can scan databases in SQL Server, Oracle, PostgreSQL, MySQL, MS Access, Amazon RedShift, and CSV files
- Can scan databases in SQL Server, Oracle, PostgreSQL, MySQL, MS Access, Amazon RedShift, Google BigQuery, SAS files and CSV files
- The scan report contains information on tables, fields, and frequency distributions of values
- Cutoff on the minimum frequency of values to protect patient privacy
- WhiteRabbit can be run with a graphical user interface or from the command prompt
Expand Down Expand Up @@ -58,6 +61,20 @@ Rabbit-In-A-Hat

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

Example in- and output
========
The file `examples.zip` contains a set of input and output examples for White Rabbit and Rabbit in a Hat.
These are used for testing of the main White Rabbit and Rabbit in a Hat features. An overview is given in below table.

| Folder | Description |
|:---------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `wr_input_csv` | csv files to test scanning on different data types and long table names. |
| `wr_input_sas` | sas7bdat files to test sas input |
| `wr_output` | Scan reports created from files in `wr_input_csv`, `wr_input_sas` and [native a Synthea database loaded in Postgres](https://github.com/ohdsi/ETL-Synthea). All with default scan options.<br> This folder also includes fake data generated from the csv scan report. The csv scan report is used to test the opening a Scan Report in Rabbit in a Hat. |
| `riah_input` | An example mapping file used to create the Rabbit in a Hat outputs. |
| `riah_output` | All export formats created by Rabbit in a Hat: as word, html, markdown, sql skeleton and the R TestFramework.<br> These are all generated from `riah_input/riah_mapping_example.gz`. |


Getting Involved
=============
* User guide and Help: <a href="http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:whiterabbit">WhiteRabbit Wiki</a>
Expand Down
Binary file added examples.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion iniFileExamples/WhiteRabbit.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
WORKING_FOLDER = /users/joe # Path to the folder where all output will be written
# Usage: dist/bin/whiteRabbit -ini <ini_file_path>
WORKING_FOLDER = /users/joe # Path to the folder where all output will be written
DATA_TYPE = PostgreSQL # "Delimited text files", "MySQL", "Oracle", "SQL Server", "PostgreSQL", "MS Access", or "Redshift"
SERVER_LOCATION = 127.0.0.1/data_base_name # Name or address of the server. For Postgres, add the database name
USER_NAME = joe # User name for the database
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.8.0-SNAPSHOT</version>
<version>0.9.0</version>
<modules>
<module>rabbitinahat</module>
<module>whiterabbit</module>
Expand Down
2 changes: 1 addition & 1 deletion 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.8.0-SNAPSHOT</version>
<version>0.9.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public static Database generateModelFromCSV(InputStream stream, String dbName) {
dataTypeColumn = "type";
descriptionColumn = "description";
}
System.out.println(row.toString());
Table table = nameToTable.get(row.get(tableNameColumn).toLowerCase());

if (table == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public Table(Table table) {
db = table.db;
name = table.name;
rowCount = table.rowCount;
rowsCheckedCount = table.rowsCheckedCount;
comment = table.comment;
fields = new ArrayList<Field>(table.fields);
isStem = table.isStem;
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.8.0-SNAPSHOT</version>
<version>0.9.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ void generate(String fileName, DocumentType documentType) {
}

for (Table targetTable : etl.getTargetDatabase().getTables()) {
if (addTargetTableSection(targetTable)) {
boolean targetTableHasMapping = addTargetTableSection(targetTable);

if (targetTableHasMapping) {
document.write(targetTable.getName());
targetTablesWritten.add(targetTable.getName());
} else {
document.reset();
};
}

Expand Down Expand Up @@ -214,6 +218,8 @@ private interface MarkupDocument {
void addTable(List<Row> rows);

void write(String targetName);

void reset();
}

private static class MarkdownDocument implements MarkupDocument {
Expand Down Expand Up @@ -287,8 +293,11 @@ public void write(String targetName) {
} catch (IOException e) {
e.printStackTrace();
}
this.reset();
}

// Reset
@Override
public void reset() {
lines = new ArrayList<>();
}

Expand Down Expand Up @@ -390,7 +399,11 @@ public void write(String targetName) {
e.printStackTrace();
}

// Reset
this.reset();
}

@Override
public void reset() {
lines = new ArrayList<>();
}

Expand Down
Loading

0 comments on commit b387479

Please sign in to comment.