OpenStop
OpenStop copied to clipboard
Rework question catalog scheme
The question catalogue was originally focused on serving a good balance between readability and versatility. However over time it gained more complexity and especially with the introduction of multi language keys it has become less readable. Additionally the structure sometimes requires duplicating tags or conditions (see crossing:markings
questions) which ultimately makes it less readable, understandable and maintainable.
The duplication is mainly needed because AND + OR operators cannot be defined explicitly. They are always implicitly defined by the JSON structure. Usually arrays []
are disjunctions (OR) while the object notation {}
defines conjunctions (AND).
Idea:
Reuse the expression system from the constructor and supplement it with more conditional expressions for matching elements similar to mapbox filter expressions. Nesting conditions could also improve performance because it avoids double checking the same tags.
Example:
["ALL"
["EQUALS", $type, "bar"]
["CONTAINS", $tag, "foo", "bla"]
]
["ANY"
["EQUALS", $type, "foo"]
["CONTAINS", $tag, "foo", "bla"]
]
---------------------------------------
"conditions": [
"ALL",
["==", [GET, $tags, "highway"], "footway"],
["==", [GET, $tags, "conveying"], "yes"],
["HAS", $tags, "bus"],
["WITHOUT", $tags, "train"]
]
---------------------------------------
"conditions": [
"ANY",
[
"ALL",
["==", [GET, $tags, "highway"], "footway"],
["==", [GET, $tags, "conveying"], "yes"],
["HAS", $tags, "bus"],
["WITHOUT", $tags, "train"]
],
[
"ALL",
["HAS", $tags, "railway"],
["WITHOUT", $tags, "train"]
]
]
Other goals:
- Allow RegEx in keys - This is necessary to match language sub keys like in
tactile_writing:embossed_printed_letters:XX=yes
(required to properly fix https://www.openstreetmap.org/changeset/134263638) - Constructor could expose a variable for the pre-existing value of a tag - this might be useful when concatenating values to pre-existing ones. If there is no previous value it would simply be
null
- Required for
check_date
evaluation (Expression that allows parsing and comparing date time)