cryogenic22 commited on
Commit
961da88
·
verified ·
1 Parent(s): 461468b

Create ui/pipeline.py

Browse files
Files changed (1) hide show
  1. ui/pipeline.py +61 -0
ui/pipeline.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Pipeline details UI component for the pharmaceutical data management agent.
3
+ """
4
+
5
+ import streamlit as st
6
+
7
+ def render_pipeline_tab(session_state):
8
+ """
9
+ Render the pipeline details tab in the UI.
10
+
11
+ Args:
12
+ session_state: Streamlit session state
13
+ """
14
+ st.subheader("Pipeline Details")
15
+
16
+ # Intent Understanding
17
+ st.markdown("### User Intent")
18
+ if session_state.conversation["user_intent"]:
19
+ st.markdown(session_state.conversation["user_intent"].get("description", "No intent captured yet"))
20
+ if "confidence_scores" in session_state.conversation and "intent_understanding" in session_state.conversation["confidence_scores"]:
21
+ score = session_state.conversation["confidence_scores"]["intent_understanding"] * 100
22
+ st.progress(score / 100, text=f"Intent Understanding Confidence: {score:.1f}%")
23
+ else:
24
+ st.info("No user intent has been captured yet. Start a conversation to extract intent.")
25
+
26
+ # Pipeline Plan
27
+ st.markdown("### Pipeline Plan")
28
+ if session_state.conversation["pipeline_plan"]:
29
+ st.markdown(session_state.conversation["pipeline_plan"].get("description", "No plan created yet"))
30
+ if "confidence_scores" in session_state.conversation and "plan_quality" in session_state.conversation["confidence_scores"]:
31
+ score = session_state.conversation["confidence_scores"]["plan_quality"] * 100
32
+ st.progress(score / 100, text=f"Plan Quality Confidence: {score:.1f}%")
33
+ else:
34
+ st.info("No pipeline plan has been created yet. Continue the conversation to develop a plan.")
35
+
36
+ # SQL Queries
37
+ st.markdown("### SQL Queries")
38
+ if session_state.conversation["sql_queries"]:
39
+ for i, query in enumerate(session_state.conversation["sql_queries"]):
40
+ with st.expander(f"Query {i+1}: {query.get('name', 'Unnamed Query')}"):
41
+ st.code(query.get("sql", ""), language="sql")
42
+ else:
43
+ st.info("No SQL queries have been generated yet. Continue the conversation to generate queries.")
44
+
45
+ # Execution Results
46
+ st.markdown("### Execution Results")
47
+ if session_state.conversation["execution_results"] and "details" in session_state.conversation["execution_results"]:
48
+ st.markdown(session_state.conversation["execution_results"].get("summary", ""))
49
+
50
+ if "success_rate" in session_state.conversation["execution_results"]:
51
+ score = session_state.conversation["execution_results"]["success_rate"] * 100
52
+ st.progress(score / 100, text=f"Execution Success Rate: {score:.1f}%")
53
+
54
+ results = session_state.conversation["execution_results"]["details"]
55
+ for i, result in enumerate(results):
56
+ status = "✅" if result["success"] else "❌"
57
+ with st.expander(f"{status} {result.get('query_name', f'Query {i+1}')}"):
58
+ st.markdown(f"**Result:** {result.get('result_summary', 'No summary available')}")
59
+ st.markdown(f"**Rows Processed:** {result.get('row_count', 0)}")
60
+ else:
61
+ st.info("No execution results available yet. Complete the pipeline creation to see results.")