Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
Heal_App
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
TMP-23-365
Heal_App
Commits
94b8b3ac
Commit
94b8b3ac
authored
Sep 01, 2023
by
Yomal-Dulanjana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Arduino Data send test-1 Pass
parent
5bafd706
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
ml/app.py
ml/app.py
+31
-0
No files found.
ml/app.py
View file @
94b8b3ac
...
...
@@ -26,6 +26,37 @@ thread1.start()
print
(
"test"
)
@
app
.
route
(
'/record'
,
methods
=
[
'POST'
])
def
record
():
data
=
request
.
get_json
()
temperature
=
data
[
'temperature'
]
# Heart Rate
bpm
=
data
[
'bpm'
]
spo2
=
data
[
'spo2'
]
# temperature = random.uniform(29, 38)
# temperature = round(temperature, 2)
# bpm = random.randint(60, 100)
# spo2 = random.randint(80, 110)
print
(
temperature
,
bpm
,
spo2
)
health_collection
=
db
[
'health'
]
health_document
=
{
"HeartRate"
:
bpm
,
"BloodOxygenLevel"
:
spo2
,
"BodyTemperature"
:
temperature
,
"created_at"
:
datetime
.
now
(),
"updated_at"
:
datetime
.
now
()
}
health_collection
.
insert_one
(
health_document
)
return
Response
(
response
=
json
.
dumps
({
"status"
:
"success"
,
"records"
:
"Recieved"
}),
status
=
200
,
mimetype
=
"application/json"
)
if
__name__
==
"__main__"
:
app
.
run
(
debug
=
True
,
...
...
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