File size: 1,427 Bytes
d8a4dbe
 
e291f3a
d8a4dbe
84a9829
 
 
 
 
ffa5ef6
8383c87
65aecd0
ffa5ef6
 
dc38e16
95fff9b
 
 
13baf1d
e291f3a
 
13baf1d
 
 
 
 
 
 
 
 
 
6526ed8
 
faf0e44
6526ed8
 
 
 
13baf1d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""The following program will read in 2 XL sheets of KP matches and the user will evaluate the quality of the matching"""
import streamlit as st
import json
import pandas as pd
xl1 = st.file_uploader("Choose first file", key="xl1")
xl2 = st.file_uploader("Choose second file", key="xl2")
if xl1 is not None and xl2 is not None:
  #assert that the first few columns are the same
  df1 = pd.read_excel(xl1, sheet_name= "0.85 Threshold")
  df2 = pd.read_excel(xl2, sheet_name= "0.85 Threshold")
  st.write(df1[["Attendee A","Attendee B","KP"]])
  if not df1[["Attendee A","Attendee B","KP"]].equals(df2[["Attendee A","Attendee B","KP"]]):
    xl1 = None
    xl2 = None
  else:
    for t1,t2 in zip(df1.iterrows(),df2.iterrows()):
      r1 = t1[1]
      r2 = t2[1]
      assert r1["KP"] == r2["KP"]
      kps1 = json.loads(r1["Matched KPs"])
      kps2 = json.loads(r2["Matched KPs"])
      for kp1, kp2 in zip(kps1.keys(),kps2.keys()):
        if kps1[kp1] > 0.99:
          kps1.pop(kp1)
        if kps2[kp2] > 0.99:
          kps2.pop(kp2)
      #now display the kps
      if kps1 == {} and kps2 == {}:
        continue
      if kps1 != {}:
        for kp1 in kps1.keys():
          col1, col2, col3 = st.columns()
          with col1:
            st.write(r1["KP"])
          with col2:
            st.write(f"kp: {kp1} , distance: {kps1[kp1]}")
          with col3:
            st.radio("Appropriate?", [True, False])