Challenge Overview
Many residential solar owners have small, undetected maintenance problems that are leading to massive downtime for their solar panels.
Using classification algorithms that detect different types of problems, Solar Doctor provides an automated alert to customers whenever there's a problem. We also provide a detailed description of the maintenance needed and offer a referral service.
Solar Doctor customers opt-in to give Solar Doctor access to their Enphase inverters through the Enphase API. Solar Doctor runs a nightly job to grab the latest solar production data, check for problems indicated by the latest data, and send automated HTML email alerts when a problem is detected.
The goal of this challenge is to add analytical and tracking services to detect problems and notify customers.
Challenge Requirements
You will address the following in this challenge :
UI Requirements
We don’t have a UI prototype or a design, you will follow same existing website UI styling :
-
- The UI changes should look good.
-
- AngularJS is used in frontend JS library.
Database Model
-
- email_preference Model: This will record user preferences
-
- user_id (reference User model)
-
- send_email : true/false
-
- useHtml : true/false
-
// this can be extended to set specific days in week, specific hour, and repeat notification settings
-
-
- notification_data model: used to record alerts to be sent to users
-
- user_id
-
- alert_needed : true/false
-
- alert_name : string
-
- alert_description :string
-
- isRead : true/false
-
- isSent : true/false
-
Required Pages
-
- Alerts Page
-
- The page will list notification_data model in a table, user will be able to see the past notifications.
-
- if record is not read display it highlighted.
-
-
- Add a form at top to allow user to set email_preference settings with ‘save’ button. Display message on save (success or failure).
-
Backend Functionality
Required backend :
-
- You will create database tables for models you are adding in this challenge.
-
- Analytics service that have the following:
-
- (checkForAlerts) function that is used to see if there is any problem in solar production data in specific date for specific user
-
- Input parameters are user id and date, date is optional (default to yesterday)
-
- Check if user has an enphase data recorded in EnphaseEnergyLifeTime:
-
- if not and user did not connect with enphase return error.
-
- if no data and user connected enphase, call refreshUserData
-
- if EnphaseEnergyLifeTime last updated date is older than specified date, then run refreshUserData.
-
-
- Exclude current date’s data, compute the average daily Watt hours of solar production data.
-
- Retrieve average daily Watt hours of provided date.
-
- create notification_data record :
-
- If it has lower than average solar production then data will be :
-
- user id (input)
-
- alert_needed : true
-
- alert_name : Below Average Performance
-
- alert_description: The production of the solar installation is lower than average.
-
-
- else :
-
- user id (input)
-
- alert_needed : false
-
- alert_name : n/a
-
- alert_description: n/a
-
-
-
-
-
- Alert service that is used to send alert emails
-
- It can have single email (checkAlertsAndSendEmails)
-
- it will use same email service as the one used in the app.
-
- get all notification_data records that have alert_needed is true and isSent equal to false.
-
- For each user pull user email preferences and send email if send_email is true, use proper email template based on useHtml field.
-
- Email template should be configured.
-
- On successful email set isSent to true.
-
-
-
- Job Scheduler
-
- Write a python script that runs as standalone script.
-
- The script logic:
-
- the method will call checkAlertsAndSendEmails
-
-
- The purpose of this script is to run as job schedular out of the box.
-
-
- Email Tracking
-
- We will enable email tracking out of the box using SendGrid, use this guide to enable Email Tracking https://sendgrid.com/docs/User_Guide/Settings/tracking.html
-
General Note
-
- Logging, validation, error handling must be properly implemented.
-
- All sensitive information, and environment specific information should be configurable.
Hosting
It is preferred if you host your solution in Heroku.
Python Web Framework
Use Django framework.
Technology
-
- Python version 3.x running on Ubuntu
-
- Postgres 9.4
-
- Django 1.8.x
-
- AngularJS
-
- Bootstrap
-
- Enphase API
Abstracting and Design Patterns
Please make sure to create helper/interface to include the common code/functionality.
Also please make sure your design is flexible, use facade design pattern and adapter design pattern (and any other proper design pattern) to enable future extensibility of the solution.
Coding Standard
Follow python coding best practices : PEP 8 for the main text, and PEP 257 for docstring conventions
Documentation
Your solution must be well documented.
Readme
Update existing readme file using Markdown language with following information :
-
- Overview
-
- Setup Prerequisites
-
- Usage Example
-
- Reference this Python Documentation
-
- Any details about any limitations of your solution.
-
- Verification Steps should be provided on separate document.
Please note, we're judging this competition not just on the code, but also on the quality of the documentation, and ease of use.
Final Submission Guidelines
Submission
-
- Upload documentation for how to run your submission
-
- Upload all your updated code as a git patch file.
-
- Add elkhawajah as a member of your forked repository
-
- Winner will be required to submit a merge request on gitlab against the branch specified