To simplify testing event 2 and 3 entries, participants may use the framework described here as an alternative to the Android framework used for scoring. Use the Android API framework to test your code on an Android phone or emulator; use the standalone Java development framework described on this page to test your code within a Java application.
A ChallengeEntry.java file can be used within either framework. When using this development framework, however, it is important to avoid using any Android libraries. If they are present in your ChallengeEntry.java, remove the lines
import android.util.Log;and
Log.e(DEBUGTAG,"Could not open data file.");These lines are optional when running your code within the Android API framework, so you may safely omit them and run the same code in both frameworks.
Download the standalone Java framework
Download these files:
The first of these files includes one of the 50-ECG batches (set-b-p9) and a sample ChallengeEntry.java file. We recommend downloading Set_allset.zip in order to test your entry using all 1000 training set A ECGs and all 500 test set B ECGs in a single batch, if you have at least 200 MB of available space.
Install the standalone Java framework in Eclipse
These instructions assume that you have already installed the popular open source Eclipse IDE and a compatible Java Runtime Environment (JRE), and that you will use them to develop and test your code.
Start Eclipse, then do the following steps, starting in Eclipse's main window:
- Select File → Import. The Import dialog will open.
- In the Import dialog, click on the triangle to the left of General to open a submenu. In the submenu, click on Existing Projects into Workspace, then click on Next >.
- Check Select archive file. A file selector dialog will open.
- Browse for the downloaded PhysioNet2011_Challenge_JavaApp.zip file, click on its name, then click OK to dismiss the file selector dialog. Click on Select All in the Import dialog.
- Press the Finish button on the bottom and this will create the Eclipse project named PhysioNet2011_Challenge_Java.
- In the Eclipse main window, click on Workbench near the upper right corner below the toolbar. (If it's not visible, go to Help → Welcome.) This should open several subwindows within the main window. The subwindow at top left should be Project Explorer, and it should show PhysioNet2011_Challenge_Java (you may have to scroll right in order to read this).
- Click on the triangle to the left of PhysioNet2011_Challenge_Java to open a submenu. The first item in the submenu should be src.
- Click on the triangle to the left of src to open another submenu. The third item should be org.physionet.challenge2011.
- Click on the triangle to the left of org.physionet.challenge2011 to open a list of Java source files.
- The first file in the list should be Challenge_Runner.java. Double-click on it to open it. After a few seconds, its contents should appear in the subwindow on the upper right.
- In this subwindow, find the line that begins
//Change root_dir to your project path
scrolling down if needed. Scroll to the right to read the rest of the comment. - The next line begins
String root_dir="
- Type into this string to erase the value shown, and change the value of
the root directory variable root_dir to match your project working
directory, following the example in the comment on the previous line.
Note: on Windows only, paths must be written in the form C:\\my_dir\\foo (i.e., using double backslashes), and data_dir and xml_dir must be redefined as \\res\\raw\\ and \\res\\xml\\ respectively in the two lines below the definition of root_dir.
- Save your change by right-clicking in the Challenge_Runner.java
subwindow and choosing Save from the popup menu.
Now install the supporting Jar files (kxml2 and xmlpull):
- In Eclipse's Project Explorer subwindow, right-click on PhysioNet2011_Challenge_Java and choose Properties from the drop-down menu. The Properties window will appear.
- Click on Java Build Path in the left-hand pane, and on the Libraries tab in the right-hand pane.
- Remove any broken links (marked with a red x) from the right-hand pane. (There will be two such links, to the kxml2 and xmlpull Jar files.) To remove a broken link, select it by clicking on it, then click Remove.
- Click on the Add External Jars button. The JAR Selection dialog will open.
- Select kxml2-min-2.3.0.jar and xmlpull_1_1_3_4c.jar (press the Ctrl key while clicking on the second jar file to add it to the selection), and click OK to dismiss the JAR Selection dialog.
- In the Properties dialog, click OK.
Test the framework
Installation is now complete. You can test it using the included sample ChallengeEntry.java and the included set of 50 ECGs in the workspace/PhysioNet2011_Challenge_Java/res/raw/ and workspace/PhysioNet2011_Challenge_Java/res/res/xml/ directories. To do so, right click on PhysioNet2011_Challenge_Java in Eclipse's Project Explorer subwindow, and select Run As → Java Application from the drop-down menu.
The output will appear in the lower right window. A log file will also be written to ECG_LOG_ecg_header_set-b_p9.txt in workspace/PhysioNet2011_Challenge_Java.
Test your code
- Replace workspace/PhysioNet2011_Challenge_Java/src/org/physionet/challenge2011/ChallengeEntry.java with your own version of ChallengeEntry.java.
- In Eclipse, go to Project → Clean, then select PhysioNet2011_Challenge_Java in the Clean dialog, and click OK.
- In the Project Explorer subwindow, right click on PhysioNet2011_Challenge_Java and click on Refresh in the drop-down menu.
- Right click on PhysioNet2011_Challenge_Java in Eclipse's Project Explorer subwindow, and select Run As → Java Application from the drop-down menu.
As above, the output will appear in the lower right window, and a log file will also be written to ECG_LOG_ecg_header_set-b_p9.txt in workspace/PhysioNet2011_Challenge_Java.
Test on all available ECGs
- Unzip Set-allset.zip.
- Replace the contents of the raw and xml directories within workspace/PhysioNet2011_Challenge_Java with the files unpacked in the previous step (these were unpacked into Set_allset/raw and Set_allset/xml respectively).
- In Eclipse's Project Explorer subwindow, select PhysioNet2011_Challenge_Java → src → org.physionet.challenge2011, and double-click on Challenge_Runner.java to open it.
- Find this line:
final int N=50;
and change it to:final int N=1500;
- Save your change (right-click and select Save).
- Right click on PhysioNet2011_Challenge_Java in Eclipse's Project Explorer subwindow, and select Run As → Java Application from the drop-down menu.
As above, the output will appear in the lower right window, and a log file will also be written to ECG_LOG_ecg_header_allset.txt in workspace/PhysioNet2011_Challenge_Java. Either this file, or the log file from the previous test, can be submitted together with your ChallengeEntry.java file as a sample of its output.