Skip to content

Commit

Permalink
Merge pull request #79 from OHDSI/release-1.3.0
Browse files Browse the repository at this point in the history
Release 1.3.0
  • Loading branch information
Maxim Moinat authored Jun 24, 2020
2 parents 988feea + 934aac9 commit 7f0fb49
Show file tree
Hide file tree
Showing 37 changed files with 746 additions and 405 deletions.
101 changes: 101 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
/bin
build/
dist/

### Usagi index files ###
derivedIndex/
mainIndex/
sleepyCat/
ConceptClassIds.txt
DomainIds.txt
VocabularyIds.txt
vocabularyVersion.txt

### Intellij ###
# Created by https://www.gitignore.io/api/intellij
# Edit at https://www.gitignore.io/?templates=intellij
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/**/sonarlint/

# SonarQube Plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator/

# End of https://www.gitignore.io/api/intellij
14 changes: 14 additions & 0 deletions Usagi.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="library" name="R User Library" level="project" />
<orderEntry type="library" name="R Skeletons" level="application" />
</component>
</module>
11 changes: 7 additions & 4 deletions src/org/ohdsi/usagi/ReadCodeMappingsFromFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ public class RowIterator implements Iterator<CodeMapping> {

public RowIterator() {
iterator = new ReadCSVFileWithHeader(filename).iterator();

if (iterator.hasNext()) {
row = iterator.next();
readNext();
} else
} else {
buffer = null;
}
}

private void readNext() {
if (row == null)
if (row == null) {
buffer = null;
else {
} else {
buffer = new CodeMapping(new SourceCode(row));
buffer.matchScore = row.getDouble("matchScore");
buffer.mappingStatus = MappingStatus.valueOf(row.get("mappingStatus"));
Expand All @@ -66,7 +68,8 @@ && new SourceCode(row).sourceName.equals(buffer.sourceCode.sourceName)) {
if (row.getInt("conceptId") != 0) {
Concept concept = Global.dbEngine.getConcept(row.getInt("conceptId"));
if (concept == null) {
buffer.mappingStatus = CodeMapping.MappingStatus.INVALID_TARGET;
buffer.mappingStatus = MappingStatus.INVALID_TARGET;
buffer.comment = "Invalid existing target: " + row.get("conceptId");
} else {
buffer.targetConcepts.add(concept);
}
Expand Down
32 changes: 12 additions & 20 deletions src/org/ohdsi/usagi/ui/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@
public class AboutDialog extends JDialog {

private static final long serialVersionUID = 2028328868610404663L;
private JEditorPane text;

public AboutDialog() {
setTitle("About Usagi");
setTitle("About Usagi v" + UsagiMain.version);
setLayout(new GridBagLayout());

GridBagConstraints g = new GridBagConstraints();
Expand All @@ -60,29 +59,22 @@ public AboutDialog() {
g.gridx = 1;
g.gridy = 0;

text = new JEditorPane(
JEditorPane text = new JEditorPane(
"text/html",
"Usagi was developed by Martijn Schuemie in <a href=\"http://ohdsi.org\">Observational Health Data Sciences and Informatics</a> (OHDSI).<br/><br/>For help, please review the <a href =\"http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:usagi\">Usagi Wiki</a>.");
"Usagi is maintained by The Hyve (www.thehyve.nl), and originally developed by Martijn Schuemie" +
"<br/>in <a href=\"http://ohdsi.org\">Observational Health Data Sciences and Informatics</a> (OHDSI)." +
"<br/><br/>For help, please review the <a href =\"http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:usagi\">Usagi Wiki</a>.");

text.setEditable(false);
text.setOpaque(false);

text.addHyperlinkListener(new HyperlinkListener() {

public void hyperlinkUpdate(HyperlinkEvent hle) {
if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
try {
// jep.setPage(hle.getURL());
try {
Desktop desktop = Desktop.getDesktop();
desktop.browse(new URI(hle.getURL().toString()));
} catch (URISyntaxException ex) {

}
} catch (IOException ex) {

}

text.addHyperlinkListener(event -> {
if (HyperlinkEvent.EventType.ACTIVATED.equals(event.getEventType())) {
try {
Desktop desktop = Desktop.getDesktop();
desktop.browse(new URI(event.getURL().toString()));
} catch (URISyntaxException | IOException ex) {
// url could not be opened
}
}
});
Expand Down
4 changes: 3 additions & 1 deletion src/org/ohdsi/usagi/ui/CodeSelectedListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
import org.ohdsi.usagi.CodeMapping;

public interface CodeSelectedListener {
public void codeSelected(CodeMapping codeMapping);
void codeSelected(CodeMapping codeMapping);
void addCodeMultiSelected(CodeMapping codeMapping);
void clearCodeMultiSelected();
}
2 changes: 1 addition & 1 deletion src/org/ohdsi/usagi/ui/ConceptTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public Class<?> getColumnClass(int col) {
}

public boolean isCellEditable(int row, int col) {
return true;
return false;
}

public void setValueAt(Object value, int row, int col) {
Expand Down
19 changes: 19 additions & 0 deletions src/org/ohdsi/usagi/ui/DataChangeEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.ohdsi.usagi.ui;

public enum DataChangeEvent {

APPROVE_EVENT (true, false, false),
SIMPLE_UPDATE_EVENT (false, false, false),
MULTI_UPDATE_EVENT (false, false, true),
RESTRUCTURE_EVENT (false, true, false);

public boolean approved;
public boolean structureChange;
public boolean multiUpdate;

DataChangeEvent(boolean approved, boolean structureChange, boolean multiUpdate) {
this.approved = approved;
this.structureChange = structureChange;
this.multiUpdate = multiUpdate;
}
}
17 changes: 1 addition & 16 deletions src/org/ohdsi/usagi/ui/DataChangeListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,5 @@
package org.ohdsi.usagi.ui;

public interface DataChangeListener {

public static DataChangeEvent APPROVE_EVENT = new DataChangeEvent(true, false);
public static DataChangeEvent SIMPLE_UPDATE_EVENT = new DataChangeEvent(false, false);
public static DataChangeEvent RESTRUCTURE_EVENT = new DataChangeEvent(false, true);

public void dataChanged(DataChangeEvent event);

public static class DataChangeEvent {
public DataChangeEvent(boolean approved, boolean structureChange) {
this.approved = approved;
this.structureChange = structureChange;
}

public boolean approved = false;
public boolean structureChange = false;
}
void dataChanged(DataChangeEvent event);
}
26 changes: 10 additions & 16 deletions src/org/ohdsi/usagi/ui/ExportSourceToConceptMapDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class ExportSourceToConceptMapDialog extends JDialog {

private JTextField sourceVocabularyIdField;
private static final long serialVersionUID = -6846083121849826818L;
private boolean exportUnapproved = false;

public ExportSourceToConceptMapDialog() {
setTitle("Export to source_to_concept_map");
Expand Down Expand Up @@ -73,23 +74,11 @@ public ExportSourceToConceptMapDialog() {
buttonPanel.add(Box.createHorizontalGlue());
JButton cancelButton = new JButton("Cancel");
cancelButton.setToolTipText("Cancel the export");
cancelButton.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent arg0) {
setVisible(false);
}
});
cancelButton.addActionListener(event -> setVisible(false));
buttonPanel.add(cancelButton);
JButton exportButton = new JButton("Export");
exportButton.setToolTipText("Select the filename and export using these settings");
exportButton.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent arg0) {
export();
}
});
exportButton.addActionListener(event -> export());
buttonPanel.add(exportButton);
add(buttonPanel, g);

Expand All @@ -98,13 +87,18 @@ public void actionPerformed(ActionEvent arg0) {
setLocationRelativeTo(Global.frame);
}

public void setExportUnapproved(boolean exportUnapproved) {
this.exportUnapproved = exportUnapproved;
}

private void export() {
JFileChooser fileChooser = new JFileChooser(Global.folder);
FileFilter csvFilter = new FileNameExtensionFilter("CSV files", "csv");
fileChooser.setFileFilter(csvFilter);
fileChooser.setDialogTitle("Export");
if (fileChooser.showSaveDialog(Global.frame) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
Global.folder = file.getParentFile().getAbsolutePath();
if (!file.getName().toLowerCase().endsWith(".csv"))
file = new File(file.getAbsolutePath() + ".csv");

Expand All @@ -116,7 +110,7 @@ private void export() {
private void writeToCsvFile(String filename) {
WriteCSVFileWithHeader out = new WriteCSVFileWithHeader(filename);
for (CodeMapping mapping : Global.mapping)
if (mapping.mappingStatus == MappingStatus.APPROVED) {
if (exportUnapproved || mapping.mappingStatus == MappingStatus.APPROVED) {
List<Concept> targetConcepts;
if (mapping.targetConcepts.size() == 0) {
targetConcepts = new ArrayList<Concept>(1);
Expand All @@ -131,7 +125,7 @@ private void writeToCsvFile(String filename) {
row.add("source_vocabulary_id", sourceVocabularyIdField.getText());
row.add("source_code_description", mapping.sourceCode.sourceName);
row.add("target_concept_id", targetConcept.conceptId);
row.add("target_vocabulary_id", targetConcept.vocabularyId);
row.add("target_vocabulary_id", targetConcept.conceptId == 0 ? "None" : targetConcept.vocabularyId );
row.add("valid_start_date", "1970-01-01");
row.add("valid_end_date", "2099-12-31");
row.add("invalid_reason", "");
Expand Down
Loading

0 comments on commit 7f0fb49

Please sign in to comment.