tools.feature_atlas.import_interaction_analysis module

Step 6: Import interaction analyses into FalkorDB.

Reads outputs/interaction_analyses.jsonl and MERGEs each analysis as an InteractionAnalysis node linked from its InteractionPrompt.

Usage:

python -m tools.feature_atlas.import_interaction_analysis

# skull – WRITING THE DIAGNOSIS

async tools.feature_atlas.import_interaction_analysis.import_analyses(analyses=None)[source]

Persist every interaction analysis into the atlas knowledge graph.

This is Step 6 of the Feature Atlas pipeline: it takes the per-pair analyses produced by the Gemini analysis swarm and writes each one into FalkorDB so the atlas captures how feature pairs interact, not just that they do. Persisting the analyses here is what makes the downstream query and demo-export steps able to surface real interaction insight.

Opens a connection to the stargazer_feature_interaction_atlas graph via get_atlas_graph (which talks to FalkorDB over the shared Redis connection pool), then MERGEs each record through merge_interaction_analysis so the import is idempotent and safe to re-run. When no analyses argument is supplied it falls back to _load_analyses(), reading outputs/interaction_analyses.jsonl from the local filesystem. Per-record failures are logged and skipped rather than aborting the batch, and after the loop it runs a read-only count(InteractionAnalysis) query to log a verification total before closing the Redis client. Called by async_main() in this module, which is in turn dispatched as Step 6 by run_atlas.py‘s step_import_analyses (imported there as async_main as run).

Parameters:

analyses (list[dict[str, Any]] | None) – Optional pre-loaded list of analysis dicts (each typically carrying source_id/target_id keys). When None, the analyses are read from outputs/interaction_analyses.jsonl via _load_analyses().

Returns:

The number of analyses successfully MERGEd into the atlas graph (records that raised during the merge are excluded from the count).

Return type:

int

async tools.feature_atlas.import_interaction_analysis.async_main()[source]

Run Step 6 end to end: load the analyses and import them into FalkorDB.

This is the coroutine that actually performs the import for command-line and orchestrated runs. It reads the analysis JSONL once for an accurate denominator, drives the FalkorDB import, and prints a human-readable summary so an operator can see how the step fared at a glance.

Reads outputs/interaction_analyses.jsonl via _load_analyses(), delegates the graph writes to import_analyses() (which connects to the stargazer_feature_interaction_atlas graph in FalkorDB), times the run, and writes a formatted report to stdout. It is invoked both by main() here (via asyncio.run) and by run_atlas.py‘s step_import_analyses, which imports it as async_main as run and awaits it directly.

Returns:

All output is side effects – the FalkorDB writes performed by import_analyses() and the summary printed to stdout.

Return type:

None

tools.feature_atlas.import_interaction_analysis.main()[source]

Synchronous CLI entry point for the Step 6 import.

Provides the python -m tools.feature_atlas.import_interaction_analysis entry point so the import can be run standalone. It exists to bridge the synchronous shell invocation into the async pipeline and to make sure progress is visible on the console.

Configures root logging at INFO level (so the per-record import logs and the verification count emitted under import_analyses() are shown), then runs async_main() to completion via asyncio.run. Called only from this module’s if __name__ == "__main__" guard; the orchestrated path in run_atlas.py awaits async_main() directly and does not go through this function.

Return type:

None

Returns:

None.