geonature.core.gn_meta.mtd.mtd_utils

Module Contents

Functions

sync_ds(ds, cd_nomenclatures)

Will create or update a given DS according to UUID.

sync_af(af)

Will update a given AF (Acquisition Framework) if already exists in database according to UUID, else update the AF.

add_or_update_organism(uuid, nom, email)

Create or update organism if UUID not exists in DB.

associate_actors(actors, CorActor, pk_name, pk_value)

Associate actor and DS or AF according to CorActor value.

associate_dataset_modules(dataset)

Associate a dataset to modules specified in [MTD][JDD_MODULE_CODE_ASSOCIATION] parameter (geonature config)

Attributes

NOMENCLATURE_MAPPING

log

geonature.core.gn_meta.mtd.mtd_utils.NOMENCLATURE_MAPPING[source]
geonature.core.gn_meta.mtd.mtd_utils.log[source]
geonature.core.gn_meta.mtd.mtd_utils.sync_ds(ds, cd_nomenclatures)[source]

Will create or update a given DS according to UUID. Only process DS if dataset’s cd_nomenclatures exists in ref_normenclatures.t_nomenclatures.

Paramètres:
  • ds – <dict> DS infos

  • cd_nomenclatures – <array> cd_nomenclature from ref_normenclatures.t_nomenclatures

geonature.core.gn_meta.mtd.mtd_utils.sync_af(af)[source]

Will update a given AF (Acquisition Framework) if already exists in database according to UUID, else update the AF.

Parameters

afdict

AF infos.

Returns

TAcquisitionFramework

The updated or inserted acquisition framework.

geonature.core.gn_meta.mtd.mtd_utils.add_or_update_organism(uuid, nom, email)[source]

Create or update organism if UUID not exists in DB.

Paramètres:
  • uuid – uniq organism uuid

  • nom – org name

  • email – org email

geonature.core.gn_meta.mtd.mtd_utils.associate_actors(actors, CorActor, pk_name, pk_value)[source]

Associate actor and DS or AF according to CorActor value.

Parameters

actorslist

list of actors

CorActordb.Model

table model

pk_namestr

pk attribute name

pk_valuestr

pk value

geonature.core.gn_meta.mtd.mtd_utils.associate_dataset_modules(dataset)[source]

Associate a dataset to modules specified in [MTD][JDD_MODULE_CODE_ASSOCIATION] parameter (geonature config)

Paramètres:

dataset – <geonature.core.gn_meta.models.TDatasets> dataset (SQLAlchemy model object)