# sanjayrk2007/ai_exposure_radar architecture

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

- Interactive diagram: https://gitdiagram.com/sanjayrk2007/ai_exposure_radar
- Repository: https://github.com/sanjayrk2007/ai_exposure_radar

## Overview

AI Exposure Radar is a private vendor-evidence analysis project. The user workflow begins with read-only workbook profile inspection, then bounded webpage collection and local document capture; M4 can extract terminology-matched spans, assess specificity, validate exact quotes, and produce a coverage-aware vendor verdict. A separate training/evaluation branch compares specificity models using manually reviewed labels, while synthetic-data experiments remain explicitly separate from real evidence. The excerpts show integration-runner calls and module references, but not every downstream workflow; uncertain connections are omitted.

Main entry points: [`m4_intel/specificity.py`](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/specificity.py) (Rule specificity), [`m4_intel/run_synthetic_experiment.py`](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/run_synthetic_experiment.py) (Synthetic experiment), [`radar/collector.py`](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/collector.py) (Page collection), [`m4_intel/train_specificity.py`](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/train_specificity.py) (Specificity training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and collection"]
  node_profile_reader["Profile inspection"]
  node_collector["Page collection<br/>[collector.py]"]
end

subgraph group_analysis["Evidence analysis"]
  node_candidate_extraction["Candidate extraction<br/>[candidates.py]"]
  node_specificity_rules["Rule specificity<br/>[specificity.py]"]
  node_quote_verification["Quote verification<br/>[verify.py]"]
  node_pipeline_runner["Integration runner<br/>[run_pipeline.py]"]
  node_vendor_verdict["Vendor verdict<br/>[verdict.py]"]
  node_review_queue["Review queues"]
  node_candidate_expansion["Candidate expansion"]
end

subgraph group_evaluation["Model evaluation"]
  node_model_training["Specificity training"]
  node_inference_helper["Scoring helper<br/>[scoring.py]"]
  node_synthetic_generator["Synthetic data"]
  node_synthetic_experiment["Synthetic experiment"]
end

subgraph group_contracts["Shared contracts"]
  node_data_contracts["Evidence contracts<br/>[models.py]"]
end

node_analyst(("Analyst"))
node_workbook["Vendor workbook"]
node_local_evidence[("Local evidence")]

node_analyst -->|"provides"| node_workbook
node_workbook -->|"reads profiles"| node_profile_reader
node_analyst -->|"starts collection"| node_collector
node_collector -->|"reads profiles"| node_profile_reader
node_collector -->|"stores pages"| node_local_evidence
node_candidate_expansion -->|"uses candidates"| node_candidate_extraction
node_candidate_extraction -->|"supports scoring"| node_specificity_rules
node_specificity_rules -->|"uses contracts"| node_data_contracts
node_pipeline_runner -->|"verifies quotes"| node_quote_verification
node_pipeline_runner -->|"scores candidates"| node_specificity_rules
node_quote_verification -->|"creates signals"| node_data_contracts
node_vendor_verdict -->|"returns verdict"| node_data_contracts
node_model_training -->|"evaluates rules"| node_specificity_rules
node_inference_helper -->|"loads model"| node_model_training
node_synthetic_experiment -->|"generates examples"| node_synthetic_generator
node_synthetic_experiment -->|"reuses training"| node_model_training
node_synthetic_experiment -->|"compares rules"| node_specificity_rules

click node_profile_reader "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/input_inspection.py"
click node_collector "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/collector.py"
click node_candidate_extraction "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/candidates.py"
click node_specificity_rules "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/specificity.py"
click node_quote_verification "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/verify.py"
click node_pipeline_runner "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/run_pipeline.py"
click node_vendor_verdict "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/verdict.py"
click node_review_queue "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/build_real_label_review_queue.py"
click node_candidate_expansion "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/expand_candidates.py"
click node_model_training "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/train_specificity.py"
click node_inference_helper "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/scoring.py"
click node_synthetic_generator "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/generate_synthetic_data.py"
click node_synthetic_experiment "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/run_synthetic_experiment.py"
click node_data_contracts "https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/contracts/models.py"

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_profile_reader,node_collector toneBlue
class node_candidate_extraction,node_specificity_rules,node_quote_verification,node_pipeline_runner,node_vendor_verdict,node_review_queue,node_candidate_expansion,node_local_evidence toneAmber
class node_model_training,node_inference_helper,node_synthetic_generator,node_synthetic_experiment toneMint
class node_data_contracts toneRose
class node_analyst,node_workbook toneIndigo
```

## Components

### Inputs and collection

- [Profile inspection](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/input_inspection.py): `radar/input_inspection.py`
- [Page collection](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/collector.py): `radar/collector.py`

### Evidence analysis

- [Candidate extraction](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/candidates.py): `m4_intel/candidates.py`
- [Rule specificity](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/specificity.py): `m4_intel/specificity.py`
- [Quote verification](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/verify.py): `m4_intel/verify.py`
- [Integration runner](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/run_pipeline.py): `m4_intel/run_pipeline.py`
- [Vendor verdict](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/verdict.py): `m4_intel/verdict.py`
- [Review queues](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/build_real_label_review_queue.py): `m4_intel/build_real_label_review_queue.py`
- [Candidate expansion](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/expand_candidates.py): `m4_intel/expand_candidates.py`

### Model evaluation

- [Specificity training](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/train_specificity.py): `m4_intel/train_specificity.py`
- [Scoring helper](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/scoring.py): `m4_intel/scoring.py`
- [Synthetic data](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/generate_synthetic_data.py): `m4_intel/generate_synthetic_data.py`
- [Synthetic experiment](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/m4_intel/run_synthetic_experiment.py): `m4_intel/run_synthetic_experiment.py`

### Shared contracts

- [Evidence contracts](https://github.com/sanjayrk2007/ai_exposure_radar/blob/main/radar/contracts/models.py): `radar/contracts/models.py`

### Other components

- **Analyst**
- **Vendor workbook**
- **Local evidence**

## Connections

- Analyst → Vendor workbook: provides (evidence: `README.md`)
- Vendor workbook → Profile inspection: reads profiles (evidence: `README.md`)
- Analyst → Page collection: starts collection (evidence: `radar/collector.py`)
- Page collection → Profile inspection: reads profiles (evidence: `radar/collector.py`)
- Page collection → Local evidence: stores pages (evidence: `radar/collector.py`)
- Candidate expansion → Candidate extraction: uses candidates (evidence: `m4_intel/expand_candidates.py`)
- Candidate extraction → Rule specificity: supports scoring (evidence: `m4_intel/specificity.py`)
- Rule specificity → Evidence contracts: uses contracts (evidence: `m4_intel/specificity.py`)
- Integration runner → Quote verification: verifies quotes (evidence: `m4_intel/run_pipeline.py`)
- Integration runner → Rule specificity: scores candidates (evidence: `m4_intel/run_pipeline.py`)
- Quote verification → Evidence contracts: creates signals (evidence: `m4_intel/verify.py`)
- Vendor verdict → Evidence contracts: returns verdict (evidence: `m4_intel/verdict.py`)
- Specificity training → Rule specificity: evaluates rules (evidence: `m4_intel/train_specificity.py`)
- Scoring helper → Specificity training: loads model (evidence: `m4_intel/scoring.py`)
- Synthetic experiment → Synthetic data: generates examples (evidence: `m4_intel/run_synthetic_experiment.py`)
- Synthetic experiment → Specificity training: reuses training (evidence: `m4_intel/run_synthetic_experiment.py`)
- Synthetic experiment → Rule specificity: compares rules (evidence: `m4_intel/run_synthetic_experiment.py`)
