Skip to content

support BlockStatement in custom model - #3004

Merged
karussell merged 7 commits into
masterfrom
block_statement
Jun 17, 2024
Merged

karussell merged 7 commits into
masterfrom
block_statement

Conversation

@karussell

@karussell karussell commented May 8, 2024 •

Copy link
Copy Markdown
Member

This PR makes it possible to nest statements to easier build sophisticated custom models.

All statements have a new do operation that allows a list of statements. See the documentation custom-models.md on how to use this.

(The original suggestion was with a then keyword, but this was a bit inconsistent for the else keyword - click details:)

Details

The if and else_if statements have a do entry that allows a list of statements:

{ 
  "if": "country == DEU",
  "do": [
     { "if": "road_class == PRIMARY", "multiply_by": "0.8"  }
  ]
}

And else allows this list directly:

{ "if": "max_speed > 70", "limit_to": "70" },
{ "else": "", 
  "do": [
     { "if": "road_class == PRIMARY", "multiply_by": "0.8"  }
  ]
}

Further nesting is currently possible (maybe we should limit it to 2 levels?):

{ 
  "if": "country == DEU",
  "do": [
     { 
         "if": "road_class == PRIMARY",
         "do": [
            { "if": "max_speed > 70", "multiply_by": "0.5" }
         ]
     }
  ]
}

TODO

@karussell karussell changed the title support BlockStatement support BlockStatement in custom model May 8, 2024
@karussell karussell added this to the 10.0 milestone Jun 17, 2024
@karussell
karussell merged commit d946022 into master Jun 17, 2024
@karussell
karussell deleted the block_statement branch June 17, 2024 13:45
@karussell karussell mentioned this pull request Jun 2, 2025
1 of 2 tasks

This branch was previously deployed

1 inactive deployment
benchmarks — eb1aa599 Deployed Jun 17, 2024 by karussell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant