# aarondyl/datashield architecture

> Architecture diagram of the GitHub repository aarondyl/datashield, 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/aarondyl/datashield
- Repository: https://github.com/aarondyl/datashield

## Overview

DataShield is a business-facing data-compliance platform with a developer workflow: users maintain company/product profiles, assess compliance, inspect regulatory impact and evidence, then work through remediation. The React app calls a FastAPI backend; deterministic assessment and policy tools coexist with LangGraph impact analysis and RAG-based regulation retrieval. Regulations and operational records persist through SQLAlchemy, using PostgreSQL/pgvector or SQLite with a local vector index. The graph reflects documented capabilities and indexed references; unsampled agent internals are not assumed to have specific call relationships.

Main entry points: [`backend/app/main.py`](https://github.com/aarondyl/datashield/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.tsx`](https://github.com/aarondyl/datashield/blob/main/frontend/src/App.tsx) (React application), [`backend/app/db/session.py`](https://github.com/aarondyl/datashield/blob/main/backend/app/db/session.py) (SQL database / pgvector), [`backend/app/api/compliance.py`](https://github.com/aarondyl/datashield/blob/main/backend/app/api/compliance.py) (Compliance API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web application"]
  node_webapp["React application<br/>[App.tsx]"]
  node_profiles["Company and product profiles<br/>[ProductsPage.tsx]"]
  node_assessment_ui["Self-assessment"]
  node_impact_ui["Impact analysis reports<br/>[AnalyzePage.tsx]"]
  node_regulations_ui["Regulation library"]
  node_privacy_ui["Privacy policy tools"]
  node_developer_ui["Developer readiness tools"]
  node_shared_ui["Shared UI components"]
end

subgraph group_api["API workflows"]
  node_app_entry["FastAPI application<br/>[main.py]"]
  node_profile_api["Company and product APIs<br/>[companies.py]"]
  node_assessment_api["Compliance API<br/>[compliance.py]"]
  node_impact_api["Impact analysis API<br/>[analysis.py]"]
  node_regulation_api["Regulation API<br/>[regulations.py]"]
  node_developer_api["Developer tools API<br/>[developer.py]"]
end

subgraph group_analysis["Compliance intelligence"]
  node_rules["Assessment and policy logic<br/>[rules.py]"]
  node_compliance_support["Questionnaire, reports, roadmap"]
  node_agent["Impact agent workflow<br/>[graph.py]"]
  node_agent_state["Agent state<br/>[state.py]"]
end

subgraph group_knowledge["Regulation knowledge"]
  node_rag_ingest["Regulation ingestion<br/>[ingestion.py]"]
  node_rag_retrieval["Vector retrieval<br/>[retrieval.py]"]
  node_regulation_content["Preloaded regulation content"]
end

subgraph group_platform["Persistence and models"]
  node_database[("SQL database / pgvector<br/>[session.py]")]
  node_models["Domain records"]
  node_llm["Configured LLM provider<br/>[llm.py]"]
end

node_user(("Business / developer user"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_profiles
node_webapp -->|"routes to"| node_assessment_ui
node_webapp -->|"routes to"| node_impact_ui
node_webapp -->|"routes to"| node_regulations_ui
node_webapp -->|"routes to"| node_privacy_ui
node_webapp -->|"routes to"| node_developer_ui
node_profiles -->|"renders"| node_shared_ui
node_webapp -->|"calls API"| node_app_entry
node_app_entry -->|"registers"| node_profile_api
node_app_entry -->|"registers"| node_assessment_api
node_app_entry -->|"registers"| node_impact_api
node_app_entry -->|"registers"| node_regulation_api
node_app_entry -->|"registers"| node_developer_api
node_assessment_api -->|"evaluates"| node_rules
node_assessment_api -->|"uses"| node_compliance_support
node_impact_api -->|"invokes"| node_agent
node_agent -->|"uses state"| node_agent_state
node_agent -.->|"retrieves evidence"| node_rag_retrieval
node_agent -.->|"uses model"| node_llm
node_regulation_api -.->|"imports ingestion"| node_rag_ingest
node_rag_ingest -->|"indexes chunks"| node_rag_retrieval
node_rag_ingest -->|"writes regulation data"| node_database
node_rag_retrieval -->|"queries articles"| node_database
node_rules -->|"reads rules data"| node_regulation_content
node_app_entry -->|"initializes"| node_database
node_app_entry -->|"rebuilds local index"| node_rag_retrieval
node_app_entry -->|"seeds records"| node_models
node_profile_api -->|"uses sessions"| node_database
node_assessment_api -->|"uses sessions"| node_database
node_impact_api -->|"uses sessions"| node_database
node_developer_api -->|"uses sessions"| node_database
node_database -->|"maps records"| node_models

click node_webapp "https://github.com/aarondyl/datashield/blob/main/frontend/src/App.tsx"
click node_profiles "https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/ProductsPage.tsx"
click node_assessment_ui "https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/SelfAssessmentPage.tsx"
click node_impact_ui "https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/AnalyzePage.tsx"
click node_regulations_ui "https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/RegulationsPage.tsx"
click node_privacy_ui "https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/PrivacyToolsPage.tsx"
click node_developer_ui "https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/DeveloperIssuesPage.tsx"
click node_shared_ui "https://github.com/aarondyl/datashield/tree/main/frontend/src/components"
click node_app_entry "https://github.com/aarondyl/datashield/blob/main/backend/app/main.py"
click node_profile_api "https://github.com/aarondyl/datashield/blob/main/backend/app/api/companies.py"
click node_assessment_api "https://github.com/aarondyl/datashield/blob/main/backend/app/api/compliance.py"
click node_impact_api "https://github.com/aarondyl/datashield/blob/main/backend/app/api/analysis.py"
click node_regulation_api "https://github.com/aarondyl/datashield/blob/main/backend/app/api/regulations.py"
click node_developer_api "https://github.com/aarondyl/datashield/blob/main/backend/app/api/developer.py"
click node_rules "https://github.com/aarondyl/datashield/blob/main/backend/app/compliance/rules.py"
click node_compliance_support "https://github.com/aarondyl/datashield/tree/main/backend/app/compliance"
click node_agent "https://github.com/aarondyl/datashield/blob/main/backend/app/agents/graph.py"
click node_agent_state "https://github.com/aarondyl/datashield/blob/main/backend/app/agents/state.py"
click node_rag_ingest "https://github.com/aarondyl/datashield/blob/main/backend/app/rag/ingestion.py"
click node_rag_retrieval "https://github.com/aarondyl/datashield/blob/main/backend/app/rag/retrieval.py"
click node_regulation_content "https://github.com/aarondyl/datashield/blob/main/backend/app/compliance/regulations_data.py"
click node_database "https://github.com/aarondyl/datashield/blob/main/backend/app/db/session.py"
click node_models "https://github.com/aarondyl/datashield/tree/main/backend/app/models"
click node_llm "https://github.com/aarondyl/datashield/blob/main/backend/app/core/llm.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,node_profiles,node_assessment_ui,node_impact_ui,node_regulations_ui,node_privacy_ui,node_developer_ui,node_shared_ui,node_user toneBlue
class node_app_entry,node_profile_api,node_assessment_api,node_impact_api,node_regulation_api,node_developer_api toneAmber
class node_rules,node_compliance_support,node_agent,node_agent_state toneMint
class node_rag_ingest,node_rag_retrieval,node_regulation_content toneRose
class node_database,node_models,node_llm toneIndigo
```

## Components

### Web application

- [React application](https://github.com/aarondyl/datashield/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Company and product profiles](https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/ProductsPage.tsx): `frontend/src/pages/ProductsPage.tsx`
- [Self-assessment](https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/SelfAssessmentPage.tsx): `frontend/src/pages/SelfAssessmentPage.tsx`
- [Impact analysis reports](https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/AnalyzePage.tsx): `frontend/src/pages/AnalyzePage.tsx`
- [Regulation library](https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/RegulationsPage.tsx): `frontend/src/pages/RegulationsPage.tsx`
- [Privacy policy tools](https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/PrivacyToolsPage.tsx): `frontend/src/pages/PrivacyToolsPage.tsx`
- [Developer readiness tools](https://github.com/aarondyl/datashield/blob/main/frontend/src/pages/DeveloperIssuesPage.tsx): `frontend/src/pages/DeveloperIssuesPage.tsx`
- [Shared UI components](https://github.com/aarondyl/datashield/tree/main/frontend/src/components): `frontend/src/components`

### API workflows

- [FastAPI application](https://github.com/aarondyl/datashield/blob/main/backend/app/main.py): `backend/app/main.py`
- [Company and product APIs](https://github.com/aarondyl/datashield/blob/main/backend/app/api/companies.py): `backend/app/api/companies.py`
- [Compliance API](https://github.com/aarondyl/datashield/blob/main/backend/app/api/compliance.py): `backend/app/api/compliance.py`
- [Impact analysis API](https://github.com/aarondyl/datashield/blob/main/backend/app/api/analysis.py): `backend/app/api/analysis.py`
- [Regulation API](https://github.com/aarondyl/datashield/blob/main/backend/app/api/regulations.py): `backend/app/api/regulations.py`
- [Developer tools API](https://github.com/aarondyl/datashield/blob/main/backend/app/api/developer.py): `backend/app/api/developer.py`

### Compliance intelligence

- [Assessment and policy logic](https://github.com/aarondyl/datashield/blob/main/backend/app/compliance/rules.py): `backend/app/compliance/rules.py`
- [Questionnaire, reports, roadmap](https://github.com/aarondyl/datashield/tree/main/backend/app/compliance): `backend/app/compliance`
- [Impact agent workflow](https://github.com/aarondyl/datashield/blob/main/backend/app/agents/graph.py): `backend/app/agents/graph.py`
- [Agent state](https://github.com/aarondyl/datashield/blob/main/backend/app/agents/state.py): `backend/app/agents/state.py`

### Regulation knowledge

- [Regulation ingestion](https://github.com/aarondyl/datashield/blob/main/backend/app/rag/ingestion.py): `backend/app/rag/ingestion.py`
- [Vector retrieval](https://github.com/aarondyl/datashield/blob/main/backend/app/rag/retrieval.py): `backend/app/rag/retrieval.py`
- [Preloaded regulation content](https://github.com/aarondyl/datashield/blob/main/backend/app/compliance/regulations_data.py): `backend/app/compliance/regulations_data.py`

### Persistence and models

- [SQL database / pgvector](https://github.com/aarondyl/datashield/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Domain records](https://github.com/aarondyl/datashield/tree/main/backend/app/models): `backend/app/models`
- [Configured LLM provider](https://github.com/aarondyl/datashield/blob/main/backend/app/core/llm.py): `backend/app/core/llm.py`

### Other components

- **Business / developer user**

## Connections

- Business / developer user → React application: uses (evidence: `README.md`)
- React application → Company and product profiles: routes to (evidence: `frontend/src/App.tsx`)
- React application → Self-assessment: routes to (evidence: `frontend/src/App.tsx`)
- React application → Impact analysis reports: routes to (evidence: `frontend/src/App.tsx`)
- React application → Regulation library: routes to (evidence: `frontend/src/App.tsx`)
- React application → Privacy policy tools: routes to (evidence: `frontend/src/App.tsx`)
- React application → Developer readiness tools: routes to (evidence: `frontend/src/App.tsx`)
- Company and product profiles → Shared UI components: renders (evidence: `frontend/src/pages/ProductsPage.tsx`)
- React application → FastAPI application: calls API (evidence: `README.md`)
- FastAPI application → Company and product APIs: registers (evidence: `backend/app/main.py`)
- FastAPI application → Compliance API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Impact analysis API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Regulation API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Developer tools API: registers (evidence: `backend/app/main.py`)
- Compliance API → Assessment and policy logic: evaluates (evidence: `backend/app/api/compliance.py`)
- Compliance API → Questionnaire, reports, roadmap: uses (evidence: `backend/app/api/compliance.py`)
- Impact analysis API → Impact agent workflow: invokes (evidence: `backend/app/api/analysis.py`)
- Impact agent workflow → Agent state: uses state
- Impact agent workflow → Vector retrieval: retrieves evidence
- Impact agent workflow → Configured LLM provider: uses model
- Regulation API → Regulation ingestion: imports ingestion
- Regulation ingestion → Vector retrieval: indexes chunks (evidence: `backend/app/rag/ingestion.py`)
- Regulation ingestion → SQL database / pgvector: writes regulation data (evidence: `backend/app/rag/ingestion.py`)
- Vector retrieval → SQL database / pgvector: queries articles (evidence: `backend/app/rag/retrieval.py`)
- Assessment and policy logic → Preloaded regulation content: reads rules data (evidence: `backend/app/compliance/rules.py`)
- FastAPI application → SQL database / pgvector: initializes (evidence: `backend/app/main.py`)
- FastAPI application → Vector retrieval: rebuilds local index (evidence: `backend/app/main.py`)
- FastAPI application → Domain records: seeds records (evidence: `backend/app/main.py`)
- Company and product APIs → SQL database / pgvector: uses sessions (evidence: `backend/app/api/companies.py`)
- Compliance API → SQL database / pgvector: uses sessions (evidence: `backend/app/api/compliance.py`)
- Impact analysis API → SQL database / pgvector: uses sessions (evidence: `backend/app/api/analysis.py`)
- Developer tools API → SQL database / pgvector: uses sessions (evidence: `backend/app/api/developer.py`)
- SQL database / pgvector → Domain records: maps records (evidence: `backend/app/db/session.py`)
