Skip to content

Commit

Permalink
Merge pull request #68 from lpoaura/develop_aura
Browse files Browse the repository at this point in the history
1.0.5
  • Loading branch information
lpojgc authored Dec 16, 2022
2 parents 85dca60 + 772d914 commit bbd58d1
Show file tree
Hide file tree
Showing 22 changed files with 2,685 additions and 632 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ la [LPO Auvergne-Rhône-Alpes](https://auvergne-rhone-alpes.lpo.fr/).

* @eguilley (LPO Auvergne-Rhône-Alpes)
* @lpofredc (@lpofredc - LPO Auvergne-Rhône-Alpes)
* @jgirardclaudon (@lpojgc LPO Auvergne-Rhône-Alpes)
* @jgc (@lpojgc LPO Auvergne-Rhône-Alpes)

![logoLPO AuRA](https://raw.githubusercontent.com/lpoaura/biodivsport-widget/master/images/LPO_AuRA_l250px.png)

Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def classFactory(iface): # pylint: disable=invalid-name
:param iface: A QGIS interface instance.
:type iface: QgsInterface
"""
return ScriptsLPOPlugin()
return ScriptsLPOPlugin(iface)
2 changes: 1 addition & 1 deletion common_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def format_layer_export(layer):
invalid_formats = ["_text", "jsonb"]
for field in old_fields:
if field.typeName() in invalid_formats:
new_fields.append(QgsField(field.name(), QVariant.String, "str"))
new_fields.append(QgsField(field.name(), QVariant.String, "text"))
else:
new_fields.append(field)
# for i,field in enumerate(new_fields):
Expand Down
64 changes: 64 additions & 0 deletions config/mv_c_cor_vn_taxref.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**********************************************************************************************************************
* Création de la vue permettant la récupération des noms d'espèces dans scr_lpo_datas.v_c_observations
**********************************************************************************************************************/



CREATE MATERIALIZED VIEW taxonomie.mv_c_cor_vn_taxref
TABLESPACE pg_default
AS WITH prep AS (
SELECT DISTINCT sp.id AS vn_id,
tg.item ->> 'name'::text AS groupe_taxo_fr,
tg.item ->> 'latin_name'::text AS groupe_taxo_sci,
sp.item ->> 'french_name'::text AS french_name,
sp.item ->> 'latin_name'::text AS latin_name
FROM src_vn_json.species_json sp
LEFT JOIN src_vn_json.taxo_groups_json tg ON ((sp.item ->> 'id_taxo_group'::text)::integer) = tg.id AND sp.site::text = tg.site::text
GROUP BY sp.id, (tg.item ->> 'name'::text), (tg.item ->> 'latin_name'::text), (sp.item ->> 'french_name'::text), (sp.item ->> 'latin_name'::text)
)
SELECT vn.vn_id,
vn.groupe_taxo_fr,
vn.groupe_taxo_sci,
vn.french_name AS vn_nom_fr,
vn.latin_name AS vn_nom_sci,
tx.cd_nom,
tx.cd_ref,
tx.group1_inpn AS tx_group1_inpn,
tx.group2_inpn AS tx_group2_inpn,
tx.classe AS tx_classe,
tx.famille AS tx_famille,
tx.nom_vern AS tx_nom_fr,
tx.lb_nom AS tx_nom_sci,
CASE
WHEN id_sp_vn.id_sp_source IS NOT NULL THEN true
ELSE false
END AS vn_utilisation
FROM prep vn
LEFT JOIN taxonomie.cor_c_vn_taxref corr ON vn.vn_id = corr.vn_id
LEFT JOIN taxonomie.taxref tx ON corr.cd_nom = tx.cd_nom
LEFT JOIN ( SELECT DISTINCT tcse.id_sp_source
FROM src_lpodatas.t_c_synthese_extended tcse
JOIN gn_synthese.synthese s ON s.id_synthese = tcse.id_synthese
WHERE (s.id_source IN ( SELECT ts.id_source
FROM gn_synthese.t_sources ts
WHERE ts.name_source::text = 'faune-aura'::text))) id_sp_vn ON id_sp_vn.id_sp_source = vn.vn_id
WITH DATA;

-- View indexes:
CREATE INDEX mv_c_cor_vn_taxref_cd_nom_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (cd_nom);
CREATE INDEX mv_c_cor_vn_taxref_groupe_taxo_fr_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (groupe_taxo_fr);
CREATE INDEX mv_c_cor_vn_taxref_tx_group2_inpn_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (tx_group2_inpn);
CREATE INDEX mv_c_cor_vn_taxref_tx_nom_fr_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (tx_nom_fr);
CREATE INDEX mv_c_cor_vn_taxref_tx_nom_sci_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (tx_nom_sci);
CREATE INDEX mv_c_cor_vn_taxref_vn_nom_fr_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (vn_nom_fr);
CREATE INDEX mv_c_cor_vn_taxref_vn_nom_sci_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (vn_nom_sci);
CREATE INDEX mv_c_cor_vn_taxref_vn_utilisation_idx1 ON taxonomie.mv_c_cor_vn_taxref USING btree (vn_utilisation);


-- Permissions

ALTER TABLE taxonomie.mv_c_cor_vn_taxref OWNER TO dbadmin;
GRANT ALL ON TABLE taxonomie.mv_c_cor_vn_taxref TO postgres;
GRANT ALL ON TABLE taxonomie.mv_c_cor_vn_taxref TO dbadmin;
GRANT SELECT ON TABLE taxonomie.mv_c_cor_vn_taxref TO dt;
GRANT ALL ON TABLE taxonomie.mv_c_cor_vn_taxref TO advanced_user;
Loading

0 comments on commit bbd58d1

Please sign in to comment.