Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ActivityTracker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
willm3
ActivityTracker
Merge requests
!9
Introduce SQL client, commit activity to db
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Introduce SQL client, commit activity to db
wmalisch/dev
into
main
Overview
2
Commits
1
Pipelines
0
Changes
4
Merged
willm3
requested to merge
wmalisch/dev
into
main
8 months ago
Overview
2
Commits
1
Pipelines
0
Changes
4
Expand
Created by: wmalisch
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
ec228b3d
1 commit,
8 months ago
4 files
+
39
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/Activity.py
+
10
−
2
Options
from
sense_hat
import
SenseHat
from
scipy.signal
import
find_peaks
from
sqlite_db_client
import
SQLiteDBClient
from
pathlib
import
Path
import
numpy
as
np
import
time
import
csv
from
pathlib
import
Path
class
Activity
:
def
__init__
(
self
,
sense
):
self
.
sense
=
sense
self
.
db_client
=
SQLiteDBClient
(
'
Activity.db
'
)
self
.
db_client
.
connect
()
def
record
(
self
):
@@ -58,7 +62,11 @@ class Activity:
steps
,
_
=
find_peaks
(
magnitudes
,
height
=
(
std_dev
+
mean
))
print
(
len
(
steps
))
# TODO: Update mongodb or some other database system
# Update SQLite database with the recorded activity
end_date
=
time
.
strftime
(
'
%Y-%m-%d
'
)
end_time
=
time
.
strftime
(
'
%H:%M:%S
'
)
steps_count
=
len
(
steps
)
self
.
db_client
.
update_activity_entry
(
timestamp
,
end_date
,
end_time
,
steps_count
)
return
True
Loading