Valeurs possibles dans la description des champs

This commit is contained in:
Colin Maudry
2026-07-13 07:36:54 +02:00
parent 26de687ece
commit 445c8666cf
2 changed files with 16 additions and 14 deletions
+6 -13
View File
@@ -972,21 +972,14 @@ def make_donut(
def make_column_picker(page: str): def make_column_picker(page: str):
table_data = [] table_data = []
table_columns = [ for col in schema.names():
{ column_data_schema = DATA_SCHEMA[col]
column_data = {
"id": col, "id": col,
"name": DATA_SCHEMA[col]["title"], "name": column_data_schema["title"],
"description": DATA_SCHEMA[col]["description"], "description": column_data_schema["description"],
} }
for col in schema.names() table_data.append(column_data)
]
for column in table_columns:
new_column = {
"id": column["id"],
"name": column["name"],
"description": DATA_SCHEMA[column["id"]]["description"],
}
table_data.append(new_column)
table = ( table = (
DataTable( DataTable(
+10 -1
View File
@@ -124,7 +124,16 @@ def get_data_schema() -> dict:
raw = _load_schema_file(cache_path) raw = _load_schema_file(cache_path)
if raw is None: if raw is None:
raise RuntimeError("Aucun schéma disponible (ni distant ni cache).") raise RuntimeError("Aucun schéma disponible (ni distant ni cache).")
return OrderedDict((c["name"], c) for c in raw["fields"]) schema = OrderedDict((c["name"], c) for c in raw["fields"])
for col in schema.keys():
new_obj = schema[col]
if "enum" in new_obj:
enums = ", ".join(new_obj["enum"])
new_obj["description"] = (
f"{new_obj['description']} Valeurs possibles : {enums}"
)
print(schema["titulaire_typeIdentifiant"])
return schema
def prepare_dashboard_data(**filter_params) -> pl.DataFrame: def prepare_dashboard_data(**filter_params) -> pl.DataFrame: