geonature.core.gn_synthese.imports.actions

Classes

Functions

get_boolean_value(→ bool)

Module Contents

geonature.core.gn_synthese.imports.actions.get_boolean_value(bib_field: geonature.core.imports.models.BibFields, default_value: bool) bool[source]
class geonature.core.gn_synthese.imports.actions.SyntheseImportActions[source]

Bases: geonature.core.imports.actions.ImportActions

static statistics_labels() List[geonature.core.imports.actions.ImportStatisticsLabels][source]

Return a list of key-value pairs describing the statistics of the import process.

Returns

list[ImportStatisticsLabels]

A list of key-value pairs. Each key-value pair is a dictionary with two keys: “key” and “value”. The “key” key contains the label of the metric, the “value” key contains the value of the metric.

Raises

NotImplementedError

If the method is not implemented in the child class.

static preprocess_transient_data(imprt: geonature.core.imports.models.TImports, df) None[source]

Preprocess the transient data for the given import.

Parameters

imprtTImports

The import object containing metadata about the import process.

dfpandas.DataFrame

The DataFrame containing the transient data.

Notes

This method is responsible for performing any necessary data transformation on the transient data before it is controlled by check_transient_data imported into the destination database.

The method is optional and can be omitted if no preprocessing is needed.

static check_transient_data(task, logger, imprt: geonature.core.imports.models.TImports)[source]

Validate and process the transient data for the given import.

Parameters

taskAny

The task object associated with the import process. Used by celery.

loggerAny

Logger instance for logging information during validation. Used by celery.

imprtTImports

The import object containing metadata about the import process.

Raises

NotImplementedError

If the method is not implemented.

static import_data_to_destination(imprt: geonature.core.imports.models.TImports) None[source]

Import data to the destination database for a given import.

Parameters

imprtTImports

The import object containing information about the data to be imported.

Notes

The data to be imported is initially available in a transient table. This method processes and transfers the data from the transient table to the destination database.

static report_plot(imprt: geonature.core.imports.models.TImports) bokeh.embed.standalone.StandaloneEmbedJson[source]

Generate the report plot for the given import. The plot must be realized using the Bokeh library. Plot must be return as JSON using the Bokeh json_item function.

Parameters

imprtTImports

The import object containing information about the import process.

Returns

plotStandaloneEmbedJson

The standalone embed json data for the report plot.

Notes

The report plot is a visualization of the imported data. It is used to provide a quick overview of the import data to the user.

static compute_bounding_box(imprt: geonature.core.imports.models.TImports)[source]

Calculate the bounding box for the imported data.

Parameters

imprtTImports

The import object containing information about the import process.

Notes

This method calculates the smallest polygon (bounding box) that contains all the geographic data imported. The bounding box is to be displayed in the import report once all data has been validated.