Skip to content

5C IF/Then/Else Quote Block #313

@MitchellShiell

Description

@MitchellShiell

Overview [Requires Finialization]

The Quote block is the basic unit of the natural language descriptions. The basic pattern of each block is as follows:

IF [field_referenced] [condition]
    THEN [conditional_field] must be [allowed values]
    ELSE  [conditional_field] [allowed values] (if applicable)
Image

https://www.figma.com/design/LILnnxiWOSiDF7k7IhBYmj/Overture_DataDictionary?node-id=3701-760&t=ht5WxX3Ztzc3JAuv-4

Each block represents a conditional restriction object from the schema.

Implementation note

This ticket outlines and focuses on basic if/then/else block rendering. Rendering Conditions and allowed values have there own tickets linked here:

Quote Block Patterns

Pattern 1: Single restriction with else (creates one quote block)

JSON Structure:

{
  "if": { 
    "conditions": [
      { "fields": ["image_format"], "match": { "value": "PNG" } }
    ] 
  },
  "then": { "codeList": ["pipeline_A", "pipeline_B"] },
  "else": { "codeList": ["pipeline_C", "pipeline_D"] }
}

UI Render Pattern:

IF image_format EQUALS "PNG"
    THEN image_pipeline must be one of: pipeline_A, pipeline_B
    ELSE must be one of: pipeline_C, pipeline_D

Pattern 2: Multiple restrictions (creates multiple quote blocks)

JSON Structure:

[
  {
    "if": { 
      "conditions": [
        { "fields": ["image_format"], "match": { "value": "PNG" } }
      ]
    },
    "then": { "codeList": ["pipeline_A", "pipeline_B"] }
  },
  {
    "if": { 
      "conditions": [
        { "fields": ["image_format"], "match": { "value": "SVG" } }
      ]
    },
    "then": { "codeList": ["pipeline_C", "pipeline_D"] }
  }
]

UI Render Pattern:

Quote Block 1:
IF image_format EQUALS "PNG"
    THEN image_pipeline must be one of: pipeline_A, pipeline_B

Quote Block 2:
IF image_format EQUALS "SVG"
    THEN image_pipeline must be one of: pipeline_C, pipeline_D

Pattern 3: Nested restrictions in else (treated as separate quote blocks)

JSON Structure:

{
  "if": { 
    "conditions": [
      { "fields": ["image_format"], "match": { "value": "PNG" } }
    ]
  },
  "then": { "codeList": ["pipeline_A", "pipeline_B"] },
  "else": [
    {
      "if": { 
        "conditions": [
          { "fields": ["image_format"], "match": { "value": "SVG" } }
        ]
      },
      "then": { "codeList": ["pipeline_C", "pipeline_D"] },
      "else": { "codeList": ["pipeline_E"] }
    }
  ]
}

UI Render Pattern:

Quote Block 1:
IF image_format EQUALS "PNG"
    THEN image_pipeline must be one of: pipeline_A, pipeline_B

Quote Block 2:
IF image_format EQUALS "SVG"
    THEN image_pipeline must be one of: pipeline_C, pipeline_D
    ELSE must be one of: pipeline_E

Note

Instead of rendering nested else structures as complex indented blocks, treat any nested conditional restrictions within an else array as new quote blocks. If the first condition doesn't match, you naturally look at the next one. Since field values are mutually exclusive (a field can't be both "PNG" and "SVG"), separate blocks are clearer than nested indentation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions