pub struct ClassificationState {
pub identifier: SubstanceIdentifier,
pub is_mixture: Option<bool>,
pub component_count: Option<usize>,
pub components: Vec<PartialComponent>,
pub current_component_index: usize,
pub physical_form: Option<PhysicalForm>,
pub purity_pct: Option<f64>,
pub organic_inorganic: Option<OrganicInorganic>,
pub chapter_hint: Option<String>,
pub intended_use: Option<IntendedUse>,
pub detected_functional_groups: Vec<String>,
pub is_complete: bool,
}Expand description
Classification state accumulated across session Q&A rounds.
Each field starts as None and is filled in as the user answers questions.
The pipeline reads this state (via to_product_description)
when the session is complete.
Fields§
§identifier: SubstanceIdentifierIdentifier entered by the user in the first question.
is_mixture: Option<bool>Whether the product is a mixture. None = not yet answered.
component_count: Option<usize>Number of components (set when is_mixture = true).
components: Vec<PartialComponent>Components collected so far (built up one at a time).
current_component_index: usizeIndex of the component currently being entered.
physical_form: Option<PhysicalForm>§purity_pct: Option<f64>§organic_inorganic: Option<OrganicInorganic>Organic / inorganic classification. None = not yet answered.
chapter_hint: Option<String>HS chapter hint narrowed down by the rule engine (two-digit string, e.g. "28").
intended_use: Option<IntendedUse>§detected_functional_groups: Vec<String>Functional group keys selected by the user (e.g. "carboxylic_acid").
is_complete: boolSet to true when next_question() returns None.
Implementations§
Source§impl ClassificationState
impl ClassificationState
Sourcepub fn has_identifier(&self) -> bool
pub fn has_identifier(&self) -> bool
Returns true if at least one identifier field has been set.
Sourcepub fn confidence_estimate(&self) -> f32
pub fn confidence_estimate(&self) -> f32
Rough confidence estimate based on how many fields are known.
Used to decide whether to emit SessionResult::RequiresLlm
when all questions have been answered.
Sourcepub fn all_components_filled(&self) -> bool
pub fn all_components_filled(&self) -> bool
Returns true if all expected mixture components have been entered.
Always returns true for non-mixture products.
Sourcepub fn current_component_has_identifier(&self) -> bool
pub fn current_component_has_identifier(&self) -> bool
Returns true if the current mixture component has an identifier.
Sourcepub fn current_component_has_fraction(&self) -> bool
pub fn current_component_has_fraction(&self) -> bool
Returns true if the current mixture component has a weight fraction.
Trait Implementations§
Source§impl Clone for ClassificationState
impl Clone for ClassificationState
Source§fn clone(&self) -> ClassificationState
fn clone(&self) -> ClassificationState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more