Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/formatting clean #73

Merged
merged 17 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed callback_graph.png
Binary file not shown.
468 changes: 231 additions & 237 deletions dashboard/__init__.py

Large diffs are not rendered by default.

Binary file modified dashboard/assets/data/test.xlsx
Binary file not shown.
66 changes: 47 additions & 19 deletions dashboard/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
dcc.Store(id='initial-table-data'),
dcc.Store(id='initial-table-columns'),
dcc.Store(id='noncomplient-indices'),
dcc.Store(id='noncomplient-indices-2'),
dcc.Store(id='noncomplient-indices-3'),
dcc.Store(id='formatting-store'),

# Sidebar
# Sidebar
html.Div([
html.Div([
dmc.Image( # This is the logo
src="./assets/images/logo.jpeg", alt="USCS", width=40),
dmc.Title(f"United States Cold Storage", order=5,),
], style={"display": "flex", "justifyContent": "center", "alignItems": "center", "gap": "1rem", "marginBottom": "1rem", "borderBottom": "1px solid #ccc", 'padding': "1rem"}),

html.Div(id='store-output'),
html.Div([
dmc.Menu([
dmc.MenuLabel("Data Analysis", style={"padding-left": "5px"}),
Expand All @@ -44,7 +46,7 @@
label="Opens a modal for cell higlighting options",
children=dmc.Button("Highlight Cells", id="btn-higlight-cells", variant="subtle", leftIcon=DashIconify(icon="bx:highlight"),),
),
dmc.Modal( # This is the modal that will open when the enforce datatypes button is clicked
dmc.Modal( # This is the modal that will open when the highlight cells button is clicked
title="Choose options for cell highlighting",
id="higlight-cells-modal",
zIndex=10000,
Expand Down Expand Up @@ -116,6 +118,28 @@
label="Distinguish cells that don't match their columns enforced formatting, set in user preferences",
children=dmc.Button("Enforce Formatting", id="btn-enforce-format", variant="subtle", leftIcon=DashIconify(icon="streamline:interface-edit-write-2-change-document-edit-modify-paper-pencil-write-writing"),)
),
dmc.Modal( # This is the modal that will open when the enforce formatting button is clicked
title="Input a specified format for each column",
id="enforce-formatting-modal",
zIndex=10000,
size="70rem",
children=[
html.Div(id='column-format-selector'),
dmc.Space(h=20),
dmc.Group(
[
dmc.Button("Submit", id="formatting-modal-submit-button"),
dmc.Button(
"Close",
color="red",
variant="outline",
id="formatting-modal-close-button",
),
],
position="right",
),
],
),
dmc.Space(h=20),
dmc.MenuLabel("Cleaning Operations", style={"padding-left": "5px"}),
dmc.Tooltip(
Expand All @@ -125,8 +149,8 @@
position="right",
transition="fade",
transitionDuration=300,
label="Distinguish and iterate over empty and corrupt cells",
children=dmc.Button("Check Empty/Corrupt Cells", id="btn-check-empty-corrupt-cells", variant="subtle", leftIcon=DashIconify(icon="iconoir:info-empty"),)
label="Removes duplicate rows from the imported data",
children=dmc.Button("Remove Duplicates", id="btn-remove-duplicates", variant="subtle", leftIcon=DashIconify(icon="bx:duplicate"),)
),
dmc.Tooltip(
withArrow=True,
Expand All @@ -135,10 +159,9 @@
position="right",
transition="fade",
transitionDuration=300,
label="Removes duplicate rows from the imported data",
children=dmc.Button("Remove Duplicates", id="btn-remove-duplicates", variant="subtle", leftIcon=DashIconify(icon="bx:duplicate"),)
label="Distinguish and iterate over empty and corrupt cells",
children=dmc.Button("Check Empty/Corrupt Cells", id="btn-check-empty-corrupt-cells", variant="subtle", leftIcon=DashIconify(icon="iconoir:info-empty"),)
),

dmc.Tooltip(
withArrow=True,
width=200,
Expand All @@ -159,17 +182,7 @@
transitionDuration=300,
label="Distinguish cells that don't match their columns enforced formatting, set in user preferences",
children=dmc.Button("Check Cells Formatting", id="btn-check-cells-formatting", variant="subtle", leftIcon=DashIconify(icon="mdi:checkbox-outline"),),
),
dmc.Tooltip(
withArrow=True,
width=200,
multiline=True,
position="right",
transition="fade",
transitionDuration=300,
label="Check all cells for any issues",
children=dmc.Button("Clean All", id="btn-clean-all", variant="subtle", color="red", leftIcon=DashIconify(icon="material-symbols:cleaning-services-outline"),),
),
)
]),
], style={"fontSize": "26px"}),
], className="sidebar"),
Expand Down Expand Up @@ -267,6 +280,21 @@
'backgroundColor': '#c4b5fd',
'margin': '0.5rem',
})),
dmc.Tooltip(
withArrow=True,
width=200,
multiline=True,
position="right",
transition="fade",
transitionDuration=300,
label="Cells with noncomplient formatting",
children=html.Div(style={
'display': 'inline-block',
'width': '20px',
'height': '20px',
'backgroundColor': '#93c5fd',
'margin': '0.5rem',
})),

], style={"display": "flex", "backgroundColor": "grey"}),

Expand Down
6 changes: 3 additions & 3 deletions dashboard/utils/dataAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ def get_data_analysis(data):

empty_corrupt_values = df.isna().sum()
num_rows, num_columns = df.shape
num_duplicate_rows = df.duplicated().sum()
# Assuming 'ID' is the name of your unique identifier column
num_duplicate_rows = df.duplicated(subset=[col for col in df.columns if col != 'ID']).sum()

if (empty_corrupt_values.sum() != 0):
return [
html.Li([
"Data: ",
html.Span(f'{"{:,}".format(df.size)}', style={
html.Span(f'{"{:,}".format(df.count().sum())}', style={
'color': '#007BFF',
'fontWeight': 'bold',
'padding': '0 5px',
'borderRadius': '5px'
})
# i want ot get rid of the bulletd points
], style={"listStyleType": "none"}),
html.Li([
"Rows: ",
Expand Down
Loading