Open-Pectus / Open-Pectus

Pectus is a process control system for Unit Operations such as filtration, chromatography, precipitation, solubilization and refolding. Pectus implements a language called P-code which is used to write methods and control components on the Unit Operation.
https://docs.openpectus.org
MIT License
8 stars 1 forks source link

Choice command issue #533

Open mpo-mjolner opened 4 months ago

mpo-mjolner commented 4 months ago

There is a bug in the uod builder regarding choice commands. A process value with choices is defined using the with_process_value_choice() builder method. When invoked without the command_options argument, it expects that its tag has choices and it should use these choices as command_options. This functionality does not work correctly.

Related functionality: When fixing this, we might also add functionality to generate example code for choice commands in addition to what we already have for regex based commands (#524).

Additionally, we should refactor the processing of commands sent from the frontend, so that for choice commands, we accept verbatim pcode instead of accepting a named option and correlating that with readings. This makes the processing simpler and makes it so that generated example command test the same input command processing as used when accepting commands from the frontend.

mpo-mjolner commented 4 months ago

Related: We currently don't support multiple commands (process values with entiher entry or choices) based on the same tag. Support for this could be added by explicitly naming the process values rather than just using ther tag names implicitly.

nneskildsf commented 4 months ago

Related: We currently don't support multiple commands (process values with entiher entry or choices) based on the same tag. Support for this could be added by explicitly naming the process values rather than just using ther tag names implicitly.

I don't really see this happening in practice. I'm not sure it's relevant to implement. The original post is certainly relevant though.

nneskildsf commented 2 months ago

Related functionality: When fixing this, we might also add functionality to generate example code for choice commands in addition to what we already have for regex based commands (#524).

Fixed in #596.