Skip to main content

classify_product

Function classify_product 

Source
pub fn classify_product(product_json: &str) -> Result<JsValue, JsValue>
Expand description

Classify a chemical product using the full rule-based pipeline (Priorities 1–3).

product_json must be a JSON-serialised ProductDescription:

{
  "identifier": { "cas": "1310-73-2" },
  "physical_form": "Solid",
  "purity_pct": null,
  "purity_type": null,
  "mixture_components": null,
  "intended_use": null,
  "additional_context": null
}

Returns a HsPrediction JS object on success, or throws a JS error string.