Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EmidWife-New
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-24-005
EmidWife-New
Commits
de015c32
Commit
de015c32
authored
May 21, 2024
by
Isura Eranda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new
parent
94ea193e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29865 additions
and
15513 deletions
+29865
-15513
package-lock.json
package-lock.json
+18445
-8658
package.json
package.json
+4
-1
src/screens/home/exercise/ExerciseActionView.js
src/screens/home/exercise/ExerciseActionView.js
+147
-568
src/screens/home/exercise/ExercisesProgress.js
src/screens/home/exercise/ExercisesProgress.js
+51
-3
src/screens/home/exercise/HealthFormExercise.js
src/screens/home/exercise/HealthFormExercise.js
+31
-2
src/screens/home/exercise/cloudinary.js
src/screens/home/exercise/cloudinary.js
+10
-0
src/services/exercises/index.js
src/services/exercises/index.js
+13
-0
yarn.lock
yarn.lock
+11164
-6281
No files found.
package-lock.json
View file @
de015c32
This diff is collapsed.
Click to expand it.
package.json
View file @
de015c32
...
@@ -19,11 +19,14 @@
...
@@ -19,11 +19,14 @@
"
@react-navigation/native
"
:
"
^6.1.17
"
,
"
@react-navigation/native
"
:
"
^6.1.17
"
,
"
@react-navigation/stack
"
:
"
^6.3.29
"
,
"
@react-navigation/stack
"
:
"
^6.3.29
"
,
"
axios
"
:
"
^1.6.8
"
,
"
axios
"
:
"
^1.6.8
"
,
"
cloudinary
"
:
"
^2.2.0
"
,
"
cloudinary-react-native
"
:
"
^1.0.0
"
,
"
formik
"
:
"
^2.4.6
"
,
"
formik
"
:
"
^2.4.6
"
,
"
metro-react-native-babel-preset
"
:
"
^0.77.0
"
,
"
metro-react-native-babel-preset
"
:
"
^0.77.0
"
,
"
moment
"
:
"
^2.30.1
"
,
"
moment
"
:
"
^2.30.1
"
,
"
react
"
:
"
18.2.0
"
,
"
react
"
:
"
18.2.0
"
,
"
react-native
"
:
"
0.73.6
"
,
"
react-native
"
:
"
0.73.6
"
,
"
react-native-chart-kit
"
:
"
^6.12.0
"
,
"
react-native-circular-progress
"
:
"
^1.4.0
"
,
"
react-native-circular-progress
"
:
"
^1.4.0
"
,
"
react-native-circular-progress-indicator
"
:
"
^4.4.2
"
,
"
react-native-circular-progress-indicator
"
:
"
^4.4.2
"
,
"
react-native-gesture-handler
"
:
"
^2.16.2
"
,
"
react-native-gesture-handler
"
:
"
^2.16.2
"
,
...
@@ -41,7 +44,6 @@
...
@@ -41,7 +44,6 @@
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@babel/core
"
:
"
^7.20.0
"
,
"
@babel/core
"
:
"
^7.20.0
"
,
"
react-native-image-picker
"
:
"
^7.1.1
"
,
"
@babel/preset-env
"
:
"
^7.20.0
"
,
"
@babel/preset-env
"
:
"
^7.20.0
"
,
"
@babel/runtime
"
:
"
^7.20.0
"
,
"
@babel/runtime
"
:
"
^7.20.0
"
,
"
@react-native/babel-preset
"
:
"
0.73.21
"
,
"
@react-native/babel-preset
"
:
"
0.73.21
"
,
...
@@ -54,6 +56,7 @@
...
@@ -54,6 +56,7 @@
"
eslint
"
:
"
^8.19.0
"
,
"
eslint
"
:
"
^8.19.0
"
,
"
jest
"
:
"
^29.6.3
"
,
"
jest
"
:
"
^29.6.3
"
,
"
prettier
"
:
"
2.8.8
"
,
"
prettier
"
:
"
2.8.8
"
,
"
react-native-image-picker
"
:
"
^7.1.1
"
,
"
react-test-renderer
"
:
"
18.2.0
"
,
"
react-test-renderer
"
:
"
18.2.0
"
,
"
typescript
"
:
"
5.0.4
"
"
typescript
"
:
"
5.0.4
"
},
},
...
...
src/screens/home/exercise/ExerciseActionView.js
View file @
de015c32
This diff is collapsed.
Click to expand it.
src/screens/home/exercise/ExercisesProgress.js
View file @
de015c32
...
@@ -9,20 +9,60 @@ import {
...
@@ -9,20 +9,60 @@ import {
Image
,
Image
,
View
,
View
,
ScrollView
,
ScrollView
,
Button
Button
,
Dimensions
}
from
'
react-native
'
;
}
from
'
react-native
'
;
import
Logo
from
'
../../../assets/icons/progress.svg
'
;
import
Logo
from
'
../../../assets/icons/progress.svg
'
;
import
AsyncStorage
from
'
@react-native-async-storage/async-storage
'
;
import
AsyncStorage
from
'
@react-native-async-storage/async-storage
'
;
import
{
ProgressChart
}
from
"
react-native-chart-kit
"
;
// each value represents a goal ring in Progress chart
const
data
=
{
labels
:
[
"
Session 1
"
,
"
Session 2
"
,
"
Session 3
"
],
// optional
data
:
[
0.4
,
0.0
,
0.0
]
};
const
{
width
}
=
Dimensions
.
get
(
'
window
'
);
const
ExercisesProgress
=
(
props
)
=>
{
const
ExercisesProgress
=
(
props
)
=>
{
const
chartConfig
=
{
backgroundColor
:
"
#e26a00
"
,
backgroundGradientFrom
:
"
#fb8c00
"
,
backgroundGradientTo
:
"
#ffa726
"
,
decimalPlaces
:
2
,
// optional, defaults to 2dp
color
:
(
opacity
=
1
)
=>
`rgba(255, 255, 255,
${
opacity
}
)`
,
labelColor
:
(
opacity
=
1
)
=>
`rgba(255, 255, 255,
${
opacity
}
)`
,
style
:
{
borderRadius
:
16
},
propsForDots
:
{
r
:
"
6
"
,
strokeWidth
:
"
2
"
,
stroke
:
"
#ffa726
"
},
}
return
(
return
(
<
SafeAreaView
style
=
{
styles
.
container
}
>
<
SafeAreaView
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
secondContainer
}
>
<
View
style
=
{
styles
.
secondContainer
}
>
<
Text
style
=
{
styles
.
topTextMain
}
>
ExercisesProgress
<
/Text
>
<
Text
style
=
{
styles
.
topTextMain
}
>
ExercisesProgress
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
thirdContainer
}
>
<
View
style
=
{
styles
.
thirdContainer
}
>
<
Text
>
No
data
found
<
/Text
>
<
ProgressChart
data
=
{
data
}
width
=
{
width
}
height
=
{
220
}
strokeWidth
=
{
16
}
radius
=
{
32
}
chartConfig
=
{
chartConfig
}
hideLegend
=
{
false
}
/
>
<
/View
>
<
View
style
=
{
styles
.
secondContainer
}
>
<
Text
style
=
{
styles
.
topTextMain
}
>
Week
Report
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
secondContainer
}
>
<
Text
style
=
{
styles
.
SecondTextMain
}
>
Not
Found
data
<
/Text
>
<
/View
>
<
/View
>
<
/SafeAreaView
>
<
/SafeAreaView
>
)
)
...
@@ -41,6 +81,7 @@ const styles = StyleSheet.create({
...
@@ -41,6 +81,7 @@ const styles = StyleSheet.create({
flexDirection
:
'
row
'
,
flexDirection
:
'
row
'
,
justifyContent
:
'
space-between
'
,
justifyContent
:
'
space-between
'
,
paddingHorizontal
:
10
,
paddingHorizontal
:
10
,
marginTop
:
20
},
},
topTextMain
:
{
topTextMain
:
{
marginTop
:
15
,
marginTop
:
15
,
...
@@ -49,11 +90,18 @@ const styles = StyleSheet.create({
...
@@ -49,11 +90,18 @@ const styles = StyleSheet.create({
marginLeft
:
10
,
marginLeft
:
10
,
color
:
"
black
"
color
:
"
black
"
},
},
SecondTextMain
:
{
marginTop
:
15
,
fontSize
:
15
,
marginLeft
:
10
,
color
:
"
black
"
},
thirdContainer
:
{
thirdContainer
:
{
alignItems
:
"
center
"
,
alignItems
:
"
center
"
,
textAlign
:
"
center
"
,
textAlign
:
"
center
"
,
height
:
"
30%
"
,
height
:
"
30%
"
,
marginTop
:
"
20%
"
marginTop
:
"
10%
"
,
marginHorizontal
:
20
}
}
})
})
export
default
ExercisesProgress
export
default
ExercisesProgress
\ No newline at end of file
src/screens/home/exercise/HealthFormExercise.js
View file @
de015c32
...
@@ -24,6 +24,28 @@ const HealthFormExercise = (props) => {
...
@@ -24,6 +24,28 @@ const HealthFormExercise = (props) => {
const
[
wearableModalVisible
,
setWearableModalVisible
]
=
useState
(
false
);
const
[
wearableModalVisible
,
setWearableModalVisible
]
=
useState
(
false
);
const
validateInputs
=
(
values
)
=>
{
const
errors
=
{};
if
(
!
values
.
SystolicBP
||
isNaN
(
values
.
SystolicBP
)
||
values
.
SystolicBP
<=
0
||
values
.
SystolicBP
>
180
)
{
errors
.
SystolicBP
=
'
Invalid Systolic Blood Pressure (1-180)
'
;
}
if
(
!
values
.
DiastolicBP
||
isNaN
(
values
.
DiastolicBP
)
||
values
.
DiastolicBP
<=
0
||
values
.
DiastolicBP
>
120
)
{
errors
.
DiastolicBP
=
'
Invalid Diastolic Blood Pressure (1-120)
'
;
}
if
(
!
values
.
Blood_glucose
||
isNaN
(
values
.
Blood_glucose
)
||
values
.
Blood_glucose
<=
0
||
values
.
Blood_glucose
>
18
)
{
errors
.
Blood_glucose
=
'
Invalid Blood Glucose (1-400)
'
;
}
if
(
!
values
.
BodyTemp
||
isNaN
(
values
.
BodyTemp
)
||
values
.
BodyTemp
<=
0
||
values
.
BodyTemp
>
113
)
{
errors
.
BodyTemp
=
'
Invalid Body Temperature (1-45)
'
;
}
if
(
!
values
.
HeartRate
||
isNaN
(
values
.
HeartRate
)
||
values
.
HeartRate
<=
0
||
values
.
HeartRate
>
200
)
{
errors
.
HeartRate
=
'
Invalid Heart Rate (1-200)
'
;
}
return
errors
;
};
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isWearbleDevice
)
{
if
(
isWearbleDevice
)
{
const
databaseRef
=
database
().
ref
(
'
test
'
);
const
databaseRef
=
database
().
ref
(
'
test
'
);
...
@@ -35,7 +57,7 @@ const HealthFormExercise = (props) => {
...
@@ -35,7 +57,7 @@ const HealthFormExercise = (props) => {
console
.
log
(
"
data
"
,
data
);
console
.
log
(
"
data
"
,
data
);
};
};
updateDeviceState
()
updateDeviceState
()
databaseRef
.
on
(
'
value
'
,
onDataChange
);
databaseRef
.
on
(
'
value
'
,
onDataChange
);
return
()
=>
{
return
()
=>
{
...
@@ -54,6 +76,12 @@ const HealthFormExercise = (props) => {
...
@@ -54,6 +76,12 @@ const HealthFormExercise = (props) => {
}
}
const
onSubmit
=
async
(
values
)
=>
{
const
onSubmit
=
async
(
values
)
=>
{
const
errors
=
validateInputs
(
values
);
if
(
Object
.
keys
(
errors
).
length
>
0
)
{
ToastAndroid
.
show
(
Object
.
values
(
errors
).
join
(
'
,
'
),
ToastAndroid
.
LONG
);
return
;
}
let
userDataString
=
await
AsyncStorage
.
getItem
(
'
userData
'
);
let
userDataString
=
await
AsyncStorage
.
getItem
(
'
userData
'
);
let
userData
=
JSON
.
parse
(
userDataString
);
let
userData
=
JSON
.
parse
(
userDataString
);
console
.
log
(
values
)
console
.
log
(
values
)
...
@@ -73,7 +101,7 @@ const HealthFormExercise = (props) => {
...
@@ -73,7 +101,7 @@ const HealthFormExercise = (props) => {
try
{
try
{
await
AsyncStorage
.
setItem
(
'
userData
'
,
JSON
.
stringify
(
userData
));
await
AsyncStorage
.
setItem
(
'
userData
'
,
JSON
.
stringify
(
userData
));
navigation
.
navigate
(
ROUTES
.
EXERCISE_MAIN_MENU
);
navigation
.
navigate
(
ROUTES
.
EXERCISE_MAIN_MENU
);
ToastAndroid
.
show
(
'
userData updated successfully !
'
,
ToastAndroid
.
SHORT
);
ToastAndroid
.
show
(
'
userData updated successfully !
'
,
ToastAndroid
.
SHORT
);
}
catch
(
error
)
{
}
catch
(
error
)
{
ToastAndroid
.
show
(
'
Error updating userData !
'
,
ToastAndroid
.
SHORT
);
ToastAndroid
.
show
(
'
Error updating userData !
'
,
ToastAndroid
.
SHORT
);
}
}
...
@@ -86,6 +114,7 @@ const HealthFormExercise = (props) => {
...
@@ -86,6 +114,7 @@ const HealthFormExercise = (props) => {
ToastAndroid
.
show
(
'
Error updating userData !
'
,
ToastAndroid
.
SHORT
);
ToastAndroid
.
show
(
'
Error updating userData !
'
,
ToastAndroid
.
SHORT
);
}
}
}
}
return
(
return
(
<
SafeAreaView
>
<
SafeAreaView
>
<
Formik
<
Formik
...
...
src/screens/home/exercise/cloudinary.js
0 → 100644
View file @
de015c32
// // cloudinary.js
// import { Cloudinary } from 'cloudinary-core';
// const cloudinary = new Cloudinary({
// cloud_name: 'dehjozc3p',
// api_key: '381783681172934',
// api_secret: '438Ho1zc1fje40TJplqtpj3wzGU'
// });
// export default cloudinary;
src/services/exercises/index.js
View file @
de015c32
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
let
BASE_PATH
=
'
http://16.170.242.186:8080
'
;
let
BASE_PATH
=
'
http://16.170.242.186:8080
'
;
let
SECOND_BASE_PATH
=
'
http://16.171.16.144:8070/api/mother
'
;
let
SECOND_BASE_PATH
=
'
http://16.171.16.144:8070/api/mother
'
;
let
THIRD_BASE_PATH
=
'
http://51.20.73.24:8000
'
;
import
AsyncStorage
from
'
@react-native-async-storage/async-storage
'
;
import
AsyncStorage
from
'
@react-native-async-storage/async-storage
'
;
...
@@ -57,4 +58,16 @@ export let updateDeviceStatus = async (id, deviceStatus) => {
...
@@ -57,4 +58,16 @@ export let updateDeviceStatus = async (id, deviceStatus) => {
}
catch
(
error
)
{
}
catch
(
error
)
{
return
error
return
error
}
}
}
export
let
updatePoseCountStatus
=
async
(
url
,
mode
)
=>
{
try
{
let
value
=
await
axios
.
post
(
THIRD_BASE_PATH
+
'
/video_feed
'
,
{
video_url
:
url
,
exercise_mode
:
mode
})
return
value
;
}
catch
(
error
)
{
return
error
}
}
}
\ No newline at end of file
yarn.lock
View file @
de015c32
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment