# sunandan89/anumati architecture

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

- Interactive diagram: https://gitdiagram.com/sunandan89/anumati
- Repository: https://github.com/sunandan89/anumati

## Overview

Anumati is a Frappe-based DPDP consent platform for nonprofits. Its principal workflow is assisted or offline field capture: register a data principal, record consent or withdrawal, apply verification and enforcement rules, and preserve signed, hash-chained evidence. Separate capabilities cover notices and multilingual publishing, rights requests, breach and audit handling, outbound messages, and operational analytics. The graph emphasizes API-to-domain behavior and ledger internals evidenced in excerpts or the README; several documented subsystems are represented at their exact enclosing source directories because their implementations were not sampled.

Main entry points: [`anumati/api/v1/consent.py`](https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/consent.py) (Consent API), [`anumati/ledger/chain.py`](https://github.com/sunandan89/anumati/blob/main/anumati/ledger/chain.py) (Hash-chain ledger), [`anumati/api/v1/principal.py`](https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/principal.py) (Principal API), [`anumati/anumati/doctype/field_device`](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/field_device) (Offline field app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_field["Field consent"]
  node_fieldapp["Offline field app"]
  node_principal_api["Principal API<br/>[principal.py]"]
  node_principal[("Principal records")]
  node_profile["Profile answers<br/>[profile.py]"]
  node_consent_api["Consent API<br/>[consent.py]"]
  node_verification["Verification<br/>[verification.py]"]
  node_enforcement["Consent enforcement<br/>[enforcement.py]"]
  node_consent_records[("Consent events and state")]
end

subgraph group_governance["Privacy governance"]
  node_notices["Notice publishing"]
  node_rights["Rights requests<br/>[rights.py]"]
  node_breaches["Breach incidents"]
  node_retention["Retention and purge"]
  node_audit[("Audit trail")]
end

subgraph group_trust["Trust and evidence"]
  node_ledger["Hash-chain ledger<br/>[chain.py]"]
  node_canonical["Canonical payloads<br/>[canonical.py]"]
  node_keystore[("Tenant key store<br/>[keystore.py]")]
  node_signing["Ed25519 signing<br/>[signing.py]"]
  node_evidence["Evidence capture<br/>[evidence.py]"]
  node_pii["PII protection<br/>[pii.py]"]
end

subgraph group_services["Platform services"]
  node_channels["Message channels<br/>[__init__.py]"]
  node_msg91["MSG91 adapter<br/>[msg91.py]"]
  node_schema["API validation<br/>[schema.py]"]
end

subgraph group_insights["Operations and insight"]
  node_analytics["Dashboard analytics"]
  node_profile_report["Profile totals"]
  node_dashboard["Programme dashboard"]
end

node_worker(("Field worker"))

node_worker -->|"records offline"| node_fieldapp
node_fieldapp -.->|"syncs people"| node_principal_api
node_principal_api -->|"validates input"| node_schema
node_principal_api -->|"saves records"| node_principal
node_principal_api -->|"saves answers"| node_profile
node_fieldapp -.->|"submits decisions"| node_consent_api
node_consent_api -->|"validates input"| node_schema
node_consent_api -->|"checks person"| node_principal
node_consent_api -->|"checks published notice"| node_notices
node_consent_api -->|"inserts events"| node_consent_records
node_consent_api -->|"invalidates state"| node_enforcement
node_verification -.->|"updates verification"| node_consent_records
node_consent_records -.->|"seals records"| node_ledger
node_ledger -->|"canonicalizes"| node_canonical
node_ledger -->|"gets active key"| node_keystore
node_ledger -->|"signs hashes"| node_signing
node_keystore -->|"generates keypair"| node_signing
node_consent_api -.->|"accepts evidence"| node_evidence
node_principal -.->|"protects personal data"| node_pii
node_rights -->|"uses consent API"| node_consent_api
node_audit -.->|"sealed by chain"| node_ledger
node_channels -->|"dispatches SMS"| node_msg91
node_analytics -.->|"supports reporting"| node_dashboard
node_profile_report -.->|"summarizes answers"| node_profile

click node_fieldapp "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/field_device"
click node_principal_api "https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/principal.py"
click node_principal "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/data_principal"
click node_profile "https://github.com/sunandan89/anumati/blob/main/anumati/profile.py"
click node_consent_api "https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/consent.py"
click node_verification "https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/verification.py"
click node_enforcement "https://github.com/sunandan89/anumati/blob/main/anumati/enforcement.py"
click node_consent_records "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/consent_event"
click node_notices "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/notice_template"
click node_rights "https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/rights.py"
click node_breaches "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/breach_incident"
click node_retention "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/retention_policy"
click node_audit "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/audit_entry"
click node_ledger "https://github.com/sunandan89/anumati/blob/main/anumati/ledger/chain.py"
click node_canonical "https://github.com/sunandan89/anumati/blob/main/anumati/ledger/canonical.py"
click node_keystore "https://github.com/sunandan89/anumati/blob/main/anumati/ledger/keystore.py"
click node_signing "https://github.com/sunandan89/anumati/blob/main/anumati/ledger/signing.py"
click node_evidence "https://github.com/sunandan89/anumati/blob/main/anumati/evidence.py"
click node_pii "https://github.com/sunandan89/anumati/blob/main/anumati/pii.py"
click node_channels "https://github.com/sunandan89/anumati/blob/main/anumati/channels/__init__.py"
click node_msg91 "https://github.com/sunandan89/anumati/blob/main/anumati/channels/msg91.py"
click node_schema "https://github.com/sunandan89/anumati/blob/main/anumati/api/schema.py"
click node_analytics "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/dashboard_chart"
click node_profile_report "https://github.com/sunandan89/anumati/blob/main/anumati/anumati/report/profile_answer_totals/profile_answer_totals.py"
click node_dashboard "https://github.com/sunandan89/anumati/tree/main/anumati/anumati/workspace"

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_fieldapp,node_principal_api,node_principal,node_profile,node_consent_api,node_verification,node_enforcement,node_consent_records toneBlue
class node_notices,node_rights,node_breaches,node_retention,node_audit toneAmber
class node_ledger,node_canonical,node_keystore,node_signing,node_evidence,node_pii toneMint
class node_channels,node_msg91,node_schema,node_worker toneRose
class node_analytics,node_profile_report,node_dashboard toneIndigo
```

## Components

### Field consent

- [Offline field app](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/field_device): `anumati/anumati/doctype/field_device`
- [Principal API](https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/principal.py): `anumati/api/v1/principal.py`
- [Principal records](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/data_principal): `anumati/anumati/doctype/data_principal`
- [Profile answers](https://github.com/sunandan89/anumati/blob/main/anumati/profile.py): `anumati/profile.py`
- [Consent API](https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/consent.py): `anumati/api/v1/consent.py`
- [Verification](https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/verification.py): `anumati/api/v1/verification.py`
- [Consent enforcement](https://github.com/sunandan89/anumati/blob/main/anumati/enforcement.py): `anumati/enforcement.py`
- [Consent events and state](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/consent_event): `anumati/anumati/doctype/consent_event`

### Privacy governance

- [Notice publishing](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/notice_template): `anumati/anumati/doctype/notice_template`
- [Rights requests](https://github.com/sunandan89/anumati/blob/main/anumati/api/v1/rights.py): `anumati/api/v1/rights.py`
- [Breach incidents](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/breach_incident): `anumati/anumati/doctype/breach_incident`
- [Retention and purge](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/retention_policy): `anumati/anumati/doctype/retention_policy`
- [Audit trail](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/doctype/audit_entry): `anumati/anumati/doctype/audit_entry`

### Trust and evidence

- [Hash-chain ledger](https://github.com/sunandan89/anumati/blob/main/anumati/ledger/chain.py): `anumati/ledger/chain.py`
- [Canonical payloads](https://github.com/sunandan89/anumati/blob/main/anumati/ledger/canonical.py): `anumati/ledger/canonical.py`
- [Tenant key store](https://github.com/sunandan89/anumati/blob/main/anumati/ledger/keystore.py): `anumati/ledger/keystore.py`
- [Ed25519 signing](https://github.com/sunandan89/anumati/blob/main/anumati/ledger/signing.py): `anumati/ledger/signing.py`
- [Evidence capture](https://github.com/sunandan89/anumati/blob/main/anumati/evidence.py): `anumati/evidence.py`
- [PII protection](https://github.com/sunandan89/anumati/blob/main/anumati/pii.py): `anumati/pii.py`

### Platform services

- [Message channels](https://github.com/sunandan89/anumati/blob/main/anumati/channels/__init__.py): `anumati/channels/__init__.py`
- [MSG91 adapter](https://github.com/sunandan89/anumati/blob/main/anumati/channels/msg91.py): `anumati/channels/msg91.py`
- [API validation](https://github.com/sunandan89/anumati/blob/main/anumati/api/schema.py): `anumati/api/schema.py`

### Operations and insight

- [Dashboard analytics](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/dashboard_chart): `anumati/anumati/dashboard_chart`
- [Profile totals](https://github.com/sunandan89/anumati/blob/main/anumati/anumati/report/profile_answer_totals/profile_answer_totals.py): `anumati/anumati/report/profile_answer_totals/profile_answer_totals.py`
- [Programme dashboard](https://github.com/sunandan89/anumati/tree/main/anumati/anumati/workspace): `anumati/anumati/workspace`

### Other components

- **Field worker**

## Connections

- Field worker → Offline field app: records offline (evidence: `README.md`)
- Offline field app → Principal API: syncs people
- Principal API → API validation: validates input (evidence: `anumati/api/v1/principal.py`)
- Principal API → Principal records: saves records (evidence: `anumati/api/v1/principal.py`)
- Principal API → Profile answers: saves answers (evidence: `anumati/api/v1/principal.py`)
- Offline field app → Consent API: submits decisions
- Consent API → API validation: validates input (evidence: `anumati/api/v1/consent.py`)
- Consent API → Principal records: checks person (evidence: `anumati/api/v1/consent.py`)
- Consent API → Notice publishing: checks published notice (evidence: `anumati/api/v1/consent.py`)
- Consent API → Consent events and state: inserts events (evidence: `anumati/api/v1/consent.py`)
- Consent API → Consent enforcement: invalidates state (evidence: `anumati/api/v1/consent.py`)
- Verification → Consent events and state: updates verification
- Consent events and state → Hash-chain ledger: seals records
- Hash-chain ledger → Canonical payloads: canonicalizes (evidence: `anumati/ledger/chain.py`)
- Hash-chain ledger → Tenant key store: gets active key (evidence: `anumati/ledger/chain.py`)
- Hash-chain ledger → Ed25519 signing: signs hashes (evidence: `anumati/ledger/chain.py`)
- Tenant key store → Ed25519 signing: generates keypair (evidence: `anumati/ledger/keystore.py`)
- Consent API → Evidence capture: accepts evidence
- Principal records → PII protection: protects personal data
- Rights requests → Consent API: uses consent API (evidence: `anumati/api/v1/rights.py`)
- Audit trail → Hash-chain ledger: sealed by chain
- Message channels → MSG91 adapter: dispatches SMS (evidence: `anumati/channels/__init__.py`)
- Dashboard analytics → Programme dashboard: supports reporting
- Profile totals → Profile answers: summarizes answers
