Skip to content

API to integrate data for a Health Clinic managing volunteer hours.

License

Notifications You must be signed in to change notification settings

ari-denary/volunteer-management-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Volunteer Management System

This is a Flask-built API to maintain experience hours and related information for users that are volunteers or admin of a health clinic.



Contributors Forks Stargazers Issues MIT License


Table of Contents
  1. About The Project
  2. Usage
  3. Roadmap
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About the Project

This is an API for managing volunteers and their experience hours.

(back to top)

Built With

  • Flask

(back to top)

Getting Started

Installation

  1. Clone the repo

    git clone https://github.com/ari-denary/volunteer-management-backend.git
  2. cd into project folder in terminal window

  3. Create a virtual environment

python3 -m venv venv
  1. Activate venv
source venv/bin/activate
  1. Install in venv all items from requirements.txt
pip3 install -r requirements.txt
  1. Run Flask
flask run

(back to top)

Usage

The API contains the following routes that receive and return JSON.

POST /auth/signup

  • Handles user signup. Expects JSON:
    {
        "badge_number":"1",
        "email":"sample@mail.com",
        "password":"password",
        "first_name":"sample",
        "last_name":"user",
        "dob":"datetime.datetime(2000, 1, 1, 0, 0)",
        "gender":"Prefer not to say",
        "address":"123 Cherry lane",
        "city":"New York",
        "state":"NY",
        "zip_code":"11001",
        "phone_number":"9991234567",
        "is_student":"true",
        "is_healthcare_provider": "false",
        "is_multilingual":"false"
    }
  • Returns JSON:
    { "token": "dleoidlksd.aslkfjoiweflkfj.aldsjfoweifsldf" }

POST /auth/login

  • Handles user login. Expects JSON:
    { "email": "mail@mail.com", "password": "mypassword" }
  • Returns JSON:
    { "token": "dleoidlksd.aslkfjoiweflkfj.aldsjfoweifsldf" }

GET /users/race-ethnicity-options

  • Authorization: None Required
  • Returns JSON { race_ethnicity_options: { "race": [...], "ethnicity: [...], "ethnic_background": [...] } }

GET /users

  • Gets all users.
  • Authorization: must be admin requesting with valid token.
  • Returns JSON:
    {
        "users": [{
            "id": 1,
            "email": "admin@mail.com",
            "experience_hours": 10,
            "badge_number": 100,
            "first_name": "first",
            "last_name": "user",
            "is_admin": False,
            "is_student": True,
            "is_healthcare_provider": False,
            "is_multilingual": False,
            "status": "new"
        } ... ]
    }

GET /users/user_id

  • Gets a user by id.
  • Authorization: must be same user or admin requesting with valid token.
  • Returns JSON:
    {
        "user": {
            "id": 1,
            "email": "admin@mail.com",
            "school_email": "joe@school.edu",
            "badge_number": 100,
            "first_name": "first",
            "last_name": "user",
            "dob": "Sat, 01 Jan 2000 00:00:00 GMT",
            "gender": "male",
            "pronouns": "he/him",
            "race": "white",
            "ethnicity": "caucasian",
            "created_at": "Sun, 21 May 2023 20:12:14 GMT",
            "phone_number": "9991234567",
            "phone_carrier": "verizon",
            "address": "123 Cherry lane",
            "city": "New York",
            "state": "NY",
            "zip_code": "11001",
            "is_admin": false,
            "is_multilingual": false,
            "is_student": true,
            "type_of_student": "full-time",
            "school": "Oklahoma State",
            "anticipated_graduation": "Sun, 19 May 2025 20:12:14 GMT",
            "major": "Biology",
            "minor": null,
            "classification": null,
            "degree": "B.S.",
            "is_healthcare_provider": false,
            "type_of_provider": null,
            "employer": null,
            "is_multilingual": false,
            "status": "new",
        }
    }

GET users/user_id/experiences

  • Gets all experiences for a user. Optional query parameter of 'incomplete' will return all experiences whose sign_out_time is None. Primary use case for 'incomplete' is for getting experience(s) to "sign out".
  • Authorization: must be same user or admin requesting with valid token.
  • Returns JSON:
    {
        "user_experiences": [{
            "id": 1,
            "date": "2023-04-06-08:35:12:23",
            "sign_in_time": "2023-04-06-08:35:12:23",
            "sign_out_time": "2023-04-06-08:35:12:23",
            "department": "lab",
            "user_id": 3
        } ... ]
    }

GET users/user_id/languages

  • Gets all languages for a user.
  • Authorization: must be same user or admin requesting with valid token.
  • Returns JSON:
    {
        "user_languages": [{
            "id": 1,
            "language": "spanish",
            "fluency": "proficent",
            "user_id": 3
        } ... ]
    }

GET /experiences

  • Gets all experiences for all users. Optional query parameter of 'incomplete' will return all experiences whose sign_out_time is None.
    • Primary use case for 'incomplete' is to check any experiences that have not "signed out".
  • Authorization: must be admin requesting with valid token.
  • Returns JSON:
   {
        "user_experiences": [{
            "id": 1,
            "date": "2023-04-06-08:35:12:23",
            "sign_in_time": "2023-04-06-08:35:12:23",
            "sign_out_time": "2023-04-06-08:35:12:23",
            "department": "lab",
            "user_id": 3
        } ... ]
    }

POST /experiences

  • Create a new experience. Use case for "signing-in" to an experience.
  • Authorization: must be same user or admin requesting with valid token.
  • Accepts JSON - "date", "sign_in_time", "department", "user_id" required "sign_out_time" optional
  {
      "date": "2022-01-05 00:00:00",
      "sign_in_time": "2022-01-05 08:00:00",
      "department": "lab",
      "user_id": 3
  }
  • Returns JSON:
  {
      "user_experience": {
          "id": 1,
          "date": "2022-01-05 00:00:00",
          "sign_in_time": "2022-01-05 08:00:00",
          "sign_out_time": "None",
          "department": "lab",
          "user_id": 3
      }
  }

PATCH /experiences/<int:exp_id>

  • Update a user's experience sign out time and/or department.
  • Use case for "signing-out" of an experience.
  • Authorization: must be same user or admin requesting with valid token.
  • Accepts JSON - "sign_out_time" required, "department" optional
{
    "sign_out_time": "2023-04-06-08:35:12:23",
    "department": "pharmacy"
}
  • Returns JSON
  {
      "user_experience": {
          "id": 1,
          "date": "2023-04-06-08:35:12:23",
          "sign_in_time": "2023-04-06-08:35:12:23",
          "sign_out_time": "2023-04-06-08:35:12:23",
          "department": "pharmacy",
          "user_id": 3
      }
  }

(back to top)

Tests

To run tests:

FLASK_DEBUG=False python -m unittest test_filename.py

Roadmap

  • Refactor JSON validation to use json schema while maintaining current level of datetime validation

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Ari Denary - adenary.dev@gmail.com - LinkedIn

Project Link: https://github.com/ari-denary/volunteer-management-backend

(back to top)

About

API to integrate data for a Health Clinic managing volunteer hours.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages