diff --git a/backend/geonature/core/gn_synthese/imports/synthese_import_mixin.py b/backend/geonature/core/gn_synthese/imports/synthese_import_mixin.py index a99d8ace8b..63554a2dc9 100644 --- a/backend/geonature/core/gn_synthese/imports/synthese_import_mixin.py +++ b/backend/geonature/core/gn_synthese/imports/synthese_import_mixin.py @@ -59,6 +59,7 @@ import typing import json + class SyntheseImportMixin(ImportMixin): @staticmethod @@ -277,24 +278,6 @@ def update_batch_progress(batch, step): id_area=current_app.config["IMPORT"]["ID_AREA_RESTRICTION"], ) - # progress = 0.4 + ((i + 1) / len(sql_checks)) * 0.6 - # task.update_state(state="PROGRESS", meta={"progress": progress}) - - # def get_where_clause_id_import(self, imprt: TImports) -> str: - # return get_where_clause_id_import(imprt) - - # def import_data_to_destination(self, imprt: TImports) -> None: - # import_data_to_synthese(imprt) - - # def remove_data_from_destination(self, imprt: TImports) -> None: - # remove_data_from_synthese(imprt) - - # def report_plot(self, imprt: TImports) -> Row: - # return report_plot(imprt) - - # def compute_bounding_box(self, imprt: TImports) -> None: - # return None - @staticmethod def import_data_to_destination(imprt: TImports) -> None: module = TModules.query.filter_by(module_code="IMPORT").one() diff --git a/backend/geonature/core/gn_synthese/module.py b/backend/geonature/core/gn_synthese/module.py index 694d074f14..c1380b7230 100644 --- a/backend/geonature/core/gn_synthese/module.py +++ b/backend/geonature/core/gn_synthese/module.py @@ -1,7 +1,6 @@ from geonature.core.gn_commons.models import TModules from geonature.core.gn_synthese.imports import SyntheseImportMixin -from abc import ABCMeta class SyntheseModuleMetaclass(type(SyntheseImportMixin), type(TModules)): diff --git a/backend/geonature/core/imports/import_mixin.py b/backend/geonature/core/imports/import_mixin.py index d0de0d5eda..55ab215ff3 100644 --- a/backend/geonature/core/imports/import_mixin.py +++ b/backend/geonature/core/imports/import_mixin.py @@ -11,6 +11,7 @@ class ImportStatisticsLabels(typing.TypedDict): key: str value: str + class ImportInputUrl(typing.TypedDict): url: str label: str diff --git a/backend/geonature/core/imports/models.py b/backend/geonature/core/imports/models.py index b33152d5ec..dd3344348a 100644 --- a/backend/geonature/core/imports/models.py +++ b/backend/geonature/core/imports/models.py @@ -134,6 +134,7 @@ def validity_columns(self): @property def import_mixin(self): from geonature.core.imports.import_mixin import ImportMixin + if not ImportMixin.is_implemented_in_module(type(self.module)): raise NotImplementedError return self.module @@ -142,6 +143,7 @@ def import_mixin(self): def statistics_labels(self): return self.import_mixin.statistics_labels() + @serializable class BibThemes(db.Model): __tablename__ = "bib_themes" diff --git a/contrib/gn_module_occhab/backend/gn_module_occhab/imports/occhab_import_mixin.py b/contrib/gn_module_occhab/backend/gn_module_occhab/imports/occhab_import_mixin.py index dd7b7f13e9..8320be1638 100644 --- a/contrib/gn_module_occhab/backend/gn_module_occhab/imports/occhab_import_mixin.py +++ b/contrib/gn_module_occhab/backend/gn_module_occhab/imports/occhab_import_mixin.py @@ -45,6 +45,7 @@ ) from bokeh.embed.standalone import StandaloneEmbedJson + class OcchabImportMixin(ImportMixin): @staticmethod @@ -367,9 +368,7 @@ def compute_bounding_box(imprt: TImports): transient_table = imprt.destination.get_transient_table() statement = ( sa.select( - sa.func.ST_AsGeojson( - sa.func.ST_Extent(transient_table.c[name_geom_4326_field]) - ) + sa.func.ST_AsGeojson(sa.func.ST_Extent(transient_table.c[name_geom_4326_field])) ) .where(where_clause_id_import) .where(transient_table.c[entity.validity_column] == True)