23 lines
639 B
Python
23 lines
639 B
Python
from typing import List
|
|
|
|
import pandas as pd
|
|
|
|
from config.models import Call, Participant
|
|
from setup import db_engine, session
|
|
|
|
|
|
def get_call_data(usernames: List) -> pd.DataFrame:
|
|
query_calls = (
|
|
session.query(Call, Participant.username)
|
|
.filter(Participant.id == Call.participant_id)
|
|
.filter(Participant.username.in_(usernames))
|
|
)
|
|
with db_engine.connect() as connection:
|
|
df_calls = pd.read_sql(query_calls.statement, connection)
|
|
return df_calls
|
|
|
|
|
|
def enumerate_contacts(comm_df: pd.DataFrame) -> pd.DataFrame:
|
|
# Calculate frequencies and return in descending order.
|
|
return comm_df
|