From a06a1ea980e866b2adaa8f80cd7b7990312eef36 Mon Sep 17 00:00:00 2001 From: SJiB Date: Sat, 18 Mar 2023 16:57:51 +0100 Subject: [PATCH 01/62] add delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql Delta for VSA-DSS Export / Import --- ...low_characteristic_to_fk_overflow_char.sql | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql diff --git a/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql new file mode 100644 index 00000000..2bc3fe9c --- /dev/null +++ b/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -0,0 +1,133 @@ +-- drop connected views +DROP VIEW IF EXISTS qgep_od.vw_leapingweir; +DROP VIEW IF EXISTS qgep_od.vw_prank_weir; +DROP VIEW IF EXISTS qgep_od.vw_pump; +DROP VIEW IF EXISTS qgep_od.vw_qgep_overflow; + + +-- class overflow +--1. add correct fk_overflow_char +ALTER TABLE IF EXISTS qgep_od.overflow ADD COLUMN fk_overflow_char varchar (16); + +-- 2. add correct CONSTRAINT +-- ALTER TABLE qgep_od.overflow ADD COLUMN fk_overflow_characteristic varchar (16); +--ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_overflow_characteristic FOREIGN KEY (fk_overflow_characteristic) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE set null; + +ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_overflow_char FOREIGN KEY (fk_overflow_char) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE set null; + +--3. copy data from fk_overflow_characteristic to fk_overflow_char +UPDATE qgep_od.overflow +SET fk_overflow_char = fk_overflow_characteristic; + +-- 4. delete old rel_overflow_overflow_characteristic constraint +ALTER TABLE IF EXISTS qgep_od.overflow DROP CONSTRAINT rel_overflow_overflow_characteristic; + +-- 5. delete wrong fk_overflow_characteristic column +ALTER TABLE IF EXISTS qgep_od.overflow DROP COLUMN fk_overflow_characteristic; + +-- 6. rename wrong value in qgep_sys.dictionary_od_field +-- not needed as fk_attributes are not in qgep_sys tables + + +-- class hq_relation +--1. add correct fk_overflow_char +ALTER TABLE IF EXISTS qgep_od.hq_relation ADD COLUMN fk_overflow_char varchar (16); + +-- 2. add correct CONSTRAINT +--ALTER TABLE qgep_od.hq_relation ADD COLUMN fk_overflow_characteristic varchar (16); +--ALTER TABLE qgep_od.hq_relation ADD CONSTRAINT rel_hq_relation_overflow_characteristic FOREIGN KEY (fk_overflow_characteristic) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE cascade; + +ALTER TABLE qgep_od.hq_relation ADD CONSTRAINT rel_hq_relation_overflow_char FOREIGN KEY (fk_overflow_char) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE cascade; + + +--3. copy data from fk_overflow_characteristic to fk_overflow_char +UPDATE qgep_od.hq_relation +SET fk_overflow_char = fk_overflow_characteristic; + +-- 4. delete old rel_overflow_overflow_characteristic constraint +ALTER TABLE IF EXISTS qgep_od.hq_relation DROP CONSTRAINT rel_hq_relation_overflow_characteristic; + +-- 5. delete wrong fk_overflow_characteristic column +ALTER TABLE IF EXISTS qgep_od.hq_relation DROP COLUMN fk_overflow_characteristic; + +-- 6. rename wrong value in qgep_sys.dictionary_od_field +-- not needed as fk_attributes are not in qgep_sys tables + + +-- class hydraulic_char_data +--1. add correct fk_overflow_char +ALTER TABLE IF EXISTS qgep_od.hydraulic_char_data ADD COLUMN fk_overflow_char varchar (16); + +-- 2. add correct CONSTRAINT +--ALTER TABLE qgep_od.hydraulic_char_data ADD COLUMN fk_overflow_characteristic varchar (16); +--ALTER TABLE qgep_od.hydraulic_char_data ADD CONSTRAINT rel_hydraulic_char_data_overflow_characteristic FOREIGN KEY (fk_overflow_characteristic) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE cascade; + +ALTER TABLE qgep_od.hydraulic_char_data ADD CONSTRAINT rel_hydraulic_char_data_overflow_char FOREIGN KEY (fk_overflow_char) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE cascade; + + +--3. copy data from fk_overflow_characteristic to fk_overflow_char +UPDATE qgep_od.hydraulic_char_data +SET fk_overflow_char = fk_overflow_characteristic; + +-- 4. delete old rel_overflow_overflow_characteristic constraint +ALTER TABLE IF EXISTS qgep_od.hydraulic_char_data DROP CONSTRAINT rel_hydraulic_char_data_overflow_characteristic; + +-- 5. delete wrong fk_overflow_characteristic column +ALTER TABLE IF EXISTS qgep_od.hydraulic_char_data DROP COLUMN fk_overflow_characteristic; + +-- 6. rename wrong value in qgep_sys.dictionary_od_field +-- not needed as fk_attributes are not in qgep_sys tables + + +-- class overflow_char +-- 1. rename attribute kind_overflow_characteristic and overflow_characteristic_digital in table qgep_od.overflow_char +-- https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-rename-column/ + +ALTER TABLE qgep_od.overflow_char +RENAME COLUMN kind_overflow_characteristic TO kind_overflow_char; + +ALTER TABLE qgep_od.overflow_char +RENAME COLUMN overflow_characteristic_digital TO overflow_char_digital; + +-- 2. rename qgep_vl.overflow_char_kind_overflow_characteristic to overflow_char_kind_overflow_char +--and qgep_vl.overflow_char_overflow_characteristic_digital to overflow_char_overflow_char_digital + +ALTER TABLE qgep_vl.overflow_char_kind_overflow_characteristic RENAME TO overflow_char_kind_overflow_char; + +ALTER TABLE qgep_vl.overflow_char_overflow_characteristic_digital RENAME TO overflow_char_overflow_char_digital; + +-- 3. rename wrong value in qgep_sys.dictionary_od_field + +-- adjust value list in dictionary_od_field +-- INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6219,'overflow_char','kind_overflow_characteristic','kind_overflow_characteristic','Kennlinie_Typ','GENRE_COURBE_DE_FONCTIONNEMENT','curva_caratteristica_tipo','tipul_curbei_de_func?ionare','yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.','NULL','[CHF]',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); + + +UPDATE qgep_sys.dictionary_od_field +SET field_name = 'kind_overflow_char', + field_name_en = 'kind_overflow_char' +WHERE (table_name = 'overflow_char' AND field_name = 'kind_overflow_characteristic' AND field_name_en = 'kind_overflow_characteristic') +RETURNING *; + +-- INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6222,'overflow_char','overflow_characteristic_digital','overflow_characteristic_digital','Kennlinie_digital','COURBE_DE_FONCTIONNEMENT_NUM','curva_caratteristica_digitale','curba_de_func?ionare_numerica','yyy_Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in Ueberlaufcharakteristik ausgefüllt sein in HQ_Relation.','Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in HQ_Relation ausgefüllt sein.','Si courbe de fonctionnement numérique = oui, les attributs pour les relations Q-Q et H-Q doivent être saisis dans la classe RELATION_HQ.','NULL','',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); + +UPDATE qgep_sys.dictionary_od_field +SET field_name = 'overflow_char_digital', + field_name_en = 'overflow_char_digital' +WHERE (table_name = 'overflow_char' AND field_name = 'overflow_characteristic_digital' AND field_name_en = 'overflow_characteristic_digital') +RETURNING *; + + +-- 4. rename wrong value in qgep_sys.dictionary_od_values +-- INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6220,'overflow_char','kind_overflow_characteristic','hq','hq','','HQ','','HQ','','HQ','','','','yyy_H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','ligne H / Q: H = hauteur d’eau lors du déversement [m.s.m.], Q = débit conservé vers STEP [l/s]','Assegnare altezza (H) e portata (Q)',''); + +UPDATE qgep_sys.dictionary_od_values +SET field_name = 'kind_overflow_char' +WHERE (table_name = 'overflow_char' AND field_name = 'kind_overflow_characteristic') +RETURNING *; + +--INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6223,'overflow_char','overflow_characteristic_digital','yes','yes','','ja','','oui','','si','','','','','','','',''); + +UPDATE qgep_sys.dictionary_od_values +SET field_name = 'overflow_char_digital' +WHERE (table_name = 'overflow_char' AND field_name = 'overflow_characteristic_digital') +RETURNING *; \ No newline at end of file From d92f9f63ca3330568b59c636304a3e2f4eff413b Mon Sep 17 00:00:00 2001 From: tproduit Date: Fri, 24 Mar 2023 07:33:05 +0100 Subject: [PATCH 02/62] Correction of the Prandtl-Colebrook conversion --- swmm_views/04_vw_swmm_conduits.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm_views/04_vw_swmm_conduits.sql b/swmm_views/04_vw_swmm_conduits.sql index e031e16c..cd3a61de 100644 --- a/swmm_views/04_vw_swmm_conduits.sql +++ b/swmm_views/04_vw_swmm_conduits.sql @@ -19,7 +19,7 @@ SELECT WHEN re.coefficient_of_friction IS NOT NULL THEN (1 / re.coefficient_of_friction::double precision) WHEN re.coefficient_of_friction IS NULL AND re.wall_roughness IS NOT NULL THEN CASE - WHEN re.clear_height IS NOT NULL THEN (1 / (4 * SQRT(9.81) * POWER((32 / re.clear_height::double precision / 1000),(1 / 6::double precision))*LOG(((3.71 * re.clear_height::double precision / 1000) / (re.wall_roughness / 1000)))))::numeric(7,4) + WHEN re.clear_height IS NOT NULL THEN ((3.71 * re.clear_height::double precision/ 1000.)/(POWER(10., re.wall_roughness/( 4. * SQRT(9.81) * POWER((32. / (re.clear_height::double precision/1000.)), 1./6.)))))::numeric(7,4) WHEN re.clear_height IS NULL AND re.swmm_default_coefficient_of_friction IS NOT NULL THEN (1 / re.swmm_default_coefficient_of_friction::double precision) ELSE 0.01 END @@ -37,10 +37,10 @@ SELECT concat_ws(';', ws.identifier, CASE - WHEN re.coefficient_of_friction IS NOT NULL THEN '1 / K_Strickler is used as roughness' + WHEN re.coefficient_of_friction IS NOT NULL THEN '1 / K_Strickler, 1/re.coefficient_of_friction is used as roughness' WHEN re.coefficient_of_friction IS NULL AND re.wall_roughness IS NOT NULL THEN CASE - WHEN re.clear_height IS NOT NULL THEN 'The approximation of 1 / K_Strickler is computed using K_Colebrook to determined the roughness as roughness' + WHEN re.clear_height IS NOT NULL THEN 'The approximation of 1 / K_Strickler is computed from re.wall_roughness using an approximation formula.' WHEN re.clear_height IS NULL AND re.swmm_default_coefficient_of_friction IS NOT NULL THEN 'The default value stored in reach.swmm_default_coefficient_of_friction is used' ELSE 'Default value 0.01 is used as roughness' END From cb1c2d833ef4109fd3768edfa23ab5273f7077ba Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:06:28 +0100 Subject: [PATCH 03/62] Allow longer value_xx --- 03_qgep_db_dss.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/03_qgep_db_dss.sql b/03_qgep_db_dss.sql index ca5d0429..e297b8fc 100644 --- a/03_qgep_db_dss.sql +++ b/03_qgep_db_dss.sql @@ -33,11 +33,11 @@ CREATE TABLE qgep_sys.value_list_base ( code integer NOT NULL, vsacode integer NOT NULL, -value_en character varying(50), -value_de character varying(50), -value_fr character varying(50), -value_it character varying(60), -value_ro character varying(50), +value_en character varying(100), +value_de character varying(100), +value_fr character varying(100), +value_it character varying(100), +value_ro character varying(100), abbr_en character varying(3), abbr_de character varying(3), abbr_fr character varying(3), From 55fb554cc22e6026870afa622b5665e15f0976f3 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:12:11 +0100 Subject: [PATCH 04/62] add delta --- delta/delta_2023.0_allow_longer_vl_names.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 delta/delta_2023.0_allow_longer_vl_names.sql diff --git a/delta/delta_2023.0_allow_longer_vl_names.sql b/delta/delta_2023.0_allow_longer_vl_names.sql new file mode 100644 index 00000000..8c0114da --- /dev/null +++ b/delta/delta_2023.0_allow_longer_vl_names.sql @@ -0,0 +1,10 @@ +ALTER TABLE qgep_sys.value_list_base +ALTER COLUMN value_en TYPE character varying(100); +ALTER TABLE qgep_sys.value_list_base +ALTER COLUMN value_de TYPE character varying(100); +ALTER TABLE qgep_sys.value_list_base +ALTER COLUMN value_fr TYPE character varying(100); +ALTER TABLE qgep_sys.value_list_base +ALTER COLUMN value_it TYPE character varying(100); +ALTER TABLE qgep_sys.value_list_base +ALTER COLUMN value_ro TYPE character varying(100); From 79bd7457257ec3be539207056827dd4a37e84c8a Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Fri, 24 Mar 2023 10:18:05 +0100 Subject: [PATCH 05/62] set current_version to 2023.0 --- system/CURRENT_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CURRENT_VERSION.txt b/system/CURRENT_VERSION.txt index dc1e644a..d730fbef 100644 --- a/system/CURRENT_VERSION.txt +++ b/system/CURRENT_VERSION.txt @@ -1 +1 @@ -1.6.0 +2023.0 From d4bc5baf594d07c8ee7ac33e7d4815554afc0c80 Mon Sep 17 00:00:00 2001 From: tproduit Date: Fri, 24 Mar 2023 10:51:34 +0100 Subject: [PATCH 06/62] Add missing parenthesis --- swmm_views/04_vw_swmm_conduits.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm_views/04_vw_swmm_conduits.sql b/swmm_views/04_vw_swmm_conduits.sql index cd3a61de..0fe618dd 100644 --- a/swmm_views/04_vw_swmm_conduits.sql +++ b/swmm_views/04_vw_swmm_conduits.sql @@ -19,7 +19,7 @@ SELECT WHEN re.coefficient_of_friction IS NOT NULL THEN (1 / re.coefficient_of_friction::double precision) WHEN re.coefficient_of_friction IS NULL AND re.wall_roughness IS NOT NULL THEN CASE - WHEN re.clear_height IS NOT NULL THEN ((3.71 * re.clear_height::double precision/ 1000.)/(POWER(10., re.wall_roughness/( 4. * SQRT(9.81) * POWER((32. / (re.clear_height::double precision/1000.)), 1./6.)))))::numeric(7,4) + WHEN re.clear_height IS NOT NULL THEN 1./((4. * SQRT(9.81) * POWER((32. / (re.clear_height::double precision / 1000.)),(1. / 6.::double precision)))*LOG(((3.71 * (re.clear_height::double precision / 1000.)) / (re.wall_roughness / 1000.))))::numeric(7,4) WHEN re.clear_height IS NULL AND re.swmm_default_coefficient_of_friction IS NOT NULL THEN (1 / re.swmm_default_coefficient_of_friction::double precision) ELSE 0.01 END From f01f07fecde8407fa1a0ab6f1c0b9912c5d94a02 Mon Sep 17 00:00:00 2001 From: SJiB Date: Wed, 29 Mar 2023 17:22:57 +0200 Subject: [PATCH 07/62] added delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql --- ...xx_fk_chute_to_fk_surface_water_bodies.sql | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 delta/delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql diff --git a/delta/delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql b/delta/delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql new file mode 100644 index 00000000..50fa8d06 --- /dev/null +++ b/delta/delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql @@ -0,0 +1,69 @@ +-- class water_catchment +--1. add correct fk_surface_water_bodies +ALTER TABLE IF EXISTS qgep_od.water_catchment ADD COLUMN fk_surface_water_bodies varchar (16); + +-- 2. add correct CONSTRAINT +-- ALTER TABLE qgep_od.water_catchment ADD CONSTRAINT rel_water_catchment_chute FOREIGN KEY (fk_chute) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; + +ALTER TABLE IF EXISTS qgep_od.water_catchment ADD CONSTRAINT rel_water_catchment_surface_water_bodies FOREIGN KEY (fk_surface_water_bodies) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; + +--3. copy data from fk_chute to fk_surface_water_bodies +UPDATE qgep_od.water_catchment +SET fk_surface_water_bodies = fk_chute; + +-- 4. delete old rel_water_catchment_chute constraint +ALTER TABLE IF EXISTS qgep_od.water_catchment DROP CONSTRAINT rel_water_catchment_chute; + +-- 5. delete wrong fk_chute column +ALTER TABLE IF EXISTS qgep_od.water_catchment DROP COLUMN fk_chute; + +-- 6. rename wrong value in qgep_sys.dictionary_od_field +-- not needed as fk_attributes are not in qgep_sys tables + + +-- class bathing_area +--1. add correct fk_surface_water_bodies +ALTER TABLE IF EXISTS qgep_od.bathing_area ADD COLUMN fk_surface_water_bodies varchar (16); + +-- 2. add correct CONSTRAINT +-- ALTER TABLE qgep_od.bathing_area ADD CONSTRAINT rel_bathing_area_chute FOREIGN KEY (fk_chute) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; + +ALTER TABLE IF EXISTS qgep_od.bathing_area ADD CONSTRAINT rel_bathing_area_surface_water_bodies FOREIGN KEY (fk_surface_water_bodies) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; + +--3. copy data from fk_chute to fk_surface_water_bodies +UPDATE qgep_od.bathing_area +SET fk_surface_water_bodies = fk_chute; + +-- 4. delete old rel_water_catchment_chute constraint +ALTER TABLE IF EXISTS qgep_od.bathing_area DROP CONSTRAINT rel_bathing_area_chute; + +-- 5. delete wrong fk_chute column +ALTER TABLE IF EXISTS qgep_od.bathing_area DROP COLUMN fk_chute; + +-- 6. rename wrong value in qgep_sys.dictionary_od_field +-- not needed as fk_attributes are not in qgep_sys tables + + + +-- class sector_water_body +--1. add correct fk_surface_water_bodies +ALTER TABLE IF EXISTS qgep_od.sector_water_body ADD COLUMN fk_surface_water_bodies varchar (16); + +-- 2. add correct CONSTRAINT +-- ALTER TABLE qgep_od.sector_water_body ADD CONSTRAINT rel_sector_water_body_chute FOREIGN KEY (fk_chute) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; + +ALTER TABLE IF EXISTS qgep_od.sector_water_body ADD CONSTRAINT rel_sector_water_body_surface_water_bodies FOREIGN KEY (fk_surface_water_bodies) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; + +--3. copy data from fk_chute to fk_surface_water_bodies +UPDATE qgep_od.sector_water_body +SET fk_surface_water_bodies = fk_chute; + +-- 4. delete old rel_water_catchment_chute constraint +ALTER TABLE IF EXISTS qgep_od.sector_water_body DROP CONSTRAINT rel_sector_water_body_chute; + +-- 5. delete wrong fk_chute column +ALTER TABLE IF EXISTS qgep_od.sector_water_body DROP COLUMN fk_chute; + +-- 6. rename wrong value in qgep_sys.dictionary_od_field +-- not needed as fk_attributes are not in qgep_sys tables + From 56307b23aa2b9336517006a0909c732568e4cd92 Mon Sep 17 00:00:00 2001 From: SJiB Date: Wed, 29 Mar 2023 17:30:55 +0200 Subject: [PATCH 08/62] adapted fk_chute -> fk_surface_water_bodies and rel_*_chute --- 03_qgep_db_dss.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/03_qgep_db_dss.sql b/03_qgep_db_dss.sql index ca5d0429..a28b001e 100644 --- a/03_qgep_db_dss.sql +++ b/03_qgep_db_dss.sql @@ -3538,8 +3538,8 @@ ALTER TABLE qgep_vl.water_catchment_kind ADD CONSTRAINT pkey_qgep_vl_water_catch ON UPDATE RESTRICT ON DELETE RESTRICT; ALTER TABLE qgep_od.water_catchment ADD COLUMN fk_aquifier varchar (16); ALTER TABLE qgep_od.water_catchment ADD CONSTRAINT rel_water_catchment_aquifier FOREIGN KEY (fk_aquifier) REFERENCES qgep_od.aquifier(obj_id) ON UPDATE CASCADE ON DELETE set null; -ALTER TABLE qgep_od.water_catchment ADD COLUMN fk_chute varchar (16); -ALTER TABLE qgep_od.water_catchment ADD CONSTRAINT rel_water_catchment_chute FOREIGN KEY (fk_chute) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; +ALTER TABLE qgep_od.water_catchment ADD COLUMN fk_surface_water_bodies varchar (16); +ALTER TABLE qgep_od.water_catchment ADD CONSTRAINT rel_water_catchment_surface_water_bodies FOREIGN KEY (fk_surface_water_bodies) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; CREATE TABLE qgep_vl.river_bank_control_grade_of_river () INHERITS (qgep_sys.value_list_base); ALTER TABLE qgep_vl.river_bank_control_grade_of_river ADD CONSTRAINT pkey_qgep_vl_river_bank_control_grade_of_river_code PRIMARY KEY (code); INSERT INTO qgep_vl.river_bank_control_grade_of_river (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (341,341,'none','keine','nul', 'nessuno', 'inexistent', '', '', '', '', '', 'true'); @@ -3646,8 +3646,8 @@ ALTER TABLE qgep_vl.sector_water_body_kind ADD CONSTRAINT pkey_qgep_vl_sector_wa ALTER TABLE qgep_od.sector_water_body ADD CONSTRAINT fkey_vl_sector_water_body_kind FOREIGN KEY (kind) REFERENCES qgep_vl.sector_water_body_kind (code) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT; -ALTER TABLE qgep_od.sector_water_body ADD COLUMN fk_chute varchar (16); -ALTER TABLE qgep_od.sector_water_body ADD CONSTRAINT rel_sector_water_body_chute FOREIGN KEY (fk_chute) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE cascade; +ALTER TABLE qgep_od.sector_water_body ADD COLUMN fk_surface_water_bodies varchar (16); +ALTER TABLE qgep_od.sector_water_body ADD CONSTRAINT rel_sector_water_body_surface_water_bodies FOREIGN KEY (fk_surface_water_bodies) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE cascade; ALTER TABLE qgep_od.cooperative ADD CONSTRAINT oorel_od_cooperative_organisation FOREIGN KEY (obj_id) REFERENCES qgep_od.organisation(obj_id) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE qgep_od.canton ADD CONSTRAINT oorel_od_canton_organisation FOREIGN KEY (obj_id) REFERENCES qgep_od.organisation(obj_id) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE qgep_od.waste_water_association ADD CONSTRAINT oorel_od_waste_water_association_organisation FOREIGN KEY (obj_id) REFERENCES qgep_od.organisation(obj_id) ON DELETE CASCADE ON UPDATE CASCADE; @@ -4202,8 +4202,8 @@ ALTER TABLE qgep_vl.rock_ramp_stabilisation ADD CONSTRAINT pkey_qgep_vl_rock_ram ON UPDATE RESTRICT ON DELETE RESTRICT; ALTER TABLE qgep_od.fish_pass ADD COLUMN fk_water_control_structure varchar (16); ALTER TABLE qgep_od.fish_pass ADD CONSTRAINT rel_fish_pass_water_control_structure FOREIGN KEY (fk_water_control_structure) REFERENCES qgep_od.water_control_structure(obj_id) ON UPDATE CASCADE ON DELETE cascade; -ALTER TABLE qgep_od.bathing_area ADD COLUMN fk_chute varchar (16); -ALTER TABLE qgep_od.bathing_area ADD CONSTRAINT rel_bathing_area_chute FOREIGN KEY (fk_chute) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; +ALTER TABLE qgep_od.bathing_area ADD COLUMN fk_surface_water_bodies varchar (16); +ALTER TABLE qgep_od.bathing_area ADD CONSTRAINT rel_bathing_area_surface_water_bodies FOREIGN KEY (fk_surface_water_bodies) REFERENCES qgep_od.surface_water_bodies(obj_id) ON UPDATE CASCADE ON DELETE set null; ALTER TABLE qgep_od.wastewater_networkelement ADD COLUMN fk_wastewater_structure varchar (16); ALTER TABLE qgep_od.wastewater_networkelement ADD CONSTRAINT rel_wastewater_networkelement_wastewater_structure FOREIGN KEY (fk_wastewater_structure) REFERENCES qgep_od.wastewater_structure(obj_id) ON UPDATE CASCADE ON DELETE cascade; CREATE TABLE qgep_vl.reach_point_elevation_accuracy () INHERITS (qgep_sys.value_list_base); From 74ff7495f51cfa935a73bc4d46e8e757b90c013c Mon Sep 17 00:00:00 2001 From: SJiB Date: Wed, 29 Mar 2023 17:40:16 +0200 Subject: [PATCH 09/62] add *overflow_char instead of overflow_characteristic in 03_qgep_dss.sql --- 03_qgep_db_dss.sql | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/03_qgep_db_dss.sql b/03_qgep_db_dss.sql index ca5d0429..dee16fb3 100644 --- a/03_qgep_db_dss.sql +++ b/03_qgep_db_dss.sql @@ -1,6 +1,6 @@ ------ This file generates the VSA-DSS database (Modul VSA-DSS) in en on QQIS ------ For questions etc. please contact Stefan Burckhardt stefan.burckhardt@sjib.ch ------- version 03.07.2017 21:26:28 +------ version 03.07.2017 21:26:28 / updated 29.3.2023 BEGIN; ------ CREATE SCHEMA qgep; @@ -2072,10 +2072,10 @@ CREATE SEQUENCE qgep_od.seq_overflow_char_oid INCREMENT 1 MINVALUE 0 MAXVALUE 99 COMMENT ON COLUMN qgep_od.overflow_char.obj_id IS '[primary_key] INTERLIS STANDARD OID (with Postfix/Präfix) or UUOID, see www.interlis.ch'; ALTER TABLE qgep_od.overflow_char ADD COLUMN identifier varchar(20) ; COMMENT ON COLUMN qgep_od.overflow_char.identifier IS ''; -ALTER TABLE qgep_od.overflow_char ADD COLUMN kind_overflow_characteristic integer ; -COMMENT ON COLUMN qgep_od.overflow_char.kind_overflow_characteristic IS 'yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben. / Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben. / La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.'; -ALTER TABLE qgep_od.overflow_char ADD COLUMN overflow_characteristic_digital integer ; -COMMENT ON COLUMN qgep_od.overflow_char.overflow_characteristic_digital IS 'yyy_Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in Ueberlaufcharakteristik ausgefüllt sein in HQ_Relation. / Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in HQ_Relation ausgefüllt sein. / Si courbe de fonctionnement numérique = oui, les attributs pour les relations Q-Q et H-Q doivent être saisis dans la classe RELATION_HQ.'; +ALTER TABLE qgep_od.overflow_char ADD COLUMN kind_overflow_char integer ; +COMMENT ON COLUMN qgep_od.overflow_char.kind_overflow_char IS 'yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben. / Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben. / La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.'; +ALTER TABLE qgep_od.overflow_char ADD COLUMN overflow_char_digital integer ; +COMMENT ON COLUMN qgep_od.overflow_char.overflow_char_digital IS 'yyy_Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in Ueberlaufcharakteristik ausgefüllt sein in HQ_Relation. / Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in HQ_Relation ausgefüllt sein. / Si courbe de fonctionnement numérique = oui, les attributs pour les relations Q-Q et H-Q doivent être saisis dans la classe RELATION_HQ.'; ALTER TABLE qgep_od.overflow_char ADD COLUMN remark varchar(80) ; COMMENT ON COLUMN qgep_od.overflow_char.remark IS 'General remarks / Allgemeine Bemerkungen / Remarques générales'; ALTER TABLE qgep_od.overflow_char ADD COLUMN last_modification TIMESTAMP without time zone DEFAULT now(); @@ -4369,24 +4369,24 @@ ALTER TABLE qgep_vl.retention_body_kind ADD CONSTRAINT pkey_qgep_vl_retention_bo ON UPDATE RESTRICT ON DELETE RESTRICT; ALTER TABLE qgep_od.retention_body ADD COLUMN fk_infiltration_installation varchar (16); ALTER TABLE qgep_od.retention_body ADD CONSTRAINT rel_retention_body_infiltration_installation FOREIGN KEY (fk_infiltration_installation) REFERENCES qgep_od.infiltration_installation(obj_id) ON UPDATE CASCADE ON DELETE cascade; -CREATE TABLE qgep_vl.overflow_char_kind_overflow_characteristic () INHERITS (qgep_sys.value_list_base); -ALTER TABLE qgep_vl.overflow_char_kind_overflow_characteristic ADD CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code PRIMARY KEY (code); - INSERT INTO qgep_vl.overflow_char_kind_overflow_characteristic (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6220,6220,'hq','HQ','HQ', 'HQ', '', '', '', '', '', '', 'true'); - INSERT INTO qgep_vl.overflow_char_kind_overflow_characteristic (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6221,6221,'qq','QQ','QQ', 'QQ', '', '', '', '', '', '', 'true'); - INSERT INTO qgep_vl.overflow_char_kind_overflow_characteristic (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6228,6228,'unknown','unbekannt','inconnu', 'sconosciuto', '', '', '', '', '', '', 'true'); - ALTER TABLE qgep_od.overflow_char ADD CONSTRAINT fkey_vl_overflow_char_kind_overflow_characteristic FOREIGN KEY (kind_overflow_characteristic) - REFERENCES qgep_vl.overflow_char_kind_overflow_characteristic (code) MATCH SIMPLE - ON UPDATE RESTRICT ON DELETE RESTRICT; -CREATE TABLE qgep_vl.overflow_char_overflow_characteristic_digital () INHERITS (qgep_sys.value_list_base); -ALTER TABLE qgep_vl.overflow_char_overflow_characteristic_digital ADD CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code PRIMARY KEY (code); - INSERT INTO qgep_vl.overflow_char_overflow_characteristic_digital (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6223,6223,'yes','ja','oui', 'si', '', '', '', '', '', '', 'true'); - INSERT INTO qgep_vl.overflow_char_overflow_characteristic_digital (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6224,6224,'no','nein','non', 'no', '', '', '', '', '', '', 'true'); - INSERT INTO qgep_vl.overflow_char_overflow_characteristic_digital (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6225,6225,'unknown','unbekannt','inconnu', 'sconosciuto', '', '', '', '', '', '', 'true'); - ALTER TABLE qgep_od.overflow_char ADD CONSTRAINT fkey_vl_overflow_char_overflow_characteristic_digital FOREIGN KEY (overflow_characteristic_digital) - REFERENCES qgep_vl.overflow_char_overflow_characteristic_digital (code) MATCH SIMPLE - ON UPDATE RESTRICT ON DELETE RESTRICT; -ALTER TABLE qgep_od.hq_relation ADD COLUMN fk_overflow_characteristic varchar (16); -ALTER TABLE qgep_od.hq_relation ADD CONSTRAINT rel_hq_relation_overflow_characteristic FOREIGN KEY (fk_overflow_characteristic) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE cascade; +CREATE TABLE qgep_vl.overflow_char_kind_overflow_char () INHERITS (qgep_sys.value_list_base); +ALTER TABLE qgep_vl.overflow_char_kind_overflow_char ADD CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_char_code PRIMARY KEY (code); + INSERT INTO qgep_vl.overflow_char_kind_overflow_char (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6220,6220,'hq','HQ','HQ', 'HQ', '', '', '', '', '', '', 'true'); + INSERT INTO qgep_vl.overflow_char_kind_overflow_char (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6221,6221,'qq','QQ','QQ', 'QQ', '', '', '', '', '', '', 'true'); + INSERT INTO qgep_vl.overflow_char_kind_overflow_char (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6228,6228,'unknown','unbekannt','inconnu', 'sconosciuto', '', '', '', '', '', '', 'true'); + ALTER TABLE qgep_od.overflow_char ADD CONSTRAINT fkey_vl_overflow_char_kind_overflow_char FOREIGN KEY (kind_overflow_char) + REFERENCES qgep_vl.overflow_char_kind_overflow_char (code) MATCH SIMPLE + ON UPDATE RESTRICT ON DELETE RESTRICT; +CREATE TABLE qgep_vl.overflow_char_overflow_char_digital () INHERITS (qgep_sys.value_list_base); +ALTER TABLE qgep_vl.overflow_char_overflow_char_digital ADD CONSTRAINT pkey_qgep_vl_overflow_char_overflow_char_digital_code PRIMARY KEY (code); + INSERT INTO qgep_vl.overflow_char_overflow_char_digital (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6223,6223,'yes','ja','oui', 'si', '', '', '', '', '', '', 'true'); + INSERT INTO qgep_vl.overflow_char_overflow_char_digital (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6224,6224,'no','nein','non', 'no', '', '', '', '', '', '', 'true'); + INSERT INTO qgep_vl.overflow_char_overflow_char_digital (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (6225,6225,'unknown','unbekannt','inconnu', 'sconosciuto', '', '', '', '', '', '', 'true'); + ALTER TABLE qgep_od.overflow_char ADD CONSTRAINT fkey_vl_overflow_char_overflow_char_digital FOREIGN KEY (overflow_char_digital) + REFERENCES qgep_vl.overflow_char_overflow_char_digital (code) MATCH SIMPLE + ON UPDATE RESTRICT ON DELETE RESTRICT; +ALTER TABLE qgep_od.hq_relation ADD COLUMN fk_overflow_char varchar (16); +ALTER TABLE qgep_od.hq_relation ADD CONSTRAINT rel_hq_relation_overflow_char FOREIGN KEY (fk_overflow_char) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE cascade; CREATE TABLE qgep_vl.structure_part_renovation_demand () INHERITS (qgep_sys.value_list_base); ALTER TABLE qgep_vl.structure_part_renovation_demand ADD CONSTRAINT pkey_qgep_vl_structure_part_renovation_demand_code PRIMARY KEY (code); INSERT INTO qgep_vl.structure_part_renovation_demand (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (138,138,'not_necessary','nicht_notwendig','pas_necessaire', 'zzz_nicht_notwendig', 'nenecesare', 'NN', 'NN', 'PN', '', '', 'true'); @@ -4760,8 +4760,8 @@ ALTER TABLE qgep_od.overflow ADD COLUMN fk_wastewater_node varchar (16); ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_wastewater_node FOREIGN KEY (fk_wastewater_node) REFERENCES qgep_od.wastewater_node(obj_id) ON UPDATE CASCADE ON DELETE cascade; ALTER TABLE qgep_od.overflow ADD COLUMN fk_overflow_to varchar (16); ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_overflow_to FOREIGN KEY (fk_overflow_to) REFERENCES qgep_od.wastewater_node(obj_id) ON UPDATE CASCADE ON DELETE set null; -ALTER TABLE qgep_od.overflow ADD COLUMN fk_overflow_characteristic varchar (16); -ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_overflow_characteristic FOREIGN KEY (fk_overflow_characteristic) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE set null; +ALTER TABLE qgep_od.overflow ADD COLUMN fk_overflow_char varchar (16); +ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_overflow_char FOREIGN KEY (fk_overflow_char) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE set null; ALTER TABLE qgep_od.overflow ADD COLUMN fk_control_center varchar (16); ALTER TABLE qgep_od.overflow ADD CONSTRAINT rel_overflow_control_center FOREIGN KEY (fk_control_center) REFERENCES qgep_od.control_center(obj_id) ON UPDATE CASCADE ON DELETE set null; CREATE TABLE qgep_vl.throttle_shut_off_unit_actuation () INHERITS (qgep_sys.value_list_base); @@ -4952,8 +4952,8 @@ ALTER TABLE qgep_vl.hydraulic_char_data_status ADD CONSTRAINT pkey_qgep_vl_hydra ON UPDATE RESTRICT ON DELETE RESTRICT; ALTER TABLE qgep_od.hydraulic_char_data ADD COLUMN fk_wastewater_node varchar (16); ALTER TABLE qgep_od.hydraulic_char_data ADD CONSTRAINT rel_hydraulic_char_data_wastewater_node FOREIGN KEY (fk_wastewater_node) REFERENCES qgep_od.wastewater_node(obj_id) ON UPDATE CASCADE ON DELETE set null; -ALTER TABLE qgep_od.hydraulic_char_data ADD COLUMN fk_overflow_characteristic varchar (16); -ALTER TABLE qgep_od.hydraulic_char_data ADD CONSTRAINT rel_hydraulic_char_data_overflow_characteristic FOREIGN KEY (fk_overflow_characteristic) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE set null; +ALTER TABLE qgep_od.hydraulic_char_data ADD COLUMN fk_overflow_char varchar (16); +ALTER TABLE qgep_od.hydraulic_char_data ADD CONSTRAINT rel_hydraulic_char_data_overflow_char FOREIGN KEY (fk_overflow_char) REFERENCES qgep_od.overflow_char(obj_id) ON UPDATE CASCADE ON DELETE set null; ALTER TABLE qgep_od.backflow_prevention ADD CONSTRAINT oorel_od_backflow_prevention_structure_part FOREIGN KEY (obj_id) REFERENCES qgep_od.structure_part(obj_id) ON DELETE CASCADE ON UPDATE CASCADE; CREATE TABLE qgep_vl.backflow_prevention_kind () INHERITS (qgep_sys.value_list_base); ALTER TABLE qgep_vl.backflow_prevention_kind ADD CONSTRAINT pkey_qgep_vl_backflow_prevention_kind_code PRIMARY KEY (code); From ecbaede6a2dde9019d13d1bc2a9833381b14f4fb Mon Sep 17 00:00:00 2001 From: SJiB Date: Wed, 12 Apr 2023 10:08:46 +0200 Subject: [PATCH 10/62] remove drop view of connected views not needed as already in https://github.com/QGEP/datamodel/blob/master/view/drop_views.sql --- ..._xxx_fk_overflow_characteristic_to_fk_overflow_char.sql | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index 2bc3fe9c..df74ff63 100644 --- a/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -1,9 +1,4 @@ --- drop connected views -DROP VIEW IF EXISTS qgep_od.vw_leapingweir; -DROP VIEW IF EXISTS qgep_od.vw_prank_weir; -DROP VIEW IF EXISTS qgep_od.vw_pump; -DROP VIEW IF EXISTS qgep_od.vw_qgep_overflow; - +-- drop connected views not needed as already listed in https://github.com/QGEP/datamodel/blob/master/view/drop_views.sql -- class overflow --1. add correct fk_overflow_char From babe0bb8f4c2a2b13a7ea1711e1324ee9f7c341d Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 20 Jun 2023 09:03:35 +0200 Subject: [PATCH 11/62] add changed files from #208 As [#208](https://github.com/QGEP/datamodel/pull/208) was accidentally pushed from my master branch, i had to do some cleanup. Same changes in swmm views, but not from Master --- swmm_views/02_vw_swmm_junctions.sql | 38 +++++++++++++++---------- swmm_views/04_vw_swmm_conduits.sql | 20 +++++++------ swmm_views/05_vw_swmm_dividers.sql | 20 +++++++------ swmm_views/07_vw_swmm_losses.sql | 3 +- swmm_views/08_vw_swmm_outfalls.sql | 8 ++++-- swmm_views/10_vw_swmm_subareas.sql | 12 +++++--- swmm_views/11_vw_swmm_dwf.sql | 12 +++++--- swmm_views/12_vw_swmm_raingages.sql | 12 +++++--- swmm_views/13_vw_swmm_infiltrations.sql | 6 ++-- swmm_views/16_vw_swmm_pumps.sql | 14 +++++---- swmm_views/18_vw_swmm_storages.sql | 32 +++++++++++++-------- swmm_views/19_vw_swmm_outlets.sql | 14 +++++---- swmm_views/21_vw_swmm_weirs.sql | 24 ++++++++++------ swmm_views/22_vw_swmm_curves.sql | 36 ++++++++++++++--------- swmm_views/23_vw_swmm_xsections.sql | 33 ++++++++++++--------- swmm_views/27_vw_swmm_results.sql | 6 ++-- 16 files changed, 181 insertions(+), 109 deletions(-) diff --git a/swmm_views/02_vw_swmm_junctions.sql b/swmm_views/02_vw_swmm_junctions.sql index 992be3a3..1b079fac 100644 --- a/swmm_views/02_vw_swmm_junctions.sql +++ b/swmm_views/02_vw_swmm_junctions.sql @@ -15,11 +15,11 @@ SELECT CONCAT_WS(',', 'manhole', mf.value_en) as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN ch_fh.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id @@ -29,8 +29,10 @@ LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::te LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id LEFT JOIN qgep_od.cover co on ws.fk_main_cover = co.obj_id LEFT JOIN qgep_vl.manhole_function mf on ma.function = mf.code +LEFT JOIN qgep_vl.wastewater_structure_status ws_st on ws_st.code=ws.status +LEFT JOIN qgep_vl.channel_function_hierarchic ch_fh on ch_fh.code=ws._function_hierarchic WHERE wn.obj_id IS NOT NULL -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION @@ -43,14 +45,14 @@ SELECT NULL::float as SurchargeDepth, NULL::float as PondedArea, ws.identifier::text as description, - CONCAT_WS(',','special_structure', ssf.value_en) as tag, + CONCAT_WS(',','special_structure', ss_fu.value_en) as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN ch_fh.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id @@ -59,10 +61,12 @@ LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ss.obj_id::text LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id LEFT JOIN qgep_od.cover co on ws.fk_main_cover = co.obj_id -LEFT JOIN qgep_vl.special_structure_function ssf on ss.function = ssf.code +LEFT JOIN qgep_vl.special_structure_function ss_fu on ss_fu.code=ss.function +LEFT JOIN qgep_vl.wastewater_structure_status ws_st on ws_st.code=ws.status +LEFT JOIN qgep_vl.channel_function_hierarchic ch_fh on ch_fh.code=ws._function_hierarchic WHERE wn.obj_id IS NOT NULL -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND function NOT IN ( -- must be the same list in vw_swmm_storages +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ss_fu.vsacode NOT IN ( -- must be the same list in vw_swmm_storages 6397, --"pit_without_drain" -- 245, --"drop_structure" 6398, --"hydrolizing_tank" @@ -109,11 +113,11 @@ SELECT 'junction without structure' as tag, coalesce(from_wn.situation_geometry, ST_StartPoint(re.progression_geometry)) as geom, CASE - WHEN ws.status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ch.function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN ch_fh.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, coalesce(from_wn.obj_id, re.obj_id) as obj_id @@ -126,8 +130,10 @@ LEFT JOIN qgep_od.channel ch on ch.obj_id::text = ws.obj_id::text -- Get wastewater structure linked to the from node LEFT JOIN qgep_od.wastewater_networkelement we ON from_wn.obj_id = we.obj_id LEFT JOIN qgep_od.wastewater_structure ws_node ON we.fk_wastewater_structure::text = ws_node.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st on ws_st.code=ws.status +LEFT JOIN qgep_vl.channel_function_hierarchic ch_fh on ch_fh.code=ch.function_hierarchic -- select only operationals and "planned" -WHERE ws.status IN (6530, 6533, 8493, 6529, 6526, 7959) +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) and ws_node is null UNION @@ -143,11 +149,11 @@ SELECT 'junction without structure' as tag, coalesce(to_wn.situation_geometry, ST_EndPoint(re.progression_geometry)) as geom, CASE - WHEN ws.status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ch.function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN ch_fh.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, coalesce(to_wn.obj_id, re.obj_id) as obj_id @@ -160,6 +166,8 @@ LEFT JOIN qgep_od.channel ch on ch.obj_id::text = ws.obj_id::text -- Get wastewater structure linked to the to node LEFT JOIN qgep_od.wastewater_networkelement we ON to_wn.obj_id = we.obj_id LEFT JOIN qgep_od.wastewater_structure ws_node ON we.fk_wastewater_structure::text = ws_node.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st on ws_st.code=ws.status +LEFT JOIN qgep_vl.channel_function_hierarchic ch_fh on ch_fh.code=ch.function_hierarchic -- select only operationals and "planned" -WHERE ws.status IN (6530, 6533, 8493, 6529, 6526, 7959) +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) and ws_node is null; diff --git a/swmm_views/04_vw_swmm_conduits.sql b/swmm_views/04_vw_swmm_conduits.sql index e031e16c..0d103b69 100644 --- a/swmm_views/04_vw_swmm_conduits.sql +++ b/swmm_views/04_vw_swmm_conduits.sql @@ -52,17 +52,17 @@ SELECT ELSE 'Default value 0.01 is used as roughness' END, CASE - WHEN pp.profile_type = 3350 THEN + WHEN vl_pp.vsacode = 3350 THEN CASE WHEN re.clear_height = 0 OR re.clear_height IS NULL THEN concat('Reach', re.obj_id,': circular profile with default value of 0.1m as clear_height') ELSE NULL END - WHEN pp.profile_type = 3351 THEN + WHEN vl_pp.vsacode = 3351 THEN CASE WHEN re.clear_height = 0 OR re.clear_height IS NULL THEN concat('Reach', re.obj_id,': egg profile with default value of 0.1m as clear_height') ELSE NULL END - WHEN pp.profile_type = 3352 THEN + WHEN vl_pp.vsacode = 3352 THEN CASE WHEN pp.height_width_ratio IS NOT NULL THEN CASE @@ -75,7 +75,7 @@ SELECT ELSE concat('Reach', re.obj_id,': arch profile with default value of 1 as height_width_ratio and with known clear_height value') END END - WHEN pp.profile_type = 3353 THEN + WHEN vl_pp.vsacode = 3353 THEN CASE WHEN pp.height_width_ratio IS NOT NULL THEN CASE @@ -88,7 +88,7 @@ SELECT ELSE concat('Reach', re.obj_id,': rectangular profile with default value of 1 as height_width_ratio and with known clear_height value') END END - WHEN pp.profile_type = 3354 THEN + WHEN vl_pp.vsacode = 3354 THEN CASE WHEN pp.height_width_ratio IS NOT NULL THEN CASE @@ -101,7 +101,7 @@ SELECT ELSE concat('Reach', re.obj_id,': parabolic profile with default value of 1 as height_width_ratio, with known clear_height value and no code value') END END - WHEN pp.profile_type = 3355 THEN concat('Reach', re.obj_id,': custom profile to be defined in SWMM') + WHEN vl_pp.vsacode = 3355 THEN concat('Reach', re.obj_id,': custom profile to be defined in SWMM') END, CASE WHEN to_wn.obj_id IS NULL THEN 'Blind connection, the destination node must be edited' @@ -109,19 +109,20 @@ SELECT ELSE NULL END ) as description, - cfh.value_en as tag, + cfhy.value_en as tag, ST_CurveToLine(st_force3d(progression_geometry))::geometry(LineStringZ, %(SRID)s) as geom, CASE WHEN status IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ch.function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, re.obj_id as obj_id FROM qgep_od.reach as re LEFT JOIN qgep_od.pipe_profile pp on pp.obj_id = re.fk_pipe_profile +LEFT JOIN qgep_vl.pipe_profile_profile_type vl_pp on pp.profile_type = vl_pp.code LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.obj_id::text = re.obj_id::text LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure LEFT JOIN qgep_od.reach_point rp_from ON rp_from.obj_id::text = re.fk_reach_point_from::text @@ -129,7 +130,8 @@ LEFT JOIN qgep_od.reach_point rp_to ON rp_to.obj_id::text = re.fk_reach_point_to LEFT JOIN qgep_od.wastewater_node from_wn on from_wn.obj_id = rp_from.fk_wastewater_networkelement LEFT JOIN qgep_od.wastewater_node to_wn on to_wn.obj_id = rp_to.fk_wastewater_networkelement LEFT JOIN qgep_od.channel ch on ch.obj_id::text = ws.obj_id::text -LEFT JOIN qgep_vl.channel_function_hydraulic cfh on cfh.code = ch.function_hydraulic +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi on cfhi.code = ch.function_hierarchic +LEFT JOIN qgep_vl.channel_function_hydraulic cfhy on cfhy.code = ch.function_hydraulic -- select only operationals and "planned" WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); -- 6526 "other.calculation_alternative" diff --git a/swmm_views/05_vw_swmm_dividers.sql b/swmm_views/05_vw_swmm_dividers.sql index dfeecbe0..310bb178 100644 --- a/swmm_views/05_vw_swmm_dividers.sql +++ b/swmm_views/05_vw_swmm_dividers.sql @@ -15,22 +15,24 @@ SELECT 0 as PondedArea, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.manhole ma LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ma.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.cover co on ws.fk_main_cover = co.obj_id LEFT JOIN qgep_vl.manhole_function mf on ma.function = mf.code -WHERE function = 4798 -- separating_structure -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +WHERE mf.vsacode = 4798 -- separating_structure +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -46,19 +48,21 @@ SELECT 0 as PondedArea, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.special_structure ss LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ss.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.cover co on ws.fk_main_cover = co.obj_id LEFT JOIN qgep_vl.special_structure_function ssf on ss.function = ssf.code -WHERE function = 4799 -- separating_structure -AND status IN (6530, 6533, 8493, 6529, 6526, 7959); +WHERE ssf.vsacode = 4799 -- separating_structure +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/07_vw_swmm_losses.sql b/swmm_views/07_vw_swmm_losses.sql index 07826969..e10079a0 100644 --- a/swmm_views/07_vw_swmm_losses.sql +++ b/swmm_views/07_vw_swmm_losses.sql @@ -30,5 +30,6 @@ LEFT JOIN qgep_od.reach_point rp_from ON rp_from.obj_id::text = re.fk_reach_poin LEFT JOIN qgep_od.wastewater_node from_wn on from_wn.obj_id = rp_from.fk_wastewater_networkelement LEFT JOIN qgep_od.throttle_shut_off_unit ts ON ts.fk_wastewater_node = from_wn.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) ; -- wastewater node of the downstream wastewater node diff --git a/swmm_views/08_vw_swmm_outfalls.sql b/swmm_views/08_vw_swmm_outfalls.sql index 9861eb63..872631f8 100644 --- a/swmm_views/08_vw_swmm_outfalls.sql +++ b/swmm_views/08_vw_swmm_outfalls.sql @@ -14,18 +14,20 @@ SELECT dp.obj_id::varchar as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.discharge_point as dp LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id WHERE wn.obj_id IS NOT NULL -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) ; diff --git a/swmm_views/10_vw_swmm_subareas.sql b/swmm_views/10_vw_swmm_subareas.sql index f7b0fbd6..c7b09376 100644 --- a/swmm_views/10_vw_swmm_subareas.sql +++ b/swmm_views/10_vw_swmm_subareas.sql @@ -25,35 +25,39 @@ SELECT wn_obj_id as obj_id FROM ( -SELECT ca.*, sr.surface_storage, 'rw_current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*, sr.surface_storage, 'rw_current' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_area LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_current IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*, sr.surface_storage, 'ww_current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*, sr.surface_storage, 'ww_current' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_area LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_ww_current IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*, sr.surface_storage, 'rw_planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*, sr.surface_storage, 'rw_planned' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_area LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_planned IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*, sr.surface_storage, 'ww_planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*, sr.surface_storage, 'ww_planned' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_area LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_ww_planned IS NOT NULL -- to avoid unconnected catchments ) as ca; diff --git a/swmm_views/11_vw_swmm_dwf.sql b/swmm_views/11_vw_swmm_dwf.sql index ec55b874..bd093179 100644 --- a/swmm_views/11_vw_swmm_dwf.sql +++ b/swmm_views/11_vw_swmm_dwf.sql @@ -43,31 +43,35 @@ SELECT wn_obj_id as obj_id FROM ( -SELECT ca.*,'current' as state, 'rw_current' as type_ca, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'current' as state, 'rw_current' as type_ca, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_current IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*,'planned' as state, 'rw_planned' as type_ca, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'planned' as state, 'rw_planned' as type_ca, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_planned IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*,'current' as state, 'ww_current' as type_ca, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'current' as state, 'ww_current' as type_ca, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_ww_current IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*,'planned' as state, 'ww_planned' as type_ca, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'planned' as state, 'ww_planned' as type_ca, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_ww_planned IS NOT NULL -- to avoid unconnected catchments ) as ca; diff --git a/swmm_views/12_vw_swmm_raingages.sql b/swmm_views/12_vw_swmm_raingages.sql index 80ae0133..8437a947 100644 --- a/swmm_views/12_vw_swmm_raingages.sql +++ b/swmm_views/12_vw_swmm_raingages.sql @@ -15,31 +15,35 @@ SELECT wn_obj_id as obj_id FROM ( -SELECT ca.*,'current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'current' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_current IS NOT NULL -- to avoid unconnected catchments UNION -SELECT ca.*,'planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'planned' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_planned IS NOT NULL -- to avoid unconnected catchments UNION -SELECT ca.*,'current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'current' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_ww_current IS NOT NULL -- to avoid unconnected catchments UNION -SELECT ca.*,'planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'planned' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_ww_planned IS NOT NULL -- to avoid unconnected catchments ) as ca; diff --git a/swmm_views/13_vw_swmm_infiltrations.sql b/swmm_views/13_vw_swmm_infiltrations.sql index fd319c85..cdd8f125 100644 --- a/swmm_views/13_vw_swmm_infiltrations.sql +++ b/swmm_views/13_vw_swmm_infiltrations.sql @@ -18,17 +18,19 @@ SELECT wn_obj_id as obj_id FROM ( -SELECT ca.*,'current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'current' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_current IS NOT NULL -- to avoid unconnected catchments UNION ALL -SELECT ca.*,'planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic +SELECT ca.*,'planned' as state, wn.obj_id as wn_obj_id, cfhi.vsacode AS _function_hierarchic FROM qgep_od.catchment_area as ca LEFT JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE fk_wastewater_networkelement_rw_planned IS NOT NULL -- to avoid unconnected catchments ) as ca; diff --git a/swmm_views/16_vw_swmm_pumps.sql b/swmm_views/16_vw_swmm_pumps.sql index b5472c3a..a055f9c2 100644 --- a/swmm_views/16_vw_swmm_pumps.sql +++ b/swmm_views/16_vw_swmm_pumps.sql @@ -20,26 +20,30 @@ SELECT CASE WHEN oc.obj_id IS NULL --'yes; THEN 'No curve will be created for this pump, it has no overflow_characteristic' - WHEN oc.overflow_characteristic_digital != 6223 --'yes; + WHEN vl_oc_dig.vsacode != 6223 --'yes; THEN 'No curve will be created for this pump, overflow_characteristic_digital not equal to yes' - WHEN oc.kind_overflow_characteristic != 6220 --'hq; + WHEN vl_oc_ki.vsacode != 6220 --'hq; THEN concat(pu.obj_id, 'No curve will be created for this pump, kind_overflow_characteristic is not equal to H/Q, Q/Q relations are not supported by SWMM') ELSE NULL END ) as description, pu.obj_id::varchar as tag, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.pump pu LEFT JOIN qgep_od.overflow of ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/18_vw_swmm_storages.sql b/swmm_views/18_vw_swmm_storages.sql index 5444f6a4..4094764a 100644 --- a/swmm_views/18_vw_swmm_storages.sql +++ b/swmm_views/18_vw_swmm_storages.sql @@ -27,16 +27,18 @@ SELECT CONCAT_WS(',','special_structure', ssf.value_en) as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.special_structure ss LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ss.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id LEFT JOIN qgep_od.hydr_geometry hg on hg.obj_id = wn.fk_hydr_geometry @@ -46,7 +48,7 @@ LEFT JOIN ( ) as hr on hr.fk_hydr_geometry = hg.obj_id LEFT JOIN qgep_od.cover co on ws.fk_main_cover = co.obj_id LEFT JOIN qgep_vl.special_structure_function ssf on ss.function = ssf.code -WHERE ss.function IN ( -- must be the same list in vw_swmm_junctions +WHERE ssf.vsacode IN ( -- must be the same list in vw_swmm_junctions 6397, --"pit_without_drain" -- 245, --"drop_structure" 6398, --"hydrolizing_tank" @@ -78,7 +80,7 @@ WHERE ss.function IN ( -- must be the same list in vw_swmm_junctions -- 3008, --"unknown" -- 2745, --"vortex_manhole" ) -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -106,16 +108,18 @@ SELECT CONCAT_WS(',','infiltration_installation', iik.value_en) as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.infiltration_installation as ii LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id LEFT JOIN qgep_od.hydr_geometry hg on hg.obj_id = wn.fk_hydr_geometry @@ -124,7 +128,7 @@ LEFT JOIN ( FROM qgep_od.hydr_geom_relation ) as hr on hr.fk_hydr_geometry = hg.obj_id LEFT JOIN qgep_vl.infiltration_installation_kind iik on ii.kind = iik.code -WHERE ii.kind IN ( +WHERE iik.vsacode IN ( --3282 --"with_soil_passage" --3285 --"without_soil_passage" --3279 --"surface_infiltration" @@ -137,7 +141,7 @@ WHERE ii.kind IN ( --278 --"adsorbing_well" --3283 --"infiltration_pipe_sections_gallery" ) -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -163,7 +167,7 @@ SELECT 'Prank weir' as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE @@ -174,8 +178,12 @@ SELECT FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vL_oc_ki ON oc.kind_overflow_characteristic = vL_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vl_oc_dig.vsacode = 6223 --'yes; +AND vL_oc_ki.vsacode = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) diff --git a/swmm_views/19_vw_swmm_outlets.sql b/swmm_views/19_vw_swmm_outlets.sql index 73f36951..2c507a1c 100644 --- a/swmm_views/19_vw_swmm_outlets.sql +++ b/swmm_views/19_vw_swmm_outlets.sql @@ -10,19 +10,23 @@ SELECT NULL as Qexpon, 'NO' as Gated, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vL_oc_dig ON oc.overflow_characteristic_digital = vL_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) \ No newline at end of file +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vL_oc_dig.vsacode = 6223 --'yes; +AND vl_oc_ki.vsacode = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index c9f41238..25cad417 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -16,11 +16,11 @@ SELECT NULL as RoadSurf, NULL as CoeffCurve, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id, @@ -28,11 +28,15 @@ SELECT FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND (oc.overflow_characteristic_digital != 6223 OR oc.overflow_characteristic_digital IS NULL) --'yes; -OR (oc.kind_overflow_characteristic != 6220 OR oc.overflow_characteristic_digital IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND (vl_oc_dig.vsacode != 6223 OR vl_oc_dig.vsacode IS NULL) --'yes; +OR (vl_oc_ki.vsacode != 6220 OR vl_oc_ki.vsacode IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) UNION ALL @@ -52,11 +56,11 @@ SELECT NULL as RoadSurf, NULL as CoeffCurve, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id, @@ -64,6 +68,10 @@ SELECT FROM qgep_od.leapingweir lw LEFT JOIN qgep_od.overflow of ON lw.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); \ No newline at end of file +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/22_vw_swmm_curves.sql b/swmm_views/22_vw_swmm_curves.sql index a192f5d5..ba13daea 100644 --- a/swmm_views/22_vw_swmm_curves.sql +++ b/swmm_views/22_vw_swmm_curves.sql @@ -14,23 +14,27 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_curves AS hq.altitude as XValue, hq.flow as YValue, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_od.pump pu ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vl_oc_dig.vsacode = 6223 --'yes; +AND vl_oc_ki.vsacode = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pu.obj_id IS NOT NULL ORDER BY pu.obj_id, hq.altitude) @@ -47,23 +51,27 @@ UNION ALL hq.altitude as XValue, hq.flow as YValue, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_od.prank_weir pw ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vl_oc_dig.vsacode = 6223 --'yes; +AND vl_oc_ki.vsacode = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pw.obj_id IS NOT NULL ORDER BY pw.obj_id, hq.altitude) @@ -80,11 +88,11 @@ UNION ALL hr.water_depth as XValue, hr.water_surface as YValue, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id @@ -92,4 +100,6 @@ FROM qgep_od.hydr_geom_relation hr LEFT JOIN qgep_od.hydr_geometry hg on hg.obj_id = hr.fk_hydr_geometry LEFT JOIN qgep_od.wastewater_node wn on hg.obj_id = wn.fk_hydr_geometry LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -ORDER BY wn.obj_id, hr.water_depth) \ No newline at end of file +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +ORDER BY wn.obj_id, hr.water_depth) diff --git a/swmm_views/23_vw_swmm_xsections.sql b/swmm_views/23_vw_swmm_xsections.sql index 8ce815f9..a98d299e 100644 --- a/swmm_views/23_vw_swmm_xsections.sql +++ b/swmm_views/23_vw_swmm_xsections.sql @@ -6,12 +6,12 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_xsections AS SELECT DISTINCT re.obj_id as Link, CASE - WHEN pp.profile_type = 3350 THEN 'CIRCULAR' -- circle - WHEN pp.profile_type = 3353 THEN 'RECT_CLOSED' -- rectangular - WHEN pp.profile_type = 3351 THEN 'EGG' -- egg - WHEN pp.profile_type = 3355 THEN 'CUSTOM' -- special - WHEN pp.profile_type = 3352 THEN 'ARCH' -- mouth - WHEN pp.profile_type = 3354 THEN 'PARABOLIC' -- open + WHEN ppt.vsacode = 3350 THEN 'CIRCULAR' -- circle + WHEN ppt.vsacode = 3353 THEN 'RECT_CLOSED' -- rectangular + WHEN ppt.vsacode = 3351 THEN 'EGG' -- egg + WHEN ppt.vsacode = 3355 THEN 'CUSTOM' -- special + WHEN ppt.vsacode = 3352 THEN 'ARCH' -- mouth + WHEN ppt.vsacode = 3354 THEN 'PARABOLIC' -- open ELSE 'CIRCULAR' END as Shape, --Geom1 = height -> used for all the profile types @@ -22,7 +22,7 @@ SELECT DISTINCT END as Geom1, --Geom2 = width -> needed for profile rect_closed,arch and parabolic CASE - WHEN pp.profile_type IN (3352,3353,3354) THEN CASE + WHEN ppt.vsacode IN (3352,3353,3354) THEN CASE WHEN pp.height_width_ratio IS NOT NULL THEN CASE WHEN re.clear_height = 0 THEN 0.1/pp.height_width_ratio WHEN re.clear_height IS NULL THEN 0.1/pp.height_width_ratio @@ -39,20 +39,23 @@ SELECT DISTINCT 1 as Barrels, NULL as Culvert, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ch.function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, re.obj_id as obj_id FROM qgep_od.reach re LEFT JOIN qgep_od.pipe_profile pp on pp.obj_id = re.fk_pipe_profile +LEFT JOIN qgep_vl.pipe_profile_profile_type ppt on ppt.code =pp.profile_type LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.obj_id::text = re.obj_id::text LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ne.fk_wastewater_structure::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_od.channel ch ON ch.obj_id::text = ws.obj_id::text -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ch.function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -68,11 +71,11 @@ SELECT NULL as Barrels, NULL as Culvert, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id @@ -81,8 +84,10 @@ LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) AND oc.overflow_characteristic_digital != 6223 --'NO or unknown; OR oc.kind_overflow_characteristic != 6220 -- Q/Q relation or unknown -AND status IN (6530, 6533, 8493, 6529, 6526, 7959); +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/27_vw_swmm_results.sql b/swmm_views/27_vw_swmm_results.sql index 21e58e1b..09785dcd 100644 --- a/swmm_views/27_vw_swmm_results.sql +++ b/swmm_views/27_vw_swmm_results.sql @@ -1,6 +1,6 @@ CREATE OR REPLACE VIEW qgep_swmm.node_results AS -SELECT ws.obj_id AS ws_obj_id, ma.function AS ma_function, ss.function AS ss_function, +SELECT ws.obj_id AS ws_obj_id, mf.vsacode AS ma_function, ssf.vsacode AS ss_function, mp.obj_id AS mp_obj_id, mp.remark AS swmm_simulation_name, md.obj_id AS md_obj_id, ms.obj_id AS ms_obj_id, ms.dimension, ms.remark AS swmm_parameter, @@ -9,7 +9,9 @@ wn.situation_geometry AS geom FROM qgep_od.wastewater_structure ws JOIN qgep_od.wastewater_node wn ON wn.obj_id = ws.fk_main_wastewater_node LEFT JOIN qgep_od.manhole ma ON ma.obj_id = ws.obj_id +LEFT JOIN qgep_vl.manhole_function mf ON mf.code = ma.function LEFT JOIN qgep_od.special_structure ss ON ss.obj_id = ws.obj_id +LEFT JOIN qgep_vl.special_structure_function ssf ON ssf.code = ss.function LEFT JOIN qgep_od.measuring_point mp ON mp.fk_wastewater_structure = ws.obj_id LEFT JOIN qgep_od.measuring_device md ON md.fk_measuring_point = mp.obj_id LEFT JOIN qgep_od.measurement_series ms ON ms.fk_measuring_point = mp.obj_id @@ -32,4 +34,4 @@ LEFT JOIN qgep_od.measuring_device md ON md.fk_measuring_point = mp.obj_id LEFT JOIN qgep_od.measurement_series ms ON ms.fk_measuring_point = mp.obj_id LEFT JOIN qgep_od.measurement_result mr ON mr.fk_measurement_series = ms.obj_id WHERE md.remark = 'SWMM Simulation' -ORDER BY mp.obj_id, mr.time; \ No newline at end of file +ORDER BY mp.obj_id, mr.time; From 9c26936ce31d4c2a2cf46278a5e7fa43d4346354 Mon Sep 17 00:00:00 2001 From: Arnaud Poncet-Montanges Date: Mon, 17 Jul 2023 12:09:54 +0200 Subject: [PATCH 12/62] Rename delta to 1.6.1 Rename delta to 1.6.1 --- ..._1.6.1_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename delta/{delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql => delta_1.6.1_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql} (100%) diff --git a/delta/delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql similarity index 100% rename from delta/delta_1.5.x_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql rename to delta/delta_1.6.1_dss_rename_xxx_fk_chute_to_fk_surface_water_bodies.sql From c60d2bd62c22ce052b8296d48ff7c7425e33f3a7 Mon Sep 17 00:00:00 2001 From: Arnaud Poncet-Montanges Date: Mon, 17 Jul 2023 12:49:10 +0200 Subject: [PATCH 13/62] Update version 1.6.1 to match after delta state Update version 1.6.1 to match after delta state --- system/CURRENT_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CURRENT_VERSION.txt b/system/CURRENT_VERSION.txt index dc1e644a..9c6d6293 100644 --- a/system/CURRENT_VERSION.txt +++ b/system/CURRENT_VERSION.txt @@ -1 +1 @@ -1.6.0 +1.6.1 From 426f5534553a8be64279e5385059cd283d4a16f3 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:13:07 +0200 Subject: [PATCH 14/62] Create delta --- delta/delta_1.6.1_alter_order_fct_hierarchic | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 delta/delta_1.6.1_alter_order_fct_hierarchic diff --git a/delta/delta_1.6.1_alter_order_fct_hierarchic b/delta/delta_1.6.1_alter_order_fct_hierarchic new file mode 100644 index 00000000..2b98cb80 --- /dev/null +++ b/delta/delta_1.6.1_alter_order_fct_hierarchic @@ -0,0 +1,20 @@ +UPDATE qgep_vl.channel_function_hierarchic +SET order_fct_hierarchic= + array_position( + ARRAY[ + 5068 --pwwf.water_bodies + ,5070 --pwwf.main_drain_regional + ,5069 --pwwf.main_drain + ,5071 --pwwf.collector_sewer + ,5062 --pwwf.renovation_conduction + ,5064 --pwwf.residential_drainage + ,5072 --pwwf.road_drainage + ,5066 --pwwf.other + ,5074 --pwwf.unknown + ,5063 --swwf.renovation_conduction + ,5065 --swwf.residential_drainage + ,5073 --swwf.road_drainage + ,5067 --swwf.other + ,5075 --swwf.other + ] + ,code) From 770dc55a421e75d49e1dc95535557d9e2b677cac Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:13:30 +0200 Subject: [PATCH 15/62] Update CURRENT_VERSION.txt to 1.6.1 --- system/CURRENT_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CURRENT_VERSION.txt b/system/CURRENT_VERSION.txt index dc1e644a..9c6d6293 100644 --- a/system/CURRENT_VERSION.txt +++ b/system/CURRENT_VERSION.txt @@ -1 +1 @@ -1.6.0 +1.6.1 From bf2589d83c2bef8840efb5b9de6296dbdb6d3086 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:49:14 +0200 Subject: [PATCH 16/62] set CURRENT_VERSION to 1.6.1 for pum dependency, it must not be 2023.0 --- system/CURRENT_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CURRENT_VERSION.txt b/system/CURRENT_VERSION.txt index d730fbef..9c6d6293 100644 --- a/system/CURRENT_VERSION.txt +++ b/system/CURRENT_VERSION.txt @@ -1 +1 @@ -2023.0 +1.6.1 From 76abb8e60c8ae248d36a154b9122d65c76e43aad Mon Sep 17 00:00:00 2001 From: SJiB Date: Mon, 18 Sep 2023 09:19:31 +0800 Subject: [PATCH 17/62] Adapt swmm views fk_overflow_char instead of fk_overflow_characteristic --- swmm_views/16_vw_swmm_pumps.sql | 2 +- swmm_views/18_vw_swmm_storages.sql | 2 +- swmm_views/19_vw_swmm_outlets.sql | 2 +- swmm_views/21_vw_swmm_weirs.sql | 4 ++-- swmm_views/22_vw_swmm_curves.sql | 8 ++++---- swmm_views/23_vw_swmm_xsections.sql | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/swmm_views/16_vw_swmm_pumps.sql b/swmm_views/16_vw_swmm_pumps.sql index b5472c3a..829b69cb 100644 --- a/swmm_views/16_vw_swmm_pumps.sql +++ b/swmm_views/16_vw_swmm_pumps.sql @@ -39,7 +39,7 @@ SELECT wn.obj_id as obj_id FROM qgep_od.pump pu LEFT JOIN qgep_od.overflow of ON pu.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/18_vw_swmm_storages.sql b/swmm_views/18_vw_swmm_storages.sql index 5444f6a4..62dcfc9d 100644 --- a/swmm_views/18_vw_swmm_storages.sql +++ b/swmm_views/18_vw_swmm_storages.sql @@ -173,7 +173,7 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) diff --git a/swmm_views/19_vw_swmm_outlets.sql b/swmm_views/19_vw_swmm_outlets.sql index 73f36951..04b301c2 100644 --- a/swmm_views/19_vw_swmm_outlets.sql +++ b/swmm_views/19_vw_swmm_outlets.sql @@ -20,7 +20,7 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index c9f41238..109ffd1f 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -27,7 +27,7 @@ SELECT NULL as message FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) @@ -63,7 +63,7 @@ SELECT concat('Leaping weirs are not supported by SWMM, ', lw.obj_id, 'see: https://swmm5.org/2013/07/19/leaping-weir-example-in-swmm-5-and-infoswmm-alternative/') as message FROM qgep_od.leapingweir lw LEFT JOIN qgep_od.overflow of ON lw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); \ No newline at end of file diff --git a/swmm_views/22_vw_swmm_curves.sql b/swmm_views/22_vw_swmm_curves.sql index a192f5d5..c56d8689 100644 --- a/swmm_views/22_vw_swmm_curves.sql +++ b/swmm_views/22_vw_swmm_curves.sql @@ -23,8 +23,8 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_curves AS END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq -LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow of ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.pump pu ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id @@ -56,8 +56,8 @@ UNION ALL END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq -LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow of ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.prank_weir pw ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id diff --git a/swmm_views/23_vw_swmm_xsections.sql b/swmm_views/23_vw_swmm_xsections.sql index 8ce815f9..dadea572 100644 --- a/swmm_views/23_vw_swmm_xsections.sql +++ b/swmm_views/23_vw_swmm_xsections.sql @@ -78,7 +78,7 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) From 478bf803b692be698ed4d5c8db03282c158ad41f Mon Sep 17 00:00:00 2001 From: SJiB Date: Mon, 18 Sep 2023 10:00:28 +0800 Subject: [PATCH 18/62] adapt kind_overflow_char instead of kind_overflow_characteristic --- swmm_views/16_vw_swmm_pumps.sql | 4 ++-- swmm_views/18_vw_swmm_storages.sql | 2 +- swmm_views/19_vw_swmm_outlets.sql | 2 +- swmm_views/21_vw_swmm_weirs.sql | 2 +- swmm_views/22_vw_swmm_curves.sql | 4 ++-- swmm_views/23_vw_swmm_xsections.sql | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/swmm_views/16_vw_swmm_pumps.sql b/swmm_views/16_vw_swmm_pumps.sql index 829b69cb..3af84ac2 100644 --- a/swmm_views/16_vw_swmm_pumps.sql +++ b/swmm_views/16_vw_swmm_pumps.sql @@ -22,8 +22,8 @@ SELECT THEN 'No curve will be created for this pump, it has no overflow_characteristic' WHEN oc.overflow_characteristic_digital != 6223 --'yes; THEN 'No curve will be created for this pump, overflow_characteristic_digital not equal to yes' - WHEN oc.kind_overflow_characteristic != 6220 --'hq; - THEN concat(pu.obj_id, 'No curve will be created for this pump, kind_overflow_characteristic is not equal to H/Q, Q/Q relations are not supported by SWMM') + WHEN oc.kind_overflow_char != 6220 --'hq; + THEN concat(pu.obj_id, 'No curve will be created for this pump, kind_overflow_char is not equal to H/Q, Q/Q relations are not supported by SWMM') ELSE NULL END ) as description, diff --git a/swmm_views/18_vw_swmm_storages.sql b/swmm_views/18_vw_swmm_storages.sql index 62dcfc9d..e2350365 100644 --- a/swmm_views/18_vw_swmm_storages.sql +++ b/swmm_views/18_vw_swmm_storages.sql @@ -178,4 +178,4 @@ LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) +AND oc.kind_overflow_char = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) diff --git a/swmm_views/19_vw_swmm_outlets.sql b/swmm_views/19_vw_swmm_outlets.sql index 04b301c2..cc0f4cb7 100644 --- a/swmm_views/19_vw_swmm_outlets.sql +++ b/swmm_views/19_vw_swmm_outlets.sql @@ -25,4 +25,4 @@ LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) \ No newline at end of file +AND oc.kind_overflow_char = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) \ No newline at end of file diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index 109ffd1f..76ec0bc9 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -32,7 +32,7 @@ LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) AND (oc.overflow_characteristic_digital != 6223 OR oc.overflow_characteristic_digital IS NULL) --'yes; -OR (oc.kind_overflow_characteristic != 6220 OR oc.overflow_characteristic_digital IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) +OR (oc.kind_overflow_char != 6220 OR oc.overflow_characteristic_digital IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) UNION ALL diff --git a/swmm_views/22_vw_swmm_curves.sql b/swmm_views/22_vw_swmm_curves.sql index c56d8689..52188463 100644 --- a/swmm_views/22_vw_swmm_curves.sql +++ b/swmm_views/22_vw_swmm_curves.sql @@ -30,7 +30,7 @@ LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) +AND oc.kind_overflow_char = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pu.obj_id IS NOT NULL ORDER BY pu.obj_id, hq.altitude) @@ -63,7 +63,7 @@ LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) AND oc.overflow_characteristic_digital = 6223 --'yes; -AND oc.kind_overflow_characteristic = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) +AND oc.kind_overflow_char = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pw.obj_id IS NOT NULL ORDER BY pw.obj_id, hq.altitude) diff --git a/swmm_views/23_vw_swmm_xsections.sql b/swmm_views/23_vw_swmm_xsections.sql index dadea572..ddf08926 100644 --- a/swmm_views/23_vw_swmm_xsections.sql +++ b/swmm_views/23_vw_swmm_xsections.sql @@ -83,6 +83,6 @@ LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) AND oc.overflow_characteristic_digital != 6223 --'NO or unknown; -OR oc.kind_overflow_characteristic != 6220 -- Q/Q relation or unknown +OR oc.kind_overflow_char != 6220 -- Q/Q relation or unknown AND status IN (6530, 6533, 8493, 6529, 6526, 7959); From da0ec04185d60d77caa74a3ad7e21ad096cf72a9 Mon Sep 17 00:00:00 2001 From: Arnaud Poncet-Montanges Date: Mon, 2 Oct 2023 09:07:33 +0200 Subject: [PATCH 19/62] Rename delta_2023.0_allow_longer_vl_names.sql to delta_1.6.1_allow_longer_vl_names.sql Rename delta_2023.0_allow_longer_vl_names.sql to delta_1.6.1_allow_longer_vl_names.sql --- ..._longer_vl_names.sql => delta_1.6.1_allow_longer_vl_names.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename delta/{delta_2023.0_allow_longer_vl_names.sql => delta_1.6.1_allow_longer_vl_names.sql} (100%) diff --git a/delta/delta_2023.0_allow_longer_vl_names.sql b/delta/delta_1.6.1_allow_longer_vl_names.sql similarity index 100% rename from delta/delta_2023.0_allow_longer_vl_names.sql rename to delta/delta_1.6.1_allow_longer_vl_names.sql From 69757258ac6c1dd9d0773db107fa67acffe605ef Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:54:31 +0200 Subject: [PATCH 20/62] Add infiltration installations to 08_vw_swmm_outfalls.sql --- swmm_views/08_vw_swmm_outfalls.sql | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/swmm_views/08_vw_swmm_outfalls.sql b/swmm_views/08_vw_swmm_outfalls.sql index 872631f8..516cf408 100644 --- a/swmm_views/08_vw_swmm_outfalls.sql +++ b/swmm_views/08_vw_swmm_outfalls.sql @@ -30,4 +30,34 @@ LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::te LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id WHERE wn.obj_id IS NOT NULL AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) + +UNION + +SELECT + wn.obj_id as Name, + coalesce(wn.bottom_level,0) as InvertElev, + 'FREE'::varchar as Type, + NULL as StageData, + 'NO'::varchar as tide_gate, + NULL::varchar as RouteTo, + ws.identifier as description, + ii.obj_id::varchar as tag, + wn.situation_geometry as geom, + CASE + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' + ELSE 'current' + END as state, + CASE + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + ELSE 'secondary' + END as hierarchy, + wn.obj_id as obj_id +FROM qgep_od.infiltration_installation as ii +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text +LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id +WHERE wn.obj_id IS NOT NULL +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) ; From 43017b65961139e562645308f9f2b87f00ad3f72 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:55:34 +0200 Subject: [PATCH 21/62] Create delta_1.6.1_add_ii_to_swmm_outfalls --- delta/delta_1.6.1_add_ii_to_swmm_outfalls | 63 +++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 delta/delta_1.6.1_add_ii_to_swmm_outfalls diff --git a/delta/delta_1.6.1_add_ii_to_swmm_outfalls b/delta/delta_1.6.1_add_ii_to_swmm_outfalls new file mode 100644 index 00000000..516cf408 --- /dev/null +++ b/delta/delta_1.6.1_add_ii_to_swmm_outfalls @@ -0,0 +1,63 @@ +-------- +-- View for the swmm module class outfalls +-------- +CREATE OR REPLACE VIEW qgep_swmm.vw_outfalls AS + +SELECT + wn.obj_id as Name, + coalesce(wn.bottom_level,0) as InvertElev, + 'FREE'::varchar as Type, + NULL as StageData, + 'NO'::varchar as tide_gate, + NULL::varchar as RouteTo, + ws.identifier as description, + dp.obj_id::varchar as tag, + wn.situation_geometry as geom, + CASE + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' + ELSE 'current' + END as state, + CASE + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + ELSE 'secondary' + END as hierarchy, + wn.obj_id as obj_id +FROM qgep_od.discharge_point as dp +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text +LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id +WHERE wn.obj_id IS NOT NULL +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) + +UNION + +SELECT + wn.obj_id as Name, + coalesce(wn.bottom_level,0) as InvertElev, + 'FREE'::varchar as Type, + NULL as StageData, + 'NO'::varchar as tide_gate, + NULL::varchar as RouteTo, + ws.identifier as description, + ii.obj_id::varchar as tag, + wn.situation_geometry as geom, + CASE + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' + ELSE 'current' + END as state, + CASE + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + ELSE 'secondary' + END as hierarchy, + wn.obj_id as obj_id +FROM qgep_od.infiltration_installation as ii +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text +LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id +WHERE wn.obj_id IS NOT NULL +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +; From e1115ce58167913cfbfc6b12f05192eff4d29c6e Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:55:52 +0200 Subject: [PATCH 22/62] Update CURRENT_VERSION.txt --- system/CURRENT_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CURRENT_VERSION.txt b/system/CURRENT_VERSION.txt index dc1e644a..9c6d6293 100644 --- a/system/CURRENT_VERSION.txt +++ b/system/CURRENT_VERSION.txt @@ -1 +1 @@ -1.6.0 +1.6.1 From c9d0438bcdae0088fd608d215aacfe60182c59e4 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:01:56 +0200 Subject: [PATCH 23/62] Fix typo in delta_1.6.1_add_ii_to_swmm_outfalls --- delta/delta_1.6.1_add_ii_to_swmm_outfalls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delta/delta_1.6.1_add_ii_to_swmm_outfalls b/delta/delta_1.6.1_add_ii_to_swmm_outfalls index 516cf408..0d678ecd 100644 --- a/delta/delta_1.6.1_add_ii_to_swmm_outfalls +++ b/delta/delta_1.6.1_add_ii_to_swmm_outfalls @@ -23,7 +23,7 @@ SELECT END as hierarchy, wn.obj_id as obj_id FROM qgep_od.discharge_point as dp -LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text From a5050199ef0724b3b64549362e8fcf9b132ae373 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:04:30 +0200 Subject: [PATCH 24/62] Fix typo in right spot --- delta/delta_1.6.1_add_ii_to_swmm_outfalls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/delta/delta_1.6.1_add_ii_to_swmm_outfalls b/delta/delta_1.6.1_add_ii_to_swmm_outfalls index 0d678ecd..b0dc5feb 100644 --- a/delta/delta_1.6.1_add_ii_to_swmm_outfalls +++ b/delta/delta_1.6.1_add_ii_to_swmm_outfalls @@ -23,7 +23,7 @@ SELECT END as hierarchy, wn.obj_id as obj_id FROM qgep_od.discharge_point as dp -LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text @@ -53,7 +53,7 @@ SELECT END as hierarchy, wn.obj_id as obj_id FROM qgep_od.infiltration_installation as ii -LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text From 208edcc8b3cda4fe8bd077b2714ebb911be99b10 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:08:07 +0200 Subject: [PATCH 25/62] Tix typo in 08_vw_swmm_outfalls.sql too --- swmm_views/08_vw_swmm_outfalls.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmm_views/08_vw_swmm_outfalls.sql b/swmm_views/08_vw_swmm_outfalls.sql index 516cf408..b0dc5feb 100644 --- a/swmm_views/08_vw_swmm_outfalls.sql +++ b/swmm_views/08_vw_swmm_outfalls.sql @@ -53,7 +53,7 @@ SELECT END as hierarchy, wn.obj_id as obj_id FROM qgep_od.infiltration_installation as ii -LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text +LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text From f65155cc2aa23da68de61507a62f6de2c298243a Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:47:39 +0200 Subject: [PATCH 26/62] Update drop_views.sql --- view/drop_views.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/view/drop_views.sql b/view/drop_views.sql index 32a19f20..797d5f96 100644 --- a/view/drop_views.sql +++ b/view/drop_views.sql @@ -1,4 +1,6 @@ + + -- qgep_swmm views DROP VIEW IF EXISTS qgep_swmm.vw_aquifers CASCADE; DROP VIEW IF EXISTS qgep_swmm.vw_conduits CASCADE; @@ -130,3 +132,6 @@ DROP VIEW IF EXISTS qgep_od.vw_individual_surface; DROP VIEW IF EXISTS qgep_od.vw_file; DROP VIEW IF EXISTS qgep_od.vw_change_points; DROP VIEW IF EXISTS qgep_od.vw_catchment_area_connections; + +-- qgep_sys views +DROP VIEW IF EXISTS qgep_sys.dictionary_value_list; From c6e9c0e33b127b808244b1ad50dd2852f3ad867d Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:49:39 +0200 Subject: [PATCH 27/62] Create dictionary_value_list.sql --- view/dictionary_value_list.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 view/dictionary_value_list.sql diff --git a/view/dictionary_value_list.sql b/view/dictionary_value_list.sql new file mode 100644 index 00000000..04136c13 --- /dev/null +++ b/view/dictionary_value_list.sql @@ -0,0 +1,5 @@ + +CREATE VIEW qgep_sys.dictionary_value_list AS + SELECT p.relname AS vl_name, vl.* + FROM qgep_sys.value_list_base vl, pg_class p + WHERE vl.tableoid = p.oid; From dc767ce6393dc0d08e08ea95e3d2dd8aaf6263ca Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:50:17 +0200 Subject: [PATCH 28/62] Rename dictionary_value_list.sql to vw_dictionary_value_list.sql --- view/{dictionary_value_list.sql => vw_dictionary_value_list.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename view/{dictionary_value_list.sql => vw_dictionary_value_list.sql} (100%) diff --git a/view/dictionary_value_list.sql b/view/vw_dictionary_value_list.sql similarity index 100% rename from view/dictionary_value_list.sql rename to view/vw_dictionary_value_list.sql From 928223bc2499f6963658ff9638c7d080ef095170 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:51:32 +0200 Subject: [PATCH 29/62] Update create_views.py --- view/create_views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/view/create_views.py b/view/create_views.py index 93adc390..612a175b 100755 --- a/view/create_views.py +++ b/view/create_views.py @@ -46,6 +46,8 @@ def create_views(srid: int, drop_views(pg_service) + run_sql('view/vw_dictionary_value_list.sql', pg_service, variables) + SingleInheritance('qgep_od.structure_part', 'qgep_od.access_aid', view_name='vw_access_aid', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() SingleInheritance('qgep_od.structure_part', 'qgep_od.benching', view_name='vw_benching', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() SingleInheritance('qgep_od.structure_part', 'qgep_od.backflow_prevention', view_name='vw_backflow_prevention', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() From 5ad9d509d2ffe29261051e968126d9bb4adc8292 Mon Sep 17 00:00:00 2001 From: SJiB Date: Tue, 3 Oct 2023 16:13:42 +0200 Subject: [PATCH 30/62] Update current_version 1.6.1 --- system/CURRENT_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/CURRENT_VERSION.txt b/system/CURRENT_VERSION.txt index dc1e644a..9c6d6293 100644 --- a/system/CURRENT_VERSION.txt +++ b/system/CURRENT_VERSION.txt @@ -1 +1 @@ -1.6.0 +1.6.1 From c90bcf5b737b8a41ed57bbd9170b8a3d1ba2a764 Mon Sep 17 00:00:00 2001 From: SJiB Date: Tue, 3 Oct 2023 16:23:34 +0200 Subject: [PATCH 31/62] adapt 09_qgep_dictionaries.sql kind_overflow_characteristic replaced by kind_overflow_char --- 09_qgep_dictionaries.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/09_qgep_dictionaries.sql b/09_qgep_dictionaries.sql index 72575ea4..1b95f658 100644 --- a/09_qgep_dictionaries.sql +++ b/09_qgep_dictionaries.sql @@ -719,7 +719,7 @@ CREATE TABLE qgep_sys.dictionary_od_field ( INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (63,999999,'overflow','provider','provider','Datenlieferant','FOURNISSEUR_DES_DONNEES','fornitore_dati','rrr_Datenlieferant','Metaattribute provider - this is the person or body who delivered the data','Metaattribut Datenlieferant ist diejenige Person oder Stelle, die die Daten geliefert hat','FOURNISSEUR DES DONNEES Organisation qui crée l’enregistrement de ces données','zzz_Metaattribut L''attributo fornitore dati si riferisce alla persona o ente che ha fornito i dati','rrr_Metaattribut Datenlieferant ist diejenige Person oder Stelle, die die Daten geliefert hat',ARRAY['Werkinformation','Leitungskataster', 'GEP_Verband','GEP_Traegerschaft','SAA', 'PAA']::qgep_od.plantype[],'true','varchar(80)','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (63,999999,'overflow','last_modification','last_modification','Letzte_Aenderung','DERNIERE_MODIFICATION','ultima_modifica','rrr_Letze_Aenderung','Last modification: INTERLIS_1_DATE','Letzte Änderung: INTERLIS_1_DATE','Dernière modification: INTERLIS_1_DATE','ultima_modifica: INTERLIS_1_DATE','rrr_Letzte Änderung: INTERLIS_1_DATE',ARRAY['Werkinformation','Leitungskataster', 'GEP_Verband','GEP_Traegerschaft','SAA', 'PAA']::qgep_od.plantype[],'true','TIMESTAMP','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,2538,'overflow_char','identifier','identifier','Bezeichnung','DESIGNATION','denominazione','identificator','NULL','NULL','NULL','NULL','[CHF]',ARRAY['kein_Plantyp_definiert']::qgep_od.plantype[],'true','varchar(20)','','','','','','','','','','',NULL,NULL); - INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6219,'overflow_char','kind_overflow_characteristic','kind_overflow_characteristic','Kennlinie_Typ','GENRE_COURBE_DE_FONCTIONNEMENT','curva_caratteristica_tipo','tipul_curbei_de_func?ionare','yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.','NULL','[CHF]',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); + INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6219,'overflow_char','kind_overflow_char','kind_overflow_char','Kennlinie_Typ','GENRE_COURBE_DE_FONCTIONNEMENT','curva_caratteristica_tipo','tipul_curbei_de_func?ionare','yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.','NULL','[CHF]',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6222,'overflow_char','overflow_characteristic_digital','overflow_characteristic_digital','Kennlinie_digital','COURBE_DE_FONCTIONNEMENT_NUM','curva_caratteristica_digitale','curba_de_func?ionare_numerica','yyy_Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in Ueberlaufcharakteristik ausgefüllt sein in HQ_Relation.','Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in HQ_Relation ausgefüllt sein.','Si courbe de fonctionnement numérique = oui, les attributs pour les relations Q-Q et H-Q doivent être saisis dans la classe RELATION_HQ.','NULL','',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,2596,'overflow_char','remark','remark','Bemerkung','REMARQUE','osservazione','observa?ie','General remarks','Allgemeine Bemerkungen','Remarques générales','NULL','',ARRAY['kein_Plantyp_definiert']::qgep_od.plantype[],'true','varchar(80)','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,999999,'overflow_char','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID - Unique ID','OBJ_ID - eindeutige Kennung','OBJ_ID - ID unique','OBJ_ID - identificatore univoco','rrr_OBJ_ID - eindeutige Kennung',ARRAY['Werkinformation','Leitungskataster', 'GEP_Verband','GEP_Traegerschaft','SAA', 'PAA']::qgep_od.plantype[],'true','varchar(16)','','','','','','','','','','',NULL,NULL); @@ -1547,9 +1547,9 @@ CONSTRAINT is_dictionary_od_values_pkey PRIMARY KEY (id) INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (63,2692,2693,'overflow','signal_transmission','sending','sending','','senden','','emettre','','zzz_senden','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (63,2692,2695,'overflow','signal_transmission','sending_receiving','sending_receiving','','senden_empfangen','','emettre_recevoir','','zzz_senden_empfangen','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (63,2692,3056,'overflow','signal_transmission','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','',' ','','','',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6220,'overflow_char','kind_overflow_characteristic','hq','hq','','HQ','','HQ','','HQ','','','','yyy_H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','ligne H / Q: H = hauteur d’eau lors du déversement [m.s.m.], Q = débit conservé vers STEP [l/s]','Assegnare altezza (H) e portata (Q)',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6221,'overflow_char','kind_overflow_characteristic','qq','qq','','QQ','','QQ','','QQ','','','','yyy_Q-Q-Beziehung: Zufluss (Q1) und Durchfluss Richtung ARA (Q2) abfüllen','Q-Q-Beziehung: Zufluss (Q1) und Durchfluss Richtung ARA (Q2) abfüllen','ligne Q1 / Q2: Q1 = débit d’entrée [l/s], Q2 = débit acheminé vers STEP [l/s]','Registrare afflusso (Q1) e portata (Q2)',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6228,'overflow_char','kind_overflow_characteristic','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','','','','','',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6220,'overflow_char','kind_overflow_char','hq','hq','','HQ','','HQ','','HQ','','','','yyy_H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','ligne H / Q: H = hauteur d’eau lors du déversement [m.s.m.], Q = débit conservé vers STEP [l/s]','Assegnare altezza (H) e portata (Q)',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6221,'overflow_char','kind_overflow_char','qq','qq','','QQ','','QQ','','QQ','','','','yyy_Q-Q-Beziehung: Zufluss (Q1) und Durchfluss Richtung ARA (Q2) abfüllen','Q-Q-Beziehung: Zufluss (Q1) und Durchfluss Richtung ARA (Q2) abfüllen','ligne Q1 / Q2: Q1 = débit d’entrée [l/s], Q2 = débit acheminé vers STEP [l/s]','Registrare afflusso (Q1) e portata (Q2)',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6228,'overflow_char','kind_overflow_char','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','','','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6223,'overflow_char','overflow_characteristic_digital','yes','yes','','ja','','oui','','si','','','','','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6224,'overflow_char','overflow_characteristic_digital','no','no','','nein','','non','','no','','','','','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6225,'overflow_char','overflow_characteristic_digital','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','','','','','',''); From 3dbed81b2278cf95ac8b784cc0c0c96c85007e96 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 4 Oct 2023 08:10:27 +0200 Subject: [PATCH 32/62] add .sql to delta name --- ..._fct_hierarchic => delta_1.6.1_alter_order_fct_hierarchic.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename delta/{delta_1.6.1_alter_order_fct_hierarchic => delta_1.6.1_alter_order_fct_hierarchic.sql} (100%) diff --git a/delta/delta_1.6.1_alter_order_fct_hierarchic b/delta/delta_1.6.1_alter_order_fct_hierarchic.sql similarity index 100% rename from delta/delta_1.6.1_alter_order_fct_hierarchic rename to delta/delta_1.6.1_alter_order_fct_hierarchic.sql From 1b4a3eb593c38a80bfa2560a6b5807db8b84ea73 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 4 Oct 2023 08:11:24 +0200 Subject: [PATCH 33/62] Update order in 05_data_model_extensions.sql --- 05_data_model_extensions.sql | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/05_data_model_extensions.sql b/05_data_model_extensions.sql index e1e07e17..8b1f15ac 100644 --- a/05_data_model_extensions.sql +++ b/05_data_model_extensions.sql @@ -36,20 +36,26 @@ added solely for QGEP'; -- this column is an extension to the VSA data model and puts the _function_hierarchic in order ALTER TABLE qgep_vl.channel_function_hierarchic ADD COLUMN order_fct_hierarchic smallint; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=5 WHERE code=5062; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=7 WHERE code=5063; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=6 WHERE code=5064; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=8 WHERE code=5065; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=10 WHERE code=5066; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=13 WHERE code=5067; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=1 WHERE code=5068; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=3 WHERE code=5069; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=2 WHERE code=5070; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=4 WHERE code=5071; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=9 WHERE code=5072; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=12 WHERE code=5073; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=11 WHERE code=5074; -UPDATE qgep_vl.channel_function_hierarchic SET order_fct_hierarchic=14 WHERE code=5075; +UPDATE qgep_vl.channel_function_hierarchic +SET order_fct_hierarchic= + array_position( + ARRAY[ + 5068 --pwwf.water_bodies + ,5070 --pwwf.main_drain_regional + ,5069 --pwwf.main_drain + ,5071 --pwwf.collector_sewer + ,5062 --pwwf.renovation_conduction + ,5064 --pwwf.residential_drainage + ,5072 --pwwf.road_drainage + ,5066 --pwwf.other + ,5074 --pwwf.unknown + ,5063 --swwf.renovation_conduction + ,5065 --swwf.residential_drainage + ,5073 --swwf.road_drainage + ,5067 --swwf.other + ,5075 --swwf.other + ] + ,code) -- this column is an extension to the VSA data model and puts the _usage_current in order ALTER TABLE qgep_vl.channel_usage_current ADD COLUMN order_usage_current smallint; From fd4149111fb145990e5f4b7a44e1967f6e7e6e35 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 4 Oct 2023 08:14:48 +0200 Subject: [PATCH 34/62] Add semicolon in 05_data_model_extensions.sql --- 05_data_model_extensions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_data_model_extensions.sql b/05_data_model_extensions.sql index 8b1f15ac..9d5e5593 100644 --- a/05_data_model_extensions.sql +++ b/05_data_model_extensions.sql @@ -55,7 +55,7 @@ SET order_fct_hierarchic= ,5067 --swwf.other ,5075 --swwf.other ] - ,code) + ,code) ; -- this column is an extension to the VSA data model and puts the _usage_current in order ALTER TABLE qgep_vl.channel_usage_current ADD COLUMN order_usage_current smallint; From b563ec384f1aa342902799a69694e136a6cb46d8 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 4 Oct 2023 10:21:06 +0200 Subject: [PATCH 35/62] Alter comment --- 05_data_model_extensions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05_data_model_extensions.sql b/05_data_model_extensions.sql index 9d5e5593..d3659049 100644 --- a/05_data_model_extensions.sql +++ b/05_data_model_extensions.sql @@ -53,7 +53,7 @@ SET order_fct_hierarchic= ,5065 --swwf.residential_drainage ,5073 --swwf.road_drainage ,5067 --swwf.other - ,5075 --swwf.other + ,5075 --swwf.unknown ] ,code) ; From d8fdffafec065b5247f03a7d73610dc93b06994d Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Wed, 4 Oct 2023 10:21:29 +0200 Subject: [PATCH 36/62] alter comment --- delta/delta_1.6.1_alter_order_fct_hierarchic.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delta/delta_1.6.1_alter_order_fct_hierarchic.sql b/delta/delta_1.6.1_alter_order_fct_hierarchic.sql index 2b98cb80..0760b89f 100644 --- a/delta/delta_1.6.1_alter_order_fct_hierarchic.sql +++ b/delta/delta_1.6.1_alter_order_fct_hierarchic.sql @@ -15,6 +15,6 @@ SET order_fct_hierarchic= ,5065 --swwf.residential_drainage ,5073 --swwf.road_drainage ,5067 --swwf.other - ,5075 --swwf.other + ,5075 --swwf.unknown ] ,code) From 7140ba1571ee2bdd21983bdf1b8665cab46046ca Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 09:32:49 +0200 Subject: [PATCH 37/62] Rename to 1.6.1_xxx --- ...rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename delta/{delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql => delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql} (100%) diff --git a/delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql similarity index 100% rename from delta/delta_1.5.x_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql rename to delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql From ce3ab3c846719e91d54aa693b2f7b210f079777e Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:03:55 +0200 Subject: [PATCH 38/62] adapt overflow_char_digital instead of overflow_characteristic_digital --- 09_qgep_dictionaries.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/09_qgep_dictionaries.sql b/09_qgep_dictionaries.sql index 1b95f658..66f95a8b 100644 --- a/09_qgep_dictionaries.sql +++ b/09_qgep_dictionaries.sql @@ -720,7 +720,7 @@ CREATE TABLE qgep_sys.dictionary_od_field ( INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (63,999999,'overflow','last_modification','last_modification','Letzte_Aenderung','DERNIERE_MODIFICATION','ultima_modifica','rrr_Letze_Aenderung','Last modification: INTERLIS_1_DATE','Letzte Änderung: INTERLIS_1_DATE','Dernière modification: INTERLIS_1_DATE','ultima_modifica: INTERLIS_1_DATE','rrr_Letzte Änderung: INTERLIS_1_DATE',ARRAY['Werkinformation','Leitungskataster', 'GEP_Verband','GEP_Traegerschaft','SAA', 'PAA']::qgep_od.plantype[],'true','TIMESTAMP','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,2538,'overflow_char','identifier','identifier','Bezeichnung','DESIGNATION','denominazione','identificator','NULL','NULL','NULL','NULL','[CHF]',ARRAY['kein_Plantyp_definiert']::qgep_od.plantype[],'true','varchar(20)','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6219,'overflow_char','kind_overflow_char','kind_overflow_char','Kennlinie_Typ','GENRE_COURBE_DE_FONCTIONNEMENT','curva_caratteristica_tipo','tipul_curbei_de_func?ionare','yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.','NULL','[CHF]',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); - INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6222,'overflow_char','overflow_characteristic_digital','overflow_characteristic_digital','Kennlinie_digital','COURBE_DE_FONCTIONNEMENT_NUM','curva_caratteristica_digitale','curba_de_func?ionare_numerica','yyy_Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in Ueberlaufcharakteristik ausgefüllt sein in HQ_Relation.','Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in HQ_Relation ausgefüllt sein.','Si courbe de fonctionnement numérique = oui, les attributs pour les relations Q-Q et H-Q doivent être saisis dans la classe RELATION_HQ.','NULL','',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); + INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6222,'overflow_char','overflow_char_digital','overflow_char_digital','Kennlinie_digital','COURBE_DE_FONCTIONNEMENT_NUM','curva_caratteristica_digitale','curba_de_func?ionare_numerica','yyy_Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in Ueberlaufcharakteristik ausgefüllt sein in HQ_Relation.','Falls Kennlinie_digital = ja müssen die Attribute für die Q-Q oder H-Q Beziehung in HQ_Relation ausgefüllt sein.','Si courbe de fonctionnement numérique = oui, les attributs pour les relations Q-Q et H-Q doivent être saisis dans la classe RELATION_HQ.','NULL','',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,2596,'overflow_char','remark','remark','Bemerkung','REMARQUE','osservazione','observa?ie','General remarks','Allgemeine Bemerkungen','Remarques générales','NULL','',ARRAY['kein_Plantyp_definiert']::qgep_od.plantype[],'true','varchar(80)','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,999999,'overflow_char','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID','OBJ_ID - Unique ID','OBJ_ID - eindeutige Kennung','OBJ_ID - ID unique','OBJ_ID - identificatore univoco','rrr_OBJ_ID - eindeutige Kennung',ARRAY['Werkinformation','Leitungskataster', 'GEP_Verband','GEP_Traegerschaft','SAA', 'PAA']::qgep_od.plantype[],'true','varchar(16)','','','','','','','','','','',NULL,NULL); INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,999999,'overflow_char','dataowner','dataowner','Datenherr','MAITRE_DES_DONNEES','proprietario_dati','rrr_Datenherr','dataowner - this is the person or body who is allowed to delete, change or maintain this object','Metaattribut Datenherr ist diejenige Person oder Stelle, die berechtigt ist, diesen Datensatz zu löschen, zu ändern bzw. zu verwalten','Maître des données gestionnaire de données, qui est la personne ou l''organisation autorisée pour gérer, modifier ou supprimer les données de cette table/classe','zzz_Metaattribut L''attributo proprietario dati si riferisce alla persona o ente che è autorizzato a eliminare, modificare o gestire i dati','rrr_Metaattribut Datenherr ist diejenige Person oder Stelle, die berechtigt ist, diesen Datensatz zu löschen, zu ändern bzw. zu verwalten',ARRAY['Werkinformation','Leitungskataster', 'GEP_Verband','GEP_Traegerschaft','SAA', 'PAA']::qgep_od.plantype[],'true','varchar(80)','','','','','','','','','','',NULL,NULL); @@ -1550,9 +1550,9 @@ CONSTRAINT is_dictionary_od_values_pkey PRIMARY KEY (id) INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6220,'overflow_char','kind_overflow_char','hq','hq','','HQ','','HQ','','HQ','','','','yyy_H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','H-Q Beziehung: Hoehe (H) und Durchfluss (Q) Richtung ARA abfüllen','ligne H / Q: H = hauteur d’eau lors du déversement [m.s.m.], Q = débit conservé vers STEP [l/s]','Assegnare altezza (H) e portata (Q)',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6221,'overflow_char','kind_overflow_char','qq','qq','','QQ','','QQ','','QQ','','','','yyy_Q-Q-Beziehung: Zufluss (Q1) und Durchfluss Richtung ARA (Q2) abfüllen','Q-Q-Beziehung: Zufluss (Q1) und Durchfluss Richtung ARA (Q2) abfüllen','ligne Q1 / Q2: Q1 = débit d’entrée [l/s], Q2 = débit acheminé vers STEP [l/s]','Registrare afflusso (Q1) e portata (Q2)',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6219,6228,'overflow_char','kind_overflow_char','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','','','','','',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6223,'overflow_char','overflow_characteristic_digital','yes','yes','','ja','','oui','','si','','','','','','','',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6224,'overflow_char','overflow_characteristic_digital','no','no','','nein','','non','','no','','','','','','','',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6225,'overflow_char','overflow_characteristic_digital','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','','','','','',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6223,'overflow_char','overflow_char_digital','yes','yes','','ja','','oui','','si','','','','','','','',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6224,'overflow_char','overflow_char_digital','no','no','','nein','','non','','no','','','','','','','',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (64,6222,6225,'overflow_char','overflow_char_digital','unknown','unknown','','unbekannt','','inconnu','','sconosciuto','','','','','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (65,189,341,'river_bank','control_grade_of_river','none','none','','keine','','nul','','nessuno','','inexistent','','none (0%)','keine (0%)','nul (0%)','zzz_keine (0%)',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (65,189,2612,'river_bank','control_grade_of_river','moderate','moderate','','maessig','','moyen','','zzz_maessig','','','','moderate (10 - 30 %)','mässig (10 - 30 %)','moyen (10 - 30 %)','zzz_mässig (10 - 30 %)',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (65,189,2613,'river_bank','control_grade_of_river','strong','strong','','stark','','fort','','zzz_stark','','','','strong (30 - 60 %)','stark (30 - 60 %)','fort (30 - 60 %)','zzz_stark (30 - 60 %)',''); From 1644ecc57ad7e0fb5bb6b75cf667d528260f2028 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:21:16 +0200 Subject: [PATCH 39/62] replace overflow_characteristic_digital with overflow_char_digital --- swmm_views/16_vw_swmm_pumps.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swmm_views/16_vw_swmm_pumps.sql b/swmm_views/16_vw_swmm_pumps.sql index 3af84ac2..49ce8d5d 100644 --- a/swmm_views/16_vw_swmm_pumps.sql +++ b/swmm_views/16_vw_swmm_pumps.sql @@ -20,8 +20,8 @@ SELECT CASE WHEN oc.obj_id IS NULL --'yes; THEN 'No curve will be created for this pump, it has no overflow_characteristic' - WHEN oc.overflow_characteristic_digital != 6223 --'yes; - THEN 'No curve will be created for this pump, overflow_characteristic_digital not equal to yes' + WHEN oc.overflow_char_digital != 6223 --'yes; + THEN 'No curve will be created for this pump, overflow_char_digital not equal to yes' WHEN oc.kind_overflow_char != 6220 --'hq; THEN concat(pu.obj_id, 'No curve will be created for this pump, kind_overflow_char is not equal to H/Q, Q/Q relations are not supported by SWMM') ELSE NULL From fe2fb3fff04d6274e6f39ded52a684a195b839f0 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:24:16 +0200 Subject: [PATCH 40/62] replace overflow_characteristic_digital with overflow_char_digital --- swmm_views/18_vw_swmm_storages.sql | 2 +- swmm_views/19_vw_swmm_outlets.sql | 2 +- swmm_views/21_vw_swmm_weirs.sql | 4 ++-- swmm_views/22_vw_swmm_curves.sql | 4 ++-- swmm_views/23_vw_swmm_xsections.sql | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/swmm_views/18_vw_swmm_storages.sql b/swmm_views/18_vw_swmm_storages.sql index e2350365..4f9da312 100644 --- a/swmm_views/18_vw_swmm_storages.sql +++ b/swmm_views/18_vw_swmm_storages.sql @@ -177,5 +177,5 @@ LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; +AND oc.overflow_char_digital = 6223 --'yes; AND oc.kind_overflow_char = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) diff --git a/swmm_views/19_vw_swmm_outlets.sql b/swmm_views/19_vw_swmm_outlets.sql index cc0f4cb7..d2cf75ff 100644 --- a/swmm_views/19_vw_swmm_outlets.sql +++ b/swmm_views/19_vw_swmm_outlets.sql @@ -24,5 +24,5 @@ LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; +AND oc.overflow_char_digital = 6223 --'yes; AND oc.kind_overflow_char = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) \ No newline at end of file diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index 76ec0bc9..9d0f0773 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -31,8 +31,8 @@ LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND (oc.overflow_characteristic_digital != 6223 OR oc.overflow_characteristic_digital IS NULL) --'yes; -OR (oc.kind_overflow_char != 6220 OR oc.overflow_characteristic_digital IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) +AND (oc.overflow_char_digital != 6223 OR oc.overflow_char_digital IS NULL) --'yes; +OR (oc.kind_overflow_char != 6220 OR oc.overflow_char_digital IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) UNION ALL diff --git a/swmm_views/22_vw_swmm_curves.sql b/swmm_views/22_vw_swmm_curves.sql index 52188463..fac4b194 100644 --- a/swmm_views/22_vw_swmm_curves.sql +++ b/swmm_views/22_vw_swmm_curves.sql @@ -29,7 +29,7 @@ LEFT JOIN qgep_od.pump pu ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; +AND oc.overflow_char_digital = 6223 --'yes; AND oc.kind_overflow_char = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pu.obj_id IS NOT NULL ORDER BY pu.obj_id, hq.altitude) @@ -62,7 +62,7 @@ LEFT JOIN qgep_od.prank_weir pw ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital = 6223 --'yes; +AND oc.overflow_char_digital = 6223 --'yes; AND oc.kind_overflow_char = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pw.obj_id IS NOT NULL ORDER BY pw.obj_id, hq.altitude) diff --git a/swmm_views/23_vw_swmm_xsections.sql b/swmm_views/23_vw_swmm_xsections.sql index ddf08926..0e70a3f7 100644 --- a/swmm_views/23_vw_swmm_xsections.sql +++ b/swmm_views/23_vw_swmm_xsections.sql @@ -82,7 +82,7 @@ LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital != 6223 --'NO or unknown; +AND oc.overflow_char_digital != 6223 --'NO or unknown; OR oc.kind_overflow_char != 6220 -- Q/Q relation or unknown AND status IN (6530, 6533, 8493, 6529, 6526, 7959); From 74d04e1eb3542587d0f4210f0c87dbcb50db4b2c Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:24:56 +0200 Subject: [PATCH 41/62] migrate_dispatch_copy_data adaption --- .../dispatch_table_migration/migrate_dispatch_copy_data.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql b/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql index d3d2f6e7..df83eeca 100644 --- a/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql +++ b/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql @@ -86,8 +86,8 @@ BEGIN IF _loop_count = 0 THEN -- Missing renames _destination_table_name := regexp_replace(_destination_table_name,'^hydraulic_characteristic_data','hydraulic_char_data'); - _destination_table_name := regexp_replace(_destination_table_name,'^overflow_characteristic_kind_overflow_characteristic','overflow_char_kind_overflow_characteristic'); - _destination_table_name := regexp_replace(_destination_table_name,'^overflow_characteristic_overflow_characteristic_digital','overflow_char_overflow_characteristic_digital'); + _destination_table_name := regexp_replace(_destination_table_name,'^overflow_characteristic_kind_overflow_characteristic','overflow_char_kind_overflow_char'); + _destination_table_name := regexp_replace(_destination_table_name,'^overflow_characteristic_overflow_characteristic_digital','overflow_char_overflow_char_digital'); _loop_count = 1; CONTINUE; END IF; From c1119547a318a8e46b3092653b2a32b573c594e5 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:27:14 +0200 Subject: [PATCH 42/62] Adapt README.md char --- scripts/dispatch_table_migration/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/dispatch_table_migration/README.md b/scripts/dispatch_table_migration/README.md index 85d401fd..f2ac0893 100644 --- a/scripts/dispatch_table_migration/README.md +++ b/scripts/dispatch_table_migration/README.md @@ -36,11 +36,11 @@ To perform the migration: ## Technical details * table renames * hydraulic_characteristic_data to hydraulic_char_data - * overflow_characteristic_kind_overflow_characteristic to overflow_char_kind_overflow_characteristic - * overflow_characteristic_overflow_characteristic_digital to overflow_char_overflow_characteristic_digital + * overflow_characteristic_kind_overflow_characteristic to overflow_char_kind_overflow_char + * overflow_characteristic_overflow_characteristic_digital to overflow_char_overflow_char_digital * column renames * in table catchment_area_text, fk_catchment to fk_catchment_area - * in tables hq_relation, hydraulic_char_data and overflow: fk_overflow_char to fk_overflow_characteristic + * in tables hq_relation, hydraulic_char_data and overflow: fk_overflow_characteristic to fk_overflow_char * columns addition (missing in former models) * in table txt_symbol, skip fk_wastewater_structure * in table txt_text, skip fk_wastewater_structure, fk_catchment_area, fk_reach From 74b9e973c09c711cd79b5f40b2cc884140d13828 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:50:56 +0200 Subject: [PATCH 43/62] delete and re-add primary key constraint vl tables --- ...rflow_characteristic_to_fk_overflow_char.sql | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index df74ff63..981d2c79 100644 --- a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -84,14 +84,25 @@ RENAME COLUMN kind_overflow_characteristic TO kind_overflow_char; ALTER TABLE qgep_od.overflow_char RENAME COLUMN overflow_characteristic_digital TO overflow_char_digital; --- 2. rename qgep_vl.overflow_char_kind_overflow_characteristic to overflow_char_kind_overflow_char ---and qgep_vl.overflow_char_overflow_characteristic_digital to overflow_char_overflow_char_digital +-- 2. delete primary constraint of vl_list tables neu 5.10.2023 +ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic DROP CONSTRAINT pkey_qgep_vl_overflow_characteristic_kind_overflow_characteristic_code; + +ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital DROP CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code; + +-- 3. rename qgep_vl.overflow_char_kind_overflow_characteristic to overflow_char_kind_overflow_char +--and qgep_vl.overflow_char_overflow_characteristic_digital to overflow_char_overflow_char_digital ALTER TABLE qgep_vl.overflow_char_kind_overflow_characteristic RENAME TO overflow_char_kind_overflow_char; ALTER TABLE qgep_vl.overflow_char_overflow_characteristic_digital RENAME TO overflow_char_overflow_char_digital; --- 3. rename wrong value in qgep_sys.dictionary_od_field +-- 4. re-add primary key constraint neu 5.10.2023 +ALTER TABLE qgep_vl.overflow_char_kind_overflow_char ADD CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_char_code PRIMARY KEY (code); +ALTER TABLE qgep_vl.overflow_char_overflow_char_digital ADD CONSTRAINT pkey_qgep_vl_overflow_char_overflow_char_digital_code PRIMARY KEY (code); + + + +-- 6. rename wrong value in qgep_sys.dictionary_od_field -- adjust value list in dictionary_od_field -- INSERT INTO qgep_sys.dictionary_od_field (class_id, attribute_id, table_name, field_name, field_name_en, field_name_de, field_name_fr, field_name_it, field_name_ro, field_description_en, field_description_de, field_description_fr, field_description_it, field_description_ro, field_mandatory, field_visible, field_datatype, field_unit_en, field_unit_description_en, field_unit_de, field_unit_description_de, field_unit_fr, field_unit_description_fr, field_unit_it, field_unit_description_it, field_unit_ro, field_unit_description_ro, field_max, field_min) VALUES (64,6219,'overflow_char','kind_overflow_characteristic','kind_overflow_characteristic','Kennlinie_Typ','GENRE_COURBE_DE_FONCTIONNEMENT','curva_caratteristica_tipo','tipul_curbei_de_func?ionare','yyy_Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','Die Kennlinie ist als Q /Q- (bei Bodenöffnungen) oder als H/Q-Tabelle (bei Streichwehren) zu dokumentieren. Bei einer freien Aufteilung muss die Kennlinie nicht dokumentiert werden. Bei Abflussverhältnissen in Einstaubereichen ist die Funktion separat in einer Beilage zu beschreiben.','La courbe est à documenter sous forme de rapport Q/Q (Leaping weir) ou H/Q (déversoir latéral). Les conditions d’écoulement dans la chambre d’accumulation sont à fournir en annexe.','NULL','[CHF]',ARRAY['GEP_Verband','PAA']::qgep_od.plantype[],'true','integer','','','','','','','','','','',NULL,NULL); From a541ee856f6b6b9885dd4753111c2a00c5c72634 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 10:59:02 +0200 Subject: [PATCH 44/62] wrong vl_table name qgep_vl.overflow_char_kind_overflow_characteristic instead of qgep_vl.overflow_characteristic_kind_overflow_characteristic --- ...ename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index 981d2c79..1462cb6a 100644 --- a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -86,7 +86,7 @@ RENAME COLUMN overflow_characteristic_digital TO overflow_char_digital; -- 2. delete primary constraint of vl_list tables neu 5.10.2023 -ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic DROP CONSTRAINT pkey_qgep_vl_overflow_characteristic_kind_overflow_characteristic_code; +ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic DROP CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code; ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital DROP CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code; From 8a1586bef3075565b36c4d31eeb5b19cb5a6e6cf Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 11:14:07 +0200 Subject: [PATCH 45/62] rename pkey constraint instead of delete and re-do drop causes dependencies problems --- ...low_characteristic_to_fk_overflow_char.sql | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index 1462cb6a..946837d6 100644 --- a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -85,20 +85,28 @@ ALTER TABLE qgep_od.overflow_char RENAME COLUMN overflow_characteristic_digital TO overflow_char_digital; --- 2. delete primary constraint of vl_list tables neu 5.10.2023 -ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic DROP CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code; -ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital DROP CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code; --- 3. rename qgep_vl.overflow_char_kind_overflow_characteristic to overflow_char_kind_overflow_char +-- 2. rename qgep_vl.overflow_char_kind_overflow_characteristic to overflow_char_kind_overflow_char --and qgep_vl.overflow_char_overflow_characteristic_digital to overflow_char_overflow_char_digital ALTER TABLE qgep_vl.overflow_char_kind_overflow_characteristic RENAME TO overflow_char_kind_overflow_char; ALTER TABLE qgep_vl.overflow_char_overflow_characteristic_digital RENAME TO overflow_char_overflow_char_digital; +-- 3. delete primary constraint of vl_list tables neu 5.10.2023 - geht nicht wegen dependencies +-- use rename instead ALTER TABLE name RENAME CONSTRAINT constraint_name TO new_constraint_name; +--ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic DROP CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code; + +ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic RENAME CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code TO pkey_qgep_vl_overflow_char_kind_overflow_char_code; + +--ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital DROP CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code; + +ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital RENAME CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code TO pkey_qgep_vl_overflow_char_overflow_char_digital_code; + -- 4. re-add primary key constraint neu 5.10.2023 -ALTER TABLE qgep_vl.overflow_char_kind_overflow_char ADD CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_char_code PRIMARY KEY (code); -ALTER TABLE qgep_vl.overflow_char_overflow_char_digital ADD CONSTRAINT pkey_qgep_vl_overflow_char_overflow_char_digital_code PRIMARY KEY (code); +-- not needed anymore +--ALTER TABLE qgep_vl.overflow_char_kind_overflow_char ADD CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_char_code PRIMARY KEY (code); +--ALTER TABLE qgep_vl.overflow_char_overflow_char_digital ADD CONSTRAINT pkey_qgep_vl_overflow_char_overflow_char_digital_code PRIMARY KEY (code); From fa1dcc5c60719e5654d7de9a700d9c1a9570acca Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 11:25:57 +0200 Subject: [PATCH 46/62] wrong vl tables referenced as now renamed before --- ...ame_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index 946837d6..6f58cbd1 100644 --- a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -97,11 +97,11 @@ ALTER TABLE qgep_vl.overflow_char_overflow_characteristic_digital RENAME TO over -- use rename instead ALTER TABLE name RENAME CONSTRAINT constraint_name TO new_constraint_name; --ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic DROP CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code; -ALTER TABLE IF EXISTS qgep_vl.overflow_char_kind_overflow_characteristic RENAME CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code TO pkey_qgep_vl_overflow_char_kind_overflow_char_code; +ALTER TABLE qgep_vl.overflow_char_kind_overflow_char RENAME CONSTRAINT pkey_qgep_vl_overflow_char_kind_overflow_characteristic_code TO pkey_qgep_vl_overflow_char_kind_overflow_char_code; --ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital DROP CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code; -ALTER TABLE IF EXISTS qgep_vl.overflow_char_overflow_characteristic_digital RENAME CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code TO pkey_qgep_vl_overflow_char_overflow_char_digital_code; +ALTER TABLE qgep_vl.overflow_char_overflow_char_digital RENAME CONSTRAINT pkey_qgep_vl_overflow_char_overflow_characteristic_digital_code TO pkey_qgep_vl_overflow_char_overflow_char_digital_code; -- 4. re-add primary key constraint neu 5.10.2023 -- not needed anymore From 03fd6565f4e258fb3bd3262863b48645238f4871 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:01:54 +0200 Subject: [PATCH 47/62] Update delta_1.6.1_add_ii_to_swmm_outfalls Delta included view, which is unnecessary. Now adding delta so the addition of ii can be seen in deltas. --- delta/delta_1.6.1_add_ii_to_swmm_outfalls | 63 +---------------------- 1 file changed, 2 insertions(+), 61 deletions(-) diff --git a/delta/delta_1.6.1_add_ii_to_swmm_outfalls b/delta/delta_1.6.1_add_ii_to_swmm_outfalls index b0dc5feb..16199ac9 100644 --- a/delta/delta_1.6.1_add_ii_to_swmm_outfalls +++ b/delta/delta_1.6.1_add_ii_to_swmm_outfalls @@ -1,63 +1,4 @@ -------- --- View for the swmm module class outfalls +-- View for the swmm module class outfalls now includes infiltration installations -------- -CREATE OR REPLACE VIEW qgep_swmm.vw_outfalls AS - -SELECT - wn.obj_id as Name, - coalesce(wn.bottom_level,0) as InvertElev, - 'FREE'::varchar as Type, - NULL as StageData, - 'NO'::varchar as tide_gate, - NULL::varchar as RouteTo, - ws.identifier as description, - dp.obj_id::varchar as tag, - wn.situation_geometry as geom, - CASE - WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' - ELSE 'current' - END as state, - CASE - WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' - ELSE 'secondary' - END as hierarchy, - wn.obj_id as obj_id -FROM qgep_od.discharge_point as dp -LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text -LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code -LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic -LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text -LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id -WHERE wn.obj_id IS NOT NULL -AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) - -UNION - -SELECT - wn.obj_id as Name, - coalesce(wn.bottom_level,0) as InvertElev, - 'FREE'::varchar as Type, - NULL as StageData, - 'NO'::varchar as tide_gate, - NULL::varchar as RouteTo, - ws.identifier as description, - ii.obj_id::varchar as tag, - wn.situation_geometry as geom, - CASE - WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' - ELSE 'current' - END as state, - CASE - WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' - ELSE 'secondary' - END as hierarchy, - wn.obj_id as obj_id -FROM qgep_od.infiltration_installation as ii -LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text -LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code -LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic -LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text -LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id -WHERE wn.obj_id IS NOT NULL -AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) -; +SELECT 1; From 2f709632b19182927528be5008a30ef12af16e06 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:21:36 +0200 Subject: [PATCH 48/62] 16_vw_smm_pumps - Integrate Allow vl extensions in SWMM views #220 https://github.com/QGEP/datamodel/pull/220 to not have overlapping pullrequests --- swmm_views/16_vw_swmm_pumps.sql | 16 +++++++---- swmm_views/18_vw_swmm_storages.sql | 34 +++++++++++++--------- swmm_views/19_vw_swmm_outlets.sql | 16 +++++++---- swmm_views/21_vw_swmm_weirs.sql | 28 +++++++++++------- swmm_views/22_vw_swmm_curves.sql | 44 ++++++++++++++++++----------- swmm_views/23_vw_swmm_xsections.sql | 39 ++++++++++++++----------- 6 files changed, 108 insertions(+), 69 deletions(-) diff --git a/swmm_views/16_vw_swmm_pumps.sql b/swmm_views/16_vw_swmm_pumps.sql index 49ce8d5d..41a38d0f 100644 --- a/swmm_views/16_vw_swmm_pumps.sql +++ b/swmm_views/16_vw_swmm_pumps.sql @@ -19,27 +19,31 @@ SELECT of.identifier, CASE WHEN oc.obj_id IS NULL --'yes; - THEN 'No curve will be created for this pump, it has no overflow_characteristic' - WHEN oc.overflow_char_digital != 6223 --'yes; + THEN 'No curve will be created for this pump, it has no overflow_char' + WHEN vl_oc_dig.vsacode != 6223 --'yes; THEN 'No curve will be created for this pump, overflow_char_digital not equal to yes' - WHEN oc.kind_overflow_char != 6220 --'hq; + WHEN vl_oc_ki.vsacode != 6220 --'hq; THEN concat(pu.obj_id, 'No curve will be created for this pump, kind_overflow_char is not equal to H/Q, Q/Q relations are not supported by SWMM') ELSE NULL END ) as description, pu.obj_id::varchar as tag, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.pump pu LEFT JOIN qgep_od.overflow of ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vl_oc_dig ON oc.overflow_char_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_char = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/18_vw_swmm_storages.sql b/swmm_views/18_vw_swmm_storages.sql index 4f9da312..4094764a 100644 --- a/swmm_views/18_vw_swmm_storages.sql +++ b/swmm_views/18_vw_swmm_storages.sql @@ -27,16 +27,18 @@ SELECT CONCAT_WS(',','special_structure', ssf.value_en) as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.special_structure ss LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ss.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id LEFT JOIN qgep_od.hydr_geometry hg on hg.obj_id = wn.fk_hydr_geometry @@ -46,7 +48,7 @@ LEFT JOIN ( ) as hr on hr.fk_hydr_geometry = hg.obj_id LEFT JOIN qgep_od.cover co on ws.fk_main_cover = co.obj_id LEFT JOIN qgep_vl.special_structure_function ssf on ss.function = ssf.code -WHERE ss.function IN ( -- must be the same list in vw_swmm_junctions +WHERE ssf.vsacode IN ( -- must be the same list in vw_swmm_junctions 6397, --"pit_without_drain" -- 245, --"drop_structure" 6398, --"hydrolizing_tank" @@ -78,7 +80,7 @@ WHERE ss.function IN ( -- must be the same list in vw_swmm_junctions -- 3008, --"unknown" -- 2745, --"vortex_manhole" ) -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -106,16 +108,18 @@ SELECT CONCAT_WS(',','infiltration_installation', iik.value_en) as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.infiltration_installation as ii LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic LEFT JOIN qgep_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = we.obj_id LEFT JOIN qgep_od.hydr_geometry hg on hg.obj_id = wn.fk_hydr_geometry @@ -124,7 +128,7 @@ LEFT JOIN ( FROM qgep_od.hydr_geom_relation ) as hr on hr.fk_hydr_geometry = hg.obj_id LEFT JOIN qgep_vl.infiltration_installation_kind iik on ii.kind = iik.code -WHERE ii.kind IN ( +WHERE iik.vsacode IN ( --3282 --"with_soil_passage" --3285 --"without_soil_passage" --3279 --"surface_infiltration" @@ -137,7 +141,7 @@ WHERE ii.kind IN ( --278 --"adsorbing_well" --3283 --"infiltration_pipe_sections_gallery" ) -AND status IN (6530, 6533, 8493, 6529, 6526, 7959) +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -163,7 +167,7 @@ SELECT 'Prank weir' as tag, wn.situation_geometry as geom, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE @@ -173,9 +177,13 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vL_oc_ki ON oc.kind_overflow_characteristic = vL_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_char_digital = 6223 --'yes; -AND oc.kind_overflow_char = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vl_oc_dig.vsacode = 6223 --'yes; +AND vL_oc_ki.vsacode = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) diff --git a/swmm_views/19_vw_swmm_outlets.sql b/swmm_views/19_vw_swmm_outlets.sql index d2cf75ff..2c507a1c 100644 --- a/swmm_views/19_vw_swmm_outlets.sql +++ b/swmm_views/19_vw_swmm_outlets.sql @@ -10,19 +10,23 @@ SELECT NULL as Qexpon, 'NO' as Gated, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vL_oc_dig ON oc.overflow_characteristic_digital = vL_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_char_digital = 6223 --'yes; -AND oc.kind_overflow_char = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) \ No newline at end of file +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vL_oc_dig.vsacode = 6223 --'yes; +AND vl_oc_ki.vsacode = 6220; -- h/q relations (Q/Q relations are not supported by SWMM) diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index 9d0f0773..25cad417 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -16,23 +16,27 @@ SELECT NULL as RoadSurf, NULL as CoeffCurve, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id, NULL as message FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND (oc.overflow_char_digital != 6223 OR oc.overflow_char_digital IS NULL) --'yes; -OR (oc.kind_overflow_char != 6220 OR oc.overflow_char_digital IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND (vl_oc_dig.vsacode != 6223 OR vl_oc_dig.vsacode IS NULL) --'yes; +OR (vl_oc_ki.vsacode != 6220 OR vl_oc_ki.vsacode IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) UNION ALL @@ -52,18 +56,22 @@ SELECT NULL as RoadSurf, NULL as CoeffCurve, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id, concat('Leaping weirs are not supported by SWMM, ', lw.obj_id, 'see: https://swmm5.org/2013/07/19/leaping-weir-example-in-swmm-5-and-infoswmm-alternative/') as message FROM qgep_od.leapingweir lw LEFT JOIN qgep_od.overflow of ON lw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959); \ No newline at end of file +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); diff --git a/swmm_views/22_vw_swmm_curves.sql b/swmm_views/22_vw_swmm_curves.sql index fac4b194..ba13daea 100644 --- a/swmm_views/22_vw_swmm_curves.sql +++ b/swmm_views/22_vw_swmm_curves.sql @@ -14,23 +14,27 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_curves AS hq.altitude as XValue, hq.flow as YValue, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq -LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_char = oc.obj_id -LEFT JOIN qgep_od.overflow of ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code +LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_od.pump pu ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_char_digital = 6223 --'yes; -AND oc.kind_overflow_char = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vl_oc_dig.vsacode = 6223 --'yes; +AND vl_oc_ki.vsacode = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pu.obj_id IS NOT NULL ORDER BY pu.obj_id, hq.altitude) @@ -47,23 +51,27 @@ UNION ALL hq.altitude as XValue, hq.flow as YValue, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq -LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_char = oc.obj_id -LEFT JOIN qgep_od.overflow of ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code +LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_od.prank_weir pw ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_char_digital = 6223 --'yes; -AND oc.kind_overflow_char = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND vl_oc_dig.vsacode = 6223 --'yes; +AND vl_oc_ki.vsacode = 6220 -- h/q relations (Q/Q relations are not supported by SWMM) AND pw.obj_id IS NOT NULL ORDER BY pw.obj_id, hq.altitude) @@ -80,11 +88,11 @@ UNION ALL hr.water_depth as XValue, hr.water_surface as YValue, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id @@ -92,4 +100,6 @@ FROM qgep_od.hydr_geom_relation hr LEFT JOIN qgep_od.hydr_geometry hg on hg.obj_id = hr.fk_hydr_geometry LEFT JOIN qgep_od.wastewater_node wn on hg.obj_id = wn.fk_hydr_geometry LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -ORDER BY wn.obj_id, hr.water_depth) \ No newline at end of file +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +ORDER BY wn.obj_id, hr.water_depth) diff --git a/swmm_views/23_vw_swmm_xsections.sql b/swmm_views/23_vw_swmm_xsections.sql index 0e70a3f7..a98d299e 100644 --- a/swmm_views/23_vw_swmm_xsections.sql +++ b/swmm_views/23_vw_swmm_xsections.sql @@ -6,12 +6,12 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_xsections AS SELECT DISTINCT re.obj_id as Link, CASE - WHEN pp.profile_type = 3350 THEN 'CIRCULAR' -- circle - WHEN pp.profile_type = 3353 THEN 'RECT_CLOSED' -- rectangular - WHEN pp.profile_type = 3351 THEN 'EGG' -- egg - WHEN pp.profile_type = 3355 THEN 'CUSTOM' -- special - WHEN pp.profile_type = 3352 THEN 'ARCH' -- mouth - WHEN pp.profile_type = 3354 THEN 'PARABOLIC' -- open + WHEN ppt.vsacode = 3350 THEN 'CIRCULAR' -- circle + WHEN ppt.vsacode = 3353 THEN 'RECT_CLOSED' -- rectangular + WHEN ppt.vsacode = 3351 THEN 'EGG' -- egg + WHEN ppt.vsacode = 3355 THEN 'CUSTOM' -- special + WHEN ppt.vsacode = 3352 THEN 'ARCH' -- mouth + WHEN ppt.vsacode = 3354 THEN 'PARABOLIC' -- open ELSE 'CIRCULAR' END as Shape, --Geom1 = height -> used for all the profile types @@ -22,7 +22,7 @@ SELECT DISTINCT END as Geom1, --Geom2 = width -> needed for profile rect_closed,arch and parabolic CASE - WHEN pp.profile_type IN (3352,3353,3354) THEN CASE + WHEN ppt.vsacode IN (3352,3353,3354) THEN CASE WHEN pp.height_width_ratio IS NOT NULL THEN CASE WHEN re.clear_height = 0 THEN 0.1/pp.height_width_ratio WHEN re.clear_height IS NULL THEN 0.1/pp.height_width_ratio @@ -39,20 +39,23 @@ SELECT DISTINCT 1 as Barrels, NULL as Culvert, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ch.function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, re.obj_id as obj_id FROM qgep_od.reach re LEFT JOIN qgep_od.pipe_profile pp on pp.obj_id = re.fk_pipe_profile +LEFT JOIN qgep_vl.pipe_profile_profile_type ppt on ppt.code =pp.profile_type LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.obj_id::text = re.obj_id::text LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id::text = ne.fk_wastewater_structure::text +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_od.channel ch ON ch.obj_id::text = ws.obj_id::text -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ch.function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) UNION ALL @@ -68,21 +71,23 @@ SELECT NULL as Barrels, NULL as Culvert, CASE - WHEN status IN (7959, 6529, 6526) THEN 'planned' + WHEN ws_st.vsacode IN (7959, 6529, 6526) THEN 'planned' ELSE 'current' END as state, CASE - WHEN ws._function_hierarchic in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' + WHEN cfhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary' ELSE 'secondary' END as hierarchy, wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -WHERE status IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_char_digital != 6223 --'NO or unknown; -OR oc.kind_overflow_char != 6220 -- Q/Q relation or unknown -AND status IN (6530, 6533, 8493, 6529, 6526, 7959); +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) +AND oc.overflow_characteristic_digital != 6223 --'NO or unknown; +OR oc.kind_overflow_characteristic != 6220 -- Q/Q relation or unknown +AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); From de7139ccb10b51a1f13bb4c510ce07c3bc915a94 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:22:56 +0200 Subject: [PATCH 49/62] 18_vw_smm_storages - Integrate Allow vl extensions in SWMM views #220 https://github.com/QGEP/datamodel/pull/220 to not have overlapping pullrequests --- swmm_views/18_vw_swmm_storages.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm_views/18_vw_swmm_storages.sql b/swmm_views/18_vw_swmm_storages.sql index 4094764a..e70504bb 100644 --- a/swmm_views/18_vw_swmm_storages.sql +++ b/swmm_views/18_vw_swmm_storages.sql @@ -177,9 +177,9 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code -LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vL_oc_ki ON oc.kind_overflow_characteristic = vL_oc_ki.code +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vl_oc_dig ON oc.overflow_char_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vL_oc_ki ON oc.kind_overflow_char = vL_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code From e1639e0aae7f70fd0d030bd8c55e8a505376d22a Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:24:00 +0200 Subject: [PATCH 50/62] 19_vw_swmm_outlets - Integrate Allow vl extensions in SWMM views #220 https://github.com/QGEP/datamodel/pull/220 to not have overlapping pullrequests --- swmm_views/19_vw_swmm_outlets.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm_views/19_vw_swmm_outlets.sql b/swmm_views/19_vw_swmm_outlets.sql index 2c507a1c..2443a007 100644 --- a/swmm_views/19_vw_swmm_outlets.sql +++ b/swmm_views/19_vw_swmm_outlets.sql @@ -20,9 +20,9 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vL_oc_dig ON oc.overflow_characteristic_digital = vL_oc_dig.code -LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vL_oc_dig ON oc.overflow_char_digital = vL_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_char = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code From b9b0f02ce2896ec384cd0af8690dde89a496c126 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:24:45 +0200 Subject: [PATCH 51/62] 21_vw_swmm_weirs - Integrate Allow vl extensions in SWMM views #220 https://github.com/QGEP/datamodel/pull/220 to not have overlapping pullrequests --- swmm_views/21_vw_swmm_weirs.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index 25cad417..2212588a 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -27,9 +27,9 @@ SELECT NULL as message FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code -LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vl_oc_dig ON oc.overflow_char_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_char = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code @@ -67,9 +67,9 @@ SELECT concat('Leaping weirs are not supported by SWMM, ', lw.obj_id, 'see: https://swmm5.org/2013/07/19/leaping-weir-example-in-swmm-5-and-infoswmm-alternative/') as message FROM qgep_od.leapingweir lw LEFT JOIN qgep_od.overflow of ON lw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code -LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vl_oc_dig ON oc.overflow_char_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_char = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code From 1a054af349ee96a6892b1816ba23a06244a0afbd Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:25:26 +0200 Subject: [PATCH 52/62] 22_vw_swmm_curves - Integrate Allow vl extensions in SWMM views #220 https://github.com/QGEP/datamodel/pull/220 to not have overlapping pullrequests --- swmm_views/22_vw_swmm_curves.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/swmm_views/22_vw_swmm_curves.sql b/swmm_views/22_vw_swmm_curves.sql index ba13daea..34f83dba 100644 --- a/swmm_views/22_vw_swmm_curves.sql +++ b/swmm_views/22_vw_swmm_curves.sql @@ -23,10 +23,10 @@ CREATE OR REPLACE VIEW qgep_swmm.vw_curves AS END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq -LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code -LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code -LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vl_oc_dig ON oc.overflow_char_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_char = vl_oc_ki.code +LEFT JOIN qgep_od.overflow of ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.pump pu ON pu.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id @@ -60,10 +60,10 @@ UNION ALL END as hierarchy, wn.obj_id as obj_id FROM qgep_od.hq_relation hq -LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_characteristic = oc.obj_id -LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code -LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code -LEFT JOIN qgep_od.overflow of ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON hq.fk_overflow_char = oc.obj_id +LEFT JOIN qgep_vl.overflow_char_overflow_char_digital vl_oc_dig ON oc.overflow_char_digital = vl_oc_dig.code +LEFT JOIN qgep_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_char = vl_oc_ki.code +LEFT JOIN qgep_od.overflow of ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.prank_weir pw ON pw.obj_id = of.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id From 4038b3db20a4d8a140d0eca504a130e7b0a2f0e0 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:26:10 +0200 Subject: [PATCH 53/62] 23_vw_swmm_xsection - - Integrate Allow vl extensions in SWMM views #220 https://github.com/QGEP/datamodel/pull/220 to not have overlapping pullrequests --- swmm_views/23_vw_swmm_xsections.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swmm_views/23_vw_swmm_xsections.sql b/swmm_views/23_vw_swmm_xsections.sql index a98d299e..1e2ec259 100644 --- a/swmm_views/23_vw_swmm_xsections.sql +++ b/swmm_views/23_vw_swmm_xsections.sql @@ -81,13 +81,13 @@ SELECT wn.obj_id as obj_id FROM qgep_od.prank_weir pw LEFT JOIN qgep_od.overflow of ON pw.obj_id = of.obj_id -LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id +LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_char = oc.obj_id LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) -AND oc.overflow_characteristic_digital != 6223 --'NO or unknown; -OR oc.kind_overflow_characteristic != 6220 -- Q/Q relation or unknown +AND oc.overflow_char_digital != 6223 --'NO or unknown; +OR oc.kind_overflow_char != 6220 -- Q/Q relation or unknown AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); From e3b8c32478b383fac9b9859be3ad70b52f0717d5 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:34:39 +0200 Subject: [PATCH 54/62] correction - wrong order of replacement --- .../dispatch_table_migration/migrate_dispatch_copy_data.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql b/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql index df83eeca..97ebcda6 100644 --- a/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql +++ b/scripts/dispatch_table_migration/migrate_dispatch_copy_data.sql @@ -174,8 +174,8 @@ BEGIN AND sequence_name = '%1$I' $$, _sequence_name ) INTO _sequence_exists; IF _sequence_exists = 0 THEN - _sequence_name_fully_qualified := replace(_sequence_name_fully_qualified,'qgep.seq_od_hydraulic_char_data_oid','qgep.seq_od_hydraulic_characteristic_data_oid'); - _sequence_name_fully_qualified := replace(_sequence_name_fully_qualified,'qgep.seq_od_overflow_char_oid','qgep.seq_od_overflow_characteristic_oid'); + _sequence_name_fully_qualified := replace(_sequence_name_fully_qualified,'qgep.seq_od_hydraulic_characteristic_data_oid','qgep.seq_od_hydraulic_char_data_oid'); + _sequence_name_fully_qualified := replace(_sequence_name_fully_qualified,'qgep.seq_od_overflow_characteristic_oid','qgep.seq_od_overflow_char_oid'); END IF; -- update sequence SELECT nextval(_sequence_name_fully_qualified) INTO _sequence_value; From 2d6e0a28d80ebc78e60108620546d92ffabd8df8 Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:38:02 +0200 Subject: [PATCH 55/62] 09_qgep_dictionaries_kek - adaption value in file.class --- 09_qgep_dictionaries_kek.sql | 2 +- ...me_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/09_qgep_dictionaries_kek.sql b/09_qgep_dictionaries_kek.sql index c2856b9e..b3e23ef3 100644 --- a/09_qgep_dictionaries_kek.sql +++ b/09_qgep_dictionaries_kek.sql @@ -695,7 +695,7 @@ INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3880,'file','class','dryweather_downspout','dryweather_downspout','','Trockenwetterfallrohr','','TUYAU_CHUTE','','zzz_Trockenwetterfallrohr','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3881,'file','class','dryweather_flume','dryweather_flume','','Trockenwetterrinne','','CUNETTE_DEBIT_TEMPS_SEC','','zzz_Trockenwetterrinne','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3882,'file','class','overflow','overflow','','Ueberlauf','','DEVERSOIR','','zzz_Ueberlauf','','','',' ','','','',''); - INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3883,'file','class','overflow_characteristic','overflow_characteristic','','Ueberlaufcharakteristik','','CARACTERISTIQUES_DEVERSOIR','','zzz_Ueberlaufcharakteristik','','','',' ','','','',''); + INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3883,'file','class','overflow_char','overflow_char','','Ueberlaufcharakteristik','','CARACTERISTIQUES_DEVERSOIR','','zzz_Ueberlaufcharakteristik','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3884,'file','class','shore','shore','','Ufer','','RIVE','','zzz_Ufer','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3885,'file','class','accident','accident','','Unfall','','ACCIDENT','','zzz_Unfall','','','',' ','','','',''); INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3886,'file','class','inspection','inspection','','Untersuchung','','EXAMEN','','zzz_Untersuchung','','','',' ','','','',''); diff --git a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index 6f58cbd1..61c07fe1 100644 --- a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -144,4 +144,7 @@ RETURNING *; UPDATE qgep_sys.dictionary_od_values SET field_name = 'overflow_char_digital' WHERE (table_name = 'overflow_char' AND field_name = 'overflow_characteristic_digital') -RETURNING *; \ No newline at end of file +RETURNING *; + + + --INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3883,'file','class','overflow_char','overflow_char','','Ueberlaufcharakteristik','','CARACTERISTIQUES_DEVERSOIR','','zzz_Ueberlaufcharakteristik','','','',' ','','','',''); \ No newline at end of file From 6c38f34a60f1309f8c2bd5831c75f31af34bf12d Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:38:52 +0200 Subject: [PATCH 56/62] 04_vsa_kek_extension.sql - file.class overflow_characteristic to char --- 04_vsa_kek_extension.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04_vsa_kek_extension.sql b/04_vsa_kek_extension.sql index 24dc529b..867f4840 100644 --- a/04_vsa_kek_extension.sql +++ b/04_vsa_kek_extension.sql @@ -1045,7 +1045,7 @@ ALTER TABLE qgep_vl.file_class ADD CONSTRAINT pkey_qgep_vl_file_class_code PRIMA INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3880,3880,'dryweather_downspout','Trockenwetterfallrohr','TUYAU_CHUTE', '', '', '', 'true'); INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3881,3881,'dryweather_flume','Trockenwetterrinne','CUNETTE_DEBIT_TEMPS_SEC', '', '', '', 'true'); INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3882,3882,'overflow','Ueberlauf','DEVERSOIR', '', '', '', 'true'); - INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3883,3883,'overflow_characteristic','Ueberlaufcharakteristik','CARACTERISTIQUES_DEVERSOIR', '', '', '', 'true'); + INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3883,3883,'overflow_char','Ueberlaufcharakteristik','CARACTERISTIQUES_DEVERSOIR', '', '', '', 'true'); INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3884,3884,'shore','Ufer','RIVE', '', '', '', 'true'); INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3885,3885,'accident','Unfall','ACCIDENT', '', '', '', 'true'); INSERT INTO qgep_vl.file_class (code, vsacode, value_en, value_de, value_fr, abbr_en, abbr_de, abbr_fr, active) VALUES (3886,3886,'inspection','Untersuchung','EXAMEN', '', '', '', 'true'); From 59c77a688ba7cfaa96529c2c9ce4b4b0f951727d Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 6 Oct 2023 13:47:18 +0200 Subject: [PATCH 57/62] Adapt dictionary_od_values file','class','overflow_char --- ...xxx_fk_overflow_characteristic_to_fk_overflow_char.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql index 61c07fe1..74f413bd 100644 --- a/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql +++ b/delta/delta_1.6.1_dss_rename_xxx_fk_overflow_characteristic_to_fk_overflow_char.sql @@ -147,4 +147,10 @@ WHERE (table_name = 'overflow_char' AND field_name = 'overflow_characteristic_di RETURNING *; - --INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3883,'file','class','overflow_char','overflow_char','','Ueberlaufcharakteristik','','CARACTERISTIQUES_DEVERSOIR','','zzz_Ueberlaufcharakteristik','','','',' ','','','',''); \ No newline at end of file + --INSERT INTO qgep_sys.dictionary_od_values (class_id, attribute_id, value_id, table_name, field_name, value_name, value_name_en, shortcut_en, value_name_de, shortcut_de, value_name_fr, shortcut_fr, value_name_it, shortcut_it, value_name_ro, shortcut_ro, value_description_en, value_description_de, value_description_fr, value_description_it, value_description_ro) VALUES (3754,3764,3883,'file','class','overflow_char','overflow_char','','Ueberlaufcharakteristik','','CARACTERISTIQUES_DEVERSOIR','','zzz_Ueberlaufcharakteristik','','','',' ','','','',''); + +UPDATE qgep_sys.dictionary_od_values +SET value_name = 'overflow_char', + value_name_en = 'overflow_char' +WHERE (table_name = 'file' AND field_name = 'class') +RETURNING *; \ No newline at end of file From 0759fd15516c4c1dbf0824dede47dff04d98a751 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:58:26 +0200 Subject: [PATCH 58/62] Update 09_vw_swmm_subcatchments.sql 09_vw_swmm_subcatchments.sql was missing. --- swmm_views/09_vw_swmm_subcatchments.sql | 88 ++++++++++++++++++------- 1 file changed, 65 insertions(+), 23 deletions(-) diff --git a/swmm_views/09_vw_swmm_subcatchments.sql b/swmm_views/09_vw_swmm_subcatchments.sql index 41b04bb2..56d367c3 100644 --- a/swmm_views/09_vw_swmm_subcatchments.sql +++ b/swmm_views/09_vw_swmm_subcatchments.sql @@ -81,27 +81,69 @@ SELECT END as hierarchy, wn_obj_id as obj_id FROM ( - SELECT ca.*, wn.situation_geometry as wn_geom, 'rw_current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic - FROM qgep_od.catchment_area as ca - INNER JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_rw_current - LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id - LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure - UNION ALL - SELECT ca.*, wn.situation_geometry as wn_geom, 'rw_planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic - FROM qgep_od.catchment_area as ca - INNER JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_rw_planned - LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id - LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure - UNION ALL - SELECT ca.*, wn.situation_geometry as wn_geom, 'ww_current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic - FROM qgep_od.catchment_area as ca - INNER JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_ww_current - LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id - LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure - UNION ALL - SELECT ca.*, wn.situation_geometry as wn_geom,'ww_planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic - FROM qgep_od.catchment_area as ca - INNER JOIN qgep_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_ww_planned - LEFT JOIN qgep_od.wastewater_node wn on wn.obj_id = ne.obj_id - LEFT JOIN qgep_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure + SELECT ca_1.obj_id, + ddc.vsacode as direct_discharge_current, + ddp.vsacode as direct_discharge_planned, + ca_1.discharge_coefficient_rw_current, + ca_1.discharge_coefficient_rw_planned, + ca_1.discharge_coefficient_ww_current, + ca_1.discharge_coefficient_ww_planned, + dsc.vsacode as drainage_system_current, + dsp.vsacode as drainage_system_planned, + ca_1.identifier, + ic.vsacode as infiltration_current, + ip.vsacode as infiltration_planned, + ca_1.perimeter_geometry, + ca_1.population_density_current, + ca_1.population_density_planned, + ca_1.remark, + rc.vsacode as retention_current, + rp.vsacode as retention_planned, + ca_1.runoff_limit_current, + ca_1.runoff_limit_planned, + ca_1.seal_factor_rw_current, + ca_1.seal_factor_rw_planned, + ca_1.seal_factor_ww_current, + ca_1.seal_factor_ww_planned, + ca_1.sewer_infiltration_water_production_current, + ca_1.sewer_infiltration_water_production_planned, + ca_1.surface_area, + ca_1.waste_water_production_current, + ca_1.waste_water_production_planned, + ca_1.last_modification, + ca_1.fk_dataowner, + ca_1.fk_provider, + ca_1.fk_wastewater_networkelement_rw_current, + ca_1.fk_wastewater_networkelement_rw_planned, + ca_1.fk_wastewater_networkelement_ww_planned, + ca_1.fk_wastewater_networkelement_ww_current, + wn.situation_geometry AS wn_geom, + CASE WHEN ca_1.fk_wastewater_networkelement_rw_current =wn.obj_id + THEN 'rw_current'::text + WHEN ca_1.fk_wastewater_networkelement_ww_current =wn.obj_id + THEN 'ww_current'::text + WHEN ca_1.fk_wastewater_networkelement_rw_planned =wn.obj_id + THEN 'rw_planned'::text + WHEN ca_1.fk_wastewater_networkelement_ww_planned =wn.obj_id + THEN 'ww_planned'::text + ELSE 'ERROR' + END AS state, + wn.obj_id AS wn_obj_id, + fhy.vsacode as _function_hierarchic + FROM qgep_od.catchment_area ca_1 + JOIN qgep_od.wastewater_networkelement ne + ON ne.obj_id::text IN (ca_1.fk_wastewater_networkelement_rw_current::text, + ca_1.fk_wastewater_networkelement_ww_current::text, + ca_1.fk_wastewater_networkelement_rw_planned::text, + ca_1.fk_wastewater_networkelement_ww_planned::text) + LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id::text = ne.obj_id::text + LEFT JOIN qgep_vl.catchment_area_direct_discharge_current ddc ON ddc.code=ca_1.direct_discharge_current + LEFT JOIN qgep_vl.catchment_area_direct_discharge_planned ddp ON ddp.code=ca_1.direct_discharge_planned + LEFT JOIN qgep_vl.catchment_area_drainage_system_current dsc ON dsc.code=ca_1.drainage_system_current + LEFT JOIN qgep_vl.catchment_area_drainage_system_planned dsp ON dsp.code=ca_1.drainage_system_planned + LEFT JOIN qgep_vl.catchment_area_infiltration_current ic ON ic.code=ca_1.infiltration_current + LEFT JOIN qgep_vl.catchment_area_infiltration_planned ip ON ip.code=ca_1.infiltration_planned + LEFT JOIN qgep_vl.catchment_area_retention_current rc ON rc.code=ca_1.retention_current + LEFT JOIN qgep_vl.catchment_area_retention_planned rp ON rp.code=ca_1.retention_planned + LEFT JOIN qgep_vl.channel_function_hierarchic fhy ON fhy.code=wn._function_hierarchic ) as ca; From b9763c4988271339d406aecc31799f7beed85961 Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Tue, 17 Oct 2023 14:29:20 +0200 Subject: [PATCH 59/62] add structure part views --- view/create_views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/view/create_views.py b/view/create_views.py index 612a175b..0f7c45c5 100755 --- a/view/create_views.py +++ b/view/create_views.py @@ -54,6 +54,12 @@ def create_views(srid: int, SingleInheritance('qgep_od.structure_part', 'qgep_od.cover', view_name='vw_cover', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() SingleInheritance('qgep_od.structure_part', 'qgep_od.dryweather_downspout', view_name='vw_dryweather_downspout', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() SingleInheritance('qgep_od.structure_part', 'qgep_od.dryweather_flume', view_name='vw_dryweather_flume', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() + SingleInheritance('qgep_od.structure_part', 'qgep_od.solids_retention', view_name='vw_solids_retention', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() + SingleInheritance('qgep_od.structure_part', 'qgep_od.tank_cleaning', view_name='vw_tank_cleaning', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() + SingleInheritance('qgep_od.structure_part', 'qgep_od.tank_emptying', view_name='vw_tank_emptying', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() + SingleInheritance('qgep_od.structure_part', 'qgep_od.electric_equipment', view_name='vw_electric_equipment', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() + SingleInheritance('qgep_od.structure_part', 'qgep_od.electromechanical_equipment', view_name='vw_electromechanical_equipment', pg_service=pg_service, pkey_default_value=True, inner_defaults={'identifier': 'obj_id'}).create() + SingleInheritance('qgep_od.wastewater_structure', 'qgep_od.channel', view_name='vw_channel', pg_service=pg_service).create() SingleInheritance('qgep_od.wastewater_structure', 'qgep_od.manhole', view_name='vw_manhole', pg_service=pg_service).create() SingleInheritance('qgep_od.wastewater_structure', 'qgep_od.discharge_point', view_name='vw_discharge_point', pg_service=pg_service).create() From 8aa1cde52ab05478352a24ec44d069dc6fefcc3e Mon Sep 17 00:00:00 2001 From: cymed <102035587+cymed@users.noreply.github.com> Date: Fri, 20 Oct 2023 17:37:16 +0200 Subject: [PATCH 60/62] Alter weir view the old weir view linked the wastewater structure with the wastewater node via ws.fk_main_wastewater_node. This resulted in overflows being secondary if they didn't start from the main wn of a ws. --- swmm_views/21_vw_swmm_weirs.sql | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/swmm_views/21_vw_swmm_weirs.sql b/swmm_views/21_vw_swmm_weirs.sql index 25cad417..a994d478 100644 --- a/swmm_views/21_vw_swmm_weirs.sql +++ b/swmm_views/21_vw_swmm_weirs.sql @@ -31,9 +31,8 @@ LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node -LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code -LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON wn._status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959) AND (vl_oc_dig.vsacode != 6223 OR vl_oc_dig.vsacode IS NULL) --'yes; OR (vl_oc_ki.vsacode != 6220 OR vl_oc_ki.vsacode IS NULL)-- h/q relations (Q/Q relations are not supported by SWMM) @@ -71,7 +70,6 @@ LEFT JOIN qgep_od.overflow_char oc ON of.fk_overflow_characteristic = oc.obj_id LEFT JOIN qgep_vl.overflow_char_overflow_characteristic_digital vl_oc_dig ON oc.overflow_characteristic_digital = vl_oc_dig.code LEFT JOIN qgep_vl.overflow_char_kind_overflow_characteristic vl_oc_ki ON oc.kind_overflow_characteristic = vl_oc_ki.code LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node -LEFT JOIN qgep_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id -LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code -LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic +LEFT JOIN qgep_vl.wastewater_structure_status ws_st ON wn._status = ws_st.code +LEFT JOIN qgep_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959); From 1b829160c891d824362892a76767ddfd0c4605ad Mon Sep 17 00:00:00 2001 From: SJiB Date: Fri, 3 May 2024 16:27:20 +0200 Subject: [PATCH 61/62] add wwtp_structure to view --- view/vw_qgep_wastewater_structure.py | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/view/vw_qgep_wastewater_structure.py b/view/vw_qgep_wastewater_structure.py index 7a178c72..3a80ede2 100755 --- a/view/vw_qgep_wastewater_structure.py +++ b/view/vw_qgep_wastewater_structure.py @@ -40,6 +40,7 @@ def vw_qgep_wastewater_structure(srid: int, WHEN ss.obj_id IS NOT NULL THEN 'special_structure' WHEN dp.obj_id IS NOT NULL THEN 'discharge_point' WHEN ii.obj_id IS NOT NULL THEN 'infiltration_installation' + WHEN wt.obj_id IS NOT NULL THEN 'wwtp_structure' ELSE 'unknown' END AS ws_type @@ -85,6 +86,7 @@ def vw_qgep_wastewater_structure(srid: int, LEFT JOIN qgep_od.special_structure ss ON ss.obj_id = ws.obj_id LEFT JOIN qgep_od.discharge_point dp ON dp.obj_id = ws.obj_id LEFT JOIN qgep_od.infiltration_installation ii ON ii.obj_id = ws.obj_id + LEFT JOIN qgep_od.wwtp_structure wt ON wt.obj_id = ws.obj_id LEFT JOIN qgep_od.wastewater_networkelement ne ON ne.obj_id = ws.fk_main_wastewater_node LEFT JOIN qgep_od.wastewater_node wn ON wn.obj_id = ws.fk_main_wastewater_node LEFT JOIN qgep_od.channel ch ON ch.obj_id = ws.obj_id @@ -157,6 +159,15 @@ def vw_qgep_wastewater_structure(srid: int, skip_columns=[], prefix='dp_', remap_columns={}), + wt_columns=select_columns(pg_cur=cursor, + table_schema='qgep_od', + table_name='wwtp_structure', + table_alias='wt', + remove_pkey=True, + indent=4, + skip_columns=[], + prefix='wt_', + remap_columns={}), wn_cols=select_columns(pg_cur=cursor, table_schema='qgep_od', table_name='wastewater_node', @@ -211,6 +222,10 @@ def vw_qgep_wastewater_structure(srid: int, WHEN NEW.ws_type = 'infiltration_installation' THEN {insert_ii} + -- Wastewater treatment plant structure (wwtp structure) + WHEN NEW.ws_type = 'wwtp_structure' THEN + {insert_wt} + ELSE RAISE NOTICE 'Wastewater structure type not known (%)', NEW.ws_type; -- ERROR END CASE; @@ -275,6 +290,14 @@ def vw_qgep_wastewater_structure(srid: int, remove_pkey=False, indent=6, remap_columns={'obj_id': 'obj_id'}), + insert_wt=insert_command(pg_cur=cursor, + table_schema='qgep_od', + table_name='wwtp_structure', + table_alias='wt', + prefix='wt_', + remove_pkey=False, + indent=6, + remap_columns={'obj_id': 'obj_id'}), insert_wn=insert_command(pg_cur=cursor, table_schema='qgep_od', table_name='vw_wastewater_node', @@ -329,6 +352,7 @@ def vw_qgep_wastewater_structure(srid: int, WHEN OLD.ws_type = 'special_structure' THEN DELETE FROM qgep_od.special_structure WHERE obj_id = OLD.obj_id; WHEN OLD.ws_type = 'discharge_point' THEN DELETE FROM qgep_od.discharge_point WHERE obj_id = OLD.obj_id; WHEN OLD.ws_type = 'infiltration_installation' THEN DELETE FROM qgep_od.infiltration_installation WHERE obj_id = OLD.obj_id; + WHEN OLD.ws_type = 'wwtp_structure' THEN DELETE FROM qgep_od.wwtp_structure WHERE obj_id = OLD.obj_id; ELSE -- do nothing END CASE; @@ -337,6 +361,7 @@ def vw_qgep_wastewater_structure(srid: int, WHEN NEW.ws_type = 'special_structure' THEN INSERT INTO qgep_od.special_structure (obj_id) VALUES(OLD.obj_id); WHEN NEW.ws_type = 'discharge_point' THEN INSERT INTO qgep_od.discharge_point (obj_id) VALUES(OLD.obj_id); WHEN NEW.ws_type = 'infiltration_installation' THEN INSERT INTO qgep_od.infiltration_installation (obj_id) VALUES(OLD.obj_id); + WHEN NEW.ws_type = 'wwtp_structure' THEN INSERT INTO qgep_od.wwtp_structure (obj_id) VALUES(OLD.obj_id); ELSE -- do nothing END CASE; END IF; @@ -354,6 +379,9 @@ def vw_qgep_wastewater_structure(srid: int, WHEN NEW.ws_type = 'infiltration_installation' THEN {update_ii} + WHEN NEW.ws_type = 'wwtp_structure' THEN + {update_wt} + ELSE -- do nothing END CASE; @@ -499,6 +527,15 @@ def vw_qgep_wastewater_structure(srid: int, indent=6, skip_columns=[], remap_columns={'obj_id': 'obj_id'}), + update_wt=update_command(pg_cur=cursor, + table_schema='qgep_od', + table_name='wwtp_structure', + table_alias='wt', + prefix='wt_', + remove_pkey=True, + indent=6, + skip_columns=[], + remap_columns={'obj_id': 'obj_id'}), update_wn=update_command(pg_cur=cursor, table_schema='qgep_od', table_name='wastewater_node', From 2b04072598f8b965912aa965769675cc6629bf2c Mon Sep 17 00:00:00 2001 From: SJiB Date: Sat, 4 May 2024 21:45:58 +0200 Subject: [PATCH 62/62] change prefix 000000 to ch0000 to have valid OID when not adapting for own project e.g. when only testing qgep --- 02_oid_generation.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02_oid_generation.sql b/02_oid_generation.sql index c036d7ac..23d858d8 100644 --- a/02_oid_generation.sql +++ b/02_oid_generation.sql @@ -17,7 +17,7 @@ COMMENT ON TABLE qgep_sys.oid_prefixes IS 'This table contains OID prefixes for different communities or organizations. The application or administrator changing this table has to make sure that only one record is set to active.'; -- sample entry for Invalid - you need to adapt this entry later for your own organization -INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('00000000','Invalid',TRUE); +INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch000000','Invalid',TRUE); INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch11h8mw','Stadt Uster',FALSE); INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch15z36d','SIGE',FALSE); INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch13p7mz','Arbon',FALSE);