# guilheslherme/projeto_politicas_seguranca architecture

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

- Interactive diagram: https://gitdiagram.com/guilheslherme/projeto_politicas_seguranca
- Repository: https://github.com/guilheslherme/projeto_politicas_seguranca

## Overview

Health In Sight is a Django portal for presenting official health information, not diagnosing users. Its central workflow lets a visitor select symptoms, then returns source-attributed conditions—or interrupts with urgent-care guidance for a warning symptom. Separate branches cover accounts and two-factor authentication, optional consent-based saved materials, privacy rights, and authentication auditing. The README documents these capabilities; sampled source confirms key catalog rules, consent behavior, and audit recording. Some view-level wiring is unsampled, so uncertain calls are omitted.

Main entry points: [`apps/accounts/views.py`](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/views.py) (Account flows), [`apps/catalog/views.py`](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views.py) (Catalog pages), [`apps/catalog/models.py`](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py) (Sourced associations), [`apps/accounts/models.py`](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/models.py) (Account and MFA data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_health["Health information"]
  node_catalog_views["Catalog pages<br/>[views.py]"]
  node_condition_views["Condition pages<br/>[views.py]"]
  node_saved_views["Saved materials<br/>[views_conta.py]"]
  node_symptoms["Symptoms<br/>[models.py]"]
  node_conditions["Conditions<br/>[models.py]"]
  node_materials["Official materials<br/>[models.py]"]
  node_associations["Sourced associations<br/>[models.py]"]
  node_saved_data["Saved-material records<br/>[models.py]"]
end

subgraph group_accounts["Accounts and access"]
  node_account_views["Account flows<br/>[views.py]"]
  node_account_data["Account and MFA data<br/>[models.py]"]
  node_account_manager["Account creation<br/>[managers.py]"]
  node_email_service["Email delivery"]
end

subgraph group_privacy["Privacy rights"]
  node_privacy_views["Privacy controls<br/>[views.py]"]
  node_privacy_middleware["Consent gate<br/>[middleware.py]"]
  node_consent_data["Consent records<br/>[models.py]"]
end

subgraph group_assurance["Security and audit"]
  node_audit_signals["Auth event signals<br/>[signals.py]"]
  node_audit_data["Hash-chained events<br/>[models.py]"]
  node_audit_tools["Audit verification<br/>[verificar_logs.py]"]
  node_audit_analysis["Audit analysis<br/>[analisar_logs.py]"]
end

node_visitor(("Visitor"))
node_member(("Signed-in member"))
node_mysql[("MySQL database")]
node_official_sources(("Health agencies"))

node_visitor -->|"selects symptoms"| node_catalog_views
node_catalog_views -->|"reads symptoms"| node_symptoms
node_catalog_views -->|"finds matches"| node_associations
node_associations -->|"references"| node_conditions
node_associations -->|"cites source"| node_materials
node_catalog_views -->|"shows results or warning"| node_visitor
node_visitor -->|"opens condition"| node_condition_views
node_condition_views -->|"reads condition"| node_conditions
node_conditions -->|"links sources"| node_materials
node_official_sources -->|"provides content"| node_materials
node_member -->|"registers or signs in"| node_account_views
node_account_views -->|"creates account"| node_account_manager
node_account_manager -->|"saves credentials"| node_account_data
node_account_views -->|"checks MFA and recovery"| node_account_data
node_account_views -.->|"sends recovery email"| node_email_service
node_member -->|"manages saved items"| node_saved_views
node_saved_views -->|"checks purpose consent"| node_consent_data
node_saved_views -->|"saves or removes items"| node_saved_data
node_member -->|"exercises data rights"| node_privacy_views
node_privacy_views -->|"records or revokes consent"| node_consent_data
node_privacy_views -->|"exports or deletes account"| node_account_data
node_privacy_middleware -->|"checks current policy"| node_consent_data
node_account_views -->|"emits auth events"| node_audit_signals
node_audit_signals -->|"records events"| node_audit_data
node_audit_tools -->|"verifies chain"| node_audit_data
node_audit_analysis -->|"summarizes events"| node_audit_data
node_symptoms -->|"stored in"| node_mysql
node_conditions -->|"stored in"| node_mysql
node_materials -->|"stored in"| node_mysql
node_associations -->|"stored in"| node_mysql
node_saved_data -->|"stored in"| node_mysql
node_account_data -->|"stored in"| node_mysql
node_consent_data -->|"stored in"| node_mysql
node_audit_data -->|"stored in"| node_mysql

click node_catalog_views "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views.py"
click node_condition_views "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views.py"
click node_saved_views "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views_conta.py"
click node_symptoms "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py"
click node_conditions "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py"
click node_materials "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py"
click node_associations "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py"
click node_saved_data "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py"
click node_account_views "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/views.py"
click node_account_data "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/models.py"
click node_account_manager "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/managers.py"
click node_privacy_views "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/privacy/views.py"
click node_privacy_middleware "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/privacy/middleware.py"
click node_consent_data "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/privacy/models.py"
click node_audit_signals "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/signals.py"
click node_audit_data "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/models.py"
click node_audit_tools "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/management/commands/verificar_logs.py"
click node_audit_analysis "https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/management/commands/analisar_logs.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_catalog_views,node_condition_views,node_saved_views,node_symptoms,node_conditions,node_materials,node_associations,node_saved_data toneBlue
class node_account_views,node_account_data,node_account_manager,node_email_service,node_mysql toneAmber
class node_privacy_views,node_privacy_middleware,node_consent_data toneMint
class node_audit_signals,node_audit_data,node_audit_tools,node_audit_analysis toneRose
class node_visitor,node_member,node_official_sources toneIndigo
```

## Components

### Health information

- [Catalog pages](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views.py): `apps/catalog/views.py`
- [Condition pages](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views.py): `apps/catalog/views.py`
- [Saved materials](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/views_conta.py): `apps/catalog/views_conta.py`
- [Symptoms](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py): `apps/catalog/models.py`
- [Conditions](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py): `apps/catalog/models.py`
- [Official materials](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py): `apps/catalog/models.py`
- [Sourced associations](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py): `apps/catalog/models.py`
- [Saved-material records](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/catalog/models.py): `apps/catalog/models.py`

### Accounts and access

- [Account flows](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/views.py): `apps/accounts/views.py`
- [Account and MFA data](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/models.py): `apps/accounts/models.py`
- [Account creation](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/accounts/managers.py): `apps/accounts/managers.py`
- **Email delivery**

### Privacy rights

- [Privacy controls](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/privacy/views.py): `apps/privacy/views.py`
- [Consent gate](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/privacy/middleware.py): `apps/privacy/middleware.py`
- [Consent records](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/privacy/models.py): `apps/privacy/models.py`

### Security and audit

- [Auth event signals](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/signals.py): `apps/audit/signals.py`
- [Hash-chained events](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/models.py): `apps/audit/models.py`
- [Audit verification](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/management/commands/verificar_logs.py): `apps/audit/management/commands/verificar_logs.py`
- [Audit analysis](https://github.com/guilheslherme/projeto_politicas_seguranca/blob/main/apps/audit/management/commands/analisar_logs.py): `apps/audit/management/commands/analisar_logs.py`

### Other components

- **Visitor**
- **Signed-in member**
- **MySQL database**
- **Health agencies**

## Connections

- Visitor → Catalog pages: selects symptoms
- Catalog pages → Symptoms: reads symptoms
- Catalog pages → Sourced associations: finds matches
- Sourced associations → Conditions: references
- Sourced associations → Official materials: cites source
- Catalog pages → Visitor: shows results or warning
- Visitor → Condition pages: opens condition
- Condition pages → Conditions: reads condition
- Conditions → Official materials: links sources
- Health agencies → Official materials: provides content
- Signed-in member → Account flows: registers or signs in
- Account flows → Account creation: creates account
- Account creation → Account and MFA data: saves credentials
- Account flows → Account and MFA data: checks MFA and recovery
- Account flows → Email delivery: sends recovery email
- Signed-in member → Saved materials: manages saved items
- Saved materials → Consent records: checks purpose consent
- Saved materials → Saved-material records: saves or removes items
- Signed-in member → Privacy controls: exercises data rights
- Privacy controls → Consent records: records or revokes consent
- Privacy controls → Account and MFA data: exports or deletes account
- Consent gate → Consent records: checks current policy
- Account flows → Auth event signals: emits auth events
- Auth event signals → Hash-chained events: records events
- Audit verification → Hash-chained events: verifies chain
- Audit analysis → Hash-chained events: summarizes events
- Symptoms → MySQL database: stored in
- Conditions → MySQL database: stored in
- Official materials → MySQL database: stored in
- Sourced associations → MySQL database: stored in
- Saved-material records → MySQL database: stored in
- Account and MFA data → MySQL database: stored in
- Consent records → MySQL database: stored in
- Hash-chained events → MySQL database: stored in
