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

Data model: dataowner and provider #43

Closed
andreasneumann opened this issue Apr 14, 2014 · 16 comments
Closed

Data model: dataowner and provider #43

andreasneumann opened this issue Apr 14, 2014 · 16 comments
Assignees

Comments

@andreasneumann
Copy link
Contributor

Almost any od_xx table has the two attributes "dataowner" and "provider". Currently these are only text fields. I think it would be more elegant if these could be relations to the table "od_organisation" - With the current setup there is a lot of duplication and it is harder to update the information of the dataowner and provider.

Any thoughts?

@sjib
Copy link
Contributor

sjib commented Apr 15, 2014

Grundsätzlich spricht nichts gegen eine solche Umsetzung in QGEP, in der VSA-DSS INTERLIS Version wird es aber nicht so umgesetzt – es überfordert die Leute schon so, diese Daten überhaupt zu liefern. Man müsste das dann einfach beim Export in die VSA-DSS wieder anders abfüllen (also Name des Datenherrn statt FS).
Falls man z.B. das Ingenieurbüro, das Datenherr ist oder die Gemeinde dann bei Organisation abfüllt muss man einfach gut darauf achten, diese allenfalls mehrfach aufzulisten, in der Funktion als Datenherr – das ist dann allenfalls nicht ganz die gleiche Dienststelle v.a. bei grösseren Gemeinden / Städten. So wie man die Gemeinde sowohl als privaten Eigentümer und als „Gemeinde“ Eigentümer auch schon doppelt erfassen sollte. Siehe diese Überlegungen dazu auf der DSS Webseite (Attributierungshandbuch): http://www.vsa.ch/fileadmin/user_upload/DSS/download/AH_DSS_Eigentuemer_Betreiber_2007_07_02.pdf

Falls du das so willst mit FS für Datenherr / Datenlieferant, schick mir eine Vorlage, wie ich das im SQL Create anpassen soll.

@m-kuhn
Copy link
Contributor

m-kuhn commented Aug 27, 2014

While I think the idea is basically good in terms of database structure, what do we gain from it?

QGIS supports a widget type called Unique Values. This widget type is able to suggest values that have previously been used for a certain field. So for the user it is very easy to re-enter the same dataowner, but limited to the same layer/field.

@m-kuhn
Copy link
Contributor

m-kuhn commented Oct 16, 2014

Andreas provides an example for Stefan how to implement this.

@andreasneumann
Copy link
Contributor Author

Here is an example how this would be done for one table (sample od_wastewater_structure). It concerns all od_* tables.

ALTER TABLE qgep.od_wastewater_structure ADD COLUMN dataowner integer;
ALTER TABLE qgep.od_wastewater_structure ADD COLUMN provider integer;

ALTER TABLE qgep.od_wastewater_structure ADD CONSTRAINT rel_wastewater_structure_dataowner FOREIGN KEY (dataowner) REFERENCES qgep.od_organisation(obj_id);
ALTER TABLE qgep.od_wastewater_structure ADD CONSTRAINT rel_wastewater_structure_provider FOREIGN KEY (provider) REFERENCES qgep.od_organisation(obj_id);

The constraints can only be added after both tables where created, so better at the end of the SQL.

@andreasneumann
Copy link
Contributor Author

Oliver needs to check whether this is implemented in latest version.

@sjib
Copy link
Contributor

sjib commented Dec 22, 2014

Fehlermeldung: Am Schluss wenn du die Constrain für die Fremdschlüssel hinzufügst, wird zweimal fk_dataowner hinzugefüngt. Müssste einmel fk_provider sein. (issue #43)

  • ist nun in der neuesten Version 22.12.2014 korrigiert

@m-kuhn
Copy link
Contributor

m-kuhn commented Feb 10, 2015

Waiting for Interlis Import => then update the model to the newest model by @sjib => then import and migrate and verify

@m-kuhn
Copy link
Contributor

m-kuhn commented Aug 16, 2015

Currently there are two fields for each

  • dataowner
  • fk_dataowner

Not sure this is what we want?

@andreasneumann
Copy link
Contributor Author

I believe the VSA-DSS model has the dataowner field as varchar/text, but we discussed that we would prefer the fk_dataowner foreign key to the organization table.

So, we should get rid of the dataowner column and add this to an export view, when we will need the text representation instead of the foreign key.

But the export views are not top priority, currently.

@sjib
Copy link
Contributor

sjib commented Oct 16, 2015

Discuss in meeting 19.10.2015 (https://github.com/QGEP/QGEP/wiki/Meeting-2015-10-19)

@sjib
Copy link
Contributor

sjib commented Nov 23, 2015

Take out dataowner and dataprovider field in datamodel

@sjib sjib added the P1 label Nov 27, 2015
@3nids
Copy link
Member

3nids commented Dec 10, 2015

@sjib what would be the delay for this?

@sjib
Copy link
Contributor

sjib commented Dec 10, 2015

In working on the INTERLIS Export / Import we found out, that it is really challenging, when we always have to link the organization table into all the queries when exporting or importing data. So we think it would be helpful to keep the dataowner / provider as a field that we can fill with the current identifier of the related dataset in organization while exporting or importing and delete it, when we have pre- or postprocessed dataowner and provider an created the necessary fs_* (postprocess while importing) or matched the identifier of organization (preprocess in the export process).

Does this disturbs any other development that you are doing?

@m-kuhn
Copy link
Contributor

m-kuhn commented Dec 10, 2015

In this case, wouldn't it be preferable to either create the field at the start / end of an import/export process and delete it in the end?
This way the risk of mistaking this for authoritative data when it is out of sync will be reduced.

@3nids
Copy link
Member

3nids commented Dec 10, 2015

@sjib sorry not following, what prevents from using views for export and trigger for import?

@sjib
Copy link
Contributor

sjib commented May 17, 2016

Adapted in https://raw.githubusercontent.com/QGEP/datamodel Release 26.4.2016

@sjib sjib closed this as completed May 17, 2016
qgep-ninja added a commit to qgep-ninja/QGEP that referenced this issue Sep 21, 2016
commit afdd70ade43516e5c23d66ebaf863334c8a6d87a
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 13:24:36 2016 +0200

    Remove dataowner and provider

    Really fixes QGEP#43

commit debbfd71b9f0a8968f3c3e40b858445470d07a35
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 12:51:00 2016 +0200

    Finalize relativ_path changes

commit 599e8fe6995d3120f4b96949dfe6e4526b113bf7
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 12:45:41 2016 +0200

    Fix db_setup

commit 7023d7a3d5a81b6bcf94cf6e7fa658b316db4b77
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 10:50:50 2016 +0200

    Followup fix relativ_path

commit eda80d9b6ac7e7488546a291282664f9507f2412
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 10:39:11 2016 +0200

    Fix typo in od_file
qgep-ninja added a commit to qgep-ninja/QGEP that referenced this issue Oct 18, 2016
commit e511805091eb885a118c6c9d095124bfc8389151
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 16:16:52 2016 +0200

    Update tests to vw_qgep_wastewater_structure

commit 47bac028a6cd818922193ec4002337e5da3477c3
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 12:46:06 2016 +0200

    Add od_wastewater_structure.main_cover

commit 8a9ba10347b1616430c9bc245f729004c0f23f9d
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 12:45:12 2016 +0200

    Add vw_qgep_wastewater_structure

commit afdd70ade43516e5c23d66ebaf863334c8a6d87a
Author: Matthias Kuhn <matthias@opengis.ch>
Date:   Wed Sep 21 13:24:36 2016 +0200

    Remove dataowner and provider

    Really fixes QGEP#43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants