Skip to content

Commit

Permalink
Remove wastewater structure symbology trigger (#68)
Browse files Browse the repository at this point in the history
* Remove wastewater structure symbology trigger

* fix typo

* update swmm views

* Join ne before wn in dividers

* join channel for losses

* typo fix
  • Loading branch information
cymed authored Jan 23, 2024
1 parent cd57986 commit 6bee96b
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 129 deletions.
4 changes: 2 additions & 2 deletions datamodel/app/swmm_views/02_vw_swmm_junctions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = we.obj_id
LEFT JOIN tww_od.cover co on ws.fk_main_cover = co.obj_id
LEFT JOIN tww_vl.manhole_function mf on ma.function = mf.code
LEFT JOIN tww_vl.wastewater_structure_status ws_st on ws_st.code=ws.status
LEFT JOIN tww_vl.channel_function_hierarchic ch_fh on ch_fh.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic ch_fh on ch_fh.code=wn._function_hierarchic
WHERE wn.obj_id IS NOT NULL
AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)

Expand Down Expand Up @@ -63,7 +63,7 @@ LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = we.obj_id
LEFT JOIN tww_od.cover co on ws.fk_main_cover = co.obj_id
LEFT JOIN tww_vl.special_structure_function ss_fu on ss_fu.code=ss.function
LEFT JOIN tww_vl.wastewater_structure_status ws_st on ws_st.code=ws.status
LEFT JOIN tww_vl.channel_function_hierarchic ch_fh on ch_fh.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic ch_fh on ch_fh.code=wn._function_hierarchic
WHERE wn.obj_id IS NOT NULL
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
Expand Down
4 changes: 2 additions & 2 deletions datamodel/app/swmm_views/05_vw_swmm_dividers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ SELECT
FROM tww_od.manhole ma
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id::text = ma.obj_id::text
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_od.wastewater_networkelement ne ON ne.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
LEFT JOIN tww_od.cover co on ws.fk_main_cover = co.obj_id
LEFT JOIN tww_vl.manhole_function mf on ma.function = mf.code
WHERE mf.vsacode = 4798 -- separating_structure
Expand Down Expand Up @@ -59,9 +59,9 @@ SELECT
FROM tww_od.special_structure ss
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id::text = ss.obj_id::text
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_od.wastewater_networkelement ne ON ne.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
LEFT JOIN tww_od.cover co on ws.fk_main_cover = co.obj_id
LEFT JOIN tww_vl.special_structure_function ssf on ss.function = ssf.code
WHERE ssf.vsacode = 4799 -- separating_structure
Expand Down
6 changes: 4 additions & 2 deletions datamodel/app/swmm_views/07_vw_swmm_losses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ SELECT DISTINCT
END as flap_gate,
0::float as Seepage,
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_fhi.vsacode in (5062, 5064, 5066, 5068, 5069, 5070, 5071, 5072, 5074) THEN 'primary'
ELSE 'secondary'
END as hierarchy,
re.obj_id as obj_id
Expand All @@ -30,6 +30,8 @@ LEFT JOIN tww_od.reach_point rp_from ON rp_from.obj_id::text = re.fk_reach_point
LEFT JOIN tww_od.wastewater_node from_wn on from_wn.obj_id = rp_from.fk_wastewater_networkelement
LEFT JOIN tww_od.throttle_shut_off_unit ts ON ts.fk_wastewater_node = from_wn.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_od.channel ch ON ws.obj_id = ch.obj_id
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic ch_fhi ON ch.function_hierarchic = ch_fhi.code
WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)
; -- wastewater node of the downstream wastewater node
8 changes: 4 additions & 4 deletions datamodel/app/swmm_views/08_vw_swmm_outfalls.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ SELECT
wn.obj_id as obj_id
FROM tww_od.discharge_point as dp
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id::text = dp.obj_id::text
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = we.obj_id
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE wn.obj_id IS NOT NULL
AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)

Expand All @@ -54,10 +54,10 @@ SELECT
wn.obj_id as obj_id
FROM tww_od.infiltration_installation as ii
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = we.obj_id
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE wn.obj_id IS NOT NULL
AND ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)
;
12 changes: 4 additions & 8 deletions datamodel/app/swmm_views/09_vw_swmm_subcatchments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,23 @@ SELECT
END as hierarchy,
wn_obj_id as obj_id
FROM (
SELECT ca.*, wn.situation3d_geometry as wn_geom, 'rw_current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic
SELECT ca.*, wn.situation3d_geometry as wn_geom, 'rw_current' as state, wn.obj_id as wn_obj_id, wn._function_hierarchic
FROM tww_od.catchment_area as ca
INNER JOIN tww_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_rw_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
UNION ALL
SELECT ca.*, wn.situation3d_geometry as wn_geom, 'rw_planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic
SELECT ca.*, wn.situation3d_geometry as wn_geom, 'rw_planned' as state, wn.obj_id as wn_obj_id, wn._function_hierarchic
FROM tww_od.catchment_area as ca
INNER JOIN tww_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_rw_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
UNION ALL
SELECT ca.*, wn.situation3d_geometry as wn_geom, 'ww_current' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic
SELECT ca.*, wn.situation3d_geometry as wn_geom, 'ww_current' as state, wn.obj_id as wn_obj_id, wn._function_hierarchic
FROM tww_od.catchment_area as ca
INNER JOIN tww_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_ww_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
UNION ALL
SELECT ca.*, wn.situation3d_geometry as wn_geom,'ww_planned' as state, wn.obj_id as wn_obj_id, ws._function_hierarchic
SELECT ca.*, wn.situation3d_geometry as wn_geom,'ww_planned' as state, wn.obj_id as wn_obj_id, wn._function_hierarchic
FROM tww_od.catchment_area as ca
INNER JOIN tww_od.wastewater_networkelement ne on ne.obj_id = ca.fk_wastewater_networkelement_ww_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
) as ca;
8 changes: 4 additions & 4 deletions datamodel/app/swmm_views/10_vw_swmm_subareas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LEFT JOIN tww_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_are
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
Expand All @@ -40,7 +40,7 @@ LEFT JOIN tww_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_are
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
Expand All @@ -49,7 +49,7 @@ LEFT JOIN tww_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_are
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
Expand All @@ -58,6 +58,6 @@ LEFT JOIN tww_od.surface_runoff_parameters sr ON ca.obj_id = sr.fk_catchment_are
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE fk_wastewater_networkelement_ww_planned IS NOT NULL -- to avoid unconnected catchments
) as ca;
8 changes: 4 additions & 4 deletions datamodel/app/swmm_views/11_vw_swmm_dwf.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,30 @@ FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE fk_wastewater_networkelement_ww_planned IS NOT NULL -- to avoid unconnected catchments
) as ca;
8 changes: 4 additions & 4 deletions datamodel/app/swmm_views/12_vw_swmm_raingages.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_ww_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE fk_wastewater_networkelement_ww_planned IS NOT NULL -- to avoid unconnected catchments
) as ca;
4 changes: 2 additions & 2 deletions datamodel/app/swmm_views/13_vw_swmm_infiltrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_current
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._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, cfhi.vsacode AS _function_hierarchic
FROM tww_od.catchment_area as ca
LEFT JOIN tww_od.wastewater_networkelement ne on ne.obj_id = fk_wastewater_networkelement_rw_planned
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id = ne.fk_wastewater_structure
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE fk_wastewater_networkelement_rw_planned IS NOT NULL -- to avoid unconnected catchments
) as ca;
2 changes: 1 addition & 1 deletion datamodel/app/swmm_views/16_vw_swmm_pumps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ LEFT JOIN tww_vl.overflow_char_kind_overflow_char vl_oc_ki ON oc.kind_overflow_c
LEFT JOIN tww_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node
LEFT JOIN tww_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959);
8 changes: 4 additions & 4 deletions datamodel/app/swmm_views/18_vw_swmm_storages.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ SELECT
FROM tww_od.special_structure ss
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id::text = ss.obj_id::text
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = we.obj_id
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
LEFT JOIN tww_od.hydr_geometry hg on hg.obj_id = wn.fk_hydr_geometry
LEFT JOIN (
SELECT distinct fk_hydr_geometry
Expand Down Expand Up @@ -119,9 +119,9 @@ SELECT
FROM tww_od.infiltration_installation as ii
LEFT JOIN tww_od.wastewater_structure ws ON ws.obj_id::text = ii.obj_id::text
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_od.wastewater_networkelement we ON we.fk_wastewater_structure::text = ws.obj_id::text
LEFT JOIN tww_od.wastewater_node wn on wn.obj_id = we.obj_id
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
LEFT JOIN tww_od.hydr_geometry hg on hg.obj_id = wn.fk_hydr_geometry
LEFT JOIN (
SELECT distinct fk_hydr_geometry
Expand Down Expand Up @@ -171,7 +171,7 @@ SELECT
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
Expand All @@ -184,7 +184,7 @@ LEFT JOIN tww_vl.overflow_char_kind_overflow_char vL_oc_ki ON oc.kind_overflow_c
LEFT JOIN tww_od.wastewater_node wn ON wn.obj_id = of.fk_wastewater_node
LEFT JOIN tww_od.wastewater_structure ws ON ws.fk_main_wastewater_node = wn.obj_id
LEFT JOIN tww_vl.wastewater_structure_status ws_st ON ws.status = ws_st.code
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=ws._function_hierarchic
LEFT JOIN tww_vl.channel_function_hierarchic cfhi ON cfhi.code=wn._function_hierarchic
WHERE ws_st.vsacode IN (6530, 6533, 8493, 6529, 6526, 7959)
-- Attribute overflow_characteristics_digital does not exist anymore in VSA-DSS 2020
--AND vl_oc_dig.vsacode = 6223 --'yes;
Expand Down
Loading

0 comments on commit 6bee96b

Please sign in to comment.