Skip to content

Commit

Permalink
Remove cruved + correction sql
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Dec 30, 2024
1 parent 4aa2cb5 commit ca836cd
Show file tree
Hide file tree
Showing 17 changed files with 403 additions and 462 deletions.
39 changes: 17 additions & 22 deletions RHOMEOOrthoptere/exports/csv/export_csv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,27 @@ WITH source AS (
), sites AS (

SELECT

id_base_site,
s.id_base_site,
sg.sites_group_name,
sg.sites_group_description,
sg.comments sites_group_comments,
base_site_name,
base_site_description,
id_inventor,
s.base_site_name,
s.base_site_description,
s.id_inventor,
CONCAT(tr.nom_role, ' ', tr.prenom_role) AS inventor,
COALESCE (t_base_sites.meta_update_date, first_use_date) AS date_site,
altitude_min,
altitude_max,
geom_local,
st_x(ST_Centroid(geom)) AS wgs84_x,
st_y(ST_Centroid(geom)) AS wgs84_y,
st_x(ST_Centroid(geom_local)) AS l93_x,
st_y(ST_Centroid(geom_local)) AS l93_y,
COALESCE (s.meta_update_date, s.first_use_date) AS date_site,
s.altitude_min,
s.altitude_max,
s.geom_local,
st_x(ST_Centroid(s.geom)) AS wgs84_x,
st_y(ST_Centroid(s.geom)) AS wgs84_y,
st_x(ST_Centroid(s.geom_local)) AS l93_x,
st_y(ST_Centroid(s.geom_local)) AS l93_y,
(sc.data::json#>>'{size_maille}')::text AS site_size_maille

FROM gn_monitoring.t_base_sites
JOIN gn_monitoring.t_site_complements sc USING (id_base_site)
JOIN gn_monitoring.t_sites_groups sg USING (id_sites_group)
JOIN utilisateurs.t_roles tr ON tr.id_role = t_base_sites.id_inventor
FROM gn_monitoring.t_base_sites s
JOIN gn_monitoring.t_site_complements sc USING (id_base_site)
JOIN gn_monitoring.t_sites_groups sg USING (id_sites_group)
JOIN utilisateurs.t_roles tr ON tr.id_role = s.id_inventor

), visits AS (

Expand Down Expand Up @@ -147,10 +145,7 @@ SELECT
ON t.cd_nom = o.cd_nom
JOIN source
ON TRUE
JOIN observers obs ON obs.id_base_visit = v.id_base_visit

LEFT JOIN LATERAL ref_geo.fct_get_altitude_intersection(s.geom_local) alt (altitude_min, altitude_max)
ON TRUE
JOIN observers obs ON obs.id_base_visit = v.id_base_visit
WHERE m.module_code = :module_code
;

Expand Down
1 change: 0 additions & 1 deletion RHOMEOOrthoptere/module.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":1, "U":1, "D": 1},
"module_label":"RHOMEOOthoptere",
"module_desc":"Module pour le protocole de suivi RhoMeO des Othopteres",
"color":"#e5fffe",
Expand Down
1 change: 0 additions & 1 deletion RHOMEOOrthoptere/observation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":1, "U":1, "D": 1},
"description_field_name":"cd_nom",
"genre":"F",
"display_properties": [
Expand Down
1 change: 0 additions & 1 deletion RHOMEOOrthoptere/site.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":1, "U":1, "D": 1},
"genre":"M",
"label": "site",
"label_list": "Sites",
Expand Down
1 change: 0 additions & 1 deletion RHOMEOOrthoptere/sites_group.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":1, "U":1, "D": 1},
"genre":"F",
"label": "zone",
"label_list": "Prospect zone",
Expand Down
8 changes: 4 additions & 4 deletions RHOMEOOrthoptere/synthese.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
-- ne pas remplacer cette variable, elle est indispensable pour les scripts d'installations
-- le module pouvant être installé avec un code différent de l'original

DROP VIEW IF EXISTS gn_monitoring.v_synthese_:module_code;
CREATE VIEW gn_monitoring.v_synthese_:module_code AS
DROP VIEW IF EXISTS gn_monitoring.v_synthese_RHOMEOOrthoptere;
CREATE VIEW gn_monitoring.v_synthese_RHOMEOOrthoptere AS

WITH source AS (

Expand All @@ -29,7 +29,7 @@ WITH source AS (
id_source

FROM gn_synthese.t_sources
WHERE name_source = CONCAT('MONITORING_', UPPER(:'module_code'))
WHERE name_source = CONCAT('MONITORING_', UPPER(:module_code))
LIMIT 1

), sites AS (
Expand Down Expand Up @@ -184,5 +184,5 @@ JOIN observers obs
ON obs.id_base_visit = v.id_base_visit
LEFT JOIN LATERAL ref_geo.fct_get_altitude_intersection(s.the_geom_local) alt (altitude_min, altitude_max)
ON TRUE
WHERE m.module_code = :'module_code'
WHERE m.module_code = :module_code
;
1 change: 0 additions & 1 deletion RHOMEOOrthoptere/visit.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"cruved": {"C":1, "U":1, "D": 1},
"genre":"M",
"label": "Passage",
"label_list": "Passages",
Expand Down
2 changes: 1 addition & 1 deletion chronoventaire/synthese.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ AS WITH t_source AS (
tbv.id_digitiser,
tbs.id_inventor,
concat(tr.nom_role, ' ', tr.prenom_role) AS observers,
tsc.id_module,
tbv.id_module,
tbv.comments AS comment_context,
to2.comments AS comment_description,
obs.ids_observers,
Expand Down
Loading

0 comments on commit ca836cd

Please sign in to comment.