Project

General

Profile

3 Methodology » History » Version 13

André Fernandes Gonçalves, 12/01/2024 16:32

1 2 Ana Sofia Sousa
h1. 3 Methodology
2 3 André Fernandes Gonçalves
3 6 Ana Sofia Sousa
h2. 3.1. App Structure
4 1 Ana Sofia Sousa
5 8 Ana Sofia Sousa
h3. 3.1.1. Use Cases Diagram 
6 6 Ana Sofia Sousa
7 6 Ana Sofia Sousa
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. 
8 6 Ana Sofia Sousa
9 7 Ana Sofia Sousa
p=. !----!
10 10 Ana Sofia Sousa
Figure 3.1.1.1. Use Cases Diagram.
11 6 Ana Sofia Sousa
12 1 Ana Sofia Sousa
13 10 Ana Sofia Sousa
h3. 3.1.2. Activity Workflow Diagram 
14 10 Ana Sofia Sousa
15 10 Ana Sofia Sousa
16 10 Ana Sofia Sousa
17 10 Ana Sofia Sousa
18 10 Ana Sofia Sousa
19 10 Ana Sofia Sousa
20 10 Ana Sofia Sousa
21 10 Ana Sofia Sousa
22 10 Ana Sofia Sousa
23 9 Ana Sofia Sousa
h2. 3.2. Algorithms
24 1 Ana Sofia Sousa
25 9 Ana Sofia Sousa
h3. 3.2.1. Step Counting
26 9 Ana Sofia Sousa
27 4 André Fernandes Gonçalves
Having the values from the accelerometer which has a FREQUENCY OF ____, the acceleration from the 3 axis in condensed in the acceleration magnitude:
28 4 André Fernandes Gonçalves
29 4 André Fernandes Gonçalves
mag = sqrt(x^2+y^2+z^2)
30 4 André Fernandes Gonçalves
31 4 André Fernandes Gonçalves
Then, in order to remove the gravitational acceleration, the average acceleration is subtracted:
32 4 André Fernandes Gonçalves
33 4 André Fernandes Gonçalves
netmag = mag - avgmag
34 4 André Fernandes Gonçalves
35 4 André Fernandes Gonçalves
so the netmag represents only the acceleration regarding movement. The algorithm works as follows:
36 1 Ana Sofia Sousa
The time-netmag graph is divided in dynamic 3-sample windows. The values of these samples are tracked and if they are in crescent order, the system registers the first sample as the start of a step. When a value is detected above a pre-defined OR DYNAMIC threshold, all values above that threshold are saved in a vector, PeakVector. When the values of netmag drop below the threshold, the system uses a 2-samples window to track the slope of the magnitude. If the second value is greater than the first, it is considered the start of a new step, thus ending the previous one. Since the PeakVector contains all the values that fall above the step threshold, the maximum value should represent the real peak.
37 6 Ana Sofia Sousa
38 13 André Fernandes Gonçalves
s<vdsb<jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbs<vdsb<jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
39 13 André Fernandes Gonçalves
s<vdsb<jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbs<vdsb<jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbs<vdsb<jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbs<vdsb<jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
40 13 André Fernandes Gonçalves
41 11 Ana Sofia Sousa
h3. 3.2.2.
42 1 Ana Sofia Sousa
43 9 Ana Sofia Sousa
44 9 Ana Sofia Sousa
45 9 Ana Sofia Sousa
46 9 Ana Sofia Sousa
47 9 Ana Sofia Sousa
48 9 Ana Sofia Sousa
h2. 3.3. Design and Functionalities
49 9 Ana Sofia Sousa
50 9 Ana Sofia Sousa
UI/UX...
51 9 Ana Sofia Sousa
52 9 Ana Sofia Sousa
53 9 Ana Sofia Sousa
The color pallet used in the developed app consists of a dark theme with orange and red details to capture the user's attention.
54 9 Ana Sofia Sousa
55 9 Ana Sofia Sousa
56 1 Ana Sofia Sousa
...
57 9 Ana Sofia Sousa
58 9 Ana Sofia Sousa
59 9 Ana Sofia Sousa
60 1 Ana Sofia Sousa
h3. LoginActivity
61 9 Ana Sofia Sousa
62 10 Ana Sofia Sousa
When the user opens the app, he encounters the Login Page. In this activity, the user can fill in his username and password to enter the app, accessing the ACTIVITY or, if they don't have an account yet, click on the signup button to register. 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.
63 9 Ana Sofia Sousa
64 1 Ana Sofia Sousa
65 9 Ana Sofia Sousa
66 9 Ana Sofia Sousa
h3. SignUpActivity
67 9 Ana Sofia Sousa
68 10 Ana Sofia Sousa
In this activity, 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 Activity. There is also the possibility of clicking on the login button to go back to the LoginActivity if the user is already registerd. When a new user is added, an userId is created that is used in the following activities.
69 9 Ana Sofia Sousa
70 9 Ana Sofia Sousa
71 10 Ana Sofia Sousa
72 9 Ana Sofia Sousa
h3. BluetoothService?
73 1 Ana Sofia Sousa
74 10 Ana Sofia Sousa
After logging in or signing up, the user enters the app, where first ACTIVITY_INTERMIDIATE is shown. 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, and then, once this connection is completed, the user is sent to the MainActivity by clicking the button.
75 9 Ana Sofia Sousa
76 9 Ana Sofia Sousa
77 9 Ana Sofia Sousa
Explicar cenas conexão bluetooth......BioLib aqui?
78 9 Ana Sofia Sousa
79 9 Ana Sofia Sousa
80 9 Ana Sofia Sousa
81 9 Ana Sofia Sousa
82 9 Ana Sofia Sousa
h3. MainActivity
83 1 Ana Sofia Sousa
84 10 Ana Sofia Sousa
This activity shows a bottom navigation bar with options to travel to other five pages by clicking on the icons. This bar is shown in all of the fragments so, at any time, the user can navigate between the settings, profile, home, statistics, and calendar pages.
85 9 Ana Sofia Sousa
86 9 Ana Sofia Sousa
87 9 Ana Sofia Sousa
falar de stepCounterService + fragments? 
88 9 Ana Sofia Sousa
Começa logo o stepCounterservice ptt começa logo a contar os passos? 
89 1 Ana Sofia Sousa
90 9 Ana Sofia Sousa
//faz sentido fazer isto assim ou faz + sentido explicar a conexão bluetooth e aquisição de dados antes do LogoActivity?
91 9 Ana Sofia Sousa
92 1 Ana Sofia Sousa
93 9 Ana Sofia Sousa
h3. SettingsFragment
94 9 Ana Sofia Sousa
95 10 Ana Sofia Sousa
After the Main Activity, the user is sent to the page where he can fill his information, so that the calculations performed later regarding the walked distance, for example, can be 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. 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 fragment before saving the desired settings, this values will not be stored, and won't appear once this activity is opened again. After this, the user can click on the bar in the bottom to travel to any fragment they desire.
96 9 Ana Sofia Sousa
97 9 Ana Sofia Sousa
//meter prints da db?
98 1 Ana Sofia Sousa
99 9 Ana Sofia Sousa
100 9 Ana Sofia Sousa
h3. ProfileFragment
101 9 Ana Sofia Sousa
102 10 Ana Sofia Sousa
In this fragment, the user can choose the goals he wants to accomplish by choosing the desired steps, calories burnt, walked distance or spent time through the number pickers. In resemblance to the SettingsFragment, by clicking on the save button, the user's data is stored in the database under the user Id. Also, simmilarly to the SettingsFragmment, if the user leaves the 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.
103 9 Ana Sofia Sousa
104 9 Ana Sofia Sousa
//meter prints da db?
105 9 Ana Sofia Sousa
106 9 Ana Sofia Sousa
107 9 Ana Sofia Sousa
h3. HomeFragment
108 9 Ana Sofia Sousa
109 10 Ana Sofia Sousa
In this fragment, data obtained from the present day is shown. Here, the walked distance, burnt calories and a progress bar are presented. The progress bar 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. 
110 9 Ana Sofia Sousa
As the user approaches and achieves his step goals, notifications are sent, to motivate the user. 
111 9 Ana Sofia Sousa
112 9 Ana Sofia Sousa
...falar sobre notificações...
113 9 Ana Sofia Sousa
114 9 Ana Sofia Sousa
Also, when the user achieves the step goal, a celebration animation appears on the screen of the app. 
115 9 Ana Sofia Sousa
116 10 Ana Sofia Sousa
....falar sobre a animação - saber se funciona 1º
117 9 Ana Sofia Sousa
118 9 Ana Sofia Sousa
119 9 Ana Sofia Sousa
120 9 Ana Sofia Sousa
121 9 Ana Sofia Sousa
122 9 Ana Sofia Sousa
h3. StatisticsFragment
123 9 Ana Sofia Sousa
124 9 Ana Sofia Sousa
When the user clicks on the statistics icon in the bottom navigation bar, ......
125 9 Ana Sofia Sousa
126 1 Ana Sofia Sousa
127 9 Ana Sofia Sousa
h3. CalendarFragment
128 9 Ana Sofia Sousa
129 9 Ana Sofia Sousa
When the user clicks on the calendar icon in the bottom navigation bar, ....
130 9 Ana Sofia Sousa
131 9 Ana Sofia Sousa
132 9 Ana Sofia Sousa
133 9 Ana Sofia Sousa
h3. DatabaseHelper
134 9 Ana Sofia Sousa
135 9 Ana Sofia Sousa
To allow saving and retrieving the necessary data in the app, this file is used to manage and interact with a SQLite database. //by providing methods for tasks such as initializing the database, inserting data, updating records, and retrieving information?
136 9 Ana Sofia Sousa
137 9 Ana Sofia Sousa
In this file, the database in initialized, three tables 'users', 'Data', and 'ACCDataTable' are created and some default data is inserted.
138 9 Ana Sofia Sousa
139 9 Ana Sofia Sousa
esquema da estrutura das tabelas...
140 9 Ana Sofia Sousa
141 9 Ana Sofia Sousa
The database is upgraded when there is a change in the database version, dropping the existing tables and recreating them with the updated structure. 
142 9 Ana Sofia Sousa
143 9 Ana Sofia Sousa
Regarding the user related operations: The insertUser method inserts a new user into the users table, checking for the availability of the username.
144 9 Ana Sofia Sousa
145 10 Ana Sofia Sousa
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.
146 9 Ana Sofia Sousa
147 9 Ana Sofia Sousa
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.
148 9 Ana Sofia Sousa
149 9 Ana Sofia Sousa
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).
150 9 Ana Sofia Sousa
151 9 Ana Sofia Sousa
User ID Retrieval: The getUserIdByUsername method retrieves the user ID based on the given username from the users table.
152 9 Ana Sofia Sousa
153 9 Ana Sofia Sousa
154 9 Ana Sofia Sousa
155 9 Ana Sofia Sousa
h3. MyContentProvider?
156 9 Ana Sofia Sousa
157 9 Ana Sofia Sousa
//se tiver a ver com os dados do VJ por isto depois do bluetooth/main activity