From 406264c37e63c07d35fe9a40947f84e3cd666f48 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Tue, 31 Dec 2019 20:16:15 +0000 Subject: [PATCH] Simplify structure of QA error data --- css/65_data.css | 42 ++--- data/qa_errors.json | 307 ++++++++------------------------ modules/osm/qa_error.js | 11 +- modules/services/osmose.js | 2 +- modules/svg/improveOSM.js | 5 +- modules/svg/osmose.js | 2 +- modules/ui/improveOSM_header.js | 5 +- modules/ui/osmose_header.js | 2 +- scripts/build_data.js | 5 +- 9 files changed, 108 insertions(+), 273 deletions(-) diff --git a/css/65_data.css b/css/65_data.css index ff62cb7b1..503fca1a7 100644 --- a/css/65_data.css +++ b/css/65_data.css @@ -156,51 +156,51 @@ /* Osmose Errors ------------------------------------------------------- */ -.osmose.category-0 { +.osmose.item-0 { color: #BDBDBD; } -.osmose.category-1040, -.osmose.category-1050, -.osmose.category-1070, -.osmose.category-1080, -.osmose.category-1150, -.osmose.category-1190, -.osmose.category-1280 { +.osmose.item-1040, +.osmose.item-1050, +.osmose.item-1070, +.osmose.item-1080, +.osmose.item-1150, +.osmose.item-1190, +.osmose.item-1280 { color: #DCB000; } -.osmose.category-2110 { +.osmose.item-2110 { color: #2CDCDC; } -.osmose.category-3040, -.osmose.category-3090, -.osmose.category-3161, -.osmose.category-3220, -.osmose.category-3250 { +.osmose.item-3040, +.osmose.item-3090, +.osmose.item-3161, +.osmose.item-3220, +.osmose.item-3250 { color: #2D9359; } -.osmose.category-4080 { +.osmose.item-4080 { color: #F2F230; } -.osmose.category-5070 { +.osmose.item-5070 { color: #EC0000; } -.osmose.category-7040, -.osmose.category-7090 { +.osmose.item-7040, +.osmose.item-7090 { color: #9F16B4; } -.osmose.category-8300, -.osmose.category-8360 { +.osmose.item-8300, +.osmose.item-8360 { color: #3DE736; } -.osmose.category-9010 { +.osmose.item-9010 { color: #976432; } diff --git a/data/qa_errors.json b/data/qa_errors.json index 230e565f4..374d553ea 100644 --- a/data/qa_errors.json +++ b/data/qa_errors.json @@ -1,36 +1,13 @@ { "services": { "improveOSM": { - "errorTypes": { - "ow": { - "icon": "fas-long-arrow-alt-right", - "category": "routing" - }, - "mr-both": { - "icon": "maki-car", - "category": "geometry" - }, - "mr-parking": { - "icon": "maki-parking", - "category": "geometry" - }, - "mr-path": { - "icon": "maki-shoe", - "category": "geometry" - }, - "mr-road": { - "icon": "maki-car", - "category": "geometry" - }, - "tr": { - "icon": "temaki-junction", - "category": "routing" - } - } - }, - "keepRight": { - "errorTypes": { - + "errorIcons": { + "ow": "fas-long-arrow-alt-right", + "mr-both": "maki-car", + "mr-parking": "maki-parking", + "mr-path": "maki-shoe", + "mr-road": "maki-car", + "tr": "temaki-junction" } }, "osmose": { @@ -56,208 +33,74 @@ "8360", "9010" ], - "errorTypes": { - "0-1": { - "icon": "maki-home" - }, - "0-2": { - "icon": "maki-home" - }, - "1040-1": { - "icon": "maki-square-stroked" - }, - "1050-1": { - "icon": "maki-circle-stroked" - }, - "1050-1050": { - "icon": "maki-circle-stroked" - }, - "1070-1": { - "icon": "maki-home" - }, - "1070-4": { - "icon": "maki-dam" - }, - "1070-5": { - "icon": "maki-dam" - }, - "1070-8": { - "icon": "maki-cross" - }, - "1070-10": { - "icon": "maki-cross" - }, - "1150-1": { - "icon": "far-clone" - }, - "1150-2": { - "icon": "far-clone" - }, - "1150-3": { - "icon": "far-clone" - }, - "1190-10": { - "icon": "fas-share-alt" - }, - "1190-20": { - "icon": "fas-share-alt" - }, - "1190-30": { - "icon": "fas-share-alt" - }, - "1280-1": { - "icon": "maki-attraction" - }, - "2110-21101": { - "icon": "temaki-plaque" - }, - "2110-21102": { - "icon": "fas-shapes" - }, - "3040-3040": { - "icon": "far-times-circle" - }, - "3090-3090": { - "icon": "fas-calendar-alt" - }, - "3161-1": { - "icon": "maki-parking" - }, - "3161-2": { - "icon": "maki-parking" - }, - "3220-32200": { - "icon": "maki-roadblock" - }, - "3220-32201": { - "icon": "maki-roadblock" - }, - "3250-32501": { - "icon": "maki-watch" - }, - "4080-1": { - "icon": "far-dot-circle" - }, - "4080-2": { - "icon": "far-dot-circle" - }, - "4080-3": { - "icon": "far-dot-circle" - }, - "5070-50703": { - "icon": "fas-tint-slash" - }, - "5070-50704": { - "icon": "fas-code" - }, - "5070-50705": { - "icon": "fas-question" - }, - "7040-1": { - "icon": "temaki-power_tower" - }, - "7040-2": { - "icon": "temaki-power" - }, - "7040-4": { - "icon": "maki-marker" - }, - "7040-6": { - "icon": "temaki-power" - }, - "7090-1": { - "icon": "maki-rail" - }, - "7090-3": { - "icon": "maki-circle" - }, - "8300-1": { - "icon": "fas-tachometer-alt" - }, - "8300-2": { - "icon": "fas-tachometer-alt" - }, - "8300-3": { - "icon": "fas-tachometer-alt" - }, - "8300-4": { - "icon": "fas-tachometer-alt" - }, - "8300-5": { - "icon": "fas-tachometer-alt" - }, - "8300-6": { - "icon": "fas-tachometer-alt" - }, - "8300-7": { - "icon": "fas-tachometer-alt" - }, - "8300-8": { - "icon": "fas-tachometer-alt" - }, - "8300-9": { - "icon": "fas-tachometer-alt" - }, - "8300-10": { - "icon": "fas-tachometer-alt" - }, - "8300-11": { - "icon": "fas-tachometer-alt" - }, - "8300-12": { - "icon": "fas-tachometer-alt" - }, - "8300-13": { - "icon": "fas-tachometer-alt" - }, - "8300-14": { - "icon": "fas-tachometer-alt" - }, - "8300-15": { - "icon": "fas-tachometer-alt" - }, - "8300-16": { - "icon": "fas-tachometer-alt" - }, - "8300-17": { - "icon": "fas-tachometer-alt" - }, - "8300-20": { - "icon": "temaki-height_restrictor" - }, - "8300-21": { - "icon": "fas-weight-hanging" - }, - "8300-32": { - "icon": "maki-circle-stroked" - }, - "8300-34": { - "icon": "temaki-diamond" - }, - "8300-39": { - "icon": "temaki-pedestrian" - }, - "8360-1": { - "icon": "temaki-bench" - }, - "8360-2": { - "icon": "maki-bicycle" - }, - "8360-3": { - "icon": "temaki-security_camera" - }, - "8360-4": { - "icon": "temaki-fire_hydrant" - }, - "8360-5": { - "icon": "temaki-traffic_signals" - }, - "9010-9010001": { - "icon": "make-waste-basket" - }, - "9010-9010003": { - "icon": "temaki-plaque" - } + "errorIcons": { + "0-1": "maki-home", + "0-2": "maki-home", + "1040-1": "maki-square-stroked", + "1050-1": "maki-circle-stroked", + "1050-1050": "maki-circle-stroked", + "1070-1": "maki-home", + "1070-4": "maki-dam", + "1070-5": "maki-dam", + "1070-8": "maki-cross", + "1070-10": "maki-cross", + "1150-1": "far-clone", + "1150-2": "far-clone", + "1150-3": "far-clone", + "1190-10": "fas-share-alt", + "1190-20": "fas-share-alt", + "1190-30": "fas-share-alt", + "1280-1": "maki-attraction", + "2110-21101": "temaki-plaque", + "2110-21102": "fas-shapes", + "3040-3040": "far-times-circle", + "3090-3090": "fas-calendar-alt", + "3161-1": "maki-parking", + "3161-2": "maki-parking", + "3220-32200": "maki-roadblock", + "3220-32201": "maki-roadblock", + "3250-32501": "maki-watch", + "4080-1": "far-dot-circle", + "4080-2": "far-dot-circle", + "4080-3": "far-dot-circle", + "5070-50703": "fas-tint-slash", + "5070-50704": "fas-code", + "5070-50705": "fas-question", + "7040-1": "temaki-power_tower", + "7040-2": "temaki-power", + "7040-4": "maki-marker", + "7040-6": "temaki-power", + "7090-1": "maki-rail", + "7090-3": "maki-circle", + "8300-1": "fas-tachometer-alt", + "8300-2": "fas-tachometer-alt", + "8300-3": "fas-tachometer-alt", + "8300-4": "fas-tachometer-alt", + "8300-5": "fas-tachometer-alt", + "8300-6": "fas-tachometer-alt", + "8300-7": "fas-tachometer-alt", + "8300-8": "fas-tachometer-alt", + "8300-9": "fas-tachometer-alt", + "8300-10": "fas-tachometer-alt", + "8300-11": "fas-tachometer-alt", + "8300-12": "fas-tachometer-alt", + "8300-13": "fas-tachometer-alt", + "8300-14": "fas-tachometer-alt", + "8300-15": "fas-tachometer-alt", + "8300-16": "fas-tachometer-alt", + "8300-17": "fas-tachometer-alt", + "8300-20": "temaki-height_restrictor", + "8300-21": "fas-weight-hanging", + "8300-32": "maki-circle-stroked", + "8300-34": "temaki-diamond", + "8300-39": "temaki-pedestrian", + "8360-1": "temaki-bench", + "8360-2": "maki-bicycle", + "8360-3": "temaki-security_camera", + "8360-4": "temaki-fire_hydrant", + "8360-5": "temaki-traffic_signals", + "9010-9010001": "maki-waste-basket", + "9010-9010003": "temaki-plaque" } } } diff --git a/modules/osm/qa_error.js b/modules/osm/qa_error.js index 7e18de237..d76893d01 100644 --- a/modules/osm/qa_error.js +++ b/modules/osm/qa_error.js @@ -44,13 +44,8 @@ Object.assign(qaError.prototype, { if (this.service && this.error_type) { var serviceInfo = services[this.service]; - if (serviceInfo) { - var errInfo = serviceInfo.errorTypes[this.error_type]; - - if (errInfo) { - this.icon = errInfo.icon; - this.category = errInfo.category; - } + if (serviceInfo && serviceInfo.errorIcons) { + this.icon = serviceInfo.errorIcons[this.error_type]; } } @@ -65,4 +60,4 @@ Object.assign(qaError.prototype, { update: function(attrs) { return qaError(this, attrs); // {v: 1 + (this.v || 0)} } -}); +}); \ No newline at end of file diff --git a/modules/services/osmose.js b/modules/services/osmose.js index 71d9ba24b..74cb2c461 100644 --- a/modules/services/osmose.js +++ b/modules/services/osmose.js @@ -125,7 +125,7 @@ export default { const error_type = [item, error_class].join('-'); // Filter out unsupported error types (some are too specific or advanced) - if (error_type in services.osmose.errorTypes) { + if (error_type in services.osmose.errorIcons) { let loc = issue.geometry.coordinates; // lon, lat loc = preventCoincident(loc); diff --git a/modules/svg/improveOSM.js b/modules/svg/improveOSM.js index 1c5540299..9dee08553 100644 --- a/modules/svg/improveOSM.js +++ b/modules/svg/improveOSM.js @@ -119,8 +119,7 @@ export function svgImproveOSM(projection, context, dispatch) { 'qa_error', d.service, 'error_id-' + d.id, - 'error_type-' + d.error_type, - 'category-' + d.category + 'error_type-' + d.error_type ].join(' '); }); @@ -258,4 +257,4 @@ export function svgImproveOSM(projection, context, dispatch) { return drawImproveOSM; -} +} \ No newline at end of file diff --git a/modules/svg/osmose.js b/modules/svg/osmose.js index bc25d9612..77d54e921 100644 --- a/modules/svg/osmose.js +++ b/modules/svg/osmose.js @@ -120,7 +120,7 @@ export function svgOsmose(projection, context, dispatch) { d.service, 'error_id-' + d.id, 'error_type-' + d.error_type, - 'category-' + d.item + 'item-' + d.item ].join(' '); }); diff --git a/modules/ui/improveOSM_header.js b/modules/ui/improveOSM_header.js index f9ae38327..bc0fb28b3 100644 --- a/modules/ui/improveOSM_header.js +++ b/modules/ui/improveOSM_header.js @@ -51,8 +51,7 @@ export function uiImproveOsmHeader() { 'qa_error', d.service, 'error_id-' + d.id, - 'error_type-' + d.error_type, - 'category-' + d.category + 'error_type-' + d.error_type ].join(' '); }); @@ -94,4 +93,4 @@ export function uiImproveOsmHeader() { return improveOsmHeader; -} +} \ No newline at end of file diff --git a/modules/ui/osmose_header.js b/modules/ui/osmose_header.js index b66d31980..c2f0ce1aa 100644 --- a/modules/ui/osmose_header.js +++ b/modules/ui/osmose_header.js @@ -57,7 +57,7 @@ export function uiOsmoseHeader() { d.service, 'error_id-' + d.id, 'error_type-' + d.error_type, - 'category-' + d.item + 'item-' + d.item ].join(' '); }); diff --git a/scripts/build_data.js b/scripts/build_data.js index 02f72b80f..30e2f4979 100644 --- a/scripts/build_data.js +++ b/scripts/build_data.js @@ -175,10 +175,9 @@ function readQAErrorIcons(faIcons, tnpIcons) { const qa = read('data/qa_errors.json'); for (const service in qa.services) { - for (const error in qa.services[service].errorTypes) { + for (const error in qa.services[service].errorIcons) { const icon = qa.services[service] - .errorTypes[error] - .icon; + .errorIcons[error]; // fontawesome icon, remember for later if (/^fa[srb]-/.test(icon)) {