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

OCDS - Group validation errors by type #1168

Merged
merged 2 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cove_360/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-17 10:38+0000\n"
"POT-Creation-Date: 2019-04-25 09:44+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion cove_iati/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-17 10:38+0000\n"
"POT-Creation-Date: 2019-04-25 09:44+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
16 changes: 16 additions & 0 deletions cove_ocds/lib/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from collections import defaultdict
import json


def group_validation_errors(validation_errors):
validation_errors_grouped = defaultdict(list)
for error_json, values in validation_errors:
error = json.loads(error_json)
if error['message_type'] == 'required':
validation_errors_grouped['required'].append((error_json, values))
elif error['message_type'] in ['format', 'pattern', 'number', 'string',
'date-time', 'uri', 'object', 'integer', 'array']:
validation_errors_grouped['format'].append((error_json, values))
else:
validation_errors_grouped['other'].append((error_json, values))
return validation_errors_grouped
120 changes: 87 additions & 33 deletions cove_ocds/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-17 10:38+0000\n"
"POT-Creation-Date: 2019-04-25 09:44+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -23,7 +23,7 @@ msgstr ""

#: cove_ocds/lib/exceptions.py:11 cove_ocds/lib/exceptions.py:24
#: cove_ocds/lib/exceptions.py:40 cove_ocds/lib/exceptions.py:53
#: cove_ocds/views.py:67 cove_ocds/views.py:78
#: cove_ocds/views.py:68 cove_ocds/views.py:79
msgid "Try Again"
msgstr ""

Expand Down Expand Up @@ -235,32 +235,53 @@ msgid "Conversion Errors (titles)"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:256
#: cove_ocds/templates/cove_ocds/explore_base.html:412
#: cove_ocds/templates/cove_ocds/explore_base.html:415
msgid "Structural Errors"
msgid "Structural Errors - Required Fields"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:260
msgid ""
"Some or all of your data is missing fields which are required by the OCDS "
"schema."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:270
#: cove_ocds/templates/cove_ocds/explore_base.html:430
#: cove_ocds/templates/cove_ocds/explore_base.html:433
#: cove_ocds/templates/cove_ocds/explore_base.html:280
msgid "Structural Errors - Format"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:284
msgid ""
"Some or all of your data includes fields which are incorrectly formatted."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:304
msgid "Structural Errors - Other"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:308
msgid "Some or all of your data has validation errors."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:323
#: cove_ocds/templates/cove_ocds/explore_base.html:483
#: cove_ocds/templates/cove_ocds/explore_base.html:486
msgid "Structure Warnings"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:292
#: cove_ocds/templates/cove_ocds/explore_base.html:418
#: cove_ocds/templates/cove_ocds/explore_base.html:421
#: cove_ocds/templates/cove_ocds/explore_base.html:345
#: cove_ocds/templates/cove_ocds/explore_base.html:471
#: cove_ocds/templates/cove_ocds/explore_base.html:474
msgid "Conformance (Rules)"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:314
#: cove_ocds/templates/cove_ocds/explore_base.html:367
msgid "Codelist Errors"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:336
#: cove_ocds/templates/cove_ocds/explore_base.html:389
msgid "Additional Fields"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:340
#: cove_ocds/templates/cove_ocds/explore_base.html:393
msgid ""
"This data includes the following fields which are not part of the OCDS "
"schema. You should check whether the data in these fields could be provided "
Expand All @@ -269,66 +290,71 @@ msgid ""
"schema."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:354
#: cove_ocds/templates/cove_ocds/explore_base.html:407
msgid "Additional Codelist Values"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:374
#: cove_ocds/templates/cove_ocds/explore_base.html:454
#: cove_ocds/templates/cove_ocds/explore_base.html:457
#: cove_ocds/templates/cove_ocds/explore_base.html:427
#: cove_ocds/templates/cove_ocds/explore_base.html:507
#: cove_ocds/templates/cove_ocds/explore_base.html:510
msgid "Deprecated Fields"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:374
#: cove_ocds/templates/cove_ocds/explore_base.html:427
msgid ""
"Fields flagged as 'deprecated' will be either replaced or removed in future "
"versions of the schema."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:390
#: cove_ocds/templates/cove_ocds/explore_base.html:443
msgid "Save or Share these results"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:391
#: cove_ocds/templates/cove_ocds/explore_base.html:444
msgid "Use the following url to share these results:"
msgstr ""

#. Translators: Paragraph that describes the application
#: cove_ocds/templates/cove_ocds/explore_base.html:396
#: cove_ocds/templates/cove_ocds/explore_base.html:449
msgid ""
"These results will be available for 7 days from the day the data was first "
"uploaded. You can revisit these results until then."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:397
#: cove_ocds/templates/cove_ocds/explore_base.html:450
msgid ""
"After 7 days all uploaded data is deleted from our servers, and the results "
"will no longer be available. Anyone using the link to this page after that "
"will be shown a message that tells them the file has been removed."
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:424
#: cove_ocds/templates/cove_ocds/explore_base.html:465
#: cove_ocds/templates/cove_ocds/explore_base.html:468
msgid "Structural Errors"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:477
msgid "view all errors &#9660;"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:427
#: cove_ocds/templates/cove_ocds/explore_base.html:439
#: cove_ocds/templates/cove_ocds/explore_base.html:445
#: cove_ocds/templates/cove_ocds/explore_base.html:480
#: cove_ocds/templates/cove_ocds/explore_base.html:492
#: cove_ocds/templates/cove_ocds/explore_base.html:498
msgid "View all errors &#9650;"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:436
#: cove_ocds/templates/cove_ocds/explore_base.html:489
#: cove_ocds/templates/cove_ocds/ocds_missing_ids_table.html:6
#: cove_ocds/templates/cove_ocds/ocid_prefixes_table.html:5
msgid "View all errors &#9660;"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:442
#: cove_ocds/templates/cove_ocds/explore_base.html:495
msgid "Quality Warnings"
msgstr ""

#: cove_ocds/templates/cove_ocds/explore_base.html:448
#: cove_ocds/templates/cove_ocds/explore_base.html:451
#: cove_ocds/templates/cove_ocds/explore_base.html:501
#: cove_ocds/templates/cove_ocds/explore_base.html:504
msgid "Additional Fields (fields in data not in schema)"
msgstr ""

Expand Down Expand Up @@ -951,11 +977,39 @@ msgstr ""
msgid "Open Contracting Identifier guidance"
msgstr ""

#: cove_ocds/views.py:65 cove_ocds/views.py:76
#: cove_ocds/templates/cove_ocds/validation_table.html:7
msgid "Error Description"
msgstr ""

#: cove_ocds/templates/cove_ocds/validation_table.html:8
msgid "Error Count"
msgstr ""

#: cove_ocds/templates/cove_ocds/validation_table.html:9
msgid "First 3 Examples"
msgstr ""

#: cove_ocds/templates/cove_ocds/validation_table.html:10
msgid "Location of first 3 errors"
msgstr ""

#: cove_ocds/templates/cove_ocds/validation_table.html:12
msgid "Spreadsheet Location of first 3 errors"
msgstr ""

#: cove_ocds/templates/cove_ocds/validation_table.html:65
msgid "Path:"
msgstr ""

#: cove_ocds/templates/cove_ocds/validation_table.html:66
msgid "Line:"
msgstr ""

#: cove_ocds/views.py:66 cove_ocds/views.py:77
msgid "Sorry, we can't process that data"
msgstr ""

#: cove_ocds/views.py:79
#: cove_ocds/views.py:80
msgid ""
"OCDS JSON should have an object as the top level, the JSON you supplied does "
"not."
Expand Down
Loading