Skip to content

Commit

Permalink
Merge pull request #311 from thehyve/cdm-v5.4
Browse files Browse the repository at this point in the history
Add support for OMOP CDM v5.4
  • Loading branch information
Maxim Moinat authored Sep 28, 2021
2 parents 81cd8b8 + 0dbafba commit db893a7
Show file tree
Hide file tree
Showing 22 changed files with 503 additions and 1,164 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@ public class Database implements Serializable {

public enum CDMVersion {
CDMV4("CDMV4.csv")
, CDMV5("CDMV5.csv")
, CDMV501("CDMV5.0.1.csv")
, CDMV510("CDMV5.1.0.csv")
, CDMV520("CDMV5.2.0.csv")
, CDMV530("CDMV5.3.0.csv")
, CDMV531("CDMV5.3.1.csv")
, CDMV531_O("CDMV5.3.1_Oncology.csv")
, CDMV50("CDMV5.0.csv")
, CDMV51("CDMV5.1.csv")
, CDMV52("CDMV5.2.csv")
, CDMV53("CDMV5.3.csv")
, CDMV54("CDMV5.4.csv")
, CDMV60("CDMV6.0.csv")
, CDMV60_O("CDMV6.0_Oncology.csv")
;

private final String fileName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ public class RabbitInAHatMain implements ResizeListener {
public final static String ACTION_FILTER = "Filter";
public final static String ACTION_MAKE_MAPPING = "Make Mappings";
public final static String ACTION_REMOVE_MAPPING = "Remove Mappings";
public final static String ACTION_SET_TARGET_V4 = "CDM v4";
public final static String ACTION_SET_TARGET_V5 = "CDM v5.0.0";
public final static String ACTION_SET_TARGET_V501 = "CDM v5.0.1";
public final static String ACTION_SET_TARGET_V510 = "CDM v5.1.0";
public final static String ACTION_SET_TARGET_V520 = "CDM v5.2.0";
public final static String ACTION_SET_TARGET_V530 = "CDM v5.3.0";
public final static String ACTION_SET_TARGET_V531 = "CDM v5.3.1";
public final static String ACTION_SET_TARGET_V60 = "CDM v6.0";
public final static String ACTION_SET_TARGET_V60_O = "CDM v6.0 + Oncology";
public final static String ACTION_SET_TARGET_V4 = "CDM v4";
public final static String ACTION_SET_TARGET_V50 = "CDM v5.0";
public final static String ACTION_SET_TARGET_V51 = "CDM v5.1";
public final static String ACTION_SET_TARGET_V52 = "CDM v5.2";
public final static String ACTION_SET_TARGET_V53 = "CDM v5.3";
public final static String ACTION_SET_TARGET_V54 = "CDM v5.4";
public final static String ACTION_SET_TARGET_V60 = "CDM v6.0-beta";
public final static String ACTION_ADD_STEM_TABLE = "Add stem table";
public final static String ACTION_REMOVE_STEM_TABLE = "Remove stem table";
public final static String ACTION_SET_TARGET_CUSTOM = "Load Custom...";
Expand Down Expand Up @@ -144,7 +142,7 @@ public void windowClosing(WindowEvent e) {
frame.setJMenuBar(createMenuBar());

ETL etl = new ETL();
etl.setTargetDatabase(Database.generateCDMModel(CDMVersion.CDMV60));
etl.setTargetDatabase(Database.generateCDMModel(CDMVersion.CDMV54));

ObjectExchange.etl = etl;

Expand Down Expand Up @@ -248,20 +246,18 @@ private JMenuBar createMenuBar() {

Map<String, CDMVersion> cdmOptions = new LinkedHashMap<>();
cdmOptions.put(ACTION_SET_TARGET_V4, CDMVersion.CDMV4);
cdmOptions.put(ACTION_SET_TARGET_V5, CDMVersion.CDMV5);
cdmOptions.put(ACTION_SET_TARGET_V501, CDMVersion.CDMV501);
cdmOptions.put(ACTION_SET_TARGET_V510, CDMVersion.CDMV510);
cdmOptions.put(ACTION_SET_TARGET_V520, CDMVersion.CDMV520);
cdmOptions.put(ACTION_SET_TARGET_V530, CDMVersion.CDMV530);
cdmOptions.put(ACTION_SET_TARGET_V531, CDMVersion.CDMV531);
cdmOptions.put(ACTION_SET_TARGET_V50, CDMVersion.CDMV50);
cdmOptions.put(ACTION_SET_TARGET_V51, CDMVersion.CDMV51);
cdmOptions.put(ACTION_SET_TARGET_V52, CDMVersion.CDMV52);
cdmOptions.put(ACTION_SET_TARGET_V53, CDMVersion.CDMV53);
cdmOptions.put(ACTION_SET_TARGET_V54, CDMVersion.CDMV54);
cdmOptions.put(ACTION_SET_TARGET_V60, CDMVersion.CDMV60);
cdmOptions.put(ACTION_SET_TARGET_V60_O, CDMVersion.CDMV60_O);

JRadioButtonMenuItem targetCDM;
ButtonGroup targetGroup = new ButtonGroup();
for (String optionName : cdmOptions.keySet()) {
targetCDM = new JRadioButtonMenuItem(optionName);
if (optionName.equals(ACTION_SET_TARGET_V60)) {
if (optionName.equals(ACTION_SET_TARGET_V54)) {
targetCDM.setSelected(true);
}
targetGroup.add(targetCDM);
Expand Down Expand Up @@ -472,8 +468,13 @@ private void doSetTargetCustom(String filename) {
etl.copyETLMappings(ObjectExchange.etl);
tableMappingPanel.setMapping(etl.getTableToTableMapping());
ObjectExchange.etl = etl;
} catch (IOException e) {
// Do nothing if error
} catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(
null, e.getMessage(),
"Error loading custom target database",
JOptionPane.ERROR_MESSAGE
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,22 @@ public static void addStemTable(ETL etl) {
Database targetDatabase = etl.getTargetDatabase();
InputStream tableStream;
InputStream mappingStream;
if (targetDatabase.getDbName().toLowerCase().equals("cdmv5.0.1")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.0.1.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.0.1.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv5.1.0")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.1.0.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.1.0.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv5.2.0")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.2.0.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.2.0.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv5.3.0")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.3.0.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.3.0.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv5.3.1")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.3.1.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.3.1.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv5.3.1_oncology")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.3.1.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.3.1.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv6.0")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV6.0.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV6.0.csv");
} else if (targetDatabase.getDbName().toLowerCase().equals("cdmv6.0_oncology")) {
if (targetDatabase.getDbName().equalsIgnoreCase("cdmv5.0")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.0.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.0.csv");
} else if (targetDatabase.getDbName().equalsIgnoreCase("cdmv5.1")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.1.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.1.csv");
} else if (targetDatabase.getDbName().equalsIgnoreCase("cdmv5.2")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.2.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.2.csv");
} else if (targetDatabase.getDbName().equalsIgnoreCase("cdmv5.3")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.3.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.3.csv");
} else if (targetDatabase.getDbName().equalsIgnoreCase("cdmv5.4")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV5.4.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV5.4.csv");
} else if (targetDatabase.getDbName().equalsIgnoreCase("cdmv6.0")) {
tableStream = StemTableFactory.class.getResourceAsStream("StemTableV6.0.csv");
mappingStream = StemTableFactory.class.getResourceAsStream("StemTableDefaultMappingV6.0.csv");
} else {
Expand Down
Loading

0 comments on commit db893a7

Please sign in to comment.