Domain Logic

Strategy plan AST, operations, and validation. Pure domain logic with no I/O or framework dependencies. Used by the agent, serialization, and tools.

Overview

  • Strategy AST — Types for plans: PlanStepNode, StrategyAST, combine operators. Recursive structure for search/transform/combine steps.

  • Strategy Operations — Combine operators, colocation params, WDK operator mapping.

  • Strategy Validation — Validate against WDK constraints; emit field paths.

  • Parameters — Specs, normalization, canonicalization, vocabulary handling.

Strategy AST

Purpose: AST types for strategy plans. PlanStepNode is recursive (search, transform, combine). StrategyAST wraps root + metadata. Used by the agent and serialization layer.

Key types: PlanStepNode, StrategyAST

AST node types for strategy representation (WDK-aligned, untyped tree).

class veupath_chatbot.domain.strategy.ast.StepTreeNode(step_id, primary_input=None, secondary_input=None)[source]

Bases: object

Node in a WDK step tree.

Represents a single step with optional primary (and for combines, secondary) input references. Used to build the stepTree payload for WDK strategy creation. Pure data structure with no I/O.

__init__(step_id, primary_input=None, secondary_input=None)[source]
to_dict()[source]

Convert to WDK stepTree format.

Return type:

JSONObject

veupath_chatbot.domain.strategy.ast.generate_step_id()[source]

Generate a unique step ID.

Return type:

str

veupath_chatbot.domain.strategy.ast.parse_filters(raw)[source]

Parse a list of step filters from raw JSON data.

Return type:

list[StepFilter]

veupath_chatbot.domain.strategy.ast.parse_analyses(raw)[source]

Parse a list of step analyses from raw JSON data.

Return type:

list[StepAnalysis]

veupath_chatbot.domain.strategy.ast.parse_reports(raw)[source]

Parse a list of step reports from raw JSON data.

Return type:

list[StepReport]

veupath_chatbot.domain.strategy.ast.parse_colocation_params(raw)[source]

Parse colocation parameters from raw JSON data.

Return type:

ColocationParams | None

class veupath_chatbot.domain.strategy.ast.StepFilter(name, value, disabled=False)[source]

Bases: object

Filter applied to a step’s result.

name: str
value: JSONValue
disabled: bool = False
to_dict()[source]
Return type:

JSONObject

__init__(name, value, disabled=False)
class veupath_chatbot.domain.strategy.ast.StepAnalysis(analysis_type, parameters=<factory>, custom_name=None)[source]

Bases: object

Analysis configuration for a step.

analysis_type: str
parameters: JSONObject
custom_name: str | None = None
to_dict()[source]
Return type:

JSONObject

__init__(analysis_type, parameters=<factory>, custom_name=None)
class veupath_chatbot.domain.strategy.ast.StepReport(report_name='standard', config=<factory>)[source]

Bases: object

Report request attached to a step.

report_name: str = 'standard'
config: JSONObject
to_dict()[source]
Return type:

JSONObject

__init__(report_name='standard', config=<factory>)
class veupath_chatbot.domain.strategy.ast.PlanStepNode(search_name, parameters=<factory>, primary_input=None, secondary_input=None, operator=None, colocation_params=None, display_name=None, filters=<factory>, analyses=<factory>, reports=<factory>, wdk_weight=None, id=<factory>)[source]

Bases: object

Untyped recursive strategy node.

Kind is inferred from structure: - combine: primary_input and secondary_input - transform: primary_input only - search: no inputs

search_name: str
parameters: JSONObject
primary_input: PlanStepNode | None = None
secondary_input: PlanStepNode | None = None
operator: CombineOp | None = None
colocation_params: ColocationParams | None = None
display_name: str | None = None
filters: list[StepFilter]
analyses: list[StepAnalysis]
reports: list[StepReport]
wdk_weight: int | None = None
id: str
infer_kind()[source]
Return type:

str

to_dict()[source]
Return type:

JSONObject

__init__(search_name, parameters=<factory>, primary_input=None, secondary_input=None, operator=None, colocation_params=None, display_name=None, filters=<factory>, analyses=<factory>, reports=<factory>, wdk_weight=None, id=<factory>)
class veupath_chatbot.domain.strategy.ast.StrategyAST(record_type, root, name=None, description=None, metadata=None)[source]

Bases: object

Complete strategy represented as an AST.

record_type: str
root: PlanStepNode
name: str | None = None
description: str | None = None
metadata: JSONObject | None = None
to_dict()[source]

Convert to dictionary representation.

Return type:

JSONObject

get_all_steps()[source]

Get all steps in the tree (depth-first).

Return type:

list[PlanStepNode]

get_step_by_id(step_id)[source]

Find a step by its ID.

Parameters:

step_id (str) – Step identifier.

Return type:

PlanStepNode | None

__init__(record_type, root, name=None, description=None, metadata=None)
veupath_chatbot.domain.strategy.ast.from_dict(data)[source]

Parse strategy from dictionary representation.

Parameters:

data (JSONObject) – Data dict.

Return type:

StrategyAST

Strategy Operations

Purpose: Operations on the strategy AST: combine operators, colocation parameters, WDK operator mapping. Used when building and manipulating plans.

Key classes: CombineOp, ColocationParams Key functions: get_wdk_operator(), parse_op()

Combine operations for strategy building.

Canonical set (matches WDK BooleanOperator): INTERSECT, MINUS, RMINUS, LONLY, RONLY, COLOCATE, UNION. LONLY = left only (same as MINUS), RONLY = right only (same as RMINUS); we keep both for round-trip fidelity with WDK.

class veupath_chatbot.domain.strategy.ops.CombineOp(*values)[source]

Bases: StrEnum

Set operations for combining two step results.

INTERSECT = 'INTERSECT'
MINUS = 'MINUS'
RMINUS = 'RMINUS'
LONLY = 'LONLY'
RONLY = 'RONLY'
COLOCATE = 'COLOCATE'
UNION = 'UNION'
class veupath_chatbot.domain.strategy.ops.ColocationParams(upstream=0, downstream=0, strand='both')[source]

Bases: object

Parameters for colocation operator.

upstream: int = 0
downstream: int = 0
strand: Literal['same', 'opposite', 'both'] = 'both'
validate()[source]

Validate parameters.

Return type:

list[str]

__init__(upstream=0, downstream=0, strand='both')
veupath_chatbot.domain.strategy.ops.get_wdk_operator(op)[source]

Get WDK boolean operator name.

Since enum values now match WDK values directly, this simply returns op.value (with a guard for COLOCATE which is not a boolean operator).

Parameters:

op (CombineOp) – Combine operator.

Returns:

WDK boolean operator name.

Raises:

ValueError – If op is COLOCATE.

Return type:

str

veupath_chatbot.domain.strategy.ops.parse_op(value)[source]

Parse operator from string value.

Parameters:

value (str) – String value to parse.

Returns:

Parsed combine operator.

Raises:

ValueError – If value is empty or unknown.

Return type:

CombineOp

Strategy Validation

Purpose: Validate plans against WDK constraints: required parameters, valid search names, step structure. Emits ValidationError with field paths for UI display.

Key function: validate_strategy()

Validation for strategy DSL.

class veupath_chatbot.domain.strategy.validate.StepValidationIssue(path, message, code)[source]

Bases: object

A single validation issue found during step/strategy validation.

path: str
message: str
code: str
__init__(path, message, code)
class veupath_chatbot.domain.strategy.validate.ValidationResult(valid, errors)[source]

Bases: object

Result of validation.

valid: bool
errors: list[StepValidationIssue]
classmethod success()[source]

Create a successful result.

Return type:

ValidationResult

classmethod failure(errors)[source]

Create a failed result.

Parameters:

errors (list[StepValidationIssue]) – Validation errors list.

Return type:

ValidationResult

__init__(valid, errors)
class veupath_chatbot.domain.strategy.validate.StrategyValidator(available_searches=None, available_transforms=None)[source]

Bases: object

Validates strategy AST.

__init__(available_searches=None, available_transforms=None)[source]

Initialize validator.

Parameters:
  • available_searches (dict[str, list[str]] | None) – Map of record_type -> list of search names.

  • available_transforms (list[str] | None) – List of available transform names.

validate(strategy)[source]

Validate a strategy AST.

Parameters:

strategy (StrategyAST) – Strategy AST.

Return type:

ValidationResult

veupath_chatbot.domain.strategy.validate.validate_strategy(strategy)[source]

Validate a strategy AST with default validator.

Parameters:

strategy (StrategyAST) – Strategy AST.

Return type:

ValidationResult

Parameters (Domain)

Purpose: Parameter specs, normalization, and validation. Vocabulary flattening, canonicalization, and value decoding. Used by catalog and tools.

Key functions (specs): extract_param_specs(), adapt_param_specs() Key functions (normalize): ParameterNormalizer Key functions (canonicalize): Value coercion for WDK wire format

Adapters for WDK parameter specifications.

class veupath_chatbot.domain.parameters.specs.ParamSpecNormalized(name, param_type, allow_empty_value=False, min_selected_count=None, max_selected_count=None, vocabulary=None, count_only_leaves=False, is_number=False, min_value=None, max_value=None, increment=None, max_length=None, display_type='', is_visible=True, group='', dependent_params=(), help=None)[source]

Bases: object

Canonical representation of a WDK parameter spec.

name: str
param_type: str
allow_empty_value: bool = False
min_selected_count: int | None = None
max_selected_count: int | None = None
vocabulary: JSONObject | JSONArray | None = None
count_only_leaves: bool = False
is_number: bool = False
min_value: float | None = None
max_value: float | None = None
increment: float | None = None
max_length: int | None = None
display_type: str = ''
is_visible: bool = True
group: str = ''
dependent_params: tuple[str, ...] = ()
help: str | None = None
__init__(name, param_type, allow_empty_value=False, min_selected_count=None, max_selected_count=None, vocabulary=None, count_only_leaves=False, is_number=False, min_value=None, max_value=None, increment=None, max_length=None, display_type='', is_visible=True, group='', dependent_params=(), help=None)
veupath_chatbot.domain.parameters.specs.unwrap_search_data(details)[source]

Normalize WDK/discovery payload shape to the dict that contains parameters.

Parameters:

details (JSONObject | None) – Search details from WDK/discovery.

Returns:

Search data dict or None.

Return type:

JSONObject | None

veupath_chatbot.domain.parameters.specs.extract_param_specs(payload)[source]

Extract parameter spec dicts from a WDK payload.

Supports the canonical WDK paths (in priority order):
  1. payload["parameters"] – list or dict

  2. payload["paramMap"] – dict (name -> spec)

  3. payload["searchConfig"]["parameters"] – list or dict

  4. payload["searchConfig"]["paramMap"] – dict

Return type:

JSONArray

veupath_chatbot.domain.parameters.specs.adapt_param_specs(payload)[source]
Return type:

dict[str, ParamSpecNormalized]

veupath_chatbot.domain.parameters.specs.find_input_step_param(specs)[source]
Return type:

str | None

veupath_chatbot.domain.parameters.specs.find_missing_required_params(param_specs, parameters)[source]

Find required parameters that are missing or empty in the given values.

Shared by validation.py and param_validation.py to keep the required-check logic in a single place.

Parameters:
  • param_specs (JSONArray) – Raw WDK parameter spec dicts.

  • parameters (JSONObject) – Parameter values to check.

Returns:

List of missing required parameter names.

Return type:

list[str]

Normalize parameter values into WDK wire format.

Delegates validation and decoding to the shared dispatch chain in _value_helpers._process_value(), then applies WDK wire formatting: compound types (multi-pick lists, ranges, filter dicts/lists) are serialized as JSON strings.

class veupath_chatbot.domain.parameters.normalize.ParameterNormalizer(specs)[source]

Bases: ParameterValueMixin

Normalize parameter values using canonical parameter specs.

Produces WDK wire-safe values: multi-pick lists become JSON strings, ranges become JSON strings, filters become JSON strings. Does NOT expand selections to leaf terms – even when WDK marks a vocabulary as countOnlyLeaves, WDK handles that expansion itself.

specs: dict[str, ParamSpecNormalized]
normalize(parameters)[source]
Return type:

JSONObject

__init__(specs)

Canonicalize parameter values (API-friendly) using WDK parameter specs.

This module is the counterpart to domain/parameters/normalize:

  • normalize produces WDK wire-safe values (often strings/JSON strings).

  • canonicalize produces API-friendly canonical JSON shapes: multi-pick values become list[str], scalars become strings, range values become {min, max}, filter values become dict/list.

Delegates validation and decoding to the shared dispatch chain in _value_helpers._process_value(), then applies canonicalizer-specific post-processing (FAKE_ALL_SENTINEL rejection, leaf enforcement).

Used at API boundaries (plan normalization, validation) so the frontend can consume stable shapes without re-implementing coercion.

class veupath_chatbot.domain.parameters.canonicalize.ParameterCanonicalizer(specs)[source]

Bases: ParameterValueMixin

Canonicalize parameter values using canonical parameter specs.

specs: dict[str, ParamSpecNormalized]
canonicalize(parameters)[source]
Return type:

JSONObject

__init__(specs)

Shared helpers for decoding parameter values.

veupath_chatbot.domain.parameters._decode_values.decode_values(value, name)[source]
Return type:

list[JSONValue]

veupath_chatbot.domain.parameters._decode_values.parse_json5_value(raw)[source]
Return type:

JSONValue | None

Shared validation and coercion helpers for parameter processing.

Used by both ParameterNormalizer (wire-safe WDK values) and ParameterCanonicalizer (API-friendly canonical shapes).

The shared dispatch chain lives in ParameterValueMixin._process_value. Each consumer (normalizer / canonicalizer) calls it and then applies its own output formatting to the returned ProcessedParam.

class veupath_chatbot.domain.parameters._value_helpers.ParamKind(*values)[source]

Bases: Enum

Discriminator for the ProcessedParam tagged union.

MULTI_PICK = 1
SINGLE_PICK = 2
SCALAR = 3
RANGE = 4
FILTER = 5
INPUT_DATASET = 6
UNKNOWN = 7
EMPTY = 8
class veupath_chatbot.domain.parameters._value_helpers.ProcessedParam(kind, value)[source]

Bases: object

Intermediate result from the shared dispatch chain.

kind tells callers what was produced so they can apply output formatting (e.g. json.dumps for the wire normalizer, identity for the canonical API formatter).

value holds the decoded, validated, native-Python value:
  • MULTI_PICK -> list[str]

  • SINGLE_PICK -> str

  • SCALAR -> str

  • RANGE -> dict with min/max keys

  • FILTER -> dict | list | str

  • INPUT_DATASET -> str

  • UNKNOWN -> original JSONValue (pass-through)

  • EMPTY -> ""

kind: ParamKind
value: JSONValue
__init__(kind, value)
class veupath_chatbot.domain.parameters._value_helpers.ParameterValueMixin[source]

Bases: object

Shared helpers for ParameterNormalizer and ParameterCanonicalizer.

Vocabulary utilities.

veupath_chatbot.domain.parameters.vocab_utils.numeric_equivalent(a, b)[source]

Check if two string values represent the same number.

Handles precision differences between WDK vocab values (often floats) and imported strategy parameters (often full-precision decimals).

Return type:

bool

veupath_chatbot.domain.parameters.vocab_utils.match_vocab_value(*, vocab, param_name, value)[source]

Match a user-supplied value against a vocabulary, returning the canonical form.

Tries exact display match, exact value match, then numeric equivalence. Raises ValidationError if no match is found.

Return type:

str

veupath_chatbot.domain.parameters.vocab_utils.normalize_vocab_key(value)[source]
Return type:

str

veupath_chatbot.domain.parameters.vocab_utils.flatten_vocab(vocabulary, prefer_term=False)[source]
Return type:

list[dict[str, str | None]]

veupath_chatbot.domain.parameters.vocab_utils.get_node_term(node)[source]

Return the term string from a vocab tree node, or None.

Return type:

str | None

veupath_chatbot.domain.parameters.vocab_utils.get_vocab_children(node)[source]

Return typed child nodes from a vocab tree node.

Return type:

list[JSONObject]

veupath_chatbot.domain.parameters.vocab_utils.find_vocab_node(root, match)[source]

Find a node whose term or display equals match (DFS).

Return type:

JSONObject | None

veupath_chatbot.domain.parameters.vocab_utils.collect_leaf_terms(node)[source]

Collect all leaf term values under node (inclusive).

Return type:

list[str]

Strategy Tree Walkers

Purpose: Shared tree traversal utilities for strategy trees. Supports both dict-based (raw JSON) and AST-based (typed Pydantic) tree structures. Used by validation, compilation, and analysis.

Shared tree walkers for strategy trees.

Two families of trees appear throughout the codebase:

  1. Dict-based trees – raw WDK stepTree payloads or PlanStepNode.to_dict() output. Children live under "primaryInput" and "secondaryInput" keys.

  2. AST treesPlanStepNode objects with .primary_input / .secondary_input attributes.

This module provides generic, reusable walkers for both so that every call site does not need to re-implement the recursive descent.

veupath_chatbot.domain.strategy.tree.walk_dict_tree(root, visitor)[source]

Pre-order walk of a dict-based step tree.

Calls visitor on every node (the node dict itself), then recurses into primaryInput and secondaryInput when they are dicts.

No-ops silently if root is not a dict.

veupath_chatbot.domain.strategy.tree.collect_dict_nodes(root)[source]

Collect all nodes in a dict-based tree (pre-order).

Return type:

list[JSONObject]

veupath_chatbot.domain.strategy.tree.collect_dict_leaves(root)[source]

Collect leaf nodes (no primaryInput or secondaryInput) from a dict tree.

Return type:

list[JSONObject]

veupath_chatbot.domain.strategy.tree.collect_dict_combine_nodes(root)[source]

Collect combine (binary) nodes from a dict tree.

A combine node has both primaryInput and secondaryInput as dicts.

Return type:

list[JSONObject]

veupath_chatbot.domain.strategy.tree.count_dict_nodes(root)[source]

Count all nodes in a dict-based tree.

Return type:

int

veupath_chatbot.domain.strategy.tree.map_dict_tree(root, transform)[source]

Bottom-up map: apply transform to every node, children first.

Children are replaced with their transformed versions before the parent is passed to transform. The original tree is not mutated; each node dict is shallow-copied before transformation.

Return type:

JSONObject

veupath_chatbot.domain.strategy.tree.walk_plan_tree(root, visitor)[source]

Pre-order walk of a PlanStepNode AST.

Calls visitor on every node, then recurses into .primary_input and .secondary_input.

veupath_chatbot.domain.strategy.tree.collect_plan_nodes(root)[source]

Collect all AST nodes (pre-order).

Return type:

list[PlanStepNode]

veupath_chatbot.domain.strategy.tree.collect_plan_leaves(root)[source]

Collect leaf AST nodes (no primary or secondary input).

Return type:

list[PlanStepNode]

Strategy — Additional Modules

Compile strategy AST to WDK API calls.

class veupath_chatbot.domain.strategy.compile.StrategyCompilerAPI(*args, **kwargs)[source]

Bases: Protocol

I/O boundary for strategy compilation.

The compiler calls these methods to create WDK steps and datasets. Any object that satisfies this protocol can be injected – the real StrategyAPI from the integrations layer is one such object.

property client: _CompilerClient
async create_step(record_type, search_name, parameters, custom_name=None, wdk_weight=None)[source]
Return type:

JSONObject

async create_combined_step(primary_step_id, secondary_step_id, boolean_operator, record_type, custom_name=None, wdk_weight=None)[source]
Return type:

JSONObject

async create_transform_step(input_step_id, transform_name, parameters, record_type='transcript', custom_name=None, wdk_weight=None)[source]
Return type:

JSONObject

async create_dataset(ids)[source]
Return type:

int

__init__(*args, **kwargs)
class veupath_chatbot.domain.strategy.compile.StepDecoratorAPI(*args, **kwargs)[source]

Bases: Protocol

I/O boundary for post-compilation step decorations (filters, analyses, reports).

async set_step_filter(step_id, filter_name, value, disabled=False)[source]
Return type:

JSONValue

async run_step_analysis(step_id, analysis_type, parameters=None, custom_name=None)[source]
Return type:

JSONObject

async run_step_report(step_id, report_name, config=None)[source]
Return type:

JSONValue

__init__(*args, **kwargs)
class veupath_chatbot.domain.strategy.compile.CompiledStep(local_id, wdk_step_id, step_type, display_name)[source]

Bases: object

A compiled step with WDK step ID.

local_id: str
wdk_step_id: int
step_type: str
display_name: str
__init__(local_id, wdk_step_id, step_type, display_name)
class veupath_chatbot.domain.strategy.compile.CompilationResult(steps, step_tree, root_step_id)[source]

Bases: object

Result of compiling a strategy to WDK.

steps: list[CompiledStep]
step_tree: StepTreeNode
root_step_id: int
to_dict()[source]

Convert to dictionary.

Return type:

JSONObject

__init__(steps, step_tree, root_step_id)
class veupath_chatbot.domain.strategy.compile.StrategyCompiler(api, site_id=None, resolve_record_type=True, resolve_search_record_type=None)[source]

Bases: object

Compiles strategy AST to WDK API calls.

__init__(api, site_id=None, resolve_record_type=True, resolve_search_record_type=None)[source]
async compile(strategy)[source]

Compile strategy to WDK steps and tree.

This creates all steps via the WDK API and builds the step tree structure for creating the strategy.

Return type:

CompilationResult

async veupath_chatbot.domain.strategy.compile.apply_step_decorations(strategy, compiled_map, api)[source]

Apply filters, analyses, and reports to compiled WDK steps.

Post-compilation step: walks the strategy AST and applies any declared decorations (filters, analyses, reports) to each step’s WDK counterpart.

async veupath_chatbot.domain.strategy.compile.compile_strategy(strategy, api, site_id=None, resolve_record_type=True, resolve_search_record_type=None)[source]

Compile a strategy AST to WDK.

Return type:

CompilationResult

Generate human-readable explanations of strategies.

veupath_chatbot.domain.strategy.explain.explain_operation(op)[source]

Explain what a combine operation does.

Parameters:

op (CombineOp) – Combine operator.

Returns:

Human-readable explanation of the operation.

Return type:

str

Small helpers related to strategy graph metadata.

veupath_chatbot.domain.strategy.metadata.derive_graph_metadata(raw_goal)[source]
Return type:

tuple[str, str]

Stateful strategy session types (in-memory).

These types model the working state while a user (or an AI agent) is building a VEuPathDB strategy during a chat session.

class veupath_chatbot.domain.strategy.session.StrategyGraph(graph_id, name, site_id)[source]

Bases: object

State for a single strategy graph.

__init__(graph_id, name, site_id)[source]
invalidate_build()[source]

Clear WDK build state so stale counts are not shown.

Call after any mutation that changes step semantics (parameters, search_name, operator, delete). The next build_strategy call will re-populate step_counts and wdk_step_ids.

add_step(step)[source]

Add a step and maintain the subtree-root set.

The new step becomes a root. If it consumes existing roots as primary_input or secondary_input, those are removed from the root set (they are now internal nodes of the new step’s subtree).

Parameters:

step (PlanStepNode) – Step to add.

Returns:

Step ID.

Return type:

str

get_step(step_id)[source]

Get a step by ID.

Parameters:

step_id (str) – Step ID.

Returns:

Step or None.

Return type:

PlanStepNode | None

recompute_roots()[source]

Recompute roots from the current steps dict.

A root is any step that is not referenced as the primary_input or secondary_input of another step. Call this after bulk mutations (delete, hydration) where incremental root tracking is impractical.

save_history(description)[source]

Save current state to history.

Parameters:

description (str) – Description of the state.

undo()[source]

Undo to previous state.

Restores current_strategy and the derived graph state (steps, roots, last_step_id) so that tools that inspect the step graph see a consistent picture after undo.

Return type:

bool

class veupath_chatbot.domain.strategy.session.StrategySession(site_id)[source]

Bases: object

Session context for the active strategy (graph + chat).

__init__(site_id)[source]
add_graph(graph)[source]

Register an existing graph in the session.

Parameters:

graph (StrategyGraph) – Strategy graph to register.

create_graph(name, graph_id=None)[source]

Create a new empty graph and register it.

Parameters:
  • name (str) – Graph name.

  • graph_id (str | None) – Optional graph ID (default: None).

Returns:

The graph.

Return type:

StrategyGraph

get_graph(graph_id)[source]

Get graph by ID (or active graph if None).

Parameters:

graph_id (str | None) – Graph ID, or None for active graph.

Returns:

Graph or None.

Return type:

StrategyGraph | None

veupath_chatbot.domain.strategy.session.hydrate_graph_from_steps_data(graph, steps_data, *, root_step_id=None, record_type=None)[source]

Hydrate an in-memory graph from persisted flat steps.

This is used when we have a persisted steps list (and maybe root_step_id) but no canonical plan to parse into an AST. It enables tools like list_current_steps to reflect existing UI-visible nodes.

Accepts arbitrary input; non-list values are silently ignored.

Parameters:
  • graph (StrategyGraph) – Strategy graph to hydrate.

  • steps_data (JSONArray | object) – Flat steps list from persistence (or any value).

  • root_step_id (str | None) – Root step ID (default: None).

  • record_type (str | None) – Record type (default: None).

Research (Domain)

Purpose: Citation formatting and research output processing.

Citation domain types and utilities.

class veupath_chatbot.domain.research.citations.Citation(id: str, source: Literal['web', 'europepmc', 'crossref', 'openalex', 'semanticscholar', 'pubmed', 'arxiv', 'biorxiv', 'medrxiv'], title: str, url: str | None = None, authors: list[str] | None = None, year: int | None = None, doi: str | None = None, pmid: str | None = None, snippet: str | None = None, accessed_at: str | None = None)[source]

Bases: object

id: str
source: Literal['web', 'europepmc', 'crossref', 'openalex', 'semanticscholar', 'pubmed', 'arxiv', 'biorxiv', 'medrxiv']
title: str
url: str | None = None
authors: list[str] | None = None
year: int | None = None
doi: str | None = None
pmid: str | None = None
snippet: str | None = None
accessed_at: str | None = None
to_dict()[source]
Return type:

JSONObject

__init__(id, source, title, url=None, authors=None, year=None, doi=None, pmid=None, snippet=None, accessed_at=None)
veupath_chatbot.domain.research.citations.ensure_unique_citation_tags(citations)[source]

Ensure all citation tags are unique by appending suffixes if needed.

Parameters:

citations (list[JSONObject]) – Citation objects.