diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b2c1f09..acbd09a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -14,7 +14,7 @@ jobs: # ...I merged a PR or pushed on the dev branch, thus deploy to the test env (dev) if: | (github.event_name == 'workflow_dispatch' && github.ref_name == 'main') || - ((github.event.pull_request.merged == true || github.event.push == true) && github.ref_name == 'dev') + ((github.event_name == 'pull_request' || github.event_name == 'push') && github.ref_name == 'dev') runs-on: ubuntu-latest environment: ${{ github.ref_name }} steps: diff --git a/src/app.py b/src/app.py index 68ed4cd..7d37f32 100644 --- a/src/app.py +++ b/src/app.py @@ -21,18 +21,18 @@ app.index_string = """ {%renderer%} diff --git a/src/pages/about.py b/src/pages/about.py index 0eb04f4..e73cc66 100644 --- a/src/pages/about.py +++ b/src/pages/about.py @@ -1,4 +1,4 @@ -from dash import register_page, html +from dash import register_page, html, dcc title = "À propos" @@ -6,4 +6,24 @@ register_page( __name__, path="/a-propos", title=f"decp.info - {title}", name=title, order=3 ) -layout = [html.H2(title)] +layout = [ + html.Div( + className="container", + children=[ + html.H2(title), + dcc.Markdown( + """Outil développé par Colin Maudry, sous licence GPL v3 (libre et gratuit). + +- [wiki du projet](https://github.com/ColinMaudry/decp-processing/wiki) +- [code source de decp.info](https://github.com/ColinMaudry/decp.info) +- [code source du traitement de données](https://github.com/ColinMaudry/decp-processing) + +Contact : +- [colin+decp@maudry.com](mailto:colin+decp@maudry.com) +- BlueSky : [@col1m.bsky.social](https://bsky.app/profile/col1m.bsky.social) +- Mastodon : [col1m@mamot.fr](https://mamot.fr/@col1m) +""" + ), + ], + ) +] diff --git a/src/pages/home.py b/src/pages/home.py index 7696f31..00ed52a 100644 --- a/src/pages/home.py +++ b/src/pages/home.py @@ -2,11 +2,14 @@ from dash import html, dcc, dash_table, register_page, Input, Output, State, cal from dotenv import load_dotenv import os import polars as pl -from src.utils import split_filter_part +from src.utils import split_filter_part, add_annuaire_link load_dotenv() -df = pl.scan_parquet(os.getenv("DATA_FILE_PARQUET_PATH")) +df: pl.LazyFrame = pl.scan_parquet(os.getenv("DATA_FILE_PARQUET_PATH")) + +# Ajout des liens vers l'annuaire +df = add_annuaire_link(df) title = "Tableau" register_page(__name__, path="/", title=f"decp.info - {title}", name=title, order=1) @@ -19,7 +22,10 @@ datatable = dash_table.DataTable( page_action="custom", filter_action="custom", filter_options={"case": "insensitive", "placeholder_text": "Filtrer..."}, - columns=[{"name": i, "id": i} for i in df.collect_schema().names()], + columns=[ + {"name": i, "id": i, "presentation": "markdown"} + for i in df.collect_schema().names() + ], selected_columns=[], selected_rows=[], # sort_action="native", @@ -38,6 +44,7 @@ datatable = dash_table.DataTable( }, ], data_timestamp=0, + markdown_options={"html": True}, ) layout = [ diff --git a/src/utils.py b/src/utils.py index d422ada..a10f729 100644 --- a/src/utils.py +++ b/src/utils.py @@ -1,3 +1,5 @@ +import polars as pl + operators = [ ["s<", "<"], ["s>", ">"], @@ -17,3 +19,26 @@ def split_filter_part(filter_part): return name, operator_group[1], value return [None] * 3 + + +def add_annuaire_link(df: pl.LazyFrame): + df = df.with_columns( + pl.when(pl.col("titulaire_typeIdentifiant") == "SIRET") + .then( + pl.col("titulaire_id") + + f' 📑' + ) + .otherwise(pl.col("titulaire_id")) + .alias("titulaire_id") + ) + df = df.with_columns( + ( + pl.col("acheteur_id") + + f' 📑' + ).alias("acheteur_id") + ) + return df