Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

name_number - set MANDATORY? #3

Open
sjib opened this issue May 6, 2024 · 7 comments
Open

name_number - set MANDATORY? #3

sjib opened this issue May 6, 2024 · 7 comments
Assignees
Labels
datamodel documentation Improvements or additions to documentation enhancement New feature or request question Further information is requested

Comments

@sjib
Copy link
Contributor

sjib commented May 6, 2024

Name_Nummer (name_number) – in INTERLIS not MANDATORY – how to handle in TEKSI Distance heating?
I would suggest to set it MANDATORY

@sjib sjib added the question Further information is requested label May 6, 2024
@sjib
Copy link
Contributor Author

sjib commented May 15, 2024

@sjib to do write concept for this as discussed

@sjib
Copy link
Contributor Author

sjib commented May 15, 2024

  • Add MANDATORY constraint to datamodel @sjib
  • Document how this constraint can be turned off if data needs to be imported that has missing Name_Number @sjib
  • Implement trigger in forms, that fill in Name_Number = obj_id if no Name_Number is added - see TWW implementation (to do add link @sjib)
  • Create sql to fill in obj_id if Name_Number is missing (Update query)

@sjib sjib self-assigned this May 15, 2024
@sjib sjib added documentation Improvements or additions to documentation enhancement New feature or request datamodel labels May 15, 2024
@sjib
Copy link
Contributor Author

sjib commented May 27, 2024

  • Add MANDATORY constraint to datamodel @sjib

I saw that we also do not have MANDATORY constraints in the postgres data model of tww - discuss with Technical group

@sjib
Copy link
Contributor Author

sjib commented May 27, 2024

  • Implement trigger in forms, that fill in Name_Number = obj_id if no Name_Number is added - see TWW implementation (to do add link @sjib)

@urskaufmann How and where did we add this in tww? In the project file or as trigger in the database?

@urskaufmann
Copy link

Name_Nummer (=Identifier) is in tww normally not defined in the project. There must be somewhere a trigger, that sets identifier = obj_id as default value. With one exception: all identifier (reach, channel, reachpoint) in vw_tww_reach do not work like this, there has to be the obj_id defined as default value. The vw_tww_reach is somewhere specially, it's to only view, where the QGIS-standard-"reuse last value" does not work...

@sjib
Copy link
Contributor Author

sjib commented May 27, 2024

These triggers seem to be created here in tww:
https://github.com/teksi/wastewater/blob/d8a3e3a8f92be62848dfc465c6cba45b824467ca/datamodel/app/view/vw_tww_wastewater_structure.py#L277

In the final database it then looks like this:
NEW.identifier = COALESCE(NEW.identifier, NEW.obj_id);

20240527_vw_tww_wws_insert_trigger

And for cover:
20240527_vw_cover_on_insert

, CASE WHEN NEW.identifier IS NOT NULL AND NEW.identifier::text <> '' THEN NEW.identifier ELSE COALESCE( NEW.obj_id, tww_sys.generate_oid('tww_od'::text, 'structure_part'::text) ) END

@sjib
Copy link
Contributor Author

sjib commented May 27, 2024

@urskaufmann In vw_tww_reach there is nothing defined for NEW wwn.identifier - may be that is the reason:
20240507_vw_tww_reach_insert_identifier_wwn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodel documentation Improvements or additions to documentation enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants