DSCI 551 Project: Generates a dynamic, personalized workout mix based on streamed heartrate. Currently in Proof-of-Concept stage.
Please ensure the following software is available:
-
Docker and docker-compose
-
npm
Please ensure the following python packages are available:
-
numpy
-
statsmodels
-
django
-
django-cors-headers
-
django-sslserver
-
influxdb
-
django-mysql
-
spotipy
-
Create a docker volume called
influx_volumeandmysql_volumefor persistent data storage. -
In the
musiquity_frontendfolder runnpm install. -
Run
python recursively_dcu.pyin the root directory. This brings up the redis, Influx and MySQL dockers. -
Create a file called
config.jsoninweb_api/web_apistructured as follows:
{
"mysql_data": {
"username": "mysql_username",
"password": "mysql_password"
}
}
- In
web_api/daemons, create a file calledapi.jsonthat is structured as follows:
{
"api": {
"key": "your_spotify_application_key",
"secret": "your_spotify_application_secret"
}
}
-
In
web_api/auth_servicecreate a file calledclient_id.jsonthat contains the oauth authentication details for Google authentication. (Note: Ensure that your oauth2 client can read activity and fitness data at the very least) -
Go to the
web_apifolder and runpython manage.py createsuperuserand create a superuser for your instance. -
Then run
python manage.py runsslserver. The SSL server is required for Google's OAuth2. -
In the
musiquity_frontendfolder, start the UI server withnpm start.
-
Open
https://localhost:8080/admin/to open the admin console and login as the superuseryou just created. -
Create a user under the 'Users' group.
-
Under the Backend Service group, create the appropriate models for your cutoffs (You can poll data and use spark for this later)
-
Create your "seed lists". The tracks in your seed lists must be spotify URIs for tracks separated by a comma.
-
Copy your username and replace the default with it in
helpers/api_querier/api_querier.pyandhelpers/spoofers/influxdb_spoofer_delay.py. -
Now go to
https://localhost:8080/authand authenticate. This should return an "authorized" message with the location of the token.txt file
-
When you have heart rate data recorded from a workout, run
api_querier.py <<token.txt absolute path>>inhelpers/api_querier. This will poll data and store it in apoints.txtfile. -
Due to issues with Google Fit Streaming, for demo purposes we shall simulate the same workout. Run
post_simulator.py. This shall simulate data streaming.
-
In
web_api/daemonsrundaemons.py. -
If no errors come up there should be data in redis.
-
Open
localhost:3000and input your username (whatever you used inapi_querier.py). You should see your current heart rate (with a little bit of trend) and suggestions.