Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development/refactor amps #8

Open
wants to merge 134 commits into
base: master
Choose a base branch
from

Conversation

SharaaRe
Copy link
Collaborator

@SharaaRe SharaaRe commented Aug 21, 2024

Summary by Sourcery

Refactor the AMPS application to use a Flask-based architecture, introducing new features for actuator control and scheduling, enhancing the user interface, and adding a new database layer for schedule management. Remove outdated server-side code and add unit tests for key components.

New Features:

  • Introduce a Flask-based web application for controlling and scheduling actuators, including lights, fans, and irrigation systems.
  • Add a new actuator scheduler to manage schedules for lighting, air, and irrigation systems using a background scheduler.
  • Implement a new CSS styling for the web interface to enhance user experience.
  • Add a new database schema and access layer for storing and retrieving actuator schedules using SQLite.

Enhancements:

  • Refactor the application to use a more modular structure, separating concerns into different modules for actuators, scheduling, and data access.
  • Improve the user interface with a new HTML template for scheduling and controlling actuators, providing a more intuitive user experience.

Tests:

  • Add unit tests for the irrigation, lighting, and air control modules to ensure functionality and reliability.

Chores:

  • Remove obsolete server-side code and views that are no longer needed after the refactor to a Flask-based application.

Copy link

sourcery-ai bot commented Aug 21, 2024

Reviewer's Guide by Sourcery

This pull request represents a significant refactoring and restructuring of the AMPS (Automated Modular Plant System) project. The changes involve a shift from a server-client architecture to a more integrated Flask-based web application. Key modifications include:

  1. Removal of the separate server component and integration of server functionality into the client-side Flask application.
  2. Introduction of a new database (SQLite) for storing schedules.
  3. Refactoring of the control logic for various components (irrigation, lighting, air control).
  4. Implementation of a new web interface using Flask templates.
  5. Addition of a scheduler component for managing timed operations.

The changes aim to simplify the system architecture, improve maintainability, and enhance the user interface for controlling the AMPS system.

File-Level Changes

Files Changes
client/app.py
server/app.js
server/socket.js
server/routes/index.js
Removed the separate server component and integrated server functionality into a Flask-based web application
client/models/actuators/dataaccess/sqlite.py
client/models/actuators/dataaccess/create_tables.py
create_tables.sql
Introduced SQLite database for storing schedules and implemented database access functions
client/models/actuators/irrigation.py
client/models/actuators/lighting.py
client/models/actuators/air.py
Refactored control logic for irrigation, lighting, and air control components
client/templates/schedule.html
client/templates/index.html
client/static/styles.css
Implemented new web interface using Flask templates and static files
client/models/actuators/actuator_scheduler.py Added a scheduler component for managing timed operations
client/models/actuators/config.py Updated configuration settings and GPIO assignments
client/models/actuators/actuator_controller.py Implemented an actuator controller to manage different components
server/views/index.ejs
server/views/schedule.ejs
server/views/tabs/air.ejs
server/views/tabs/arm.ejs
server/views/tabs/irg.ejs
server/views/tabs/led.ejs
server/views/tabs/schedule.ejs
Removed old EJS templates and associated files from the server component

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SharaaRe - I've reviewed your changes - here's some feedback:

Overall Comments:

  • This refactoring looks like a significant improvement in code structure and maintainability. However, please clarify the status of the ARM control functionality that seems to have been removed.
  • Consider adding more comprehensive error handling and logging throughout the codebase, especially in the actuator control modules.
  • The new scheduler implementation looks robust, but it would benefit from unit tests to ensure reliability, particularly around edge cases like time changes.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants