How ida7jhu/csit998_group10 works
n1-optimizer reads Python source without executing it, identifies inefficient database-use patterns, and suggests faster code. The user supplies a file or stdin through the CLI; the pipeline builds structured facts, optionally logs them, and requests AI suggestions when Ollama is available. The analyzer also creates deterministic SQL rewrites for patterns it recognizes, which take precedence over overlapping model findings. The tool never connects to a database. Edges follow README statements and shown imports/calls; unsampled implementation details are not inferred.
Main entry points: ast_builder.py Source analyzer · pipeline.py Analysis pipeline · llm_optimizer.py Suggestion processor · ast_model.py Procedure facts
Components 13
User interface
- Command-line interface
cli.py - Analysis pipeline
n1_optimizer/pipeline.py
Static analysis
- Source analyzer
n1_optimizer/ast_builder.py - Procedure facts
n1_optimizer/ast_model.py - SQL fact helpers
n1_optimizer/sql_facts.py - Value SQL helpers
n1_optimizer/value_sql.py - SQL rewrite builder
n1_optimizer/rewrites.py
Optimization suggestions
- Suggestion processor
n1_optimizer/llm_optimizer.py - Ollama client
n1_optimizer/ollama_client.py
Run logs
- Facts log
n1_optimizer/ast_log.py - Prompt log
n1_optimizer/llm_log.py
Other components
- Source author
- Ollama model server
Connections 14
- Source author → Command-line interface: provides source
README.md - Command-line interface → Analysis pipeline: starts analysis
README.md - Analysis pipeline → Source analyzer: builds facts
n1_optimizer/pipeline.py - Source analyzer → Procedure facts: builds facts
n1_optimizer/ast_builder.py - Source analyzer → SQL fact helpers: uses helpers
n1_optimizer/ast_builder.py - Source analyzer → Value SQL helpers: uses helpers
n1_optimizer/ast_builder.py - Source analyzer → SQL rewrite builder: builds rewrites
n1_optimizer/ast_builder.py - SQL rewrite builder → Procedure facts: reads facts
n1_optimizer/rewrites.py - Analysis pipeline → Facts log: logs facts
n1_optimizer/pipeline.py - Analysis pipeline → Suggestion processor: requests suggestions
n1_optimizer/pipeline.py - Suggestion processor → Procedure facts: reads facts
n1_optimizer/llm_optimizer.py - Suggestion processor → Ollama client: requests generation
n1_optimizer/llm_optimizer.py - Ollama client → Ollama model server: sends prompts
n1_optimizer/ollama_client.py - Suggestion processor → Prompt log: logs prompt
n1_optimizer/llm_optimizer.py