qwat / qwat-data-model

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

Missing comments for tables and columns #240

Open lbartoletti opened 6 years ago

lbartoletti commented 6 years ago

Tables: 48 Columns: 2962

Some comments can be easy to introduce 'id, geometry, short_XX, etc.'

Maybe travis can warn on this metric - like a coverage doc - and refuse new table or column without comment?

lbartoletti commented 6 years ago

This is a must have for the data dictionnary

tudorbarascu commented 5 years ago

I agree that we should improve the column/tables comments.

lbartoletti commented 5 years ago

@haubourg @elemoine What do you think about adding control over the new tables, where each column must have a comment to make travis happy?

lbartoletti commented 5 years ago

Quick test. Today we have 23 tables without comment

SELECT t.schemaname,
       t.tablename,
       pg_catalog.obj_description(c.oid)
FROM pg_catalog.pg_tables t
LEFT JOIN pg_catalog.pg_class c ON t.tablename = c.relname
WHERE t.schemaname LIKE 'qwat%'
  AND pg_catalog.obj_description(c.oid) IS NULL
lbartoletti commented 5 years ago

For columns

SELECT pg_tables.schemaname,
       pg_tables.tablename,
       pg_attribute.attname AS field,
  (SELECT col_description(pg_attribute.attrelid, pg_attribute.attnum) ) AS comment
FROM pg_tables,
     pg_class
JOIN pg_attribute ON pg_class.oid = pg_attribute.attrelid
AND pg_attribute.attnum > 0
WHERE pg_class.relname = pg_tables.tablename
  AND pg_attribute.atttypid <> 0::oid
  AND schemaname LIKE 'qwat%'
ORDER BY 1,2, attnum ASC

Only 44/980 have comments

haubourg commented 5 years ago

mm, that's quite a work to add all those comments. I've been playing a lot with pgmodeler to document the data model, I think I could help here, but we talks about several dozen of hours here

lbartoletti commented 5 years ago

It is necessary to proceed by steps. First, I think of commenting on all the tables and requiring that the new tables or views have a description.

We will see later on for the columns.

sjib commented 5 years ago

The SIA405 Norm 2015 has a lot of descriptions for the whole water model - it would be anyway good to document how the qwat model connects to this standard.

haubourg commented 5 years ago

@sjib Agreed! From what I get from @3nids, there is no direct relation with the SIA Norm. I've been working to evaluate the interoperability of the QWAT's Model with other models about 2 years ago. One blocker to me was that it is not easy to refer to the SIA models, UML schema and data dictionnary because it's not an open document. In which extent can we reuse parts of the SIA docs to publish some (open) documents ?