-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
We need to parse various condition types from the schema and display them in human-readable format within quote blocks. This is parsing logic that would not have been addressed in the schema table (i.e allowed values).
Basic Condition Pattern
All conditions follow the pattern:
IF [field_name] [condition_phrase] [value(s)]
Condition Types to Support
1. Value Match (value
)
Schema:
{
"fields": ["image_format"],
"match": { "value": "PNG" }
}
Render as:
IF image_format EQUALS "PNG"
2. CodeList Match (codeList
)
Schema:
{
"fields": ["status"],
"match": { "codeList": ["active", "pending"] }
}
Render as:
IF status is one of: active, pending
3. Regex Match (regex
)
Schema:
{
"fields": ["identifier"],
"match": { "regex": "^NCIT:C\\d+$" }
}
Render as:
IF identifier matches pattern: ^NCIT:C\d+$
4. Range Match (range
)
Schema:
{
"fields": ["age"],
"match": {
"range": { "min": 18, "max": 65 }
}
}
Render as:
IF age is between 18 and 65
Range Variations:
{"min": 5}
→ "is greater than or equal to 5"{"max": 100}
→ "is less than or equal to 100"{"exclusiveMin": 0}
→ "is greater than 0"{"exclusiveMax": 50}
→ "is less than 50"{"exclusiveMin": 5, "max": 50}
→ "is greater than 5 and less than or equal to 50"
5. Exists Match (exists
)
Schema:
{
"fields": ["optional_field"],
"match": { "exists": true }
}
Render as:
IF optional_field has a value
IF optional_field is empty // when exists: false
6. Count Match (count
) - Array Fields
Schema:
{
"fields": ["tags"],
"match": { "count": 3 }
}
Render as:
IF tags has exactly 3 items
Count Variations:
{"count": {"min": 2}}
→ "has 2 or more items"{"count": {"max": 5}}
→ "has 5 or fewer items"{"count": {"min": 1, "max": 3}}
→ "has between 1 and 3 items"
Multiple Field Conditions
Multiple Fields with Case Logic
Schema:
{
"fields": ["field_a", "field_b"],
"match": { "value": "test" },
"case": "any"
}
Render as:
"case": "all"
(default) → "IF field_a AND field_b EQUAL 'test'""case": "any"
→ "IF field_a OR field_b EQUALS 'test'""case": "none"
→ "IF field_a AND field_b do NOT equal 'test'"
Complex Condition Combinations
Multiple Conditions in Single If Block
Schema:
{
"conditions": [
{
"fields": ["status"],
"match": { "value": "active" }
},
{
"fields": ["age"],
"match": { "range": { "min": 18 } }
}
],
"case": "all"
}
Render as:
IF status EQUALS "active" AND age is greater than or equal to 18
Metadata
Metadata
Assignees
Labels
No labels