Skip to content

Commit

Permalink
Merge pull request #75 from OHDSI/index-build-warnings
Browse files Browse the repository at this point in the history
Index build warnings
  • Loading branch information
Maxim Moinat authored May 14, 2020
2 parents 0bdfba3 + b335427 commit e8932b0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 26 deletions.
13 changes: 6 additions & 7 deletions src/org/ohdsi/usagi/ui/RebuildIndexDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ public RebuildIndexDialog() {
private void buildIndex() {
String vocabFolder = vocabFolderField.getText();
String loincFile = loincFileField.getText();
if (!(new File(vocabFolder + "/CONCEPT.csv").exists())) {
JOptionPane.showMessageDialog(this, "Vocabulary file CONCEPT.csv not found", "Cannot build index", JOptionPane.ERROR_MESSAGE);
return;
}
if (!(new File(vocabFolder + "/CONCEPT_SYNONYM.csv").exists())) {
JOptionPane.showMessageDialog(this, "Vocabulary file CONCEPT_SYNONYM.csv not found", "Cannot build index", JOptionPane.ERROR_MESSAGE);
return;
String[] requiredVocabularyFiles = {"/CONCEPT.csv", "/CONCEPT_SYNONYM.csv", "/VOCABULARY.csv", "/CONCEPT_RELATIONSHIP.csv"};
for (String vocabFileName : requiredVocabularyFiles) {
if (!(new File(vocabFolder + vocabFileName).exists())) {
JOptionPane.showMessageDialog(this, "Vocabulary file " + vocabFileName + " not found", "Cannot build index", JOptionPane.ERROR_MESSAGE);
return;
}
}
if (loincCheckBox.isSelected() && !(new File(loincFile).exists())) {
JOptionPane.showMessageDialog(this, "LOINC file loinc.csv not found", "Cannot build index", JOptionPane.ERROR_MESSAGE);
Expand Down
8 changes: 1 addition & 7 deletions src/org/ohdsi/usagi/ui/ShowStatsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public class ShowStatsDialog extends JDialog {
private static final long serialVersionUID = 2028328868610404663L;

public ShowStatsDialog() {
String versionFileName = Global.folder + "/vocabularyVersion.txt";
String version = "Unknown";
if (new File(versionFileName).exists()) {
for (String line : new ReadTextFile(versionFileName))
version = line;
}
int termCount = Global.usagiSearchEngine.getTermCount();
BerkeleyDbStats berkeleyDbStats = Global.dbEngine.getStats();
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
Expand All @@ -62,7 +56,7 @@ public ShowStatsDialog() {

g.gridx = 1;
g.gridy = 0;
add(new JLabel(version), g);
add(new JLabel(Global.vocabularyVersion), g);

g.gridx = 0;
g.gridy = 1;
Expand Down
10 changes: 6 additions & 4 deletions src/org/ohdsi/usagi/ui/UsagiMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ public UsagiMain(String[] args) {

// Initialize global variables:
Global.mapping = new Mapping();
Global.folder = new File("").getAbsolutePath();
if (args.length == 1) {
Global.folder = args[0];
} else {
Global.folder = new File("").getAbsolutePath();
}
Global.usagiSearchEngine = new UsagiSearchEngine(Global.folder);
Global.dbEngine = new BerkeleyDbEngine(Global.folder);
if (Global.usagiSearchEngine.mainIndexExists()) {
Expand Down Expand Up @@ -121,9 +125,7 @@ public void windowClosing(WindowEvent e) {
if (!Global.usagiSearchEngine.mainIndexExists())
Global.rebuildIndexAction.actionPerformed(null);

if (args.length == 1) {
Global.folder = args[0];
} else if (args.length > 1 && args[0].equals("--file")) {
if (args.length > 1 && args[0].equals("--file")) {
OpenAction.open(new File(args[1]));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/ohdsi/usagi/ui/actions/AboutAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AboutAction extends AbstractAction {
public AboutAction() {
putValue(Action.NAME, "About Usagi");
putValue(Action.SHORT_DESCRIPTION, "About Usagi");
putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A));
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/org/ohdsi/usagi/ui/actions/ApproveAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ApproveAction extends AbstractAction {
public ApproveAction() {
putValue(Action.NAME, "Approve");
putValue(Action.SHORT_DESCRIPTION, "Approve the selected single mapping");
putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A));
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_A);
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ConceptInformationAction extends AbstractAction {
public ConceptInformationAction() {
putValue(Action.NAME, "Concept information");
putValue(Action.SHORT_DESCRIPTION, "Show additional concept information");
putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_C));
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_C);
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK));
}

Expand Down
2 changes: 1 addition & 1 deletion src/org/ohdsi/usagi/ui/actions/RebuildIndexAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RebuildIndexAction extends AbstractAction {
public RebuildIndexAction() {
putValue(Action.NAME, "Rebuild index");
putValue(Action.SHORT_DESCRIPTION, "Rebuild the index from the vocabulary data files");
putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_R));
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_R);
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/org/ohdsi/usagi/ui/actions/ShowStatsAction.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright 2019 Observational Health Data Sciences and Informatics
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -31,7 +31,7 @@ public class ShowStatsAction extends AbstractAction {
public ShowStatsAction() {
putValue(Action.NAME, "Show index statistics");
putValue(Action.SHORT_DESCRIPTION, "Show index stats");
putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
putValue(Action.MNEMONIC_KEY, KeyEvent.VK_S);
}

@Override
Expand Down

0 comments on commit e8932b0

Please sign in to comment.