This project was made from the idea of helping those with Dementia and Alzheimers recall memories using the memory palace technique. This is the Back End repository for the Untangled application, which works in tandem with the Untangled Frontend Repository. This Back End application returns information to the Front End through API requests.
Explore the docs »
·
Report Bug
·
Request Feature
- About This Project
- Virtual Environment setup
- Database Setup
- Running Locally
- Running Tests
- Endpoints
- Endpoints Table
- Database Schema
- Roadmap
- Contributing
- Contact
Visit Untangled to view all the repositories associated with this application.
This Backend application stores all the relevant data needed for the Untangled application. It has information for users, rooms, and memories, and allows for updates to users and memories. It responds to the Frontend of the application through API requests and responses. Scroll down to the endpoints section see what is available.
# build a virtual environment to install your Python packages
python3 -m venv ./venv
# 'activate' the virtual environment for your project
# do this every time you start a new terminal and enter your project folder
source venv/bin/activate
# install your Python packages
pip3 install -r requirements.txt
To shut off your virtual environment, run deactivate
at a terminal where you
have an active virtual environment.
createdb untangled_dev
createdb untangled_test
export DATABASE_URL=postgresql://localhost:5432/untangled_dev
# examine any database models you have set up
python3 manage.py db migrate
# "upgrade" your database schema to use the changes you've made in your models
python3 manage.py db upgrade
# then apply the same for your test database:
export DATABASE_URL=postgresql://localhost:5432/untangled_test
python3 manage.py db upgrade
# you can seed your database with:
python3 manage.py db_seed
To run the application in your local dev environment run:
python3 run.py
You may now access API endpoints locally at:
http://localhost:5000/api/v1/
If you just want to run your tests, pytest
by itself will do the job.
In order to return a test coverage report run:
# remove any previous test caching, previous coverage reports, and a database
# of coverage data from the last time you ran this
rm -rf .pytest_cache/ coverage_html_report/ .coverage
# set your database url for your test database and use 'coverage' to launch
# pytest
DATABASE_URL=postgresql://localhost/untangled_test coverage run -m pytest
# generate the HTML reports
coverage html
# open the coverage report in your browser
open coverage_html_report/index.html
# count how many 'assert' calls you make in your tests
# my last project using this structure had 76 tests and 296 assertions that
# made sure every little thing got tested
grep -R assert tests | grep '.py:' | wc -l
All endpoints can be reached at:
https://untangled-be.herokuapp.com/api/v1/
- GET and PATCH endpoints will return a 200 status code on success
- POST endpoints will return a 201 status code on success
- DELETE endpoints will return a 204 status code on success
Failure conditions will return an appropriate 400-series or 500-series error and a JSON payload indicating helpful errors in a format such as:
{
"error": 404,
"message": "Resource not found"
}
PATCH request: Require a body with the new information as a JSON payload. For example, the body for a user patch request:
{
"name": "ian",
"email": "[email protected]"
}
https://untangled-be.herokuapp.com/api/v1
Description | URL | Verb | Request Body | Sample Success Response |
---|---|---|---|---|
Get All Users | /users |
GET | { |
|
Get A User By Id | /users/:id |
GET | { |
|
Get All Rooms | /users/:id/rooms |
GET | { |
|
Get A Room By Id | /rooms/:id |
GET | { |
|
Get All Memories For A Room | /rooms/:id/memories |
GET | { |
|
Create a Memory | /rooms/:id/memories |
POST | { |
{ |
Update a Memory By Id | /memories/:id |
PATCH | { |
{ |
Delete a Memory | /memories/:id |
DELETE | Returns 204 No Content |
See Open Issues or visit our Project Board for a list of proposed features, known issues, and project extensions.
Contributions are what make this community such an amazing and fun place to learn, grow, and create! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/NewGreatFeature
- Commit your Changes
git commit -m 'Add some NewGreatFeature'
- Push to the Branch
git push origin feature/NewGreatFeature
- Open a new Pull Request!
Bryce Jarrett - - GitHub
Cameron Romo - - GitHub
Joe Lopez - - GitHub
Estelle Staffieri - - GitHub
Grant Dempsey - - GitHub
Eduardo Parra - - GitHub
Jesse Mellinger - - GitHub
Sean Steel - - GitHub
Project Link: Untangled