-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for #411 (can't process custom models with UTF8 BOM in csv file)
- Loading branch information
Showing
7 changed files
with
5,249 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
rabbit-core/src/test/java/org/ohdsi/rabbitInAHat/dataModel/TestDatabase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.ohdsi.rabbitInAHat.dataModel; | ||
|
||
import org.apache.commons.io.input.BOMInputStream; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class TestDatabase { | ||
|
||
@Test | ||
void testGenerateModelFromCSV() throws IOException { | ||
// confirm that issue #411 is fixed, can read custom models from (UTF-8) CSV files with and without BOM | ||
|
||
// generate a model from a CSV file without BOM | ||
String testFileWithoutBom = "tiny_riah_without_bom.csv"; | ||
InputStream inWithoutBom = TestDatabase.class.getResourceAsStream(testFileWithoutBom); | ||
assertNotNull(inWithoutBom); | ||
Database ignoredWithoutBom = Database.generateModelFromCSV(inWithoutBom, testFileWithoutBom); | ||
|
||
// generate a model from a CSV file with BOM | ||
String testFileWithBom = "tiny_riah_with_bom.csv"; | ||
InputStream inWithBom = TestDatabase.class.getResourceAsStream(testFileWithBom); | ||
assertNotNull(inWithBom); | ||
Database ignoredWithBom = Database.generateModelFromCSV(inWithBom, testFileWithBom); | ||
|
||
} | ||
} |
4,815 changes: 4,815 additions & 0 deletions
4,815
rabbit-core/src/test/resources/org/ohdsi/rabbitInAHat/dataModel/CDMConceptIDHints.csv
Large diffs are not rendered by default.
Oops, something went wrong.
384 changes: 384 additions & 0 deletions
384
rabbit-core/src/test/resources/org/ohdsi/rabbitInAHat/dataModel/CDMV5.4.csv
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
rabbit-core/src/test/resources/org/ohdsi/rabbitInAHat/dataModel/tiny_riah_with_bom.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
table,field,required,type,description,schema | ||
PERSON,person_id,Yes,Integer,PK; Patient ID,cdm |
2 changes: 2 additions & 0 deletions
2
rabbit-core/src/test/resources/org/ohdsi/rabbitInAHat/dataModel/tiny_riah_without_bom.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
table,field,required,type,description,schema | ||
PERSON,person_id,Yes,Integer,PK; Patient ID,cdm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters