import pandas as pd, json
df = pd.read_excel('/Users/maxim.ziatdinov/Code/SciLink/planning_session_20260319_183527/knowledge/PWSdatabase.xlsx')
cols = ['Li', 'Sr', 'Ba', 'Mg', 'Cu', 'Na', 'K', 'Ca', 'Co', 'Cs', 'Rb', 'V', 'Mn', 'U']
df_num = df.iloc[1:][cols].apply(pd.to_numeric, errors='coerce')
stats = df_num.agg(['count', 'mean', 'median', 'min', 'max']).round(4)
answer = stats.to_dict()
summary = "Descriptive statistics (count, mean, median, min, max) in mg/L for Li, Sr, Ba, Mg, Cu, Na, K, Ca, Co, Cs, Rb, V, Mn, U from the produced water database."
print(json.dumps({"answer": answer, "summary": summary}))
