Skip to content

Commit

Permalink
chore: adjust syntheses mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
edelclaux authored and jacquesfize committed May 16, 2024
1 parent 9ef70f2 commit 20a8aab
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import typing
import json


class SyntheseImportMixin(ImportMixin):

@staticmethod
Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion backend/geonature/core/gn_synthese/module.py
Original file line number Diff line number Diff line change
@@ -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)):
Expand Down
1 change: 1 addition & 0 deletions backend/geonature/core/imports/import_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ImportStatisticsLabels(typing.TypedDict):
key: str
value: str


class ImportInputUrl(typing.TypedDict):
url: str
label: str
Expand Down
2 changes: 2 additions & 0 deletions backend/geonature/core/imports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
)
from bokeh.embed.standalone import StandaloneEmbedJson


class OcchabImportMixin(ImportMixin):

@staticmethod
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 20a8aab

Please sign in to comment.