# akashdv25/sensitive_data_detector architecture

> Architecture diagram of the GitHub repository akashdv25/sensitive_data_detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akashdv25/sensitive_data_detector
- Repository: https://github.com/akashdv25/sensitive_data_detector

## Overview

##### Project type and purpose
- This is an open-source Python library/CLI tool (“Sensitive Data Detector”) whose sole purpose is to scan text-based files (source code, configs, etc.) for sensitive data by applying regex-based detection patterns. It ships as a pip-installable package, provides a function/API (`has_sensitive_info`) and a console entrypoint, and supports a pre-commit hook integration.

##### File structure
- Top-level:
- `.github/workflows/ci.yml`, `release.yml` → CI & release pipelines
- `README.md`, `LICENSE`, `requirements.txt`, `setup.py` → packaging & docs
- `docs/` → usage/assignment docs
- `sensitive_data_detector/` → core package
- `tests/` → unit tests
- Inside `sensitive_data_detector/`:
- `config.json` → pattern definitions
- `load_patterns.py` → loads/validates JSON patterns
- `file_reader.py` → reads file contents
- `content_analyze.py` → applies regexes to text
- `sensitive_check.py` → high-level API/CLI glue
- `version.py`, `__init__.py`
- CI files reference linting (Black, isort, Flake8), testing (pytest), and release automation.

##### README for additional insights
- Key call: `has_sensitive_info("path/to/file")`
- Configurable JSON patterns, pre-commit hook support.
- No external services—pure local processing.
- Testing via pytest, development via pre-commit hooks.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client Interface"
        CLI["Console Script / Pre-commit Entrypoint"]:::integration
        API["has_sensitive_info API"]:::runtime
    end

    subgraph "Core Engine"
        ORCH["Sensitive Check Orchestrator"]:::runtime
        FR["File Reader"]:::runtime
        PL["Pattern Loader"]:::runtime
        CA["Content Analyzer"]:::runtime
    end

    CONFIG["config.json"]:::config
    REPORT["Result Reporter (CLI Exit Codes & Console Output)"]:::runtime

    subgraph "Development Workflow"
        PRE["Pre-commit Hook"]:::integration
        CI["CI Pipeline"]:::integration
        REL["Release Automation Workflow"]:::integration
        TESTS["Unit Tests & Linters"]:::external
    end

    PRE --> CLI
    CLI --> ORCH
    API --> ORCH
    ORCH --> FR
    ORCH --> PL
    PL --> CONFIG
    FR --> CA
    PL --> CA
    CA --> ORCH
    ORCH --> REPORT

    CI --> TESTS
    CI --> REL

    click CLI "https://github.com/akashdv25/sensitive_data_detector/blob/main/.setup.py"
    click API "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/sensitive_check.py"
    click ORCH "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/sensitive_check.py"
    click FR "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/file_reader.py"
    click PL "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/load_patterns.py"
    click CA "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/content_analyze.py"
    click CONFIG "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/config.json"
    click REPORT "https://github.com/akashdv25/sensitive_data_detector/blob/main/sensitive_data_detector/sensitive_check.py"
    click CI "https://github.com/akashdv25/sensitive_data_detector/blob/main/.github/workflows/ci.yml"
    click REL "https://github.com/akashdv25/sensitive_data_detector/blob/main/.github/workflows/release.yml"
    click PRE "https://github.com/akashdv25/sensitive_data_detector/blob/main/.pre-commit-config.yaml"
    click TESTS "https://github.com/akashdv25/sensitive_data_detector/blob/main/tests/test_sensitive_check.py"

    classDef runtime fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef config fill:#90EE90,stroke:#000,stroke-width:1px
    classDef integration fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
