Skip to content

Commit

Permalink
Merge pull request #286 from OHDSI/release-0.10.3
Browse files Browse the repository at this point in the history
Release 0.10.3
  • Loading branch information
Maxim Moinat authored Feb 19, 2021
2 parents 30e850a + c2d1c3d commit 172f8c3
Show file tree
Hide file tree
Showing 15 changed files with 1,475 additions and 450 deletions.
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.10.2</version>
<version>0.10.3</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.10.2</version>
<version>0.10.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand All @@ -28,6 +29,7 @@
public class ConceptsMap {

private Map<String, Map<String, List<Concept>>> conceptMap;
public String vocabularyVersion;

private ConceptsMap() {
this.conceptMap = new HashMap<>();
Expand All @@ -40,7 +42,9 @@ private ConceptsMap() {

private void load(String filename) throws IOException{
try (InputStream conceptStream = Database.class.getResourceAsStream(filename)) {
for (CSVRecord conceptRow : CSVFormat.RFC4180.withHeader().parse(new InputStreamReader(conceptStream))) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conceptStream));
vocabularyVersion = bufferedReader.readLine();
for (CSVRecord conceptRow : CSVFormat.RFC4180.withHeader().parse(bufferedReader)) {
String omopTableName = conceptRow.get("omop_cdm_table");
String omopFieldName = conceptRow.get("omop_cdm_field");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ public enum CDMVersion {
private List<Table> tables = new ArrayList<Table>();
private static final long serialVersionUID = -3912166654601191039L;
private String dbName = "";
private static String CONCEPT_ID_HINTS_FILE_NAME = "CDMConceptIDHints_v5.0_02-OCT-19.csv";
private static final String CONCEPT_ID_HINTS_FILE_NAME = "CDMConceptIDHints.csv";
public String conceptIdHintsVocabularyVersion;

public List<Table> getTables() {
return tables;
}

public Table getTableByName(String name) {
for (Table table : tables)
if (table.getName().toLowerCase().equals(name.toLowerCase()))
if (table.getName().equalsIgnoreCase(name))
return table;
return null;
}
Expand Down Expand Up @@ -91,7 +92,8 @@ public static Database generateModelFromCSV(InputStream stream, String dbName) {

Map<String, Table> nameToTable = new HashMap<>();
try {
ConceptsMap conceptsMap = new ConceptsMap(CONCEPT_ID_HINTS_FILE_NAME);
ConceptsMap conceptIdHintsMap = new ConceptsMap(CONCEPT_ID_HINTS_FILE_NAME);
database.conceptIdHintsVocabularyVersion = conceptIdHintsMap.vocabularyVersion;

for (CSVRecord row : CSVFormat.RFC4180.withHeader().parse(new InputStreamReader(stream))) {
String tableNameColumn;
Expand Down Expand Up @@ -128,7 +130,7 @@ public static Database generateModelFromCSV(InputStream stream, String dbName) {
field.setNullable(row.get(isNullableColumn).equals(nullableValue));
field.setType(row.get(dataTypeColumn));
field.setDescription(row.get(descriptionColumn));
field.setConceptIdHints(conceptsMap.get(table.getName(), field.getName()));
field.setConceptIdHints(conceptIdHintsMap.get(table.getName(), field.getName()));

table.getFields().add(field);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -871,5 +871,31 @@ public static boolean isDate(String string) {
}
return false;
}


public static int numericOptionToInt(String option) {
switch (option) {
case "100":
case "1 hundred":
return 100;
case "1,000":
case "1 thousand":
return 1000;
case "10,000":
case "10 thousand":
return 10000;
case "100,000":
case "100 thousand":
return 100000;
case "500,000":
case "500 thousand":
return 500000;
case "1,000,000":
case "1 million":
return 1000000;
case "all":
return -1;
default:
return 0;
}
}
}
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.10.2</version>
<version>0.10.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ public void initialise() {
table.getColumnModel().getColumn(2).setCellRenderer(rightRenderer);
}

String title = isTargetFieldPanel ? "Concept ID Hints" : "Value Counts";
String title = isTargetFieldPanel ?
"Concept ID Hints " + ObjectExchange.etl.getTargetDatabase().conceptIdHintsVocabularyVersion
: "Value Counts";
fieldListPanel.setBorder(BorderFactory.createTitledBorder(title));
add(fieldListPanel, BorderLayout.CENTER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@
import org.ohdsi.rabbitInAHat.dataModel.Database.CDMVersion;
import org.ohdsi.rabbitInAHat.dataModel.ETL;
import org.ohdsi.rabbitInAHat.dataModel.Field;
import org.ohdsi.rabbitInAHat.dataModel.MappableItem;
import org.ohdsi.rabbitInAHat.dataModel.StemTableFactory;
import org.ohdsi.rabbitInAHat.dataModel.Table;
import org.ohdsi.utilities.Version;
import org.ohdsi.utilities.collections.Pair;

/**
* This is the main class for the RabbitInAHat application
Expand Down
Loading

0 comments on commit 172f8c3

Please sign in to comment.