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

cleaned unused variables #9

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
48 changes: 0 additions & 48 deletions Dashboards/utils/colors.py

This file was deleted.

24 changes: 0 additions & 24 deletions Dashboards/utils/css_reader.py

This file was deleted.

File renamed without changes.
22 changes: 9 additions & 13 deletions Dashboards/dashboard.py → dashboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import os
import dash_mantine_components as dmc

from dash import Dash, _dash_renderer, html, dcc, Output, Input, callback, no_update
from dash import Dash, _dash_renderer, html, dcc, Output, Input, callback
from dash.dependencies import State
from dash.exceptions import PreventUpdate
from dash_iconify import DashIconify
from datetime import datetime

from Dashboards.my_data.datasets import get_useful_data
from Dashboards.my_data.computed_datasets import merge_tables, calc_degrees_pollution, calc_vdl, count_lichen, count_lichen_per_species, count_species_per_observation, count_lichen_per_lichen_id, group_lichen_by_observation_and_thallus
from Dashboards.charts import blank_figure, create_map, create_hist1_nb_species, create_hist2_vdl, create_hist3, create_pie_thallus, create_hist4, create_gauge_chart
from Dashboards.constants import MAP_SETTINGS, BASE_COLOR_PALETTE, BODY_FONT_FAMILY, POSITIVE_GAUGE_COLOR_PALETTE, NEGATIVE_GAUGE_COLOR_PALETTE, TRANSLATIONS_EN_FR, GRID_STYLE, CARD_STYLE, MAP_STYLE, FLEX_COLUMNS_CONTAINER_STYLE
from my_data.datasets import get_useful_data
from my_data.computed_datasets import merge_tables, calc_degrees_pollution, calc_vdl, count_lichen, count_lichen_per_species, count_species_per_observation, count_lichen_per_lichen_id, group_lichen_by_observation_and_thallus
from dashboard.charts import blank_figure, create_map, create_hist1_nb_species, create_hist2_vdl, create_hist3, create_pie_thallus, create_hist4, create_gauge_chart
from dashboard.constants import MAP_SETTINGS, BASE_COLOR_PALETTE, BODY_FONT_FAMILY, POSITIVE_GAUGE_COLOR_PALETTE, NEGATIVE_GAUGE_COLOR_PALETTE, TRANSLATIONS_EN_FR, GRID_STYLE, CARD_STYLE, MAP_STYLE, FLEX_COLUMNS_CONTAINER_STYLE

_dash_renderer._set_react_version("18.2.0")

Expand Down Expand Up @@ -226,10 +226,6 @@ def update_dashboard2(species_id_selected, relayoutData):
species_poleo = TRANSLATIONS_EN_FR.get(species_poleo, species_poleo)
species_thallus = TRANSLATIONS_EN_FR.get(species_thallus, species_thallus)

# Pluralize the thallus
if not species_thallus.endswith("x") or species_thallus.endswith("s"):
species_thallus += "s"

return fig_map, hist4_species, species_name, species_img_path, species_acid, species_eutro, species_poleo, species_thallus, species_rarity


Expand Down Expand Up @@ -275,7 +271,7 @@ def gauge_card(title, tooltip_text, graph_id, max_height="200px"):
"flexGrow": 1,
"maxHeight": max_height
},
**CARD_STYLE
**CARD_STYLE
)

# Reusable component for histogram cards
Expand Down Expand Up @@ -472,19 +468,19 @@ def histogram_card(title, tooltip_text, graph_id, height="330px"):
),
dmc.Text(
children=[
"Ce lichen fait partie de la famille des ",
"Ce lichen ",
dmc.Text(
id="species-thallus",
c="blue",
style={"display": "inline"},
),
" et est classé comme ",
" est ",
dmc.Text(
id="species-rarity",
c="blue",
style={"display": "inline"},
),
".",
" en milieu urbain.",
],
mt="sm",
c="dimmed",
Expand Down
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion Dashboards/charts.py → dashboard/charts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import plotly.express as px
import plotly.graph_objects as go
from Dashboards.constants import BASE_COLOR_PALETTE, PASTEL_COLOR_PALETTE, PLOTLY_LAYOUT, MAP_SETTINGS
from dashboard.constants import BASE_COLOR_PALETTE, PASTEL_COLOR_PALETTE, PLOTLY_LAYOUT, MAP_SETTINGS


"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd
import numpy as np

from Dashboards.constants import SQUARE_COLUMNS, ORIENTATIONS
from dashboard.constants import SQUARE_COLUMNS, ORIENTATIONS

# Merge table_df with lichen_df, lichen_species_df and observation_df
def merge_tables(table_df, lichen_df, observation_df):
Expand Down Expand Up @@ -128,7 +128,7 @@ def count_species_per_observation(lichen_df, observation_df):
return observation_with_species_count_df


# Group by species' type and count them (but only count there presence in the table, not the frequency in each observation)
# Group by species' type and count them (but only count their presence in the table, not the frequency in each observation)
def count_lichen_per_species(lichen_df, lichen_species_df):

# Group by species' type and count them
Expand Down
2 changes: 1 addition & 1 deletion Dashboards/my_data/datasets.py → my_data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def get_lichen_ecology():
def get_lichen_ecology_csv():
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

lichen_ecology_csv_path = os.path.join(parent_dir, 'assets', 'lichen_species_ecology.csv')
lichen_ecology_csv_path = os.path.join(parent_dir, 'dashboard', 'assets', 'lichen_species_ecology.csv')
lichen_ecology_df = pd.read_csv(lichen_ecology_csv_path, delimiter=';')

return lichen_ecology_df
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions Dashboards/my_data/model.py → my_data/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class LichenEcology(Base):
# Vue pour les fréquences
class LichenFrequency(Base):
__tablename__ = 'lichen_frequency'
__table_args__ = {'autoload_with': engine}
__table_args__ = {'autoload_with': engine}

id = Column(BigInteger, primary_key=True, autoincrement=True)
id_site = Column(BigInteger)
Expand All @@ -112,5 +112,3 @@ class LichenFrequency(Base):
freq = Column(Integer)
eutrophication = Column(String(255))
poleotolerance = Column(String(255))


File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dash import Dash, html, dcc, Output, Input
from my_data.datasets import get_lichen_data, get_lichen_species_data, get_observation_data, get_table_data, get_tree_species, get_lichen_ecology
from my_data.computed_datasets import df_frequency
from Dashboards.charts import create_gauge_chart
from dashboard.charts import create_gauge_chart

chemin_dossier_parent = Path(__file__).parent.parent
sys.path.append(str(chemin_dossier_parent))
Expand Down
File renamed without changes.
File renamed without changes.
Loading