Finalement suppression des json-ld titulaire et acheteur #66
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
|
||||||
|
|
||||||
import polars as pl
|
import polars as pl
|
||||||
from dash import Input, Output, State, callback, dcc, html, register_page
|
from dash import Input, Output, State, callback, dcc, html, register_page
|
||||||
@@ -15,7 +14,6 @@ from src.utils import (
|
|||||||
get_button_properties,
|
get_button_properties,
|
||||||
get_default_hidden_columns,
|
get_default_hidden_columns,
|
||||||
get_departement_region,
|
get_departement_region,
|
||||||
make_org_jsonld,
|
|
||||||
meta_content,
|
meta_content,
|
||||||
prepare_table_data,
|
prepare_table_data,
|
||||||
sort_table_data,
|
sort_table_data,
|
||||||
@@ -56,7 +54,6 @@ datatable = html.Div(
|
|||||||
layout = [
|
layout = [
|
||||||
dcc.Store(id="acheteur_data", storage_type="memory"),
|
dcc.Store(id="acheteur_data", storage_type="memory"),
|
||||||
dcc.Location(id="acheteur_url", refresh="callback-nav"),
|
dcc.Location(id="acheteur_url", refresh="callback-nav"),
|
||||||
html.Script(type="application/ld+json", id="acheteur_jsonld"),
|
|
||||||
html.Div(
|
html.Div(
|
||||||
children=[
|
children=[
|
||||||
html.Div(
|
html.Div(
|
||||||
@@ -334,19 +331,3 @@ def download_filtered_acheteur_data(
|
|||||||
return dcc.send_bytes(
|
return dcc.send_bytes(
|
||||||
to_bytes, filename=f"decp_filtrées_{acheteur_nom}_{date}.xlsx"
|
to_bytes, filename=f"decp_filtrées_{acheteur_nom}_{date}.xlsx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@callback(
|
|
||||||
Output(component_id="acheteur_jsonld", component_property="children"),
|
|
||||||
Input("acheteur_data", "data"),
|
|
||||||
)
|
|
||||||
def get_acheteur_jsonld(acheteur) -> str:
|
|
||||||
acheteur = acheteur[0]
|
|
||||||
acheteur_id = acheteur.get("acheteur_id")
|
|
||||||
|
|
||||||
jsonld = make_org_jsonld(
|
|
||||||
acheteur_id, org_name=acheteur.get("acheteur_nom"), org_type="acheteur"
|
|
||||||
)
|
|
||||||
jsonld["@context"] = "http://schema.org/"
|
|
||||||
|
|
||||||
return json.dumps(jsonld, indent=2)
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
|
||||||
|
|
||||||
import polars as pl
|
import polars as pl
|
||||||
from dash import Input, Output, State, callback, dcc, html, register_page
|
from dash import Input, Output, State, callback, dcc, html, register_page
|
||||||
@@ -15,7 +14,6 @@ from src.utils import (
|
|||||||
get_button_properties,
|
get_button_properties,
|
||||||
get_default_hidden_columns,
|
get_default_hidden_columns,
|
||||||
get_departement_region,
|
get_departement_region,
|
||||||
make_org_jsonld,
|
|
||||||
meta_content,
|
meta_content,
|
||||||
prepare_table_data,
|
prepare_table_data,
|
||||||
sort_table_data,
|
sort_table_data,
|
||||||
@@ -56,7 +54,6 @@ datatable = html.Div(
|
|||||||
layout = [
|
layout = [
|
||||||
dcc.Store(id="titulaire_data", storage_type="memory"),
|
dcc.Store(id="titulaire_data", storage_type="memory"),
|
||||||
dcc.Location(id="titulaire_url", refresh="callback-nav"),
|
dcc.Location(id="titulaire_url", refresh="callback-nav"),
|
||||||
html.Script(type="application/ld+json", id="titulaire_jsonld"),
|
|
||||||
html.Div(
|
html.Div(
|
||||||
children=[
|
children=[
|
||||||
html.Div(
|
html.Div(
|
||||||
@@ -343,19 +340,3 @@ def download_filtered_titulaire_data(
|
|||||||
return dcc.send_bytes(
|
return dcc.send_bytes(
|
||||||
to_bytes, filename=f"decp_filtrées_{titulaire_nom}_{date}.xlsx"
|
to_bytes, filename=f"decp_filtrées_{titulaire_nom}_{date}.xlsx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@callback(
|
|
||||||
Output(component_id="titulaire_jsonld", component_property="children"),
|
|
||||||
Input("titulaire_data", "data"),
|
|
||||||
)
|
|
||||||
def get_titulaire_jsonld(titulaire) -> str:
|
|
||||||
titulaire = titulaire[0]
|
|
||||||
titulaire_id = titulaire.get("acheteur_id")
|
|
||||||
|
|
||||||
jsonld = make_org_jsonld(
|
|
||||||
titulaire_id, org_name=titulaire.get("titulaire_nom"), org_type="titulaire"
|
|
||||||
)
|
|
||||||
jsonld["@context"] = "http://schema.org/"
|
|
||||||
|
|
||||||
return json.dumps(jsonld, indent=2)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user