<commit_before>"""
Script that runs the main PowerToken function: poll WEconnect and update Fitbit.
Meant to be run in Crontab, probably every 5-15 minutes.\n
Created by <NAME> on 2/28/2018.\n
Last modified by <NAME> on 3/16/2018.
"""

from datetime import datetime, timedelta
from logging import getLogger, FileHandler, Formatter
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from fitbit import Fitbit
from helpers import get_users_with_current_activities
from models import Base, User, Activity, Log, DB_PATH
from weconnect import WeConnect

# Configures logging for the module
logger = getLogger("background.polling")
logger.setLevel(logging.INFO)
logpath = "/export/scratch/powertoken/data/background.polling.log"
handler = FileHandler(logpath)
handler.setLevel(logging.INFO)
formatter = Formatter("%(asctime)s: %(levelname)-4s - %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)

# Sets up the SQLAlchemy engine and connects it to the Sqlite database. 
engine = create_engine("sqlite:///" + DB_PATH)
Base.metadata.bind = engine<commit_msg>Modified polling script to check progress for all users, not just those who have upcoming activities.<commit_after>"""
Script that runs the main PowerToken function: poll WEconnect and update Fitbit.
Meant to be run in Crontab, probably every 5-15 minutes.\n
Created by <NAME> on 2/28/2018.\n
Last modified by <NAME> on 4/6/2018.
"""

from datetime import datetime, timedelta
from logging import getLogger, FileHandler, Formatter, INFO
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from fitbit import Fitbit
from helpers import get_users_with_current_activities
from models import Base, User, Activity, Log, DB_PATH
from weconnect import WeConnect

# Configures logging for the module
logger = getLogger("background.polling")
logger.setLevel(logging.INFO)
logpath = "/export/scratch/powertoken/data/background.polling.log"
handler = FileHandler(logpath)
handler.setLevel(logging.INFO)
formatter = Formatter("%(asctime)s: %(levelname)-4s - %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)

# Sets up the SQLAlchemy engine and connects it to the Sqlite database. 
engine = create_engine("sqlite:///" + DB_PATH)
Base.metadata.bind = engine
{'fraction_non_alphanumeric': 0.08868501529051988, 'fraction_numerical': 0.01529051987767584, 'mean_word_length': 5.897590361445783, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7181324', 'n_tokens_mistral': 699, 'n_tokens_neox': 656, 'n_words': 233}