geonature.core.gn_meta.mtd
Submodules
Package Contents
Classes
The base class of the |
|
The base class of the |
|
The base class of the |
|
Functions
|
|
|
Associate actor and DS or AF according to CorActor value. |
|
Will update a given AF (Acquisition Framework) if already exists in database according to UUID, else update the AF. |
|
Will create or update a given DS according to UUID. |
Parse an xml of AF from a string |
|
|
Parse an xml of datasets from a string |
|
Method to trigger global MTD sync. |
|
Synchro AF<array>, Synchro DS<array> |
Method to trigger global MTD sync. |
|
|
Method to trigger MTD sync on user authentication. |
Attributes
- geonature.core.gn_meta.mtd.insert_user_and_org(info_user, update_user_organism: bool = True)[source]
- class geonature.core.gn_meta.mtd.CorAcquisitionFrameworkActor[source]
Bases:
geonature.utils.env.DB.Model
The base class of the
SQLAlchemy.Model
declarative model class.To define models, subclass
db.Model
, not this. To customizedb.Model
, subclass this and pass it asmodel_class
toSQLAlchemy
. To customizedb.Model
at the metaclass level, pass an already created declarative model class asmodel_class
.- __tablename__ = 'cor_acquisition_framework_actor'
- __table_args__
- id_cafa
- id_acquisition_framework
- id_role
- id_organism
- id_nomenclature_actor_role
- nomenclature_actor_role
- role
- organism
- class geonature.core.gn_meta.mtd.CorDatasetActor[source]
Bases:
geonature.utils.env.DB.Model
The base class of the
SQLAlchemy.Model
declarative model class.To define models, subclass
db.Model
, not this. To customizedb.Model
, subclass this and pass it asmodel_class
toSQLAlchemy
. To customizedb.Model
at the metaclass level, pass an already created declarative model class asmodel_class
.- __tablename__ = 'cor_dataset_actor'
- __table_args__
- id_cda
- id_dataset
- id_role
- id_organism
- id_nomenclature_actor_role
- nomenclature_actor_role
- role
- organism
- class geonature.core.gn_meta.mtd.TAcquisitionFramework[source]
Bases:
geonature.core.gn_meta.models.commons.db.Model
The base class of the
SQLAlchemy.Model
declarative model class.To define models, subclass
db.Model
, not this. To customizedb.Model
, subclass this and pass it asmodel_class
toSQLAlchemy
. To customizedb.Model
at the metaclass level, pass an already created declarative model class asmodel_class
.- __tablename__ = 't_acquisition_frameworks'
- __table_args__
- id_acquisition_framework
- unique_acquisition_framework_id
- acquisition_framework_name
- acquisition_framework_desc
- id_nomenclature_territorial_level
- territory_desc
- keywords
- id_nomenclature_financing_type
- target_description
- ecologic_or_geologic_target
- acquisition_framework_parent_id
- is_parent
- opened
- id_digitizer
- acquisition_framework_start_date
- acquisition_framework_end_date
- meta_create_date
- meta_update_date
- initial_closing_date
- creator
- nomenclature_territorial_level
- nomenclature_financing_type
- cor_af_actor
- cor_objectifs
- cor_volets_sinp
- cor_territories
- bibliographical_references
- t_datasets
- datasets
- static get_id(uuid_af)[source]
return the acquisition framework’s id from its UUID if exist or None
- static get_user_af(user, only_query=False, only_user=False)[source]
get the af(s) where the user is actor (himself or with its organism - only himelsemf id only_use=True) or digitizer param:
user from TRole model
only_query: boolean (return the query not the id_datasets allowed if true)
only_user: boolean: return only the dataset where user himself is actor (not with its organoism)
return: a list of id_dataset or a query
- geonature.core.gn_meta.mtd.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.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.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.parse_acquisition_framwork_xml(xml)[source]
Parse an xml of AF from a string Return:
dict: a dict of the parsed xml
- geonature.core.gn_meta.mtd.parse_jdd_xml(xml)[source]
Parse an xml of datasets from a string Return:
list: a list of dict of the JDD in the xml
- class geonature.core.gn_meta.mtd.MTDInstanceApi(api_endpoint, instance_id, id_role=None)[source]
-
- get_ds_user_list()[source]
Retrieve the list of of datasets (ds) for the user.
Returns
- list
A list of datasets (ds) for the user.
- geonature.core.gn_meta.mtd.add_unexisting_digitizer(id_digitizer)[source]
Method to trigger global MTD sync.
- Paramètres:
id_digitizer – as id role from meta info