Skip to content

Results API

scinr.newton.results.DocumentResult dataclass

Result of processing a single document through a pipeline stage.

Attributes:

Name Type Description
document_name str

The Neo4j document_name (or filename stem) of the processed document.

nodes_processed int

Number of nodes (or files) successfully processed within this document. For stages 0-2, this is 1 for success, 0 for failure. For stages 3-4, this is the number of StructureNodes processed. For the tabular stage, this is the number of tables (sheets) written.

nodes_failed int

Number of nodes (or files) that failed processing within this document. For the tabular stage, the number of sheets with errors.

errors list[str]

List of error messages for this document. Empty on full success.

scinr.newton.results.StageResult dataclass

Aggregated result of running a single pipeline stage.

Attributes:

Name Type Description
stage str

Stage identifier. One of: 'preprocess', 'extraction', 'ingestion', 'annotation', 'entity_extraction', 'tabular'.

success bool

True if total_failed == 0 and no global errors occurred.

documents list[DocumentResult]

Per-document results. One DocumentResult per file or document processed.

total_processed int

Sum of nodes_processed across all DocumentResult entries.

total_failed int

Sum of nodes_failed across all DocumentResult entries.

duration_seconds float

Wall-clock time in seconds for the entire stage.

errors list[str]

Global stage-level errors not attributable to a specific document.

scinr.newton.results.PipelineResult dataclass

Aggregated result of a full run_pipeline() invocation.

Attributes:

Name Type Description
success bool

True only if every executed stage succeeded (no failures or errors).

total_duration_seconds float

Total wall-clock time for the entire pipeline run.

stages_executed list[str]

Ordered list of stage names that were actually run (skipped stages are not included).

preprocess StageResult | None

StageResult for Stage 0, or None if the stage was not executed.

extraction StageResult | None

StageResult for Stage 1, or None if the stage was not executed.

ingestion StageResult | None

StageResult for Stage 2, or None if the stage was not executed.

annotation StageResult | None

StageResult for Stage 3, or None if the stage was not executed.

entity_extraction StageResult | None

StageResult for Stage 4, or None if the stage was not executed.

tabular StageResult | None

StageResult for the tabular pipeline, or None if not executed.

scinr.newton.results.DeletionResult dataclass

Result of a delete_document() call — full Document + cascade + GC deletion.

Attributes:

Name Type Description
path str | None

The Document path that was targeted for deletion, or None when the deletion was selected by job_id instead.

version int | None

The specific version requested, or None if all versions were targeted.

job_id str | list[str] | tuple[str, ...] | None

The job_id selector (one value or several) that was targeted, or None when the deletion was selected by path instead.

tenant_id str | None

The tenant the deletion was scoped to (always applied), or None when it targeted public documents.

created_by_user_id str | list[str] | tuple[str, ...] | None

The created_by_user_id filter applied to the match, or None if no such filter was requested.

found bool

True if at least one matching Document existed before deletion. When False, all counters below are 0 and no delete or GC queries were executed.

versions_deleted list[int]

Sorted list of integer versions that matched and were deleted. Empty when found is False.

documents_deleted int

Number of :Document nodes deleted (the matched Document(s) plus any reached via IS_COMPOSED_OF*).

structure_nodes_deleted int

Number of :StructureNode nodes deleted.

info_units_deleted int

Number of :InfoUnit nodes deleted.

model_decisions_deleted int

Number of :ModelDecision nodes deleted.

proposed_models_deleted int

Number of :ProposedModel nodes deleted.

proposed_fields_deleted int

Number of :ProposedField nodes deleted.

extraction_results_deleted int

Number of :ExtractionResult nodes deleted.

gc_entity_model_instance_deleted int

:Entity/:ModelInstance nodes this deletion left orphaned, and deleted. Only the nodes that hung from the deleted :ExtractionResult nodes are checked, not the whole tenant (see collect_orphans() for that).

gc_entity_model_instance_passes int

Number of GC rounds run over :Entity/:ModelInstance candidates: 0 when there was none; one more each time a deleted node turned what it pointed at into candidates.

gc_labeled_entity_deleted int

:LabeledEntity nodes this deletion left orphaned, and deleted.

gc_labeled_entity_passes int

Number of GC rounds run over :LabeledEntity candidates.

raw_files_deleted int

Number of raw_file_ids for which deletion was attempted against the storage backend (GridFS + metadata), for the raw_file_ids referenced by the deleted Document(s) and their descendants. Idempotent — includes ids that were already absent, since delete() returns None either way.

converted_pages_deleted int

Number of ConvertedPageRecord (converted Markdown pages) deleted from the storage layer for the same raw_file_ids.

scinr.newton.results.OrphanCollectionResult dataclass

Result of a collect_orphans() call — sweep of every orphan of one tenant.

Attributes:

Name Type Description
tenant_id str | None

The tenant that was swept (API value: None = public).

gc_entity_model_instance_deleted int

:Entity/:ModelInstance nodes of the tenant deleted because no :ExtractionResult reached them.

gc_entity_model_instance_passes int

Iterations of the Entity/ModelInstance pass (each one checks every node of the tenant; it stops at the first iteration that deletes nothing, capped at GC_MAX_PASSES).

gc_labeled_entity_deleted int

:LabeledEntity nodes of the tenant deleted because nothing pointed at them.

gc_labeled_entity_passes int

Iterations of the LabeledEntity pass (same rule).

scinr.newton.results.FreezeResult dataclass

Result of a freeze_document() call — snapshot export + graph reduction.

Attributes:

Name Type Description
path str | None

The Document path targeted, or None when selected by job_id.

version int | None

The specific version requested, or None if all versions were targeted.

job_id str | list[str] | tuple[str, ...] | None

The job_id selector (one value or several) as passed by the caller, or None when selected by path.

tenant_id str | None

The tenant the freeze was scoped to (API value: None = public).

created_by_user_id str | list[str] | tuple[str, ...] | None

The created_by_user_id filter as passed, or None.

found bool

True if at least one Document matched. When False, every counter is 0 and nothing was exported, stored or mutated.

mode Literal['freeze', 'backup']

"freeze" (delete_after_export=True: the subtree was reduced and the Document(s) marked frozen=true) or "backup" (delete_after_export=False: only the snapshot was stored and last_backup_blob_id/last_backup_at set; the graph is intact).

frozen_blob_id str | None

Id of the stored snapshot in the freeze backend (in both modes), or None when nothing was found.

versions_frozen list[int]

Sorted versions of the Documents matched by the selector (IS_COMPOSED_OF* descendants not included).

documents_frozen int

Number of :Document nodes in the snapshot — frozen (mode="freeze") or backed up (mode="backup") — including the IS_COMPOSED_OF* descendants of the matched ones.

structure_nodes_deleted / structure_nodes_kept

:StructureNode nodes removed / left in place (keep_structure_nodes=True).

info_units_deleted int

:InfoUnit nodes removed (always, in mode="freeze").

model_decisions_deleted / model_decisions_kept

:ModelDecision nodes removed / kept (keep_annotations=True).

proposed_models_deleted / proposed_fields_deleted

:ProposedModel / :ProposedField nodes removed (keep_annotations=False).

extraction_results_deleted / extraction_results_kept

:ExtractionResult nodes removed / kept (keep_extraction_results=True).

gc_* / extraction_results_kept

Garbage-collection counters, same meaning as in DeletionResult (the orphans this freeze caused; always 0 with keep_extraction_results=True, which deletes no :ExtractionResult).

Every *_deleted / *_kept / gc_* counter is 0 in mode="backup".

scinr.newton.results.RestoreResult dataclass

Result of a restore_document() call — subtree rebuilt from its snapshot.

Attributes:

Name Type Description
path str | None

The Document path targeted, or None when selected by job_id.

version int | None

The specific version requested, or None if all versions were targeted.

job_id str | list[str] | tuple[str, ...] | None

The job_id selector as passed by the caller, or None.

tenant_id str | None

The tenant the restore was scoped to (API value: None = public).

created_by_user_id str | list[str] | tuple[str, ...] | None

The created_by_user_id filter as passed, or None.

found bool

True if at least one frozen Document matched. When False, every counter is 0 and nothing was read or written.

versions_restored list[int]

Sorted versions of the frozen Documents matched by the selector (folder descendants restored with them not included).

documents_restored int

Number of :Document nodes restored (matched ones plus the IS_COMPOSED_OF* descendants frozen in the same snapshot), stubs and recreated ones alike.

documents_recreated int

How many of them no longer existed in the graph (deleted, or restored from a backup) and were recreated.

frozen_blob_ids list[str]

Distinct snapshots the documents were restored from.

snapshots_deleted int

Snapshots deleted from the freeze backend because no other Document of the tenant still references them.

nodes_created int

Nodes created from the snapshot (recreated :Document nodes included).

nodes_reused int

Snapshot nodes that already existed and were reused via MERGE (kept :StructureNode trees, shared :ModelInstance/:Entity/:LabeledEntity, catalog nodes are not counted).

relationships_created int

Relationships recreated from the snapshot (those that already existed with the same properties are not duplicated).

gc_* int

Garbage-collection counters of a sweep of the whole tenant (same meaning as in OrphanCollectionResult); 0 when the restore deleted no stale :ExtractionResult (the GC is then skipped).