siddhartharyaai commited on
Commit
a915742
·
verified ·
1 Parent(s): fa41368

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -75
app.py DELETED
@@ -1,75 +0,0 @@
1
- import pandas as pd
2
- import streamlit as st
3
- import re
4
-
5
- st.set_page_config(page_title="Skype Tool + Charterer Matrix", layout="wide")
6
-
7
- CONTACT_FILE = "contacts.csv"
8
- MATRIX_FILE = "channel_matrix.xlsx"
9
-
10
- tabs = st.tabs(["Contact Filter", "Channel Matrix"])
11
-
12
- # TAB 1: Contact Filter Tool
13
- with tabs[0]:
14
- st.title("📒 Skype Contact Filter Tool")
15
-
16
- TAGS = ["+mini", "+hdy", "+smx", "+pmx", "+cape", "+med", "+atl", "+rsea",
17
- "+safr", "+pg", "+wci", "+eci", "+seas", "+feast", "+nopac", "+aus", "+aust"]
18
-
19
- df = pd.read_csv(CONTACT_FILE)
20
- df["display_name"] = df["display_name"].astype(str).str.lower()
21
- if "country" not in df.columns:
22
- df["country"] = "N/A"
23
-
24
- filter_mode = st.radio("Filter Mode", ["AND", "OR"], horizontal=True)
25
-
26
- st.markdown("### Select Tags to Filter")
27
- selected_tags = []
28
- cols = st.columns(6)
29
- for i, tag in enumerate(TAGS):
30
- if cols[i % 6].checkbox(tag):
31
- selected_tags.append(tag)
32
-
33
- if selected_tags:
34
- filtered_df = df.copy()
35
- if filter_mode == "AND":
36
- for tag in selected_tags:
37
- filtered_df = filtered_df[filtered_df["display_name"].str.contains(re.escape(tag))]
38
- else:
39
- pattern = "|".join(re.escape(tag) for tag in selected_tags)
40
- filtered_df = filtered_df[filtered_df["display_name"].str.contains(pattern)]
41
-
42
- st.success(f"Found {len(filtered_df)} matching contacts.")
43
- st.markdown("### ✅ Tick off contacts as you check them:")
44
- for i, row in filtered_df.iterrows():
45
- st.checkbox(f"**{row['display_name'].title()}** _( {row['country']} )_", key=f"contact_{i}")
46
- else:
47
- st.info("Select at least one tag to filter the contacts.")
48
-
49
- # TAB 2: Charterer-Operator Matrix
50
- with tabs[1]:
51
- st.title("📊 Channel Matrix Checker")
52
-
53
- try:
54
- matrix_df = pd.read_excel(MATRIX_FILE)
55
- matrix_df = matrix_df.rename(columns={matrix_df.columns[0]: "Operator"})
56
-
57
- charterers = list(matrix_df.columns[1:])
58
- selected_charterer = st.selectbox("Select a Charterer", charterers)
59
-
60
- if selected_charterer:
61
- yes_ops = matrix_df[matrix_df[selected_charterer].astype(str).str.upper() == "YES"]["Operator"]
62
- no_ops = matrix_df[matrix_df[selected_charterer].astype(str).str.upper() == "NO"]["Operator"]
63
-
64
- col1, col2 = st.columns(2)
65
- with col1:
66
- st.success(f"✅ Operators who work with us for {selected_charterer}'s cargoes (CRH TRADING):")
67
- for name in yes_ops:
68
- st.markdown(f"- **{name}**")
69
- with col2:
70
- st.error(f"❌ Operators who won't work with us for {selected_charterer}'s cargoes (CRH TRADING):")
71
- for name in no_ops:
72
- st.markdown(f"- {name}")
73
- except Exception as e:
74
- st.warning("Could not load matrix file. Please ensure 'channel_matrix.xlsx' exists.")
75
- st.text(f"Error: {e}")