time-fit
A compact framework for constructing time-based Just-In-Time Adaptive Interventions (JITAIs) that utilize the time of day and/or Fitbit data for intervention adaptation.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.4%) to scientific vocabulary
Keywords
Repository
A compact framework for constructing time-based Just-In-Time Adaptive Interventions (JITAIs) that utilize the time of day and/or Fitbit data for intervention adaptation.
Basic Info
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
TimeFit
Project Description
A compact framework for constructing time-based Just-In-Time Adaptive Interventions (JITAIs) that utilize the time of day and/or Fitbit data for intervention adaptation.
Note: This project is periodically updated. Watch the repository for updates.
Citation
If you use this software, please cite it as below. ```
Hung, P-Y, & Newman, M. W. (2025). TimeFit (Version 0.0.1) [Computer software]. https://github.com/MIACollaborative/time-fit
```
Getting Started
The current recommended way to use this framework is to fork the repository and write your own application in the /src/apps folder.
Install the basics
We use yarn as our package manager.
Yarn: https://yarnpkg.com/
Install MongoDB
Instructions: download MongoDB community edition
Create folder for storing data
On Mac, create /data/mdata under the home folder, or ~/data/mdata.
On Windows, create \data\db under the c disk, or c:\data\db.
Run MongoDB
In command line/terminal:
```bash
Mac: create ~/data/mdata folder first, and then run the following command in the terminal:
mongod --port 27017 --dbpath ~/data/mdata --replSet rs0 --bind_ip localhost
Windows: create C:\datea\db folder first, and then run the following command in the terminal:
mongod --port 27017 --dbpath "c:\data\db" --replSet rs0 --bind_ip localhost
```
Install MongoDB GUI
Downlaod MongoDB compass for database GUI (or use command line if you prefer)
Create Collections
You can create collections through MongoDB compass or command line.
- create a database named "time_fit"
Please reference /prisma/schema.prisma for a list of collections (everythign that starts with "model XYZ") to create within the database: * log * users * ...
Configure environment settings
Create a file named ".env" in the root of the project folder with the following content:
```bash
mongodb connection string
DATABASEURL="mongodb://localhost:27017/timefit?readPreference=primary&appname=MongoDB%20Compass&ssl=false&retryWrites=false"
for integration with Fitbit API
FITBITSUBSCRIPTIONVERIFICATIONCODE=[fitbit subscription verification code] FITBITCLIENTID=[fitbit client id] FITBITAUTHTOKEN=[fitbit authentication token] FITBITAUTH_CODE=[fitbit authorization code]
for using Mailjet service to send emails
MAILJETAPIKEY=[mailjet api key] MAILJETSECRETKEY=[mailjet secret key]
for using Twilio service to send SMS/MMS
TWILIOACCOUNTSID=[twilio account id] TWILIOAUTHTOKEN=[twilio authentication token]
```
Install dependency
Run the following command in the project folder.
```bash
yarn install
```
Configure Prisma (for database query)
In addition to the first time, everytime the database schema, /prisma/schema.prisma, is changed, run this command in the project folder.
In a temrinal:
```bash
npx prisma generate
```
Run the default sample application
In a temrinal:
```bash
yarn index
```
Usage examples
Example 1: Nudge users to take a break every 30 minutes during week days
Example 2: Nudge users to take a break every 30 minutes during week days if step count is too low
License
This project is open-sourced under the BSD 3-Clause License, allowing for free use, distribution, and modification with attribution.
Owner
- Name: MIACollaborative
- Login: MIACollaborative
- Kind: organization
- Repositories: 5
- Profile: https://github.com/MIACollaborative
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Hung" given-names: "Pei-Yao" orcid: "https://orcid.org/0000-0002-7415-901X" - family-names: "Newman" given-names: "Mark W." orcid: "https://orcid.org/0000-0001-7186-1383" title: "TimeFit" version: 0.0.1 doi: date-released: 2025-05-27 url: "https://github.com/MIACollaborative/time-fit"
GitHub Events
Total
- Watch event: 4
- Delete event: 8
- Push event: 46
- Public event: 1
- Pull request event: 14
- Create event: 8
Last Year
- Watch event: 4
- Delete event: 8
- Push event: 46
- Public event: 1
- Pull request event: 14
- Create event: 8
Dependencies
- cross-env ^7.0.3 development
- jest ^29.7.0 development
- prisma ^6.5.0 development
- @prisma/client ^6.5.0
- cron-parser ^5.0.6
- json-difference ^1.16.1
- luxon ^3.6.0
- mongodb-memory-server ^10.1.4
- node-notifier ^10.0.1
- seedrandom ^3.0.5
- twilio ^5.5.1
- voca ^1.4.1
- 366 dependencies
- @eslint/eslintrc ^3 development
- cross-env ^7.0.3 development
- eslint ^9 development
- eslint-config-next 15.3.3 development
- jest ^29.7.0 development
- next 15.3.3
- react ^19.0.0
- react-dom ^19.0.0
- cross-env ^7.0.3 development
- jest ^29.7.0 development
- @time-fit/action-collection ^1.0.0
- @time-fit/time-engine ^1.0.0
- 658 dependencies
- cross-env ^7.0.3 development
- jest ^29.7.0 development
- cross-env ^7.0.3 development
- jest ^29.7.0 development
- cross-env ^7.0.3 development
- jest ^29.7.0 development
- cross-env ^7.0.3 development
- jest ^29.7.0 development
- cross-env ^7.0.3 development
- jest ^29.7.0 development