Given the rapid adoption of smartphones, mobile healthcare is an area which deals with acquiring, transporting, storing, processing and securing data from sensors or the phone to improve the health of a user. This project aims to investigate the relationship between room temperature and human sleeping quality by developing a mobile healthcare system to improve sleeping quality based on the current body and room temperature of the user. Sleepify utilizes advanced machine learning techniques to classify the user’s sleep quality; this data is then fed to HomeKit compatible devices to control the heating of the user during their sleep. Both an app and web interface are offered. Initial testing and evaluation show positive feedback.
- Clone the github repository using
git clone https://github.com/jeremych1000/ee4-mhml
- Download the Sleepify App from <not available at the moment on the app store> or compile it yourself.
- OPTIONAL: Create a user account using
http://sleepify.zapto.org/accounts/signup/
This can be done later using the mobile app too.
All API links should be pre-pended with http://sleepify.zapto.org/api/
. POST requests should have a CSRF token in the header/cookies to prevent Cross Site Request Forgery.
Link | Available Methods | Description | Notes |
---|---|---|---|
/csrf/ | GET | Returns a CSRF token in the cookies for use when POSTing. | |
/auth/registration/ | POST | Register a new user. |
|
/auth/login/ | POST | Login a user. |
|
/auth/logout/ | POST | Logout a user. | |
/auth/password/reset/ | POST | Reset a forgotten password. | |
/auth/user/ | GET, PUT, PATCH | Edit user details. |
|
/raw_data/ | POST | Send raw sensor data to the database. |
|
/stats/last/<number_of_days> /feature / |
GET | Returns a JSON object of the logged in user's raw data for the past X days. | |
/stats/last/<number_of_days> /feature /graph/ |
GET | Returns a 640x480 graph plotted by matplotlib | |
/stats/from/<timestamp> /to/<timestamp> /feature / |
GET | Returns a JSON object of the logged in user's raw data from timestamp to timestamp. | |
/make_default/ | GET | Make a default user model. | For development. |
/migrate_feature/ | GET | Put raw data in CSV files to database. | For development. |
/get_cal_events/ | GET | Get a list of calendar events for the logged in user for the next day. | |
/import_cal_events/ | GET | Import the logged in user's calendar into the database. | Calling this URL will update the database, deleting all previous entries of the user's events. |
/dummy/ | POST | Show whatever you have sent in the POST request. | For debugging purposes. |
You are welcome to clone the repository and develop Sleepify yourself. Please give credit where credit is due.
Sleepify runs at the following URL: http://sleepify.zapto.org
. However, this is dependent on the host. If you want to develop Sleepify locally, or run Sleepify using your own web server, follow these instructions.
- Assuming you already have cloned the repository, install the required libraries using
Windows
ee4-mhml/software/web_interface/get_pip_stuff.cmd
UNIX
ee4-mhml/software/web_interface/get_pip_stuff.sh
- Decide on a port to run the webserver on, and forward that port to your hosting server/PC. Detailed instructions depending on your router can be found here.
HTTP server default: 80
Django development server default: 8000
- Setup the Django databases using
python manage.py makemigrations; python manage.py migrate
- Run the webserver with the following command:
python manage.py runserver 0.0.0.0:80
and verify that the server is running by visitinghttp://<your-ip>/
,http://localhost:80/
, orhttp://127.0.0.1:80/
.
To run the server just locally,
python manage.py runserver localhost:8000
orpython manage.py runserver 127.0.0.1:8000
.
Replace 8000 with whatever port you have forwarded.
At the moment, the application development is still at a provisional stage where the mobile application is only tested by a few specific users of specific iOS devices. In order for it to be available on the App Store for distrubtion., the app has to be submitted for publication to the App Store. This involves review process by Apple to insure the app meets their guidelines for quality and content.
In order to try out our app as a beta user, we would need to download the app directly to your iOS devices, this involves us connecting your devices to our Macs.
To develop it yourself, follow these instructions (macOS only):
- Assuming you have cloned the repository, install Cocoapods using
sudo gem install cocoapods
- Go to the app folder,
ee4-mhml/software/mhml_withbackground/
, and runpod install
. It should automatically pick out thePodfile
inside the app folder and install the required dependencies. - Open the workspace using XCode, not the project -
mhml.xcworkspace
You are welcome to issue pull requests, the Sleepify team will be on hand to deal with that, alongside issues. We aim to provide a response within 7 working days.