Chapter – 4: Implementation and Testing
4.1 Database Design
E-R Diagram and Relationships
The database design includes a detailed E-R diagram showcasing cardinalities and
relationships among entities.
Entities:
1. Data Source (One-to-Many) Raw Data: Each data source can provide multiple raw data
entries.
2. Raw Data (Many-to-One) Model: Multiple raw data entries can be associated with one
model.
3. Model (One-to-Many) Prediction: Each model can generate multiple predictions.
4. Prediction (One-to-One) Exported File: Each prediction can have an associated
exported file.
5. User (One-to-Many) User Action: Each user can perform multiple actions.
6. Model (One-to-One) Metrics: Each model has associated performance metrics.
Data Source
[Link]. Field Data Type Description
1 id INT Unique identifier for
the data source.
2 source_name VARCHAR(100) Name of the data
source.
3 url VARCHAR(255) URL where data is
fetched from.
4 last_fetch_date DATETIME Last date data was
fetched from this
source.
Description: Stores information about each source of solar power data.
Raw Data
[Link]. Field Data Type Description
1 data_id INT Unique identifier for
each raw data entry.
2 datasource_id INT Foreign key
referencing the data
source.
3 timestamp DATETIME Date and time of the
data recording.
4 solar_radiation FLOAT Recorded solar
radiation value.
5 temperature FLOAT Recorded
temperature.
6 humidity FLOAT Recorded humidity
level.
7 wind_speed FLOAT Recorded wind speed.
8 actual_power_output FLOAT Actual power output
recorded at this
timestamp.
Description: Contains raw data readings used in modeling solar power output.
Model
[Link]. Field Data Type Description
1 model_id INT Unique identifier for
each model.
2 data_id INT Foreign key
referencing the raw
data used for model
training.
3 model_type ENUM(...) Specifies the type of
model used.
4 training_date DATETIME Date the model was
trained.
5 hyperparameters JSON JSON structure
storing model
hyperparameters.
Description: Stores information about models used for solar power prediction.
Prediction
[Link]. Field Data Type Description
1 prediction_id INT Unique identifier
for each
prediction.
2 model_id INT Foreign key
referencing the
model used for
prediction.
3 forecast_date DATETIME Date for the
forecasted data.
4 predicted_interval VARCHAR(20) Interval for which
the power output
is predicted.
5 predicted_power_outpu JSON JSON structure of
t predicted power
output values.
6 actual_power_output JSON JSON structure of
actual power
output values (if
available).
Description: Stores predicted and actual power output data.
Exported File
[Link]. Field Data Type Description
1 file_id INT Unique identifier
for each exported
file.
2 prediction_id INT Foreign key
referencing the
prediction.
3 file_type ENUM('CSV', Type of file
'PNG') exported.
4 file_path VARCHAR(255) Path to the exported
file.
5 export_date DATETIME Date the file was
exported.
Description: Contains information about files exported from predictions.
Metrics
[Link]. Field Data Type Description
1 metric_id INT Unique identifier
for each set of
metrics.
2 model_id INT Foreign key
referencing the
model.
3 mae FLOAT Mean Absolute
Error of the model.
4 rmse FLOAT Root Mean Square
Error of the model.
5 mape FLOAT Mean Absolute
Percentage Error of
the model.
6 evaluation_date DATETIME Date the metrics
were evaluated.
Description: Stores performance metrics for each model.
User
[Link]. Field Data Type Description
1 user_id INT Unique identifier
for each user.
2 username VARCHAR(50) Username for the
user.
3 password_hash VARCHAR(255) Hashed password
for security.
4 email VARCHAR(100) User's email
address.
5 registration_date TIMESTAMP Date the user
registered.
Description: Contains user account information.
User Action
[Link]. Field Data Type Description
1 action_id INT Unique identifier
for each user
action.
2 user_id INT Foreign key
referencing the
user.
3 action_type ENUM(...) Type of action
performed.
4 action_details TEXT Details about the
action.
5 action_date TIMESTAMP Date and time the
action occurred.
Description: Logs actions performed by users in the system.
4.2 Class Diagram
The class diagram outlines various classes and their functions. The purpose of each class
and a detailed explanation of its methods is included below.
Class: DataProcessor
Attribute / Method Details Purpose
rawData Stores the unprocessed
data.
cleanedData Stores the cleaned and
preprocessed data.
preprocessData() This method preprocesses Preprocessing data
raw data for further
analysis.
checkDataQuality() Verifies the data's integrity Data quality check
and consistency.
Class: Model
Attribute / Method Details Purpose
modelID Unique identifier for the
model.
data Data used to train the
model.
hyperparameters Hyperparameters for model
training.
trainingDate Date when the model was
last trained.
train() Trains the model on the Model training
preprocessed data.
evaluate() Evaluates the model's Model evaluation
performance using various
metrics.
Class: Metrics
Attribute / Method Details Purpose
metricID Unique identifier for the
metric.
modelID Identifier for the associated
model.
mae Mean Absolute Error of the
model.
rmse Root Mean Square Error of
the model.
mape Mean Absolute Percentage
Error of the model.
evalDate Date when the metric was
evaluated.
calcMAE() Calculates Mean Absolute Error calculation
Error (MAE) of the model.
calcRMSE() Calculates Root Mean Error calculation
Square Error (RMSE) of
the model.
calcMAPE() Calculates Mean Absolute Error calculation
Percentage Error (MAPE)
of the model.
Class: Prophet
Attribute / Method Details Purpose
train() Trains the Prophet model Model training
on time series data.
evaluate() Evaluates the Prophet Model evaluation
model's forecasting
accuracy.
Class: LSTM
Attribute / Method Details Purpose
train() Trains the LSTM model. Model training
evaluate() Evaluates the LSTM Model evaluation
model's accuracy.
Class: Prediction
Attribute / Method Details Purpose
predictionID Unique identifier for the
prediction.
modelID Identifier for the associated
model.
forecastDate Date of the forecast.
predInterval Interval for prediction.
predOutput The forecasted output.
actualOutput The actual output data.
generateForecast() Generates forecast data. Forecast generation
savePrediction() Saves prediction data. Saving forecast data
Class: User
Attribute / Method Details Purpose
userID Unique identifier for the
user.
username Username of the user.
email User's email address.
passwordHash Hashed password for
security.
login() Authenticates user login. User authentication
register() Registers a new user. User registration
Class: DataSource
Attribute / Method Details Purpose
sourceID Unique identifier for the
data source.
sourceName Name of the data source.
url URL of the data source.
lastFetchDate Date of the last data fetch.
fetchData() Fetches data from the Data fetching
source.
updateDate() Updates the last fetch date. Date updating
Class: UserAction
Attribute / Method Details Purpose
actionID Unique identifier for the
action.
userID Identifier of the user who
performed the action.
actionType Type of action performed.
actionDate Date of the action.
recordAction() Records a user's actions. Action logging
Class: ExportManager
Attribute / Method Details Purpose
fileID Unique identifier for the
file.
fileType Type of file being exported
(e.g., CSV, PNG).
filePath Path to the exported file.
exportDate Date of the export.
exportCSV() Exports data to CSV CSV export
format.
exportPNG() Exports data to PNG PNG export
format.
Class: ARIMA
Attribute / Method Details Purpose
train() Trains the ARIMA model. Model training
evaluate() Evaluates the ARIMA Model evaluation
model's accuracy.
4.3 Test Cases
A description of the testing techniques and screen snapshots for input/output cases are
included below.
Test 01: Test case for successful Login
Input: Login ID: arpit_agrw
Password: ABCD
Expected Output: System Output: Successful Login
Test 02: Test case for incorrect password
Input: Login ID: arpit_agrw
Password: ABD
Expected Output: System Output: Incorrect Password
Test 03: Test case for incorrect ID
Input: Login ID: arpit_aw
Password: ABD
Expected Output: System Output: Incorrect ID