-
Notifications
You must be signed in to change notification settings - Fork 0
Design Document
This is a design document for an Android app 'I'm pine thank you'
- Version 1.0
-
Version 1.1
- Update user story in acceptance test so that each feature has a singular, focused user story and that the accompanying acceptance criteria are detailed and specific.
- Revise the current class diagram to enhance its logical structure and improve visual clarity.
- Modify the wireframe to highlight the directional flow between screens, ensuring the user's journey through the application is intuitive and clear.
- Minor changes in machine learning model and testing strategy
-
Version 1.2
- Edit system architecture with a newly adapted architecture (Firebase for Authserver and model serve from the client).
- Include details on prediction model testing (error metrics used, performance testing).
- Slightly revised the testing framework.
-
Version 1.3
- Revised user stories.
- Modified wireframe
- Modified frontend UI design details to match our change in scope
-
Version 1.4 (Latest)
- Modified class diagram
- Modified data model with diary model included
- Added specific implementation details for our prediction model
- Modified friends use case
- Added Open Weather API feature
Classe used for each page
Class used for API calls and data management
1. User Class
-
Attributes:
userId: Integer
username: String
password: String
email: String
-
Methods:
login()
logout()
register()
editProfile()
2. Avatar Class
-
Attributes:
avatarId: Integer
userId: Integer
customizationDetails: String
-
Methods:
customizeAvatar()
3. Farm Class
-
Attributes:
farmId: Integer
userId: Integer
pineappleStatus: String
-
Methods:
updateStatus()
customizeFarm()
4. Diary Class
-
Attributes:
entryId: Integer
userId: Integer
weatherData: String
entryText: String
date: Date
-
Methods:
createEntry()
editEntry()
deleteEntry()
1. UserModel
-
Attributes:
userId: Integer
username: String
password: String
email: String
-
Methods:
createUser()
deleteUser()
updateUser()
retrieveUser()
2. FriendModel
-
Attributes:
userId: Integer
friendId: Integer
-
Methods:
addFriend()
removeFriend()
3. NotificationModel
-
Attributes:
notificationId: Integer
userId: Integer
message: String
timestamp: DateTime
-
Methods:
sendNotification()
deleteNotification()
Note: Class Diagram could change and will be noted on wiki when that's the case
-
App
Android app 'I'm pine thank you' is developed with JAVA.
Android API Version: 34
Java Version : 11
-
Server
The server used Django-Rest-Framework (DRF) to power rest-API server and it is hosted on an AWS EC2 instance, offering scalability and reliability. -
Database
Data is securely stored in an AWS RDS MySQL database, seamlessly integrated with our server. -
Weather API Open Weather API for default values in prediction model.
-
Naive Data Analysis
- Utilizing linear regression to determine the approximate correlation between input and output.
- Conducting correlation analysis to figure out the relationships among input variables.
-
Stationarity
- ADF test for testing stationarity and employ differencing methods to make data stationary for training.
-
Prediction Model
- Building prediction models by splitting data into train and test sets (90:10 ratio)
- Utilizing the VAR mode and VARIMA model for predictions.
- Model Enhancement : Data Augmentation and Variable Reduction using Granger-Causality test
Scaling
Jittering
Magnitude Warping
Results: Much more accurate model
-
Model Accuracy Assessment
-
Evaluating the accuracy of the prediction model through error metrics.
-
Checking for overfitting.
-
Comparing VAR and VARIMA with different number of variables.
-
Following is the comparison result:
-
- Isolate the test environment with all necessary libraries for VAR and VARIMA model execution.
- Clean the dataset to handle missing values and outliers.
Phase 1: Accuracy Testing
-
Compare model predictions with actual historical outcomes using SMAPE (Symmetric Mean Absolute Percentage Error) and RMSE (Root Mean Square Error) metrics.
-
SMAPE is an accuracy measure based on percentage errors. It is defined as the average of the absolute differences between the predicted and actual values, divided by the average of the actual values, giving a percentage that describes the error size relative to the actual value. This metric is useful for comparative forecasting as it is scale-independent.
-
RMSE measures the square root of the average of the squares of the errors. This metric emphasizes larger errors and is useful when large errors are particularly undesirable.
-
Phase 2: Performance Testing
- Analyze time series for stationarity and perform model fitting.
- Conduct residual analysis to ensure residuals resemble white noise.
Phase 3: Scenario Testing
- Test models under varied weather scenarios to evaluate forecast reliability.
Phase 4: Robustness Testing
- Perform sensitivity analysis to assess model response to input variations.
- Apply stress testing by evaluating model performance with large data volumes.
Phase 5: Model Comparisons
- Compare the performance with 5 variables against 6 variables using the predetermined error metrics.
Endpoint | HTTP Method | Description | Request Parameters | Response Status Codes | Response Body |
---|---|---|---|---|---|
/api/user/signin |
POST | Signin | id, name, email | 201 Created 400 Bad Request |
User object |
/api/user/{id} |
GET | Get a user by ID | 200 OK 400 Bad Request |
User object | |
/api/user |
PUT | Update a user | 200 OK 400 Bad Request |
Updated user object | |
/api/user |
DELETE | Delete a user | 204 No Content 404 Not Found |
N/A |
Endpoint | HTTP Method | Description | Request Parameters | Response Status Codes | Response Body |
---|---|---|---|---|---|
/api/plant/user/{user_id} |
GET | Get a list of user's plants | 200 OK 404 Not Found |
List of plant objects | |
/api/plant/{plant_id} |
GET | Get a plant by ID | 200 OK 404 Not Found |
Plant object | |
/api/plant |
POST | Create a new plant | Plant data (JSON) | 201 Created 400 Bad Request |
Created plant object |
/api/plant |
PUT | Update a plant | plant_id Plant data (JSON) |
200 OK 404 Not Found |
Updated plant object |
/api/plant |
DELETE | Delete a plant | plant_id | 204 No Content 404 Not Found |
N/A |
Endpoint | HTTP Method | Description | Request Parameters | Response Status Codes | Response Body |
---|---|---|---|---|---|
/api/posts/user/{user_id} |
GET | Get user's posts | User ID | 200 OK 404 Not Found |
List of post objects |
/api/posts/{post_id} |
GET | Get a post by ID | User ID, Post ID | 200 OK 404 Not Found |
Post object |
/api/posts |
POST | Create a new post | User ID (in request body), Post data (JSON) | 201 Created 400 Bad Request |
Created post object |
/api/posts |
PUT | Update a post | User ID, Post ID, Post data (JSON) | 200 OK 404 Not Found |
Updated post object |
/api/posts |
DELETE | Delete a post | User ID, Post ID | 204 No Content 404 Not Found |
N/A |
Endpoint | HTTP Method | Description | Request Parameters | Response Status Codes | Response Body |
---|---|---|---|---|---|
/api/follows/{user_id} |
GET | Get users the user is following or Get users following the user |
User ID Query Option (bool) |
200 OK 404 Not Found |
List of users |
/api/follows |
POST | Follow a user | Target User ID | 201 Created 400 Bad Request |
Created follow object |
/api/follows |
DELETE | Unfollow a user | Target User ID | 204 No Content 404 Not Found |
N/A |
Endpoint | HTTP Method | Description | Request Parameters | Response Status Codes | Response Body |
---|---|---|---|---|---|
/api/disease |
POST | Calculate disease probability | Plant ID humidity (float, optional) temperature (float, optional) last_watered_days (int, optional) |
200 OK, 400 Bad Request | Probability of disease (%) |
1. Log in Page
-
Log in (for the registered user only).
-
If the user inputs the valid “id”, “password’ and clicks on “Login” button, the user is redirected to the home page.
-
For new users, clicking on the “Create Account” button will redirect them to the Sign Up Page. 2. Sign up Page
-
Sign up.
-
If the user inputs “name”, “id”, “password”, “password confirm”, and clicks on the “Sign Up” button, the user is redirected to the Login page.
3. Tutorial Page
- A few pages to introduce new users to the app's features.
1. Home/Main Page
- Manage pineapple avatar, farm view, user information, settings, and editing.
- If the user clicks on the edit icon, the user can edit pineapple details.
- If the user clicks on the "Diary" icon(pineapple icon), the user is redirected to the Pineapple Diary Page, and can write a new diary, view the existing diary list, view/edit the selected diary.
- If the user clicks on the “Prediction Model” icon, the user can input necessary data to predict pineapple disease and view prediction results & recommendations.
- If the user clicks on the “Friends” icon, the user can view the friend list, search for new friends and send friend requests, view the friend home page and their diaries.
2. Edit Page
- The user can edit pineapple details.
1. New Diary Page
- The user can input title, date, category etc to write a new diary. If the user clicks on the “Save” button, the new diary is added to the Pineapple Diary List.
2. Pineapple Diary List Page
- The user can view the existing Pineapple Diary List.
- If the user clicks on the + icon, the user is redirected to the New Diary Page, and can write a new diary.
- If the user clicks on one of the diaries in the list, the user is redirected to the Diary Detail page, and can view the clicked diary in detail.
3. Diary Detail page
- The user can view the previously clicked Pineapple Diary, including its title, date, category etc.
- Editing the information is enabled, and clicking on the “Save” button will reflect the changes.
1. Input Page
- The user can input weather data to predict pineapple disease.
- If the user clicks on the “Submit” button, the user is redirected to the Output Result Page, and can view prediction results & recommendations.
2. Output Result Page
- The user can view brief pineapple disease prediction results & tips based on the imputed data from the Input Page.
1. Friend list Page
- The user can view the friend list.
- If the user clicks on one of the friends in the list, the user is redirected to the Friends Pineapple Page and can view the friend’s pineapple picture, avatar and and pine diaries.
- If the user clicks on “Search” and searches friend, the user is redirected follow/search friends page and can add friends.
2. Follow/Search Friend Page
- The user can search with the username, and the relevant user list appears as the search result.
- If the user clicks on one of the follow friend icons that user is added to the Friend list Page.
3. Friends Pineapple Page
- The user can view the friend’s pineapple details and diaries
- If the user clicks on one of the friend’s diary lists, the user is redirected to the Friends Diary Detail Page and can view that diary in detail.
Adding it all up
User Story:
As a new user, I want to sign up, log in, and be guided through a tutorial so I can understand how to grow pineapples and make an account of my pineapple plant.
Acceptance Criteria
- Given I am on the sign-up page, I must be required to input all the fields: username, email (in the correct format), password, and password confirmation.
- Given I am on the sign-up page, when I input an email that is already registered, I should receive an error message indicating that the email is already taken.
- Given I am on the sign-up page, I should ensure that the passwords I enter are longer than 6 characters and that the password and confirmation match.
- Given I am on the login page, I must be required to input all the fields: username, email, password and password confirmation.
User Story:
As a user, I want to have a seamless onboarding experience when I first sign up for the app, which includes a tutorial and a personalized pineapple plant profile. Additionally, I want to be able to choose an avatar for a fun and personalized touch.
Acceptance Criteria:
- Given it's my first time logging in after signing up, when I access the app, I should be directed to the tutorial page, which provides a brief summary of how to grow pineapples.
- Given it's my first time logging in after signing up, after completing the tutorial, I should be prompted to input pineapple data to create a new pineapple plant.
- Given it's my first time logging in after signing up, I should be required to choose among 5 different avatars for a cute and personal experience.
- Given it's my first time logging in after signing up, on the "make plant page," I should be required to input plant name, plant height, and a picture of my plant to create my own pineapple plant.
- Given I revisit the app, I shouldn't be shown the tutorial again and go right to Home page.
- Given I am at home page, I should be able to see information about my pineapple and its picture and avatar.
User Story:
As a user, I want to have the ability to create, read, update, and delete diary entries with various features for enhanced functionality and privacy control.
Acceptance Criteria:
- Given I am using the app, I should be able to create new diary entries.
- Given I am reviewing my diary entries, I should have the ability to update and edit existing entries.
- Given I am reviewing my diary entries, I should be able to delete entries I no longer wish to keep.
- Given I am creating a new diary entry, I should be prompted to fill in all required fields, ensuring that no fields are left empty.
- Given I am creating a new diary entry, I should have the option to attach photos to my entry, providing a visual element to my diary.
- Given I am creating a new diary entry, I should have the ability to choose a category that represents the topic or theme of my diary.
- Given I am creating a new diary entry, I should be able to select whether the diary entry is private or public. Private entries should not be visible to friends or other users unless specified otherwise.
User Story:
As a user, I want a prediction model to understand and counteract the fruitlet core rot (fcr) diseases affecting my pineapple.
Acceptance Criteria:
- Given I'm about to use the prediction model, when I haven't entered all necessary data, then the missing information is fetched from the current weather data by default.
- Given I receive a disease likelihood result, when the risk is above a certain threshold, then I am provided with tips on treating or preventing that disease.
User Story:
As a user, I want to connect with friends, see their pineapples, and engage with their diaries to share our pineapple cultivation experiences.
Acceptance Criteria:
- Given I am in the Friends Page and I searched a friend, when I click follow, then I can see friends pineapple details.
Unit Testing:
- JUnit for individual unit testing
Integration Testing:
- Espresso for UI testing
-
Achieve at least 80% code coverage for unit testing, ensuring main functionalities are thoroughly tested
-
Achieve at least 70% code coverage for integration testing, ensuring all components work together effectively
Unit Testing: Done by Pair Programmers
- Test the smallest parts of the application in isolation (e.g., functions, classes)
Integration Testing: Done by Project Manager
- Ensure that the different modules/parts of the application work together