geonature.core.gn_synthese.routes#

Attributes#

Functions#

get_observations_for_web(permissions)

Optimized route to serve data for the frontend with all filters.

get_one_synthese(permissions, id_synthese)

Get one synthese record for web app with all decoded nomenclature

export_taxon_web(permissions)

Optimized route for taxon web export.

export_observations_web(permissions)

Optimized route for observations web export.

export_metadata(permissions)

Route to export the metadata in CSV

export_status(permissions)

Route to get all the protection status of a synthese search

general_stats(permissions)

Return stats about synthese.

taxon_stats(scope, cd_nom)

Return stats for a specific taxon

get_taxon_tree()

Get taxon tree.

get_autocomplete_taxons_synthese()

Autocomplete taxon for web search (based on all taxon in Synthese).

get_sources()

Get all sources.

getDefaultsNomenclatures()

Get default nomenclatures

get_color_taxon()

Get color of taxon in areas (vue synthese.v_color_taxon_area).

get_taxa_count()

Get taxa count in synthese filtering with generic parameters

get_observation_count()

Get observations found in a given dataset

get_bbox()

Get bbox of observations

observation_count_per_column(column)

Get observations count group by a given column

get_taxa_distribution()

Get taxa distribution for a given dataset or acquisition framework

create_report(permissions)

Create a report (e.g report) for a given synthese id

notify_new_report_change(synthese, user, id_roles, content)

update_content_report(id_report)

Modify a report (e.g report) for a given synthese id

list_all_reports(permissions)

list_reports(permissions, id_synthese)

delete_report(id_report)

list_synthese_log_entries(→ dict)

Get log history from synthese

Module Contents#

geonature.core.gn_synthese.routes.routes[source]#
geonature.core.gn_synthese.routes.get_observations_for_web(permissions)[source]#

Optimized route to serve data for the frontend with all filters.

Query filtered by any filter, returning all the fields of the view v_synthese_for_export:

properties = {
    "id": r["id_synthese"],
    "date_min": str(r["date_min"]),
    "cd_nom": r["cd_nom"],
    "nom_vern_or_lb_nom": r["nom_vern"] if r["nom_vern"] else r["lb_nom"],
    "lb_nom": r["lb_nom"],
    "dataset_name": r["dataset_name"],
    "observers": r["observers"],
    "url_source": r["url_source"],
    "unique_id_sinp": r["unique_id_sinp"],
    "entity_source_pk_value": r["entity_source_pk_value"],
}
geojson = json.loads(r["st_asgeojson"])
geojson["properties"] = properties
Qparam str limit:

Limit number of synthese returned. Defaults to NB_MAX_OBS_MAP.

Qparam str cd_ref_parent:

filtre tous les taxons enfants d’un TAXREF cd_ref.

Qparam str cd_ref:

Filter by TAXREF cd_ref attribute

Qparam str taxonomy_group2_inpn:

Filter by TAXREF group2_inpn attribute

Qparam str taxonomy_id_hab:

Filter by TAXREF id_habitat attribute

Qparam str taxhub_attribut*:

filtre générique TAXREF en fonction de l’attribut et de la valeur.

Qparam str *_red_lists*_red_lists:

filtre générique de listes rouges. Filtre sur les valeurs. Voir config.

Qparam str *_protection_status*_protection_status:

filtre générique de statuts (BdC Statuts). Filtre sur les types. Voir config.

Qparam str observers:

Filter on observer

Qparam str id_organism:

Filter on organism

Qparam str date_min:

Start date

Qparam str date_max:

End date

Qparam str id_acquisition_framework:

tbd

Qparam str geoIntersection:

Intersect with the geom send from the map

Qparam str period_start:

tbd

Qparam str period_end:

tbd

Qparam str area*:

Generic filter on area

Qparam str *:

Generic filter, given by colname & value

>jsonarr array data:

Array of synthese with geojson key, see above

>jsonarr int nb_total:

Number of observations

>jsonarr bool nb_obs_limited:

Is number of observations capped

geonature.core.gn_synthese.routes.get_one_synthese(permissions, id_synthese)[source]#

Get one synthese record for web app with all decoded nomenclature

geonature.core.gn_synthese.routes.export_taxon_web(permissions)[source]#

Optimized route for taxon web export.

This view is customisable by the administrator Some columns are mandatory: cd_ref

POST parameters: Use a list of cd_ref (in POST parameters)

to filter the v_synthese_taxon_for_export_view

Query str export_format:

str<”csv”>

geonature.core.gn_synthese.routes.export_observations_web(permissions)[source]#

Optimized route for observations web export.

This view is customisable by the administrator Some columns are mandatory: id_synthese, geojson and geojson_local to generate the exported files

POST parameters: Use a list of id_synthese (in POST parameters) to filter the v_synthese_for_export_view

Query str export_format:

str<”csv”, “geojson”, “shapefiles”, “gpkg”>

Query str export_format:

str<”csv”, “geojson”, “shapefiles”, “gpkg”>

geonature.core.gn_synthese.routes.export_metadata(permissions)[source]#

Route to export the metadata in CSV

The table synthese is join with gn_synthese.v_metadata_for_export The column jdd_id is mandatory in the view gn_synthese.v_metadata_for_export

TODO: Remove the following comment line ? or add the where clause for id_synthese in id_list ? POST parameters: Use a list of id_synthese (in POST parameters) to filter the v_synthese_for_export_view

geonature.core.gn_synthese.routes.export_status(permissions)[source]#

Route to get all the protection status of a synthese search

Get the CRUVED from “R” action because we don’t give observations X/Y but only statuts and to be consistent with the data displayed in the web interface.

Parameters:
  • HTTP-GET: the same that the /synthese endpoint (all the filter in web app)

geonature.core.gn_synthese.routes.general_stats(permissions)[source]#

Return stats about synthese.

geonature.core.gn_synthese.routes.taxon_stats(scope, cd_nom)[source]#

Return stats for a specific taxon

geonature.core.gn_synthese.routes.get_taxon_tree()[source]#

Get taxon tree.

geonature.core.gn_synthese.routes.get_autocomplete_taxons_synthese()[source]#

Autocomplete taxon for web search (based on all taxon in Synthese).

The request use trigram algorithm to get relevent results

Query str search_name:

the search name (use sql ilike statement and puts « % » for spaces)

Query str regne:

filter with kingdom

:query str group2_inpn : filter with INPN group 2

geonature.core.gn_synthese.routes.get_sources()[source]#

Get all sources.

geonature.core.gn_synthese.routes.getDefaultsNomenclatures()[source]#

Get default nomenclatures

Query str group2_inpn:

Query str regne:

Query int organism:

geonature.core.gn_synthese.routes.get_color_taxon()[source]#

Get color of taxon in areas (vue synthese.v_color_taxon_area).

Query str code_area_type:

Type area code (ref_geo.bib_areas_types.type_code)

Query int id_area:

Id of area (ref_geo.l_areas.id_area)

Query int cd_nom:

taxon code (taxonomie.taxref.cd_nom)

Those three parameters can be multiples :returns: Array<dict<VColorAreaTaxon>>

geonature.core.gn_synthese.routes.get_taxa_count()[source]#

Get taxa count in synthese filtering with generic parameters

Parameters#

id_dataset: int (query parameter)

Returns#

count: int:

the number of taxon

geonature.core.gn_synthese.routes.get_observation_count()[source]#

Get observations found in a given dataset

Parameters#

id_dataset: int (query parameter)

Returns#

count: int:

the number of observation

geonature.core.gn_synthese.routes.get_bbox()[source]#

Get bbox of observations

Parameters#

id_dataset: int: (query parameter)

Returns#

bbox: geojson:

the bounding box in geojson

geonature.core.gn_synthese.routes.observation_count_per_column(column)[source]#

Get observations count group by a given column

This function was used to count observations per dataset, but this usage have been replaced by TDatasets.synthese_records_count. Remove this function as it is very inefficient?

geonature.core.gn_synthese.routes.get_taxa_distribution()[source]#

Get taxa distribution for a given dataset or acquisition framework and grouped by a certain taxa rank

geonature.core.gn_synthese.routes.create_report(permissions)[source]#

Create a report (e.g report) for a given synthese id

Returns#

report: json:

Every occurrence’s report

geonature.core.gn_synthese.routes.notify_new_report_change(synthese, user, id_roles, content)[source]#
geonature.core.gn_synthese.routes.update_content_report(id_report)[source]#

Modify a report (e.g report) for a given synthese id

Returns#

report: json:

Every occurrence’s report

geonature.core.gn_synthese.routes.list_all_reports(permissions)[source]#
geonature.core.gn_synthese.routes.list_reports(permissions, id_synthese)[source]#
geonature.core.gn_synthese.routes.delete_report(id_report)[source]#
geonature.core.gn_synthese.routes.list_synthese_log_entries() dict[source]#

Get log history from synthese

Parameters#

Returns#

dict

log action list