File size: 7,816 Bytes
49a01f0
 
 
8bd8367
49a01f0
5c24b63
 
 
49a01f0
 
 
 
 
 
8bd8367
48d05fe
8bd8367
a9ca7ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8bd8367
5245add
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a9ca7ec
 
 
 
 
 
5245add
8bd8367
 
1455079
48d05fe
d056bf0
49a01f0
eb12caa
 
1455079
 
 
 
 
 
 
 
b029021
 
49a01f0
 
48d05fe
 
e7ab5e7
08338f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ec40d27
 
 
08338f9
 
 
 
 
48d05fe
ec40d27
 
f13f642
 
48d05fe
 
49a01f0
08338f9
 
49a01f0
3226f49
 
eb12caa
1455079
08338f9
eb12caa
1455079
eb12caa
 
 
b029021
 
49a01f0
08338f9
eb12caa
b029021
 
49a01f0
08338f9
49a01f0
08338f9
1f36b2f
08338f9
 
 
 
 
 
96f5c11
 
 
08338f9
 
 
 
 
96f5c11
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import streamlit as st
import pandas as pd
import random
from datetime import datetime, timedelta

st.set_page_config(layout="wide")


# Helper function to generate a random date within the last year
def random_date():
    start_date = datetime.now() - timedelta(days=365)
    random_days = random.randint(0, 365)
    return (start_date + timedelta(days=random_days)).strftime("%Y-%m-%d")

# Function to load and cache the product catalog
@st.cache_data
def load_catalog():
    # Generate approval attributes
    cyber_approved = [random.choice([True, False]) for _ in range(50)]
    accessibility_approved = [random.choice([True, False]) for _ in range(50)]
    privacy_approved = [random.choice([True, False]) for _ in range(50)]

    review_statuses = []
    not_approved_reasons = []
    for cyber, accessibility, privacy in zip(cyber_approved, accessibility_approved, privacy_approved):
        if cyber and accessibility and privacy:  # All approvals are True
            review_statuses.append("Approved")
            not_approved_reasons.append(None)
        elif not cyber and not accessibility and not privacy:  # All approvals are False
            review_statuses.append("Not Approved")
            not_approved_reasons.append(random.choice(["Security Concern", "Licensing Issue", "Privacy Issue", "Compliance Requirement"]))
        else:  # Mixed approvals
            review_statuses.append("Under Review")
            not_approved_reasons.append(None)
            
    products = {
    "Product Name": [
        "Notepad++", "WinRAR", "7-Zip", "CCleaner", "TeamViewer",
        "FileZilla", "PuTTY", "WinSCP", "Everything", "Greenshot",
        "Visual Studio Code", "JetBrains IntelliJ IDEA", "Sublime Text", "Atom", "Eclipse",
        "PyCharm", "NetBeans", "Xcode", "Android Studio", "GitLab",
        "Norton Antivirus", "McAfee Total Protection", "Kaspersky Internet Security", "Bitdefender Antivirus Plus", "Avast Free Antivirus",
        "Sophos Home", "Trend Micro Antivirus+", "ESET NOD32 Antivirus", "F-Secure SAFE", "Malwarebytes",
        "Microsoft Office 365", "Google Workspace", "Slack", "Trello", "Asana",
        "Zoom", "Evernote", "Notion", "Dropbox", "Adobe Acrobat Reader",
        "Adobe Photoshop", "Adobe Illustrator", "Adobe Premiere Pro", "Final Cut Pro", "Sketch",
        "Blender", "Autodesk Maya", "CorelDRAW", "GIMP", "Inkscape"
    ],
    "Category": [
        "Utility Tools", "Utility Tools", "Utility Tools", "Utility Tools", "Utility Tools",
        "Utility Tools", "Utility Tools", "Utility Tools", "Utility Tools", "Utility Tools",
        "Development Tools", "Development Tools", "Development Tools", "Development Tools", "Development Tools",
        "Development Tools", "Development Tools", "Development Tools", "Development Tools", "Development Tools",
        "Security Software", "Security Software", "Security Software", "Security Software", "Security Software",
        "Security Software", "Security Software", "Security Software", "Security Software", "Security Software",
        "Productivity Software", "Productivity Software", "Productivity Software", "Productivity Software", "Productivity Software",
        "Productivity Software", "Productivity Software", "Productivity Software", "Productivity Software", "Productivity Software",
        "Creative Software", "Creative Software", "Creative Software", "Creative Software", "Creative Software",
        "Creative Software", "Creative Software", "Creative Software", "Creative Software", "Creative Software"
    ],
        "Cyber Approved": cyber_approved,
        "Accessibility Approved": accessibility_approved,
        "Privacy Approved": privacy_approved,
        "Review Date": [random_date() for _ in range(50)],
        "Review Status": review_statuses,
        "Not Approved Reason": not_approved_reasons
}
    return pd.DataFrame(products)

# Function to filter the catalog based on multiple attributes with AND logic
@st.cache_data
def filter_catalog(catalog, search_query=None, selected_category=None, cyber_approved=None, accessibility_approved=None, privacy_approved=None,review_status=None):
    filtered = catalog
    if search_query:
        filtered = filtered[filtered.apply(lambda row: search_query.lower() in str(row).lower(), axis=1)]
    if selected_category and selected_category != 'All':
        filtered = filtered[filtered["Category"] == selected_category]
    if cyber_approved:
        filtered = filtered[filtered["Cyber Approved"] == True]
    if accessibility_approved:
        filtered = filtered[filtered["Accessibility Approved"] == True]
    if privacy_approved:
        filtered = filtered[filtered["Privacy Approved"] == True]
    if review_status and review_status != 'All':
        filtered = filtered[filtered["Review Status"] == review_status]
    return filtered

catalog = load_catalog()


st.markdown("""
<style>
.custom-header {
    font-size: 24px;
    font-weight: bold;
    color: #4f8bf9;
    margin-bottom: 10px;
}
.custom-text {
    font-size: 16px;
    margin-bottom: 20px;
}
.custom-button {
    margin: 5px;
}
.stButton>button {
    border: 2px solid #4f8bf9;
    border-radius: 20px;
    color: #4f8bf9;
}
.status-true {
    color: green;
}
.stDataFrame {
    font-size: 14px;
}
</style>
""", unsafe_allow_html=True)







# Streamlit app layout
st.markdown('<p class="custom-header">Enterprise Software Product Catalog</p>', unsafe_allow_html=True)
st.markdown('<p class="custom-text">This is the source of truth for app approval statuses within the enterprise.</p>', unsafe_allow_html=True)



# Sidebar for Advanced Search and Filtering
with st.sidebar:
    st.markdown('<p class="custom-header">Advanced Search Options</p>', unsafe_allow_html=True)
    search_query = st.text_input("Search by Any Attribute", key='search_query')
    selected_category = st.selectbox("Select Category", ['All'] + list(catalog["Category"].unique()), key='search_category')
    cyber_approved = st.checkbox("Cyber Approved", key='cyber_approved')
    accessibility_approved = st.checkbox("Accessibility Approved", key='accessibility_approved')
    privacy_approved = st.checkbox("Privacy Approved", key='privacy_approved')
    review_status_options = ['All', 'Approved', 'Under Review', 'Not Approved']
    review_status = st.selectbox("Select Review Status", options=review_status_options, key='review_status')


# Apply the enhanced filter based on user input
filtered_catalog = filter_catalog(catalog, search_query, selected_category, cyber_approved, accessibility_approved, privacy_approved, review_status)



# Display the filtered product catalog
st.markdown('<p class="custom-header">Product Catalog</p>', unsafe_allow_html=True)
st.dataframe(filtered_catalog.style.applymap(lambda x: "background-color: #ffffff"))

for index, row in filtered_catalog.iterrows():
    with st.expander(f"{row['Product Name']}"):
        st.markdown(f"""
            <div>
                <p><b>Category:</b> {row['Category']}</p>
                <p><b>Cyber Approved:</b> <span class='{"status-true" if row["Cyber Approved"] else ""}'>{'Yes' if row['Cyber Approved'] else 'No'}</span></p>
                <p><b>Accessibility Approved:</b> <span class='{"status-true" if row["Accessibility Approved"] else ""}'>{'Yes' if row['Accessibility Approved'] else 'No'}</span></p>
                <p><b>Privacy Approved:</b> <span class='{"status-true" if row["Privacy Approved"] else ""}'>{'Yes' if row['Privacy Approved'] else 'No'}</span></p>
                <p><b>Review Date:</b> {row['Review Date']}</p>
                <p><b>Review Status:</b> {row['Review Status']}</p>
                {'<p><b>Not Approved Reason:</b> '+row['Not Approved Reason']+'</p>' if row['Review Status'] == 'Not Approved' else ''}
            </div>
        """, unsafe_allow_html=True)