Skip to content

Software repository to store back end infrastructure for Mental Health Org

Notifications You must be signed in to change notification settings

mental-health-org/mental_health_be

Repository files navigation

HeLP Network API

contributors_badge issues_badge forks_badge stars_badge

Help. Learn. Connect. Grow.

The HeLP Network API is a RESTful API for the HeLP Network frontend application. To experience the UI our frontend team built please visit https://mental-health-fe.herokuapp.com/. Otherwise you may hit our endpoints through an http request helper such as Postman.


About The ProjectTechnologiesLocal SetupTestingGetting StartedEndpointsDatabase SchemaContributorsAcknowledgements

About The Project

The HeLP Network is a platform that allows helping and law professionals such as mental health counselors, special education teachers, dieticians, and paralegals to connect and share resources.

Learning Goals

  • Use an agile process to turn well defined requirements into deployed and production ready software
  • Implement professional git workflow using Git Rebase
  • Build a RESTful API with a Django/Python
  • Collaborate with front-end team in order to complete and deploy features that have been outlined in the MVP
  • Develop a basic understanding of Python/Django TDD practices

Technologies

Framework

Languages

Tools

Processes

Development Testing Dependencies
Python 3.9.7 unittest djangorestframework
Django 3.2.8 coverage dotenv
Circle CI psycopg2
Git/Github
Heroku

Local Setup

  1. Create and invoke your virtual environment in your local project directory

    $python3 -m venv <env>
    
    $source <env>/bin/activate
    
  2. Fork and clone this repo into your local project directory

  3. Install dependencies

    $python3 -m pip install -r requirements.txt
    
  4. Setup the database

    $psql
    
    $CREATE DATABASE <db_name>;
    
  5. Add PostgreSQL database info to settings.py

    DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql_psycopg2',
          'NAME': '<db_name>',
          'USER': '<username>',
          'PASSWORD': '<password>',
          'HOST': 'localhost',
          'PORT': '',
      }
    }
  6. Migrate database tables

    $python3 manage.py migrate`
    
  7. Run server

    $python3 manage.py runserver`
    

Testing

  • To run the test suite:

    $python3 manage.py test
    
  • To assess test coverage:

    $coverage run --source='.' manage.py test
    
    $coverage report
    

Getting Started

The base path of each endpoint is:

https://developer-mental-health-org.herokuapp.com/api/v1
  • For GET requests, you can simply send the endpoint requests through your internet browser.
  • For any other requests (i.e. POST, PATCH, DELETE), you will need to use an API client to provide the request body and access the endpoints.

Endpoints

The following table presents each API endpoint and its documentation.

HTTP Verb Endpoint Description Docs
GET /questions Get all questions doc
POST /questions/ Ask a new question doc
GET /search/questions Find questions with keyword or phrase in title doc
GET /filter/questions Filter questions by tag name doc
GET /questions/:id Get a single question doc
PATCH /questions/:id/ Update a question doc
DELETE /questions/:id/ Delete a question doc
POST /responses/ Post a response to a question doc
PATCH /responses/:id/ Update a response doc
DELETE /responses/:id/ Delete a response doc
GET /tags Get all tags doc
GET /tags/:id Get a single tag doc
POST /users/ Create a new user doc
GET /users/:id Get a single user doc
DELETE /users/:id/ Delete a user doc

Database Schema

HeLP Network Database Schema

Contributors

Antonio King Jason Knoll Matt Roden Stephanie Magdic
GitHub GitHub GitHub GitHub
LinkedIn LinkedIn LinkedIn LinkedIn

Acknowledgements