# saatvika04/course_eligibility_reasoner architecture

> Architecture diagram of the GitHub repository saatvika04/course_eligibility_reasoner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saatvika04/course_eligibility_reasoner
- Repository: https://github.com/saatvika04/course_eligibility_reasoner

## Overview

This repository provides a course-eligibility knowledge-base module, two reasoning paths, and a command-line query workflow, with a separate evaluation and benchmarking workflow. The CLI loads and checks a knowledge base, invokes forward or backward reasoning, and presents an eligibility verdict and trace. Predicate conversion and KB validation are distinct internal layers. The README documents the standalone stub prover and KB generation; source excerpts show evaluation, metrics, and plotting calls. Some benchmark details and data-file internals were not sampled, so their relationships are limited to explicit references.

Main entry points: [`evaluate.py`](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/evaluate.py) (Evaluation runner), [`cli.py`](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/cli.py) (Eligibility CLI), [`kb_loader.py`](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/kb_loader.py) (KB load and validation), [`reasoning_engine.py`](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/reasoning_engine.py) (Forward and backward reasoning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kb["Knowledge base"]
  node_kb_loader["KB load and validation<br/>[kb_loader.py]"]
  node_kb_data["Demo knowledge base"]
  node_generator["Synthetic KB generation<br/>[generate_kb.py]"]
end

subgraph group_reasoning["Reasoning"]
  node_predicate["Predicate conversion<br/>[to_predicates.py]"]
  node_engine["Forward and backward reasoning"]
  node_stub["Stub backward prover<br/>[stub_engine.py]"]
end

subgraph group_evaluation["Evaluation and benchmarks"]
  node_evaluation_cases["Labelled eligibility cases"]
  node_evaluate["Evaluation runner<br/>[evaluate.py]"]
  node_benchmark["Benchmark runner<br/>[benchmark.py]"]
  node_metrics["Timing and result metrics<br/>[metrics.py]"]
  node_plot["Benchmark plots<br/>[plot_results.py]"]
  node_results["Evaluation and benchmark CSVs"]
end

subgraph group_interface["User interface"]
  node_cli["Eligibility CLI<br/>[cli.py]"]
end

node_user(("Course query user"))

node_user -->|"submits query"| node_cli
node_cli -->|"loads and checks"| node_kb_loader
node_cli -->|"invokes algorithm"| node_engine
node_cli -->|"checks cycles"| node_kb_loader
node_kb_data -->|"loaded as KB"| node_kb_loader
node_engine -->|"converts KB"| node_predicate
node_stub -->|"converts KB"| node_predicate
node_generator -->|"saves through"| node_kb_loader
node_evaluate -->|"builds cases"| node_evaluation_cases
node_evaluate -->|"runs algorithms"| node_engine
node_evaluate -->|"runs benchmarks"| node_benchmark
node_evaluate -->|"measures calls"| node_metrics
node_evaluate -->|"generates plots"| node_plot
node_evaluate -.->|"writes results"| node_results
node_plot -->|"reads benchmark CSV"| node_results

click node_cli "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/cli.py"
click node_kb_loader "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/kb_loader.py"
click node_kb_data "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/data/knowledge_base.json"
click node_predicate "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/to_predicates.py"
click node_engine "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/reasoning_engine.py"
click node_stub "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/stub_engine.py"
click node_generator "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/generate_kb.py"
click node_evaluation_cases "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/evaluation_cases.py"
click node_evaluate "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/evaluate.py"
click node_benchmark "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/benchmark.py"
click node_metrics "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/metrics.py"
click node_plot "https://github.com/saatvika04/course_eligibility_reasoner/blob/main/plot_results.py"
click node_results "https://github.com/saatvika04/course_eligibility_reasoner/tree/main/results"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_kb_loader,node_kb_data,node_generator,node_user toneBlue
class node_predicate,node_engine,node_stub toneAmber
class node_evaluation_cases,node_evaluate,node_benchmark,node_metrics,node_plot,node_results toneMint
class node_cli toneRose
```

## Components

### Knowledge base

- [KB load and validation](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/kb_loader.py): `kb_loader.py`
- [Demo knowledge base](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/data/knowledge_base.json): `data/knowledge_base.json`
- [Synthetic KB generation](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/generate_kb.py): `generate_kb.py`

### Reasoning

- [Predicate conversion](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/to_predicates.py): `to_predicates.py`
- [Forward and backward reasoning](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/reasoning_engine.py): `reasoning_engine.py`
- [Stub backward prover](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/stub_engine.py): `stub_engine.py`

### Evaluation and benchmarks

- [Labelled eligibility cases](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/evaluation_cases.py): `evaluation_cases.py`
- [Evaluation runner](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/evaluate.py): `evaluate.py`
- [Benchmark runner](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/benchmark.py): `benchmark.py`
- [Timing and result metrics](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/metrics.py): `metrics.py`
- [Benchmark plots](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/plot_results.py): `plot_results.py`
- [Evaluation and benchmark CSVs](https://github.com/saatvika04/course_eligibility_reasoner/tree/main/results): `results`

### User interface

- [Eligibility CLI](https://github.com/saatvika04/course_eligibility_reasoner/blob/main/cli.py): `cli.py`

### Other components

- **Course query user**

## Connections

- Course query user → Eligibility CLI: submits query (evidence: `README.md`)
- Eligibility CLI → KB load and validation: loads and checks (evidence: `cli.py`)
- Eligibility CLI → Forward and backward reasoning: invokes algorithm (evidence: `cli.py`)
- Eligibility CLI → KB load and validation: checks cycles (evidence: `cli.py`)
- Demo knowledge base → KB load and validation: loaded as KB (evidence: `README.md`)
- Forward and backward reasoning → Predicate conversion: converts KB (evidence: `reasoning_engine.py`)
- Stub backward prover → Predicate conversion: converts KB (evidence: `stub_engine.py`)
- Synthetic KB generation → KB load and validation: saves through (evidence: `generate_kb.py`)
- Evaluation runner → Labelled eligibility cases: builds cases (evidence: `evaluate.py`)
- Evaluation runner → Forward and backward reasoning: runs algorithms (evidence: `evaluate.py`)
- Evaluation runner → Benchmark runner: runs benchmarks (evidence: `evaluate.py`)
- Evaluation runner → Timing and result metrics: measures calls (evidence: `evaluate.py`)
- Evaluation runner → Benchmark plots: generates plots (evidence: `evaluate.py`)
- Evaluation runner → Evaluation and benchmark CSVs: writes results
- Benchmark plots → Evaluation and benchmark CSVs: reads benchmark CSV (evidence: `plot_results.py`)
