Skip to content

StatisticalReinforcementLearningLab/Oralytics-RL-Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oralytics-RL-Service

This is the backend code for the RL algorithm used in the Oralytics clinical trial. The RL algorithm in Oralytics optimizes the delivery of engagement prompts to participants to maximize their brushing quality (or oral self-care behaviors). For more information about Oralytics, please see the following papers:

Citing Our Code

If you use our code or algorithm in anyway, please cite us:

@article{trella2022designing,
  title={Designing reinforcement learning algorithms for digital interventions: pre-implementation guidelines},
  author={Trella, Anna L and Zhang, Kelly W and Nahum-Shani, Inbal and Shetty, Vivek and Doshi-Velez, Finale and Murphy, Susan A},
  journal={Algorithms},
  volume={15},
  number={8},
  pages={255},
  year={2022},
  publisher={MDPI}
}
@inproceedings{trella2023reward,
  title={Reward design for an online reinforcement learning algorithm supporting oral self-care},
  author={Trella, Anna L and Zhang, Kelly W and Nahum-Shani, Inbal and Shetty, Vivek and Doshi-Velez, Finale and Murphy, Susan A},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  volume={37},
  number={13},
  pages={15724--15730},
  year={2023}
}

Creating MySQL Data Tables

  1. Make sure you have mysql installed locally (video here).
  2. Run brew services start mysql to initialize.
  3. To check that mysql works, try: mysql -u root
  4. Create two databases (one for local dev, one for unit testing). Ex: CREATE DATABASE local; CREATE DATABASE test_data;
  5. To connect to MySQL data tables, open the file and change the fields in database/database_connector.py: host="", user="", password="", database=""

then run database/python3 create_data_tables.py

MySQL Data Tables to Pandas Dataframe

For readibility of data tables, run python3 database/mysql_to_df.py to turn all MySQL data tables to csv files and Pandas Dataframe pickles.

Running Unit Tests

python3 -m unittest discover tests will run all unit tests in the tests/ folder.

Flask Mail

Flask-Mail is a package that needs to be downloaded. If you do not already have flask_mail installed, try: pip3 install --user Flask-Mail

Locally Testing Flask

This flask app was built using version 2.3.2.: https://flask.palletsprojects.com/en/2.3.x/patterns/packages/. If this is the first time running the flask app, you need to tell Flask where the application instance is: export FLASK_APP=rl_ohrs

Then install and run the application: pip3 install -e . Then run either: python3 -m flask run or flask run depending on your system.

About

Backend service for the RL Algorithm for Oralytics. Dependency API calls and configuration values are not present for privacy.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages