Evolving Clinical Practice by Tapping into the Power of Personicle
Wearable technology has begun to see an explosion in adaptability over the last decade, both in public and in …
Authors: Tirth Patel and Zara Ahmed
Personicle is a Mobile App which in its current form collects and processes the location, place, mobile device-specific measures like Calendar, Ambient Light, phone usage, and measures like Heart Rate, Activity Level, and Sleep from wearable devices like Fitbit or smartwatches. The first release uses Android phones and Fitbit devices; soon iOS and other smart wearables will be used. Currently, data is collected at every 5-minute interval to create activities and events, that may be used by health systems.
Personalization requires precise personal models; however, every individual is unique. The story of their life is comprised of events at various granularities in time and space. Personal chronicle, aka Personicle, captures this story through these events. Generally, for modeling a person, one requires five event streams: Daily Life Events, Personal Events, Personal Biological Events, Social Events related to the person, and Environmental Events around the person.
Charles Boicey and Ramesh Jain Quotes
Users can interact with and manage their Personicle accounts via a Personicle web application. This application is built using the Ruby on Rails platform. In this article, “Instantiating Personicle Infrastructure on Your Own Device”, we will discuss the steps required for hosting this application. It is a guide for 3rd party developers on how to access user data for their applications. It covers all the installation instructions they will need for running Personicle on their own system.
A Personicle is a chronicle of all events for the person. These events will be used to build their ‘model’ for understanding the underlying causes for various health outcomes: such as what caused the food allergy, or what resulted in major emotional upset. Such a model combined with their current situation(s), may help in the prediction of future situations as well as ways to prevent those situations. For each person, there will be a core Personicle that is developed through data being inputted from various application. Different applications may add a greater variety of data sources, events, and algorithms to extract more relevant information that will then be added to their core Personicle allowing for a transparent automation of inputs.
Personicle uses a number of open source projects to work on the front end application:
Clone the Personicle repo from https://github.com/ClearsenseData/personicle-rails.git
Execute the following commands one by one to install Ruby 2.6.1.
Script to install the NodeSource Node.js 12.x repo onto a Debian or Ubuntu system. Run as root or insert sudo -E
before bash
:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash –
Script to install Yarn in Ubuntu.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
Installation and updating of software in our system for additional dependencies.
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev \
sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev dirmngr gnupg \
apt-transport-https ca-certificates nodejs yarn
Install rbenv for ruby version management (Instruction for Linux). Use rbenv to pick a Ruby version for your application and guarantee that your development environment matches production. Put rbenv to work with Bundler for painless Ruby upgrades and bulletproof deployments. rbenv intercepts Ruby commands using shim executables injected into your PATH, determines which Ruby version has been specified by your application, and passes your commands along to the correct Ruby installation.
Clone the rbenv/rbenv github repository.
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Adds ~/.rbenv/bin
to the PATH environment variable. This allows the user to run executables from this location without needing to type out the whole path. Next, add ~/.rbenv/bin
to your $PATH so that you can use the rbenv command line utility. Do this by altering your ~/.bashrc file
so that it affects future login sessions:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
Then, add the command eval “$(rbenv init -)” to your ~/.bashrc file so rbenv loads automatically:
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
ruby-build is a command-line utility that makes it easy to install virtually any version of Ruby, from source. It is available as a plugin for rbenv that provides the rbenv install command, or as a standalone program. Clone the rbenv/ruby-build repository. (rbenv/ruby-build: Compile and install Ruby – GitHub)
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Add /.rbenv/plugins/ruby-build/bin
to your $PATH for access to the rbenv command-line utility. For bash: Ubuntu Desktop users should configure ~/.bashrc: (Seamlessly manage your app’s Ruby environment with rbenv)
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
rbenv-vars is a plugin for rbenv that lets you set global and project-specific environment variables before spawning Ruby processes. Clone the repository for rbenv/rbenv-vars.
git clone https://github.com/rbenv/rbenv-vars.git ~/.rbenv/plugins/rbenv-vars
The exec command replaces the current process image - the executable or program - with a new one, named as the argument to exec. If $SHELL contains the name of an executable, as it usually does, exec will spin that exe up in place of the running shell.
exec $SHELL
Install Rbenv
rbenv install 2.7.1
rbenv global2.7.1
Check ruby version using: ruby –v
gem install bundler
Check bundler version using: bundle – v
rbenv rehash
and try again (bundle –v
)Install Rails using: gem install rails –v 6.0.3
In terminal, run:
git clone https://github.com/ClearsenseData/personicle-rails.git
cd personicle-rails
bundle install
npm install
cd config
touch application.yml
It is advises to install WSL (Windows subsytem for linux ) as Ruby dependencies works best on linux.
Install WSL
Open powershell as administrator and run the below command
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Install Ubuntu from Microsoft Store: (https://apps.microsoft.com/store/detail/ubuntu-on-windows/9NBLGGH4MSV6?hl=en-us&gl=US)
Install Rbenv and Ruby
Check if homebrew is installed:
Brew --version
If homebrew is not installed on your mac, install it using the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Installing rbenv and ruby
Brew update && brew upgrade
To check for issues with homebrew:
Brew doctor
Installation might take a while:
Brew install rbenv
Rbenv init
You might see the following message on running the above command:
Load rbenv automatically by appending the following to ~/.zshrc:
eval "$(rbenv init -)"
If you see ~/.zshrc
at the end of second line, run:
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
If you see ~/.bash_profile at the end of second line, run:
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Install ruby using rbenv (2.7.1 is the ruby version)
rbenv install 2.7.1
Make this version global:
rbenv global 2.7.1
Rbenv rehash
reopen the terminal and check the correct version of ruby is installed using:
ruby –v
Install rails:
Gem install rails –v 6.0.3
Rbenv rehash
Check if correct rails version is installed using:
rails -v
Personicle has different backend services that are used by the personicle frontend application. To run your own personicle, these services need to configured and run along with the front-end application.
Personicle uses Okta for user identity and access management. It uses OAuth 2.0 authorization code flow. An Okta app integration needs to be created. Follow instructions https://developer.okta.com/docs/guides/implement-grant-type/authcode/main/ to create OIDC app integration.
client_id
and client_secret
.config/application.yml.test
(https://github.com/ClearsenseData/personicle-rails/blob/main/config/application.yml.test) to application.yml
and include your secrets here.PHYSICIAN_GROUP_ID
in the application.yml
file.GET_USER_GROUP_TOKEN
in application.yml
.GOOGLE_IDP
in application.yml
.Once all the secrets are configured and dependencies are installed, run:
Rails db:migrate
For running in development and production:
‘Rails s’
to start the application in development mode on http://localhost:3000
To run the application in production mode:
postgresql database
and add its config to application.yml
file.database.yml
file and comment lines 23-26.RAILS_ENV=production rails db:migrate
RAILS_ENV=production rails s
Wearable technology has begun to see an explosion in adaptability over the last decade, both in public and in …
This article is the third article in our article series titled “Wearable Devices for Lifestyle and Medical Monitoring”. …