parse_scheme
Convert a CDXML reaction scheme file into structured JSON with species, steps, topology, and a summarized narrative for analysis.
Instructions
Parse a CDXML reaction scheme into a structured description.
Reads a CDXML file containing a reaction scheme (single- or multi-step) and returns a structured JSON with a species registry, reaction graph, topology classification, and a natural language narrative suitable for LLM reasoning.
Uses two strategies in order: step-attribute path (reads attributes if present) then geometry-based fallback (spatial arrow detection). Text labels near arrows are classified as "chemical", "condition_ref", "footnote", "yield", "compound_label", "citation", or "bioactivity".
Args: cdxml_path: Path to a CDXML file containing a reaction scheme. output_path: If given, write the result JSON to this file and return {ok, output_path, size} instead of the full dict.
Returns: Dict with keys: source_file, species (dict of species records with smiles, name, formula, mw, role, text_category), steps (list with reactant/product/reagent species IDs and conditions), topology (linear/parallel/convergent/divergent), content_type, narrative (human-readable summary), and optionally sub_schemes for multi-panel files. When output_path is provided, returns {ok, output_path, size}.
Safety override: Parse a scheme and atomically publish its JSON descriptor.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cdxml_path | Yes | ||
| output_path | No |