Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Validata
Validata UI
Commits
f5125cf2
Commit
f5125cf2
authored
Feb 02, 2021
by
Pierre Dittgen
Browse files
Adapt to changes in frictionless report
parent
86b07244
Changes
1
Hide whitespace changes
Inline
Side-by-side
validata_ui/views.py
View file @
f5125cf2
...
...
@@ -207,14 +207,14 @@ def create_validata_ui_report(rows_count: int, validata_core_report, schema_dict
- errors are separated into "structure" and "body"
- error messages are improved
"""
v_report
=
copy
.
deepcopy
(
validata_core_report
)
v_report
=
copy
.
deepcopy
(
validata_core_report
.
to_dict
()
)
# Create a new UI report from information picked in validata report
ui_report
=
{}
ui_report
[
"table"
]
=
{}
# source headers
headers
=
v_report
.
table
[
"header"
]
headers
=
v_report
[
"tasks"
][
0
][
"resource"
][
"data"
][
0
]
ui_report
[
"table"
][
"header"
]
=
headers
# source dimension
...
...
@@ -235,9 +235,10 @@ def create_validata_ui_report(rows_count: int, validata_core_report, schema_dict
else
"Cette colonne n'est pas définie dans le schema"
for
h
in
headers
]
v_report_table
=
v_report
[
"tasks"
][
0
]
missing_headers
=
[
err
[
"message-data"
][
"column-name"
]
for
err
in
v_report
.
table
[
"errors"
]
for
err
in
v_report
_
table
[
"errors"
]
if
err
[
"code"
]
==
"missing-header"
]
ui_report
[
"table"
][
"cols_alert"
]
=
[
...
...
@@ -246,12 +247,12 @@ def create_validata_ui_report(rows_count: int, validata_core_report, schema_dict
]
# prepare error structure for UI needs
errors
=
build_ui_errors
(
v_report
.
table
[
"errors"
])
errors
=
build_ui_errors
(
v_report
_
table
[
"errors"
])
# Count errors and warnings
ui_report
[
"error_count"
]
=
len
(
errors
)
ui_report
[
"warn_count"
]
=
len
(
v_report
.
table
[
"structure_warnings"
])
ui_report
[
"warnings"
]
=
v_report
.
table
[
"structure_warnings"
]
ui_report
[
"warn_count"
]
=
len
(
v_report
_
table
[
"structure_warnings"
])
ui_report
[
"warnings"
]
=
v_report
_
table
[
"structure_warnings"
]
# Then group them in 2 groups : structure and body
ui_report
[
"table"
][
"errors"
]
=
{
"structure"
:
[],
"body"
:
[]}
...
...
@@ -390,7 +391,7 @@ def validate(schema_instance: SchemaInstance, validata_resource: ValidataResourc
# Source error
source_errors
=
[
err
for
err
in
validata_core_report
[
"ta
ble
s"
][
0
][
"errors"
]
for
err
in
validata_core_report
[
"ta
sk
s"
][
0
][
"errors"
]
if
err
[
"code"
]
in
{
"source-error"
,
"unknown-csv-dialect"
}
]
if
source_errors
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment