# antrow15/newsmindai architecture

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

- Interactive diagram: https://gitdiagram.com/antrow15/newsmindai
- Repository: https://github.com/antrow15/newsmindai

## Overview

NewsMind is a newsroom backend with a console and role-oriented FastAPI APIs. Users authenticate, then use newsroom desks for ingestion and cleaning, editorial review and assignment, audience analysis, content adaptation, and publication. The README documents the main capabilities and training flow; sampled source confirms several internal calls and the PostgreSQL persistence layer. Some desk implementations and API routes were not sampled, so those links rely on README-level architecture rather than inspected route code.

Main entry points: [`api/routers`](https://github.com/antrow15/newsmindai/tree/main/api/routers) (Role APIs), [`dao`](https://github.com/antrow15/newsmindai/tree/main/dao) (Data access), [`services/ingestion_service.py`](https://github.com/antrow15/newsmindai/blob/main/services/ingestion_service.py) (CSV ingestion), [`modules/authentication/auth_service.py`](https://github.com/antrow15/newsmindai/blob/main/modules/authentication/auth_service.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_console["Console menus<br/>[app.py]"]
  node_role_api["Role APIs"]
  node_authentication["Authentication<br/>[auth_service.py]"]
end

subgraph group_workflow["Newsroom workflow"]
  node_ingestion["CSV ingestion"]
  node_cleaners["Cleaning stages<br/>[pipeline.py]"]
  node_content_desk["Content desk<br/>[content_service.py]"]
  node_journalist_tools["Journalist tools"]
  node_editor_desk["Editor desk<br/>[editor_service.py]"]
  node_manager_desk["Manager desk<br/>[manager_service.py]"]
  node_publisher_desk["Publisher desk"]
end

subgraph group_intelligence["ML capabilities"]
  node_aia_desk["Audience analysis<br/>[aia_service.py]"]
  node_adaptation_desk["Content adaptation"]
  node_ml_capabilities["ML capabilities"]
  node_training["ML training ingest<br/>[ingest_clean.py]"]
end

subgraph group_storage["Persistence"]
  node_repository["Repositories"]
  node_user_repository["User repository<br/>[user_repository.py]"]
  node_daos["Data access"]
  node_postgres[("PostgreSQL<br/>[connection.py]")]
end

node_newsroom_user(("Newsroom user"))

node_newsroom_user -->|"uses role APIs"| node_role_api
node_newsroom_user -->|"uses menus"| node_console
node_role_api -->|"authenticates through"| node_authentication
node_console -->|"uses authentication"| node_authentication
node_role_api -.->|"offers newsroom pipeline"| node_ingestion
node_role_api -->|"exposes journalist tools"| node_journalist_tools
node_role_api -->|"exposes AIA desk"| node_aia_desk
node_role_api -->|"exposes CAE desk"| node_adaptation_desk
node_role_api -->|"exposes editor desk"| node_editor_desk
node_role_api -->|"exposes manager desk"| node_manager_desk
node_role_api -->|"exposes publisher desk"| node_publisher_desk
node_ingestion -.->|"hands off for cleaning"| node_cleaners
node_training -->|"reuses cleaners"| node_cleaners
node_editor_desk -->|"uses editor ML"| node_ml_capabilities
node_aia_desk -->|"uses AIA ML"| node_ml_capabilities
node_adaptation_desk -->|"uses adaptation ML"| node_ml_capabilities
node_ingestion -->|"registers ingested files"| node_daos
node_content_desk -->|"uses content repository"| node_repository
node_repository -->|"delegates data access"| node_daos
node_user_repository -->|"delegates user access"| node_daos
node_authentication -->|"loads user profiles"| node_user_repository
node_daos -->|"queries database"| node_postgres
node_postgres -->|"returns query rows"| node_daos

click node_console "https://github.com/antrow15/newsmindai/blob/main/app.py"
click node_role_api "https://github.com/antrow15/newsmindai/tree/main/api/routers"
click node_authentication "https://github.com/antrow15/newsmindai/blob/main/modules/authentication/auth_service.py"
click node_ingestion "https://github.com/antrow15/newsmindai/blob/main/services/ingestion_service.py"
click node_cleaners "https://github.com/antrow15/newsmindai/blob/main/cleaners/pipeline.py"
click node_content_desk "https://github.com/antrow15/newsmindai/blob/main/services/content/content_service.py"
click node_journalist_tools "https://github.com/antrow15/newsmindai/tree/main/services/journalist"
click node_editor_desk "https://github.com/antrow15/newsmindai/blob/main/services/editor/editor_service.py"
click node_manager_desk "https://github.com/antrow15/newsmindai/blob/main/services/manager/manager_service.py"
click node_publisher_desk "https://github.com/antrow15/newsmindai/blob/main/services/publisher/publisher_service.py"
click node_aia_desk "https://github.com/antrow15/newsmindai/blob/main/services/aia/aia_service.py"
click node_adaptation_desk "https://github.com/antrow15/newsmindai/blob/main/services/adaptation/adaptation_service.py"
click node_ml_capabilities "https://github.com/antrow15/newsmindai/tree/main/ml"
click node_training "https://github.com/antrow15/newsmindai/blob/main/ml/training/ingest_clean.py"
click node_repository "https://github.com/antrow15/newsmindai/blob/main/repository/content_repository.py"
click node_user_repository "https://github.com/antrow15/newsmindai/blob/main/repository/user_repository.py"
click node_daos "https://github.com/antrow15/newsmindai/tree/main/dao"
click node_postgres "https://github.com/antrow15/newsmindai/blob/main/database/connection.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_console,node_role_api,node_authentication,node_newsroom_user toneBlue
class node_ingestion,node_cleaners,node_content_desk,node_journalist_tools,node_editor_desk,node_manager_desk,node_publisher_desk toneAmber
class node_aia_desk,node_adaptation_desk,node_ml_capabilities,node_training toneMint
class node_repository,node_user_repository,node_daos,node_postgres toneRose
```

## Components

### User entry

- [Console menus](https://github.com/antrow15/newsmindai/blob/main/app.py): `app.py`
- [Role APIs](https://github.com/antrow15/newsmindai/tree/main/api/routers): `api/routers`
- [Authentication](https://github.com/antrow15/newsmindai/blob/main/modules/authentication/auth_service.py): `modules/authentication/auth_service.py`

### Newsroom workflow

- [CSV ingestion](https://github.com/antrow15/newsmindai/blob/main/services/ingestion_service.py): `services/ingestion_service.py`
- [Cleaning stages](https://github.com/antrow15/newsmindai/blob/main/cleaners/pipeline.py): `cleaners/pipeline.py`
- [Content desk](https://github.com/antrow15/newsmindai/blob/main/services/content/content_service.py): `services/content/content_service.py`
- [Journalist tools](https://github.com/antrow15/newsmindai/tree/main/services/journalist): `services/journalist`
- [Editor desk](https://github.com/antrow15/newsmindai/blob/main/services/editor/editor_service.py): `services/editor/editor_service.py`
- [Manager desk](https://github.com/antrow15/newsmindai/blob/main/services/manager/manager_service.py): `services/manager/manager_service.py`
- [Publisher desk](https://github.com/antrow15/newsmindai/blob/main/services/publisher/publisher_service.py): `services/publisher/publisher_service.py`

### ML capabilities

- [Audience analysis](https://github.com/antrow15/newsmindai/blob/main/services/aia/aia_service.py): `services/aia/aia_service.py`
- [Content adaptation](https://github.com/antrow15/newsmindai/blob/main/services/adaptation/adaptation_service.py): `services/adaptation/adaptation_service.py`
- [ML capabilities](https://github.com/antrow15/newsmindai/tree/main/ml): `ml`
- [ML training ingest](https://github.com/antrow15/newsmindai/blob/main/ml/training/ingest_clean.py): `ml/training/ingest_clean.py`

### Persistence

- [Repositories](https://github.com/antrow15/newsmindai/blob/main/repository/content_repository.py): `repository/content_repository.py`
- [User repository](https://github.com/antrow15/newsmindai/blob/main/repository/user_repository.py): `repository/user_repository.py`
- [Data access](https://github.com/antrow15/newsmindai/tree/main/dao): `dao`
- [PostgreSQL](https://github.com/antrow15/newsmindai/blob/main/database/connection.py): `database/connection.py`

### Other components

- **Newsroom user**

## Connections

- Newsroom user → Role APIs: uses role APIs
- Newsroom user → Console menus: uses menus
- Role APIs → Authentication: authenticates through (evidence: `api/main.py`)
- Console menus → Authentication: uses authentication (evidence: `app.py`)
- Role APIs → CSV ingestion: offers newsroom pipeline
- Role APIs → Journalist tools: exposes journalist tools
- Role APIs → Audience analysis: exposes AIA desk
- Role APIs → Content adaptation: exposes CAE desk
- Role APIs → Editor desk: exposes editor desk
- Role APIs → Manager desk: exposes manager desk
- Role APIs → Publisher desk: exposes publisher desk
- CSV ingestion → Cleaning stages: hands off for cleaning
- ML training ingest → Cleaning stages: reuses cleaners (evidence: `ml/training/ingest_clean.py`)
- Editor desk → ML capabilities: uses editor ML (evidence: `services/editor/editor_service.py`)
- Audience analysis → ML capabilities: uses AIA ML (evidence: `services/aia/aia_service.py`)
- Content adaptation → ML capabilities: uses adaptation ML (evidence: `services/adaptation/adaptation_service.py`)
- CSV ingestion → Data access: registers ingested files (evidence: `services/ingestion_service.py`)
- Content desk → Repositories: uses content repository (evidence: `services/content/content_service.py`)
- Repositories → Data access: delegates data access (evidence: `repository/content_repository.py`)
- User repository → Data access: delegates user access (evidence: `repository/user_repository.py`)
- Authentication → User repository: loads user profiles (evidence: `modules/authentication/auth_service.py`)
- Data access → PostgreSQL: queries database (evidence: `dao/base_dao.py`)
- PostgreSQL → Data access: returns query rows (evidence: `database/connection.py`)
