3 Methodology » History » Version 23
Version 22 (Ana Sofia Sousa, 12/01/2024 17:56) → Version 23/42 (Ana Sofia Sousa, 12/01/2024 18:12)
h1. 3 Methodology
h2. 3.1. App Structure
h3. 3.1.1. Use Cases Diagram
In the Figure bellow is the developed Use Cases Diagram that represents the possible interactions of different actors (User, Vital Jacket, Data System and Doctor) within the system. This diagram shows the requirements for the development of the app.
p=. !UseCasesDiagram.png!
Figure 3.1.1.1. Use Cases Diagram.
h3. 3.1.2. Activity Workflow Diagram
h3. 3.2.1. Step Counting
The steps are counted based on changes in the accelerometer data, specifically, the magnitude of acceleration. Here's how the step counting logic works:
The magnitude of the current accelerometer data (x, y and z axis) is calculated using the Euclidean norm: Magnitude = sqrt(x^2 + y^2 + z^2). Then, the difference between the current magnitude and the previous magnitude is calculated: MagnitudeDelta = Magnitude - MagnitudePrevious.
If MagnitudeDelta is between 15 and 90, it is considered a potential step, and the stepCount is incremented. Also, if MagnitudeDelta is greater than 90, it is considered a potential step, and the stepCount is incremented. However, if MagnitudeDelta is not in the specified ranges, it indicates no movement, and the notMovingCounter is incremented.
The notMovingCounter keeps track of consecutive accelerometer readings indicating no movement. If this counter exceeds a threshold (15 in this case), it sets the status to 0, indicating no movement.
In summary, steps are counted when there is a significant change in the accelerometer data's magnitude, and consecutive readings indicating no movement trigger a reset of the status. The stepCount variable holds the cumulative count of steps.
h2. 3.3. App Design and Functionalities
UI/UX...
The color pallet used in the developed app consists of a dark theme with orange and red details to capture the user's attention.
...
h3. Login and Sign Up Pages LoginActivity
When the user opens the app, he encounters the Login Page. Here, In this activity, the user can fill in his username and password to enter the app app, accessing the ACTIVITY or, if they don't have an account yet, click on the sign up signup button to register. If By clicking on this button, the user is sent to SignUpActivity. In this activity, if the user types in credentials that do not exist, the message "User not found!" is shown.
When
h3. SignUpActivity
In this activity, the user clicks on the button to sign up in the Login Page, he is sent to the Sign Up Page. Here, the user can create an account by choosing an username and a password. When the user clicks on the sign up button, he enters the app, and is sent to the Login Page. Activity. There is also the possibility of clicking on the login button to go back to the LoginActivity if the user is already registered. registerd. When a new user is added, an user ID userId is created that is used in the following activities.
p=. !--!
Figure 3.3.1. Use Cases Diagram.
h3. How to Use Page BluetoothService?
After logging in or signing up, the user enters the app, where first the How to Use Page, a scrollable page, ACTIVITY_INTERMIDIATE is shown. Here, In this activity, there is an explanation of the app usage, where the main features are described. First, the bluetooth connection to the Vital Jacket can be performed, where the user is aided with pop-ups. Once and then, once this connection is completed, by clicking the button user is sent to continue. If the user has already used the app, when MainActivity by clicking the button to continue, the Home Page will appear.
button.
Explicar cenas conexão bluetooth......BioLib aqui?
h3. Home Page MainActivity
In the Home Page, data obtained from the present day is shown. Here, the walked distance, burnt calories and a progress bar are displayed. The progress bar This activity shows a percentage of the steps taken, being the previously set step goal the maximum value where the bar is full (100%): progress bar value = (taken steps x 100) / step goal. If the user takes more steps than the defined step goal, the progress bar remains at 100%.
In this page, a bottom navigation bar can be seen. This allows the user with options to travel to the other four pages, Statistics, Profile, Calendar and Settings five pages by clicking on the desired icon. icons. This bar is also present shown in those pages.
Also, when the user achieves the step goal, a celebrative animation appears on the screen all of the app.
h3. Statistics Page
The app's Statistics Page displays a dynamic graph illustrating fragments so, at any time, the user's step count over the past week, offering a clear visual representation of their physical activity progression.
h3. Profile Page
In the Profile Page, the user can choose navigate between the goals he wants to accomplish by choosing the desired steps, calories burnt, walked distance or spent time through the number pickers. By clicking on the save button, the user's data is stored in the database under the user ID. If the user leaves this page before saving the desired goals, these values will not be stored, settings, profile, home, statistics, and won't appear once the Profile Page is opened again. While this page is not filled in, the app assumes default values for the goals.
h3. Calendar Page
In the Calendar Page, a monthly calendar is shown. The progress bar, walked distance and burnt calories from the present day are presented. The user has the possibility of choosing pages.
falar de stepCounterService + fragments?
Começa logo o stepCounterservice ptt começa logo a different month or day, where the same information is displayed.
contar os passos?
//faz sentido fazer isto assim ou faz + sentido explicar a conexão bluetooth e aquisição de dados antes do LogoActivity?
h3. Settings Page SettingsFragment
The first time After the user opens Main Activity, the app, after the How to Use Page, the user is sent to Settings Page, the page where he can fill in his information, so that the calculations performed later regarding the walked distance, for example, can be adequate adequated to the user's characteristics. Here, the user can choose their weight, age and height through the displayed number pickers and the gender through the radio buttons. When the user clicks on the save button, this data is stored in the database under the user's ID. Id. If the information required on this page is not filled in, the app assumes default values for the user's settings. Also, if the user decides to leave this page fragment before saving the desired settings, these this values will not be stored, and won't appear once the Settings Page this activity is opened again. After this, the user can click on the bar in the bottom to travel to any activity fragment they desire.
//meter prints da db?
h3. Notifications ProfileFragment
When a In this fragment, the user reaches can choose the number of goals he wants to accomplish by choosing the desired steps, calories burnt, walked distance walked or calories burned they define as their goal, a notification spent time through the number pickers. In resemblance to the SettingsFragment, by clicking on the save button, the user's data is sent stored in the database under the user Id. Also, simmilarly to the mobile phone congratulating SettingsFragmment, if the user on leaves the achievement. The NotificationCompat.Builder was used. fragment before saving the desired goals, this values will not be stored, and won't appear once this fragment is opened again. While this page is not filled in, the app assumes default values for the goals.
//meter prints da db?
h2. 3.4. Implementation (java files)
h3. BluetoothService HomeFragment
h3. MyContentProvider
h3. StepCounterService
h3. MainActivity
In this fragment, data obtained from the present day is shown. Here, the walked distance, burnt calories and a progress bar are presented. The MainActivity activity not only starts progress bar shows a percentage of the StepCounterService but also allows steps taken, being the previously set step goal the maximum value where the bar is full (100%): progress bar value = (taken steps x 100) / step goal.
As the user approaches and achieves his step goals, notifications are sent, to navigate between pages using motivate the navigation bar user.
...falar sobre notificações...
Also, when the user achieves the step goal, a celebration animation appears on the bottom screen of every page. the app.
....falar sobre a animação - saber se funciona 1º
h3. StatisticsFragment
When the user clicks on the statistics icon in the bottom navigation bar, ......
h3. CalendarFragment
When the user clicks on the calendar icon in the bottom navigation bar, ....
h3. DatabaseHelper
To allow storing saving and retrieving the necessary data in the app, a database helper was this file is used to manage and interact with a SQLite database by database. //by providing methods for tasks such as initializing the database, inserting data, updating records, and retrieving information. information?
In the DatabaseHelper.java this file, the database is in initialized, three tables 'users', 'Data', and 'ACCDataTable' are created and some default data is inserted.
The users table consists of the information from the Login/Sign Up, Settings and Profile, more precisely: the user ID, username, password, gender, height, age, weight, step goal, burnt calories goal, time spent goal and walked distance goal.
The AccDataTable table stores the accelerometer data, more precisely the x, y and z values, and the respective timestamp.
The Data table stores the information of the taken steps, calories burnt, walked distance, time spent and the respective date.
esquema da estrutura das tabelas...
The database is upgraded when there is a change in the database version, dropping the existing tables and recreating them with the updated structure.
Regarding the user related operations: The insertUser method inserts a new user into the users table, checking for the availability of the username.
Regarding the operations of the data obtained from the vital jacket: The insert method inserts data into the Data table, including steps, calories, distance, time, and date. The getAll method retrieves data from the Data table, grouping it by date.
Regarding the profile and settings updates: The updateSettings and updateProfile methods update user settings and profiles, respectively, in the users table based on the provided user ID.
Accelerometer Data Operations: The addACCData method inserts accelerometer data into the ACCDataTable table. It also uses a ContentResolver to insert data into a content provider (MyContentProvider).
User ID Retrieval: The getUserIdByUsername method retrieves the user ID based on the given username from the users table.
h3. MyContentProvider?
//se tiver a ver com os dados do VJ por isto depois do bluetooth/main activity
h2. 3.1. App Structure
h3. 3.1.1. Use Cases Diagram
In the Figure bellow is the developed Use Cases Diagram that represents the possible interactions of different actors (User, Vital Jacket, Data System and Doctor) within the system. This diagram shows the requirements for the development of the app.
p=. !UseCasesDiagram.png!
Figure 3.1.1.1. Use Cases Diagram.
h3. 3.1.2. Activity Workflow Diagram
h3. 3.2.1. Step Counting
The steps are counted based on changes in the accelerometer data, specifically, the magnitude of acceleration. Here's how the step counting logic works:
The magnitude of the current accelerometer data (x, y and z axis) is calculated using the Euclidean norm: Magnitude = sqrt(x^2 + y^2 + z^2). Then, the difference between the current magnitude and the previous magnitude is calculated: MagnitudeDelta = Magnitude - MagnitudePrevious.
If MagnitudeDelta is between 15 and 90, it is considered a potential step, and the stepCount is incremented. Also, if MagnitudeDelta is greater than 90, it is considered a potential step, and the stepCount is incremented. However, if MagnitudeDelta is not in the specified ranges, it indicates no movement, and the notMovingCounter is incremented.
The notMovingCounter keeps track of consecutive accelerometer readings indicating no movement. If this counter exceeds a threshold (15 in this case), it sets the status to 0, indicating no movement.
In summary, steps are counted when there is a significant change in the accelerometer data's magnitude, and consecutive readings indicating no movement trigger a reset of the status. The stepCount variable holds the cumulative count of steps.
h2. 3.3. App Design and Functionalities
UI/UX...
The color pallet used in the developed app consists of a dark theme with orange and red details to capture the user's attention.
...
h3. Login and Sign Up Pages LoginActivity
When the user opens the app, he encounters the Login Page. Here, In this activity, the user can fill in his username and password to enter the app app, accessing the ACTIVITY or, if they don't have an account yet, click on the sign up signup button to register. If By clicking on this button, the user is sent to SignUpActivity. In this activity, if the user types in credentials that do not exist, the message "User not found!" is shown.
When
h3. SignUpActivity
In this activity, the user clicks on the button to sign up in the Login Page, he is sent to the Sign Up Page. Here, the user can create an account by choosing an username and a password. When the user clicks on the sign up button, he enters the app, and is sent to the Login Page. Activity. There is also the possibility of clicking on the login button to go back to the LoginActivity if the user is already registered. registerd. When a new user is added, an user ID userId is created that is used in the following activities.
p=. !--!
Figure 3.3.1. Use Cases Diagram.
h3. How to Use Page BluetoothService?
After logging in or signing up, the user enters the app, where first the How to Use Page, a scrollable page, ACTIVITY_INTERMIDIATE is shown. Here, In this activity, there is an explanation of the app usage, where the main features are described. First, the bluetooth connection to the Vital Jacket can be performed, where the user is aided with pop-ups. Once and then, once this connection is completed, by clicking the button user is sent to continue. If the user has already used the app, when MainActivity by clicking the button to continue, the Home Page will appear.
button.
Explicar cenas conexão bluetooth......BioLib aqui?
h3. Home Page MainActivity
In the Home Page, data obtained from the present day is shown. Here, the walked distance, burnt calories and a progress bar are displayed. The progress bar This activity shows a percentage of the steps taken, being the previously set step goal the maximum value where the bar is full (100%): progress bar value = (taken steps x 100) / step goal. If the user takes more steps than the defined step goal, the progress bar remains at 100%.
In this page, a bottom navigation bar can be seen. This allows the user with options to travel to the other four pages, Statistics, Profile, Calendar and Settings five pages by clicking on the desired icon. icons. This bar is also present shown in those pages.
Also, when the user achieves the step goal, a celebrative animation appears on the screen all of the app.
h3. Statistics Page
The app's Statistics Page displays a dynamic graph illustrating fragments so, at any time, the user's step count over the past week, offering a clear visual representation of their physical activity progression.
h3. Profile Page
In the Profile Page, the user can choose navigate between the goals he wants to accomplish by choosing the desired steps, calories burnt, walked distance or spent time through the number pickers. By clicking on the save button, the user's data is stored in the database under the user ID. If the user leaves this page before saving the desired goals, these values will not be stored, settings, profile, home, statistics, and won't appear once the Profile Page is opened again. While this page is not filled in, the app assumes default values for the goals.
h3. Calendar Page
In the Calendar Page, a monthly calendar is shown. The progress bar, walked distance and burnt calories from the present day are presented. The user has the possibility of choosing pages.
falar de stepCounterService + fragments?
Começa logo o stepCounterservice ptt começa logo a different month or day, where the same information is displayed.
contar os passos?
//faz sentido fazer isto assim ou faz + sentido explicar a conexão bluetooth e aquisição de dados antes do LogoActivity?
h3. Settings Page SettingsFragment
The first time After the user opens Main Activity, the app, after the How to Use Page, the user is sent to Settings Page, the page where he can fill in his information, so that the calculations performed later regarding the walked distance, for example, can be adequate adequated to the user's characteristics. Here, the user can choose their weight, age and height through the displayed number pickers and the gender through the radio buttons. When the user clicks on the save button, this data is stored in the database under the user's ID. Id. If the information required on this page is not filled in, the app assumes default values for the user's settings. Also, if the user decides to leave this page fragment before saving the desired settings, these this values will not be stored, and won't appear once the Settings Page this activity is opened again. After this, the user can click on the bar in the bottom to travel to any activity fragment they desire.
//meter prints da db?
h3. Notifications ProfileFragment
When a In this fragment, the user reaches can choose the number of goals he wants to accomplish by choosing the desired steps, calories burnt, walked distance walked or calories burned they define as their goal, a notification spent time through the number pickers. In resemblance to the SettingsFragment, by clicking on the save button, the user's data is sent stored in the database under the user Id. Also, simmilarly to the mobile phone congratulating SettingsFragmment, if the user on leaves the achievement. The NotificationCompat.Builder was used. fragment before saving the desired goals, this values will not be stored, and won't appear once this fragment is opened again. While this page is not filled in, the app assumes default values for the goals.
//meter prints da db?
h2. 3.4. Implementation (java files)
h3. BluetoothService HomeFragment
h3. MyContentProvider
h3. StepCounterService
h3. MainActivity
In this fragment, data obtained from the present day is shown. Here, the walked distance, burnt calories and a progress bar are presented. The MainActivity activity not only starts progress bar shows a percentage of the StepCounterService but also allows steps taken, being the previously set step goal the maximum value where the bar is full (100%): progress bar value = (taken steps x 100) / step goal.
As the user approaches and achieves his step goals, notifications are sent, to navigate between pages using motivate the navigation bar user.
...falar sobre notificações...
Also, when the user achieves the step goal, a celebration animation appears on the bottom screen of every page. the app.
....falar sobre a animação - saber se funciona 1º
h3. StatisticsFragment
When the user clicks on the statistics icon in the bottom navigation bar, ......
h3. CalendarFragment
When the user clicks on the calendar icon in the bottom navigation bar, ....
h3. DatabaseHelper
To allow storing saving and retrieving the necessary data in the app, a database helper was this file is used to manage and interact with a SQLite database by database. //by providing methods for tasks such as initializing the database, inserting data, updating records, and retrieving information. information?
In the DatabaseHelper.java this file, the database is in initialized, three tables 'users', 'Data', and 'ACCDataTable' are created and some default data is inserted.
The users table consists of the information from the Login/Sign Up, Settings and Profile, more precisely: the user ID, username, password, gender, height, age, weight, step goal, burnt calories goal, time spent goal and walked distance goal.
The AccDataTable table stores the accelerometer data, more precisely the x, y and z values, and the respective timestamp.
The Data table stores the information of the taken steps, calories burnt, walked distance, time spent and the respective date.
esquema da estrutura das tabelas...
The database is upgraded when there is a change in the database version, dropping the existing tables and recreating them with the updated structure.
Regarding the user related operations: The insertUser method inserts a new user into the users table, checking for the availability of the username.
Regarding the operations of the data obtained from the vital jacket: The insert method inserts data into the Data table, including steps, calories, distance, time, and date. The getAll method retrieves data from the Data table, grouping it by date.
Regarding the profile and settings updates: The updateSettings and updateProfile methods update user settings and profiles, respectively, in the users table based on the provided user ID.
Accelerometer Data Operations: The addACCData method inserts accelerometer data into the ACCDataTable table. It also uses a ContentResolver to insert data into a content provider (MyContentProvider).
User ID Retrieval: The getUserIdByUsername method retrieves the user ID based on the given username from the users table.
h3. MyContentProvider?
//se tiver a ver com os dados do VJ por isto depois do bluetooth/main activity