reborn / services /analytics_Service.py
Rogersurf's picture
Initial Reborn version
75759c3
raw
history blame contribute delete
357 Bytes
# app/services/analytics_service.py
import pandas as pd
from data.database import Database
class AnalyticsService:
def __init__(self):
self.db = Database()
def overall_accuracy(self):
df = pd.read_sql_query("SELECT correct FROM answers", self.db.conn)
if df.empty:
return 0
return df["correct"].mean()