Sheep’s Galaxy
About
This project demonstrates an application for sleep quality monitoring and analysis.
Client side: TypeScript with Angular framework.
Server side: Python with FastAPI and DB-API to connect to the database.
Database: The database is hosted in InterSystems IRIS Cloud SQL, and we used one of its features, IntegratedML, to predict sleep quality.
Quick start
Execute the following commands in the terminal to start the project:
git clone https://github.com/banksiaglobal/SleepTracker
docker compose up -d --build
The application backend is available at http://localhost:9000/
The application frontend is available at http://localhost:8080/
InterSystems IRIS Cloud SQL
To do this, set up a deployment in the IRIS Cloud SQL portal and write the connection parameters into docker-compose file in the environment section.
Filling with data
The "sleeps" table of our database is populated with the generated data. To do this, send a request to the server:
- create tables
http://localhost:9000/utils/create
- generate data
http://localhost:9000/utils/generate
*The body of each request must contain the following fields:
- url - url database
- password - password of database
IntegratedML
The following sql queries are required to implement machine learning algorithms:
Create model sleep predicting (quality) from SQLUser.Sleeps
Train model sleeps
Here we create a machine learning model based on the Sleeps database table. For prediction, we specify the field “quality” (“quality of sleep”, the user’s sensation after sleep).
As a result of training, we get prediction and probability_quality fields, which we use later, for example, in such a sql query:
SELECT PREDICT(sleeps use sleeps) as prediction, quality,
PROBABILITY(sleeps use sleeps for '3') as probability_quality, * FROM SQLUser.Sleeps
where user_id = 1 and id = 1
where the prediction field contains a prediction of the quality of sleep, the probability_quality field contains the probability that the dream will be “qualitative” based on its entered characteristics.
Application demonstration
Video
youtube
Thanks!
Developers of project: