qwat / qwat-data-model

TEKSI Water module (project QWAT) - PostgreSQL / postgis Datamodel
https://www.teksi.ch
23 stars 25 forks source link

Pipes with a year < 1801 raises a PostGIS error: violation of pipe_year_check constraint #367

Closed nicolas-sitylb closed 1 year ago

nicolas-sitylb commented 2 years ago

Hello QWAT team!

Some survey offices record the year of pipe installation as 1800 for very old pipes for which they do not know the true year of installation.

According to this check:

https://github.com/qwat/qwat-data-model/blob/235a083ef5f6ca16363f0fa230e7ef14c39505f6/ordinary_data/pipe/od_pipe.sql#L57

it raises such fatal error in PostGIS (here triggered by the FME Software) :

ERROR |Bulk copy failed on table 'qwat_od.pipe' using delimiter ':'. 
Error was 'ERREUR:  la nouvelle ligne de la relation «pipe» viole la contrainte de vérification «pipe_year_check»

I would at least suggest to change it to >= 1800 (adding an equal sign) in order to adapt to this common use for year 1800. Or even to allow 4-digit years by using > 999.

May be solved by: https://github.com/qwat/qwat-data-model/pull/366

sjib commented 2 years ago

This would go along well with the current value range in the Swiss SIA405 Water model where the value range for year (construction year etc.) is defined as: Jahr = 1800 .. 2100; !! unbekannt = 1800 (niedrigster Wert des Wertebereiches) Annee = 1800 .. 2100; !! inconnu = 1800 (valeur la plus bas) The lowest value - in this case 1800 is used as value "unknown" as this cannot be specified in a value range otherwise.

See: https://405.sia.ch/models/2015/SIA405_Base_d-20181005.ili / https://405.sia.ch/models/2015/SIA405_Base_f-20181005.ili and https://405.sia.ch/models/2015/SIA405_Eaux_2015_2_f-20181005.ili