Backend - QEDK/clarity GitHub Wiki
FastAPI Backend
Starting the back-end server
$ git clone [email protected]:QEDK/clarity.git
$ cd clarity/backend
$ source env/bin/activate
$ pip3 install -r requirements.txt
$ uvicorn main:app --reload
The server will start running at localhost:8000
and you can access the swagger UI(for testing the REST API) in the address http://localhost:8000/docs
About
The REST API is developed using FastAPI(with postgresql as our database) keeping in view, the execution speed and speedy development by the framework. FastAPI integrate well with machine learning models and by using asynchronous code execution we can increase the over all performance of our back-end. The REST API is designed for the purpose of uploading new user-journals and returning list of user journal for a particular email and unique URL
The database is designed such that for every unique email, we will have a 36 character long unique URL. For sharing their journals and for knowing about their previous emotions a doctor or therapist can use this URL.
Follow the instructions given here for running the backend locally
Endpoints
Endpoint | Method | Description |
---|---|---|
/api/add_node |
POST | This endpoint will take input as email, journal text and the time at which the user added the journal and create a new row in the databse |
/api/get_node/{email} |
GET | For an email this endpoint will return the list of jorunals from the database |
/api/get_note_from_url/{url} |
GET | For a given url this endpoint will return the list of journals of a perticular user to which this url belongs to |
Deployed Version
View the Deployed version here