Code source de geonature.core.imports.config_schema

"""
   Spécification du schéma toml des paramètres de configurations
"""

from marshmallow import Schema, fields
from marshmallow.validate import OneOf

[docs] DEFAULT_LIST_COLUMN = [ { "prop": "format_source_file", "name": "Format", "show": False, "filter": False, }, { "prop": "full_file_name", "name": "Fichier", "show": True, "filter": True, }, { "prop": "dataset.dataset_name", "name": "Jeu de données", "show": True, "filter": False, }, { "prop": "statistics_rows", "name": "Lignes importées", "show": True, "filter": False, }, { "prop": "date_create_import", "name": "Debut import", "show": True, "filter": True, }, { "prop": "authors_name", "name": "Auteur", "show": True, "filter": False, }, ]
[docs] UPLOAD_DIRECTORY = "upload"
[docs] IMPORTS_SCHEMA_NAME = "gn_imports"
[docs] PREFIX = "gn_"
[docs] SRID = [{"name": "WGS84", "code": 4326}, {"name": "Lambert93", "code": 2154}]
[docs] ENCODAGE = ["UTF-8"]
[docs] MAX_FILE_SIZE = 1000
[docs] ALLOWED_EXTENSIONS = [".csv"]
[docs] DEFAULT_COUNT_VALUE = 1
[docs] ALLOW_VALUE_MAPPING = True
# If VALUE MAPPING is not allowed, you must specify the DEFAULT_VALUE_MAPPING_ID
[docs] DEFAULT_VALUE_MAPPING_ID = 3
[docs] INSTANCE_BOUNDING_BOX = [-5.0, 41, 10, 51.15]
[docs] ALLOW_FIELD_MAPPING = True
[docs] DEFAULT_FIELD_MAPPING_ID = 1
# Parameter to define if the checkbox allowing to change display mode is displayed or not.
[docs] DISPLAY_CHECK_BOX_MAPPED_FIELD = True
# Parameter to define the rank shown in the doughnut chart in the import report # must be in ['regne', 'phylum', 'classe', 'ordre', 'famille', 'sous_famille', 'tribu', 'group1_inpn', 'group2_inpn']
[docs] DEFAULT_RANK = "regne"
[docs] class ImportConfigSchema(Schema):
[docs] LIST_COLUMNS_FRONTEND = fields.List(fields.Dict, load_default=DEFAULT_LIST_COLUMN)
[docs] PREFIX = fields.String(load_default=PREFIX)
[docs] SRID = fields.List(fields.Dict, load_default=SRID)
[docs] ENCODAGE = fields.List(fields.String, load_default=ENCODAGE)
[docs] MAX_FILE_SIZE = fields.Integer(load_default=MAX_FILE_SIZE)
[docs] MAX_ENCODING_DETECTION_DURATION = fields.Integer(load_default=2.0)
[docs] ALLOWED_EXTENSIONS = fields.List(fields.String, load_default=ALLOWED_EXTENSIONS)
[docs] DEFAULT_COUNT_VALUE = fields.Integer(load_default=DEFAULT_COUNT_VALUE)
[docs] ALLOW_VALUE_MAPPING = fields.Boolean(load_default=ALLOW_VALUE_MAPPING)
[docs] DEFAULT_VALUE_MAPPING_ID = fields.Integer( load_default=DEFAULT_VALUE_MAPPING_ID ) # FIXME: unused
[docs] FILL_MISSING_NOMENCLATURE_WITH_DEFAULT_VALUE = fields.Boolean(load_default=True)
[docs] DISPLAY_MAPPED_VALUES = fields.Boolean(load_default=True) # FIXME: unused
[docs] INSTANCE_BOUNDING_BOX = fields.List( fields.Float, load_default=INSTANCE_BOUNDING_BOX ) # FIXME: unused
[docs] ENABLE_BOUNDING_BOX_CHECK = fields.Boolean(load_default=True) # FIXME : unused
# When setting PER_DATASET_UUID_CHECK=True (used for import in synthese): # - Replace the unicity constraint on unique_id_sinp with an unicity constraint on (unique_id_sinp,id_dataset). # - Disable per-row dataset import by setting display=False in gn_imports.bib_fields # for the id_dataset field belonging to synthese destination.
[docs] PER_DATASET_UUID_CHECK = fields.Boolean(load_default=False)
[docs] ALLOW_FIELD_MAPPING = fields.Boolean(load_default=ALLOW_FIELD_MAPPING) # FIXME: unused
[docs] DEFAULT_FIELD_MAPPING_ID = fields.Integer( load_default=DEFAULT_FIELD_MAPPING_ID ) # FIXME: unused
[docs] DISPLAY_CHECK_BOX_MAPPED_FIELD = fields.Boolean(load_default=True)
[docs] CHECK_PRIVATE_JDD_BLURING = fields.Boolean(load_default=True)
[docs] CHECK_REF_BIBLIO_LITTERATURE = fields.Boolean(load_default=True)
[docs] CHECK_EXIST_PROOF = fields.Boolean(load_default=True)
[docs] DEFAULT_GENERATE_MISSING_UUID = fields.Boolean(load_default=True)
[docs] DEFAULT_RANK = fields.String( load_default=DEFAULT_RANK, validate=OneOf( [ "regne", "phylum", "classe", "ordre", "famille", "sous_famille", "tribu", "group1_inpn", "group2_inpn", ] ), )
[docs] ID_AREA_RESTRICTION = fields.Integer(load_default=None)
[docs] ID_LIST_TAXA_RESTRICTION = fields.Integer(load_default=None)
[docs] MODULE_URL = fields.String(load_default="/import")
[docs] DATAFRAME_BATCH_SIZE = fields.Integer(load_default=10000)
[docs] EXPORT_REPORT_PDF_FILENAME = fields.String( load_default="import_{id_import}_{date_create_import}_report.pdf" )