open-contracting / notebooks-ocds

A collection of notebooks for analysing OCDS data stored in Kingfisher.
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

component_check_structure: error message when running 'Error summary section' #54

Closed fppenna closed 1 year ago

fppenna commented 1 year ago

Excecuted this section in the "Data quality feedback template" notebook and got the following error:

(psycopg2.errors.AmbiguousColumn) column reference "field" is ambiguous
LINE 61:     field,

I resolved the error by adding "errors.field" in the last SELECT and GROUP BY clause as shown below. However, I am unsure if this correction displays the table we expected

SELECT
    collection_id,
    error_type,
    errors.field,
    error,
    count(*) AS count,
    example_ocids,
    example_values
FROM
    errors
    JOIN examples USING (collection_id, error_type, error)
GROUP BY
    collection_id,
    error_type,
    errors.field,
    error,
    example_ocids,
    example_values;
jpmckinney commented 1 year ago

So in 3d55092 and baa81cdc7ee6adf8b513739617fed1c7548e7347, that errors ->> 'field' column was added, based on a change that Jen from ODS had made. I didn't check whether this change made sense, however.

If the column doesn't seem to be informative, we can just undo that change (remove 6 lines like errors ->> 'field' AS field,\n", and field,).

fppenna commented 1 year ago

I can confirm that makes sense to keep that column, as it's relevant for providing details in the structure and format report.

jpmckinney commented 1 year ago

Thank you for reporting. Fixed!