Skip to content

Commit

Permalink
Update to jar to handle multiple input files
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom authored and Tom committed Apr 2, 2019
1 parent 38701d2 commit 2e3801c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
Binary file modified EntityGenerator.jar
Binary file not shown.
47 changes: 26 additions & 21 deletions src/etl/job/jobtype/CSVToI2b2TM.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ public void runJob(JobProperties jobProperties) {
} catch (Exception e) {
logger.error("Error building patients");
logger.error(e);
e.printStackTrace();
}

logger.info("generating tables");
Expand All @@ -355,6 +356,7 @@ public void runJob(JobProperties jobProperties) {
} catch (Exception e) {
logger.error("Error Processing data files");
logger.error(e);
e.printStackTrace();
}

logger.info("Filling in Tree");
Expand Down Expand Up @@ -1205,30 +1207,33 @@ private List<Entity> processEntities(List<Mapping> mappings, Map record) throws
}
}
}
if(values == null) throw new Exception("Following Mapping does not exist in the datafile: \n"
+ mapping.toCSV() + "\n" +
" be sure that the column and file exist.");

if(relationalValue == null) throw new Exception("Following Mapping does not exist in the datafile: \n"
+ mapping.toCSV() + "\n" +
" be sure that the column and file exist.");

Set<Entity> newEnts = new HashSet<Entity>();

if(values.isEmpty()) {
if(INCLUDE_EMPTY_VALUES == true) {
String mappingK = mapping.getKey().split(":")[0];
String recordK = record.keySet().iterator().next().toString().split(":")[0];
if(mappingK.equals(recordK)) {
if(values == null) throw new Exception("Following Mapping does not exist in the datafile: \n"
+ mapping.toCSV() + "\n" +
" be sure that the column and file exist.");

if(relationalValue == null) throw new Exception("Following Mapping does not exist in the datafile: \n"
+ mapping.toCSV() + "\n" +
" be sure that the column and file exist.");

Set<Entity> newEnts = new HashSet<Entity>();

if(values.isEmpty()) {
if(INCLUDE_EMPTY_VALUES == true) {
newEnts = dt.generateTables(mapping, entities, values, relationalValue);
}
} else {
newEnts = dt.generateTables(mapping, entities, values, relationalValue);
}
} else {
newEnts = dt.generateTables(mapping, entities, values, relationalValue);
}

if(newEnts != null && newEnts.size() > 0){

builtEnts.addAll(newEnts);


if(newEnts != null && newEnts.size() > 0){

builtEnts.addAll(newEnts);

}
}

}

}
Expand Down

0 comments on commit 2e3801c

Please sign in to comment.