This repository contains the source code for the main (OpenSeizureDetector)[https://www.openseizuredetector.org.uk/] Android App, which is published on (Google Play Store)[https://play.google.com/store/apps/details?id=uk.org.openseizuredetector].
This seizure detector uses a Garmin smart watch to collect movement (acceleration) and heart rate data which is used to detect tonic-clonic epileptic seizures.
See (the OpenSeizureDetector Web Site)[https://www.openseizuredetector.org.uk/] for more details.
It is based on an accelerometer monitoring movement. It uses a fourier transform to extract the frequency spectrum of the movement, and monitors movements in a given frequency band. The idea is that it will detect the rhythmic movements associated with a seizure, but not normal day to day activities.
If the acceleration within the given frequency band is more than a threshold value, it starts a timer. If the acceleration remains above the threshold for a given period, it issues a warning beep. If it remains above the threshold for a longer specified period, the unit alarms (continuous tone rather than beep).
- The version which is currently published on Play Store is the 'master' branch.
- The development version which will be the next major release is the Beta branch - this is released on play store for beta testers.
- The current working development version is the Alpha branch - this is released on play store for alpha testers.
- The V5.x branch by user @aroonpro addresses deprecation warnings and a more modern coding style - this will become the development version once we have it working reliably.
So new developers wishing to implement features should create a fork of the Alpha branch and create a pull request agains that.
- Install the latest version of Android Studio
- Clone this repository and checkout the V4.2.x branch
- In android studio, open the folder containing the cloned repository
- Android Studio will take quite a long time downloading dependencies ('Gradle Sync')
- Select the Build->Make Project menu option - the code should compile, leading to a 'Build Successful' message.
- There will be lots of warnings about use of deprecated libraries etc!
- Android Studio may complain about the version of the Android Gradle Plug-in - Try Build->Clean Project; Build->Make Project
- If this does not work, let Android Studio upgrade the project to the newer version of Gradle - it usually works without problems now.
- You should be able to plug your phone into the computer running Android Studio and Android Studio will allow you to run the app on the phone (the drop down menu below the main menu bar lists available devices)
- If the phone does not appear, there are a few possibilities:
- Check the phone has Developer Mode enabled (there should be a Developer menu in the phone settings)
- Check that USB deugging is enabled in the developer menu on the phone.
- There may be a phone notification asking if you want to grant the computer access to the phone - select yes - if this has disappeared, try disconnecting then re-connecting the phone.
- On Linux you need to set a UDEV rule, and the user must be a member of the plugdev group (log out and back in again after changing the group membership to make sure it takes effect) (best check the Google documentation for how to do this rather than believe somethign I have written).
- The .apk file that is generated by 'make project' can be transferred to the phone, then the phone file browser should allow it to be installed (with warnings about installing apps from untrusted sources).
- If you have the official release from Play Store installed, it will refuse to install a development build - you have to uninstall the official version first.
Note that the Garmin watch app needs to be installed separately - see the (web site)[https://www.openseizuredetector.org.uk/?page_id=1128] for details.
- StartUpActivity is the entry point (This is the view that shows the checklist of things initialising, then exits)
- SdServer is started by StartUpActivity
- This creates an instance of SdDataSource for the particular data source in use (Garmin, BLE, Phone)
- SdDataSource collects data from the watch, and when a set of data is available, it calls the doAnalysis function to do the seizure detection.
- SdServer deals with raising the alarms based on the analysis results.
- SdServer also details with logging to the Data Sharing system.
- MainActivity provides a front end to view what is going on with SdServer
My code is licenced under the GNU Public Licence - for associated libraries please see Credits below.
The following libraries are used:
- (SYLT-FFT)[https://github.com/stg/SYLT-FFT] by D. Taylor.
- (NanoHTTPD)[https://github.com/NanoHttpd/nanohttpd]
- (jQuery)[http://jquery.org]
- (jBeep)[http://www.ultraduz.com.br]
- (Chartjs)[http://www.chartjs.org]
- (MPAndroidChart)[https://github.com/PhilJay/MPAndroidChart]
- (CurrentTimeService)[https://github.com/RideBeeline/android-bluetooth-current-time-service]
Logo based on "Star of life2" by Verdy p - Own work. Licensed under Public Domain via Wikimedia Commons.
Alarm Bell Icon by Pixel perfect from www.flaticon.com
Other icons crated using http://romannurik.github.io/AndroidAssetStudio.
Audio Alarm sounds from freesound https://freesound.org/people/coltonmanz/sounds/381382/, https://freesound.org/people/NoiseCollector/sounds/4270/, https://freesound.org/people/pistak23/sounds/271632/
Graham Jones, 03 December 2017. ([email protected])