# Software Requirement Specification Document
**<center>**By: Adam Eisert, Cindy Truong, Nathan George, Adhavan Ramkumar, Sujal Patel**</center>**
:::info
**Date** --- 11/27/2022
*Version 2.0*
Sections Modified:
- [3.2 Class Object Diagram](#32-ClassObject-Diagram)
:::
---
# Table of Contents
[TOC]
---
# 1. Introduction
## 1.1. Purpose
The purpose of this document is to outline the process and plan used to meet the requirements given in the term project. This document is intended to be used as both an outline of what the product is going to contain, but also a guide to how the product should function and be built. Sections 4-6 have been taken out, since they are not relevant to the term project.
## 1.2. Product Scope
The purpose of this product is to create software that will allow data to be easily understood and interpreted by a user unfamiliar with the data or specifics of the device.
## 1.3.Glossary
* OO - Object Oriented
## 1.4.References
* IEEE 830 - 1998 sample
* IEEE SRS Template
* Term Project Overview
## 1.5.Overview
This document uses a standard IEEE 830 - 1998 format with a few changes. Section 3 is in OO format, 3.8 is the state transition diagram, and section 4-6 have been removed. Important sections are listed below
* Section 2: General description of the project. Contains information on user requirements, Hardware and Software interfaces, and constraints
* Section 3: In depth look at all functional and nonfunctional requirements within the project. This is an OO design, contains all information on classes and their relationships
* Class model can be found in section 3.2, State Transition Diagram can be found in section 3.8, and Requirement Dependency Analysis table can be found in section 3.7
# 2. The Overall Description
This project will allow users to view aggregated biometric data of multiple users that has been pulled from a smart watch over the span of several days. It will display this data with a common time axis, with the option of displaying descriptions of the information, aggregating the information along various intervals, displaying metadata about the information, and displaying novel findings and correlating patterns between trends in the data.
## 2.1 Product Perspective
This project will allow users to view aggregated biometric data of multiple users that has been pulled from a smart watch. The term project will be a self contained computer application where users will define the parameters they wish to use to view biometric data, and then view said data, which is hosted on their own computer, formatted as several graphs sharing the same time axis. The application will also allow for users to view trends within the data, view descriptions, and aggregate the data with various intervals. The user will not need any equipment other than a python interpreter and the libraries included, so this program will be able to run on all modern systems. Internet access is not required, once the required libraries have been downloaded. All UI elements will be build from the required libraries.
### 2.1.1 System Interfaces
Per section 2.1 Product Perspective, The Term Project will mostly run independently, however it will require access to:
* The system time, and time zone
* The system storage
### 2.1.2 User Interfaces
As outlined in Section 2.1, user interaction will occur through a native OS window.
* Buttons and controls will allow interaction with the different elements in the window.
* Data will be shown as vertically stacked, 2D line graphs, where each parameter has its own graph.
* Each set of data will be aligned with the others by time, where time is on the x axis.
* The time range, or interval, of data viewed can be set.
* The time interval can be set with a time box, where the upper and lower timestamp can be set by clicking and dragging.
* A sidebar on the left side of the screen will hold all the general controls and pages. This will include:
* Open new data button
* Reset data button
* The aggregation interval as a drop-down
* The time zone (UTC, or local time) toggle
* Filters:
* Participant
* Date range - only dates not time
* Data type
* A button to open the query interface in the sidebar
* This will include a text box for the SQL query.
* And a submit button to run the query.
* Maybe some general info about the database structure would be useful here.
* A button to close the sidebar
### 2.1.3 Hardware Interfaces
There are no hardware interfaces required other than mouse, keyboard, and screen I/O. The user will select / control GUI elements using the mouse, and the resulting graphs will be displayed on the screen.
### 2.1.4 Software Interfaces
There are no required software interfaces for the Term Project that would
need to be used in order for the application to function to customer specification.
### 2.1.5 Communications Interface
No communication interfaces will be needed.
### 2.1.6 Memory Constraints
There are no specified memory constraints for the Term Project Application.
### 2.1.7 Site Adaptation Requirements
There are no Site Adaptation requirements.
## 2.2 Product Functions
In this section the functional requirements for the application are grouped by the highest level of requirement outlined by the customer (assignment prompt), and are further broken down into the necessary functional requirements to facilitate fulfilling those higher level requirements, with each level indicating a new more fundamental requirement needed to fulfill the parent goals.
### 2.2.1 Functional Requirements:
User interface to load in sensor data for visualization and exploration
1. Loading Data
* Given a csv file, convert to an SQL database
* Premade python functions for specific queries could be useful.
2. Data Visualization
* Query the database for the data to show.
* Align data by time on the x-axis
* Each graph should line up so that the x-axis of each of them lines up. This allows the user to see which changes in one parameter align with changes in the other parameters.
* Switch between UTC / local time
* Needs a way to specify internally which specific data is being shown.
3. Data Navigation
* Options to filter data by participant, date, and data type.
* Hide all non matching data
4. Data Aggregation
* Choose a time interval between each data point.
* Intermediate data points will be averaged
5. Query Interface
* This will open in a sidebar where the user can enter custom SQL queries
* The queries could be run interactively, or after the press of a button.
* This will function similarly to the simple filters, where only the matching data will be displayed.
6. Sidebar
* Shows general controls and functions
## 2.3 User Characteristics
The type of user is the generic “User”. This user will not require any specialized knowledge, training, equipment, or credential. These users will be able to view and explore biometric data collected by a sensor.
## 2.4 Constraints
The only constraint on the Term Project is that the user has biometric data in the proper format that the program can extract and use for visualization
## 2.5 Assumptions and Dependencies
* Biometric data must be in the proper format
* The program will only run on windows
* The program will be packaged with PyInstaller, and therefore will not have a dependency on python, or specific python libraries.
# 3. Specific Requirements
* The program should be able to load .csv tables
* The program should inform the user if their data is invalid.
* The program should allow picking multiple sets of data.
* The program should only graph the columns which are selected by the user.
* The program should allow the data to be filtered before import.
* The program should align each graph along the x-axis by time.
* The program should have a setting to switch time stamps from UTC to local.
* The program should scroll when there are too many graphs open.
* The time range should be selectable by a "time box" control.
* The user should be able to aggregate data by a certain time interval.
* Graphs should have a description of what the data is.
* The user should be able to write custom SQL queries to sort the data.
* The program should be able to analyze correlations between columns.
* The program should be able to mine patterns from the data.
* The program should support dark mode.
## 3.1 External Interface Requirements
This section will describe how the users will interface with the Term Project. The user will start with an import window which will display an option to search for biometric data on their own machine, as well as filters for participant, date and the option to include time zone information or not. There is also a button that will display graphs, but this will not return anything if no biometric data is loaded. When the user selects the option to search for biometric data, it will bring up a file explorer where users will be able to search for biometric data in their file system. Once the user selects the .csv file holding the data, it will be evaluated to see if it is formatted properly or not. If it is not formatted properly, the data will not be used, if it is formatted properly, the data will be used.
### 3.1.1 Loading Data
An internal process will extract metadata from the file which has been selected, including participant, and time. That information will be added to the options to search for participants and date. The user will be able to continue to add biometric data, or remove the biometric data that has been loaded.
Once all the biometric data has been loaded, and all options to filter have been selected, the user will select the option to display the graphs. When this is selected, an internal process will create the graphs based off the parameters supplied, and display them in a second window.
### 3.1.2 Display Info
Within this second window, the user will see all of the requested biometric information in graphs that are stacked vertically, with a scrollbar to see any graphs which might be obscured if too many graphs to fit on one screen are displayed. If a user clicks on one of the graphs, a description of the data will be displayed. They will also be able to zoom in and out, and scroll along the graphs. There will be an interface for selecting an level of aggregation, with the options for a reset, 30 seconds, 1 minute, 5 minutes, 30 minutes, and 1 hour. When a level of aggregation is selected, the graphs will be redisplayed to fit given the current level of aggregation.
### 3.1.3 Query Interface
There will be a query interface, which when selected, will open a third window where the user can input a query, with an option to execute the query, or close the window without executing. Selecting either will close the window, but if a query is executed, then the data will be displayed in the graphs according to the query which has just been written.
### 3.1.4 Time Axis
There will also be a time box created above all of the graphs on the second window, which can be manipulated via mouse to zoom in and slide along the axis of all graphs.
There will be a timezone button which when selected, will toggle between displaying data from the perspective of the local time zone of the users computer, or display the timezone from the metadata which has been collected previously.
### 3.1.5 Mockups

*Figure 3.1.5.1: Mockup of the graph window, with the sidebar open*
<br>

*Figure 3.1.5.2: Mockup of the import data window*
<br>
## 3.2 Class/Object Diagram
```graphviz
digraph obj
{
bgcolor="transparent"
node[
shape=Mrecord
style=filled
color="#bda9ea"
fillcolor="#ececff"
fontname=Helvetica
fontsize=8
fontcolor="#3b0053"];
edge [color=black, penwidth=0.4 arrowsize=0.7]
rankdir="TD";
TermProject [label="{TermProject
|
current_window: Window
|
display_main()
|
Initialize the project, \n and create the main window.
}"];
ImportWindow [label = "{ImportWindow
|
No attributes
|
search_system() \n
user_button_callback() \n
lower_time_callback() \n
upper_time_callback() \n
display_graphs() \n
|
Allow the user to pick the .csv \n
from the file system, and specify \n
simple filters to the data \n
before opening them in the graph view.
}"];
MainWindow [label = "{MainWindow
|
No attributes
|
reset_view() \n
aggregate_view() \n
timezone_toggle() \n
exec_query() \n
timebox_display() \n
|
Display biometric data in a pleasing\n
way, allow the user to further query,\n
aggregate, and zoom in on data. \n
}"];
DataHandler [label = "{DataHandler
|
database: sqlite3.Connection \n
cursor: sqlite3.Cursor \n
csv_path: str \n
|
is_valid_csv(file_path) \n
create_database() \n
|
Handle the data, and allow the user to\n
query the data in a variety of ways.
}"];
TimeBox [label = "{TimeBox
|
lower_bound: datetime \n
upper_bound: datetime \n
|
No operations
|
This class will represent the custom time\n
box PyQT6 widget. It will basically act like\n
a slider with two nobs that collide with\n
eachother, where each value is a date time.
}"];
PlotHandler [label = "{PlotHandler
|
time_range \n
plot_height \n
moving_average_seconds \n
aggregation_interval \n
max_horizontal_marker_count \n
max_vertical_marker_count \n
horizonatal_marker_interval \n
vertical_marker_interval \n
|
add_plot(plot) \n
add_plots(plots) \n
clear_plots() \n
erase_plots() \n
get_plot(index) \-\> plot \n
plot_count() \-\> int \n
regenerate_plots() \n
remove_plot(plot) \n
remove_plot_at(index) \n
set_aggregation_interval(interval) \n
set_moving_average(moving_average) \n
set_plot_height(height) \n
set_time_range(time_range) \n
|
This class handles the synchronization \n
between all the plots and ensures their styles\n
and positioning stays the same.
}"];
TermProject -> MainWindow
MainWindow -> ImportWindow
TimeBox -> MainWindow
DataHandler -> MainWindow
MainWindow -> DataHandler
ImportWindow -> DataHandler
TermProject -> ImportWindow
MainWindow -> PlotHandler
}
```
### 3.2.1 - TermProject Class
Initialize the project, and create the main window.
**Attributes:**
`current_window: Window`
*Represents the window in which the data will be visualized on.*
**Functions:**
`display_main()`
*Displays the main window.*
### 3.2.2 - ImportWindow Class
Allow the user to pick the .csv from the file system, and specify simple filters to the data before opening them in the graph view
**Functions:**
`search_system() -> string`
*Opens an explorer window to allow the selection of a file.*
`user_button_callback()`
*A function that handles interaction with the user button*
`lower_time_callback()`
*A function that handles interaction with the lower bound time selector*
`upper_time_callback()`
*A function that handles interaction with the upper bound time selector*
`display_graphs()`
*Imports data and returns back to the main window*
### 3.2.3 - MainWindow Class
Display biometric data in a pleasing way, allow the user to further query, aggregate, and zoom in on data.
**Functions:**
`reset_view()`
*Removes all aggregate functions, and query effects from the graphs, resets them to their original position*
`aggregate_view()`
*Sets a level of aggregation for the graphs to be displayed*
`timezone_toggle()`
*Swaps between whether the information is displayed using local timezone information, or UTC*
`exec_query()`
*Executes the query needed to filter the information in the graphs, and applies the change to the graphs*
`timebox_display()`
*Apply any change in the timebox range to the graphs.*
### 3.2.4 - DataHandler Class
This class handles the loading and querying of the SQL database.
**Attributes:**
`database: sqlite3.Connection`
*The connection to the database.*
`cursor: sqlite3.Cursor`
*The object used to actually fetch items from the database.*
`csv_path: string`
*The path to the csv file to import.*
**Functions:**
`is_data_valid(file_path) -> bool`
*Checks to see if data entered is valid, returns true/false.*
`create_database(file_path)`
*Creates a database using the imported data from filepath.*
### 3.2.5 - TimeBox
This class will represent the custom time box PyQT6 widget. It will basically act like a slider with two knobs that collide with each other, where each value is a date time.
**Attributes:**
`lower_bound: DateTime`
*Represents the lower time value in the range to be displayed.*
`upper_bound: DateTime`
*Represents the upper time value in the range to be displayed.*
### 3.2.6 - PlotHandler Class
This class handles the synchronization between all the plots and ensures their styles and positioning stays the same.
**Attributes:**
`time_range`
*Represents the range of time shown by the plot.*
`plot_height`
*Represents the distance from the bottom of the plot to the top.*
`moving_average_seconds`
*The number of seconds in the time window.*
`aggregation_interval`
*The interval by which the data in the plot is combined.*
`max_horizontal_marker_count`
*The largest value label of the markers on the x-axis.*
`max_vertical_marker_count`
*The largest value label of the markers on the y-axis.*
`horizontal_marker_interval`
*The interval between markers on the x-axis.*
`vertical_marker_interval`
*The interval between markers on the y-axis.*
**Functions:**
`add_plot(plot)`
*Adds a new plot to be managed and synced.*
`add_plots(plots)`
*Adds a list / array of plots to be managed.*
`clear_plots()`
*Clears the visual part of the plot but keeps the data associated with each graph.*
`erase_plots()`
*Clears the data associated with a graph.*
`get_plot(index) -> plot`
*Returns a plot by insertion-ordered index.*
`plot_count() -> int`
*Returns the number of plots being handled.*
`regenerate_plots()`
*Completely regenerates all plots from thair base data.*
`remove_plot(plot)`
*Removes a plot from the handler, does not destroy the graph or it's visuals.*
`remove_plot_at(index)`
*Removes plot at the index specified.*
`set_aggregation_interval(interval)`
*Sets the interval by which the data in the plot is combined.*
`set_moving_average(moving_average)`
*Sets the number of seconds in the time window.*
`set_plot_height(height)`
*Sets the length of the distance from the bottom of the plot to the top.*
`set_time_range(time_range)`
*Sets the range of time to be shown on the plot.*
## 3.3 Performance Requirements
The Term Project will require a single terminal, and mouse and keyboard io. Only a single user will be expected to use this program at a time. This will not be time intensive.
## 3.4 Logical Database Requirements
A database might be used for this project. When the user selects biometric data, that data will be loaded into a sqlite database which is built on the fly. More biometric data will be inserted as the user puts it in, and then that user will query the database, or the functions which pull data to display graphs will query the database. The database will be destroyed and rebuilt as needed, with no functional limit to size. There will be no personally identifying information, so security will not be a primary concern. The database will be hosted locally.
## 3.5 Design Constraints
There are no design constraints, as long as a computer has functioning IO and the ability to search its own file system, this Term Project will function.
## 3.6 Software System Attributes
This application is not going to require any maintenance, it is standalone. It will not receive any updates from the developers, as the data will not be at risk. Even though it is biometric, there is no identifying information, and the information will not be put in any more vulnerable position given the program's use. It will not be connected to the internet, it will run when the user executes it, and be terminated afterward. It doesn’t require many system resources, and is not expected to cause any significant slowdowns. It is an at-will use program that does not keep persistent data. It will be written in python, and can be run on many different platforms.
## 3.7 Specific Requirements Analysis
| Requirement | 1 | 2 | 3 | 4 | 5 |
|:---------------------------- |:---:|:---:|:---:|:---:|:---:|
| Load User Data | | | | | x |
| Select Filters | | | | | x |
| Load Time Zone Info | | | | | x |
| Switch between UTC and local | | | | x | |
| Sync Time Series | | | | | x |
| Zoom in on data | | | | x | |
| Time Box Visual | | | | x | |
| Aggregate Data | | | | x | |
| Description of Data | | | x | | |
| Query Interface | | x | | | |
| Analyze Data Correlations | x | | | | |
| Mine Patterns | x | | | | |
## 3.8 State Transition Diagram
```mermaid
flowchart LR
Start --> import{Import?}
import -- button pressed --> pick([Pick File])
pick --> valid{Is Valid?}
valid -- yes --> append([Append Database]) --> import
Start --> hasData{Has Data?}
hasData -- no --> hasData
hasData -- yes --> gen([Generate Graphs])
gen --> settings{UI/Settings Changed?}
settings -- yes --> gen
settings -- no --> settings
```