# privacy-analyzer-tamuct/privacy-compliance-checker architecture

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

- Interactive diagram: https://gitdiagram.com/privacy-analyzer-tamuct/privacy-compliance-checker
- Repository: https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker

## Overview

This is a web-based privacy-compliance analyzer for IoT manufacturers. The principal workflow is a user submitting or selecting a manufacturer policy, optionally identifying applicable states, and receiving law-specific compliance scores and knowledge-graph context. Separate maintenance workflows discover and check policy URLs, update policy history, and add or refresh regulation knowledge. The graph reflects the README’s local web-app description and the sampled modules; unsampled routes and storage wiring are represented only where supported by the excerpts or source index.

Main entry points: [`app.py`](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py) (Web UI and API), [`agentic_kg_discovery_ALTERNATIVEpt2.py`](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_kg_discovery_ALTERNATIVEpt2.py) (Agentic KG Writer), [`agentic_kg_discovery_ALTERNATIVE.py`](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_kg_discovery_ALTERNATIVE.py) (Agentic Discovery), [`agentic_policy_update_crawler.py`](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_policy_update_crawler.py) (Policy Crawler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Application"]
  node_webapp["Web UI and API<br/>[app.py]"]
end

subgraph group_analysis["Compliance Analysis"]
  node_state["State Detection"]
  node_scores["Policy Scoring<br/>[app.py]"]
  node_weighted["Weighted Grading"]
  node_kgcontext["KG Law Context<br/>[app.py]"]
end

subgraph group_policy["Policy Maintenance"]
  node_crawler["Policy Crawler"]
  node_discovery["Agentic Discovery"]
  node_writer["Agentic KG Writer"]
  node_timestamps["Policy History"]
end

subgraph group_regulations["Regulation Knowledge"]
  node_ontology[("Regulation Knowledge Graph")]
  node_regadd["Add Regulation"]
  node_regupdate["Refresh Regulation"]
  node_semantic["Semantic Extraction"]
end

node_user(("Analyst"))
node_websearch{{"Web Search Service"}}
node_llm{{"Groq LLM"}}

node_user -->|"uses"| node_webapp
node_webapp -->|"detects states"| node_state
node_webapp -->|"computes scores"| node_scores
node_webapp -->|"requests grading"| node_weighted
node_webapp -->|"queries context"| node_kgcontext
node_webapp -->|"reads graph"| node_ontology
node_webapp -->|"invokes crawler"| node_crawler
node_webapp -->|"runs discovery"| node_discovery
node_webapp -->|"runs writer"| node_writer
node_webapp -->|"records history"| node_timestamps
node_weighted -->|"requests weights"| node_llm
node_discovery -->|"searches and fetches"| node_crawler
node_discovery -->|"dispatches tools"| node_llm
node_writer -->|"queries and searches"| node_discovery
node_writer -->|"checks policy date"| node_crawler
node_writer -->|"marks checked"| node_timestamps
node_writer -->|"dispatches tools"| node_llm
node_crawler -->|"searches policies"| node_websearch
node_regadd -.->|"adds classes"| node_ontology
node_regadd -.->|"uses extraction pattern"| node_semantic
node_regupdate -.->|"refreshes annotations"| node_ontology

click node_webapp "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py"
click node_state "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step2_state_detector.py"
click node_scores "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py"
click node_weighted "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step3_agentic_weighted_grader.py"
click node_kgcontext "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py"
click node_ontology "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/data/knowledge_graph_n8259a/inferred_merged.rdf"
click node_crawler "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_policy_update_crawler.py"
click node_discovery "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_kg_discovery_ALTERNATIVE.py"
click node_writer "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_kg_discovery_ALTERNATIVEpt2.py"
click node_timestamps "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step4a_timestamps.py"
click node_regadd "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step1_add_regulation.py"
click node_regupdate "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step4b_regulation_update.py"
click node_semantic "https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/semantic_policy_extractor.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_webapp toneBlue
class node_state,node_scores,node_weighted,node_kgcontext toneAmber
class node_crawler,node_discovery,node_writer,node_timestamps toneMint
class node_ontology,node_regadd,node_regupdate,node_semantic toneRose
class node_user,node_websearch,node_llm toneIndigo
```

## Components

### Web Application

- [Web UI and API](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py): `app.py`

### Compliance Analysis

- [State Detection](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step2_state_detector.py): `step2_state_detector.py`
- [Policy Scoring](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py): `app.py`
- [Weighted Grading](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step3_agentic_weighted_grader.py): `step3_agentic_weighted_grader.py`
- [KG Law Context](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/app.py): `app.py`

### Policy Maintenance

- [Policy Crawler](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_policy_update_crawler.py): `agentic_policy_update_crawler.py`
- [Agentic Discovery](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_kg_discovery_ALTERNATIVE.py): `agentic_kg_discovery_ALTERNATIVE.py`
- [Agentic KG Writer](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/agentic_kg_discovery_ALTERNATIVEpt2.py): `agentic_kg_discovery_ALTERNATIVEpt2.py`
- [Policy History](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step4a_timestamps.py): `step4a_timestamps.py`

### Regulation Knowledge

- [Regulation Knowledge Graph](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/data/knowledge_graph_n8259a/inferred_merged.rdf): `data/knowledge_graph_n8259a/inferred_merged.rdf`
- [Add Regulation](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step1_add_regulation.py): `step1_add_regulation.py`
- [Refresh Regulation](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/step4b_regulation_update.py): `step4b_regulation_update.py`
- [Semantic Extraction](https://github.com/privacy-analyzer-tamuct/privacy-compliance-checker/blob/main/semantic_policy_extractor.py): `semantic_policy_extractor.py`

### Other components

- **Analyst**
- **Web Search Service**
- **Groq LLM**

## Connections

- Analyst → Web UI and API: uses (evidence: `README.md`)
- Web UI and API → State Detection: detects states (evidence: `app.py`)
- Web UI and API → Policy Scoring: computes scores (evidence: `app.py`)
- Web UI and API → Weighted Grading: requests grading (evidence: `app.py`)
- Web UI and API → KG Law Context: queries context (evidence: `app.py`)
- Web UI and API → Regulation Knowledge Graph: reads graph (evidence: `app.py`)
- Web UI and API → Policy Crawler: invokes crawler (evidence: `app.py`)
- Web UI and API → Agentic Discovery: runs discovery (evidence: `app.py`)
- Web UI and API → Agentic KG Writer: runs writer (evidence: `app.py`)
- Web UI and API → Policy History: records history (evidence: `app.py`)
- Weighted Grading → Groq LLM: requests weights (evidence: `step3_agentic_weighted_grader.py`)
- Agentic Discovery → Policy Crawler: searches and fetches (evidence: `agentic_kg_discovery_ALTERNATIVE.py`)
- Agentic Discovery → Groq LLM: dispatches tools (evidence: `agentic_kg_discovery_ALTERNATIVE.py`)
- Agentic KG Writer → Agentic Discovery: queries and searches (evidence: `agentic_kg_discovery_ALTERNATIVEpt2.py`)
- Agentic KG Writer → Policy Crawler: checks policy date (evidence: `agentic_kg_discovery_ALTERNATIVEpt2.py`)
- Agentic KG Writer → Policy History: marks checked (evidence: `agentic_kg_discovery_ALTERNATIVEpt2.py`)
- Agentic KG Writer → Groq LLM: dispatches tools (evidence: `agentic_kg_discovery_ALTERNATIVEpt2.py`)
- Policy Crawler → Web Search Service: searches policies (evidence: `agentic_policy_update_crawler.py`)
- Add Regulation → Regulation Knowledge Graph: adds classes
- Add Regulation → Semantic Extraction: uses extraction pattern
- Refresh Regulation → Regulation Knowledge Graph: refreshes annotations
