Giter Site home page Giter Site logo

plantdaddy-backend's Introduction

PlantDaddy-Backend

REST API for PlantDaddy web app. Leverages a modern, typed Python stack.

Value Prop:

One place with all the info you need to keep the plant alive

Features:

  • Name, classify, categorize, and perform lookups for plants
  • Create PlantGroups
  • Schedule events for watering/care

Stack:

  • FastAPI (api framework)
  • SQLModel (orm)
  • Poetry (dependencies/venv)
  • Black (formatting)
  • Flake8 (linting)
  • MyPy (strong typing)

Contributor Quickstart

Prerequisite: Poetry installation

(VSCode)

  • install Python/Pylance/Toml extensions
  • update poetry virtual environments setting to keep it in the project instead of default location by running: poetry config virtualenvs.in-project true

setup virtual environment

  • Create Virtual Environments with poetry: poetry env use python3.10 and poetry env use python3.9.
  • Activate the venv using poetry shell
  • Install the packages listed in pyproject.toml into your venv using poetry install.

setup database

  • Create a local SQLite database file by creating a file ending in .db.
  • Create a file ".env" in the project root and add the absolute path to your .db file to a variable SQLITE_FILE.

run the server

  • Start the server by running python3 -m app.console from the project root.
  • Alternatively, run from the command line with uvicorn app.api.v1.endpoints.plant:app --reload
  • Test the endpoints by going to the localhost link which appears in the console and appending "/docs" to the URL

plantdaddy-backend's People

Contributors

ethancloin avatar

Watchers

 avatar

plantdaddy-backend's Issues

Watering Frequency Feature

Summary

Allow user to assign a WateringFrequency to their plants. After x days have passed, remind user to water.

Database Relationship

WateringFrequency can exist as a standalone Enum
Each Plant can have either zero or one WateringFrequency

User Stories v1

  • Any Plant with a given WateringFrequency will follow the 'standard' schedule
    The 'standard' schedule determines whether the current day needs_water by considering whether the selected frequency is evenly divisible by the current day of the year.

EG: BIMONTHLY frequency is assigned, which has a value of 14. The current date is January 28, the 28th day of the year. Since 28 mod 14 == 0, any plant on the standard schedule should be updated to needs_water=True.

  • User can mark an individual plant as watered from the SinglePlant view
  • User can mark all plants as watered from the Home view
  • User can mark all plants matching the given filter as watered from the Home view
  • Updating the needs_water status will also update the last_watered day.

Potential Future Development

  • Track and report WateringHistory for each plant
  • Support users providing a custom start date for their watering frequency
  • Dynamically reschedule watering events if the user marks a plant as watered on an unexpected date
  • Send Push/Email notifications when scheduled waterings are due

Create Test Data

Summary

Create 5+ rows of plants which can be included in the database upon startup to make testing more consistent. Will be useful to test out parts of the frontend with real data.

Fatal Import Errors

unable to properly run uvicorn server due to import issues with both the models and db packages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.