Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,96 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
|
| 4 |
-
st.
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
("lodged", "1. Claim Lodged"),
|
| 11 |
-
("fraud", "2. Fraud Check"),
|
| 12 |
-
("coverage", "3. Coverage Check"),
|
| 13 |
-
("builder", "4. Builder Assignment"),
|
| 14 |
-
("schedule", "5. Schedule Repairs"),
|
| 15 |
-
("payment", "6. Authorise Payment"),
|
| 16 |
-
("settle", "7. Settle Claim"),
|
| 17 |
-
]
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
|
| 4 |
+
st.set_page_config(layout="wide")
|
| 5 |
+
st.title("ποΈ GenAI Claims Workflow (Fake Horizontal Layout)")
|
| 6 |
|
| 7 |
+
components.html(
|
| 8 |
+
"""
|
| 9 |
+
<div id="cy" style="width: 100%; height: 500px; border:1px solid #ccc;"></div>
|
| 10 |
+
<div id="tooltip" style="display:none; position:absolute; background:white; color:black; padding:10px; border-radius:5px; border:1px solid #666; box-shadow:2px 2px 8px rgba(0,0,0,0.2); z-index:10; max-width:300px;"></div>
|
| 11 |
|
| 12 |
+
<script src="https://unpkg.com/cytoscape@3.24.0/dist/cytoscape.min.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
<script>
|
| 15 |
+
const stepDetails = {
|
| 16 |
+
lodged: "π© Claim is received via the customer portal.",
|
| 17 |
+
fraud: "π Fraud check using LLM.",
|
| 18 |
+
coverage: "π Check if claim is covered by policy.",
|
| 19 |
+
builder: "π· Assign a builder.",
|
| 20 |
+
schedule: "π
Schedule the repair.",
|
| 21 |
+
payment: "π³ Authorise builder payment.",
|
| 22 |
+
settle: "β
Mark claim as settled."
|
| 23 |
+
};
|
| 24 |
|
| 25 |
+
const cy = cytoscape({
|
| 26 |
+
container: document.getElementById('cy'),
|
| 27 |
+
layout: { name: 'preset' }, // Position manually
|
| 28 |
+
style: [
|
| 29 |
+
{
|
| 30 |
+
selector: 'node',
|
| 31 |
+
style: {
|
| 32 |
+
'label': 'data(label)',
|
| 33 |
+
'background-color': '#0077B6',
|
| 34 |
+
'color': '#fff',
|
| 35 |
+
'text-valign': 'center',
|
| 36 |
+
'text-halign': 'center',
|
| 37 |
+
'text-wrap': 'wrap',
|
| 38 |
+
'text-max-width': 100,
|
| 39 |
+
'font-size': '14px',
|
| 40 |
+
'shape': 'roundrectangle',
|
| 41 |
+
'width': 'label',
|
| 42 |
+
'height': 'label',
|
| 43 |
+
'padding': '10px'
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
selector: 'edge',
|
| 48 |
+
style: {
|
| 49 |
+
'width': 2,
|
| 50 |
+
'line-color': '#aaa',
|
| 51 |
+
'target-arrow-color': '#aaa',
|
| 52 |
+
'target-arrow-shape': 'triangle'
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
],
|
| 56 |
+
elements: [
|
| 57 |
+
{ data: { id: 'lodged', label: '1. Claim Lodged' }, position: { x: 100, y: 100 } },
|
| 58 |
+
{ data: { id: 'fraud', label: '2. Fraud Check' }, position: { x: 300, y: 100 } },
|
| 59 |
+
{ data: { id: 'coverage', label: '3. Coverage Check' }, position: { x: 500, y: 100 } },
|
| 60 |
+
{ data: { id: 'builder', label: '4. Builder Assignment' }, position: { x: 700, y: 100 } },
|
| 61 |
+
{ data: { id: 'schedule', label: '5. Schedule Repairs' }, position: { x: 900, y: 100 } },
|
| 62 |
+
{ data: { id: 'payment', label: '6. Authorise Payment' }, position: { x: 1100, y: 100 } },
|
| 63 |
+
{ data: { id: 'settle', label: '7. Settle Claim' }, position: { x: 1300, y: 100 } },
|
| 64 |
+
{ data: { source: 'lodged', target: 'fraud' }},
|
| 65 |
+
{ data: { source: 'fraud', target: 'coverage' }},
|
| 66 |
+
{ data: { source: 'coverage', target: 'builder' }},
|
| 67 |
+
{ data: { source: 'builder', target: 'schedule' }},
|
| 68 |
+
{ data: { source: 'schedule', target: 'payment' }},
|
| 69 |
+
{ data: { source: 'payment', target: 'settle' }}
|
| 70 |
+
]
|
| 71 |
+
});
|
| 72 |
|
| 73 |
+
const tooltip = document.getElementById('tooltip');
|
| 74 |
+
|
| 75 |
+
cy.on('tap', 'node', function(evt) {
|
| 76 |
+
const nodeId = evt.target.id();
|
| 77 |
+
const description = stepDetails[nodeId] || "No info available.";
|
| 78 |
+
const rect = document.getElementById('cy').getBoundingClientRect();
|
| 79 |
+
const pos = evt.originalEvent;
|
| 80 |
+
|
| 81 |
+
tooltip.innerHTML = '<strong>' + evt.target.data('label') + '</strong><br>' + description;
|
| 82 |
+
tooltip.style.left = (pos.clientX - rect.left + 20) + 'px';
|
| 83 |
+
tooltip.style.top = (pos.clientY - rect.top + 20) + 'px';
|
| 84 |
+
tooltip.style.display = 'block';
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
cy.on('tap', function(evt) {
|
| 88 |
+
if (evt.target === cy) {
|
| 89 |
+
tooltip.style.display = 'none';
|
| 90 |
+
}
|
| 91 |
+
});
|
| 92 |
+
</script>
|
| 93 |
+
""",
|
| 94 |
+
height=550,
|
| 95 |
+
scrolling=False
|
| 96 |
+
)
|