# k1m-june9/public_insight architecture

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

- Interactive diagram: https://gitdiagram.com/k1m-june9/public_insight
- Repository: https://github.com/k1m-june9/public_insight

## Overview

PublicInsight is a policy-data discovery platform: people browse and search public-sector content, explore its knowledge graph, and receive personalized recommendations; administrators manage the content. The README documents graph ETL from MySQL, PDFs, and Elasticsearch logs, Node2Vec prediction, KoBART summarization, and interactive graph exploration. The graph includes those capabilities and the main API, search, and recommendation layers. Some implementation paths are supported only by the tree or README, so uncertain runtime links are omitted or marked unverified.

Main entry points: [`backend/app/F14_knowledge_graph/pipeline.py`](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F14_knowledge_graph/pipeline.py) (Knowledge graph ETL), [`backend/app/F7_models/feeds.py`](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F7_models/feeds.py) (Feed and user models), [`front_web/src/app`](https://github.com/k1m-june9/public_insight/tree/main/front_web/src/app) (Web application), [`backend/app/F2_services/graph.py`](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/graph.py) (Graph service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web application"]
  node_graph_ui["Mind map<br/>[MindMap.tsx]"]
  node_feed_view["Feed and recommendations<br/>[page.tsx]"]
  node_search_view["Search interface<br/>[page.tsx]"]
  node_admin_view["Admin console"]
end

subgraph group_api["Application API"]
  node_api_entry["HTTP API<br/>[api.py]"]
  node_content_services["Content services<br/>[feed.py]"]
  node_auth_service["Authentication<br/>[auth.py]"]
  node_graph_service["Graph service<br/>[graph.py]"]
  node_search_api["Search API"]
  node_reco_service["Recommendation service<br/>[service.py]"]
end

subgraph group_intelligence["Discovery and intelligence"]
  node_graph_etl["Knowledge graph ETL<br/>[pipeline.py]"]
  node_graph_ml["Graph ML prediction<br/>[graph_ml.py]"]
  node_text_summary["Document summarization<br/>[summarizer.py]"]
  node_recommendation_engine["Recommendation engine<br/>[engine.py]"]
end

subgraph group_data["Data and storage"]
  node_mysql[("MySQL data<br/>[connection.py]")]
  node_neo4j[("Neo4j graph<br/>[graph_db.py]")]
  node_elastic[("Elasticsearch<br/>[ES1_client.py]")]
  node_feed_models[("Feed and user models<br/>[feeds.py]")]
end

node_visitor(("Reader"))
node_admin(("Administrator"))

node_visitor -->|"browses"| node_web
node_admin -->|"manages content"| node_admin_view
node_web -.->|"requests data"| node_api_entry
node_search_view -.->|"submits searches"| node_search_api
node_search_api -->|"searches"| node_elastic
node_feed_view -.->|"requests recommendations"| node_reco_service
node_reco_service -->|"scores feeds"| node_recommendation_engine
node_recommendation_engine -->|"uses feed data"| node_feed_models
node_graph_ui -.->|"explores graph"| node_graph_service
node_graph_service -.->|"queries graph"| node_neo4j
node_graph_etl -->|"extracts records"| node_mysql
node_graph_etl -->|"extracts logs"| node_elastic
node_graph_etl -->|"loads graph"| node_neo4j
node_graph_etl -->|"invokes prediction"| node_graph_ml
node_text_summary -.->|"summarizes documents"| node_feed_models
node_auth_service -.->|"uses account data"| node_feed_models
node_content_services -.->|"manages content"| node_feed_models

click node_web "https://github.com/k1m-june9/public_insight/tree/main/front_web/src/app"
click node_graph_ui "https://github.com/k1m-june9/public_insight/blob/main/front_web/src/components/mind-map/MindMap.tsx"
click node_feed_view "https://github.com/k1m-june9/public_insight/blob/main/front_web/src/app/feed/%5Bid%5D/page.tsx"
click node_search_view "https://github.com/k1m-june9/public_insight/blob/main/front_web/src/app/search/page.tsx"
click node_admin_view "https://github.com/k1m-june9/public_insight/tree/main/front_web/src/app/admin"
click node_api_entry "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F1_routers/v1/api.py"
click node_content_services "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/feed.py"
click node_auth_service "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/auth.py"
click node_graph_service "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/graph.py"
click node_search_api "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F11_search/ES8_search_service.py"
click node_reco_service "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F13_recommendations/service.py"
click node_graph_etl "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F14_knowledge_graph/pipeline.py"
click node_graph_ml "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F14_knowledge_graph/graph_ml.py"
click node_text_summary "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F4_utils/summarizer.py"
click node_recommendation_engine "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F13_recommendations/engine.py"
click node_mysql "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F8_database/connection.py"
click node_neo4j "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F8_database/graph_db.py"
click node_elastic "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F11_search/ES1_client.py"
click node_feed_models "https://github.com/k1m-june9/public_insight/blob/main/backend/app/F7_models/feeds.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_web,node_graph_ui,node_feed_view,node_search_view,node_admin_view toneBlue
class node_api_entry,node_content_services,node_auth_service,node_graph_service,node_search_api,node_reco_service toneAmber
class node_graph_etl,node_graph_ml,node_text_summary,node_recommendation_engine toneMint
class node_mysql,node_neo4j,node_elastic,node_feed_models toneRose
class node_visitor,node_admin toneIndigo
```

## Components

### User experience

- [Web application](https://github.com/k1m-june9/public_insight/tree/main/front_web/src/app): `front_web/src/app`
- [Mind map](https://github.com/k1m-june9/public_insight/blob/main/front_web/src/components/mind-map/MindMap.tsx): `front_web/src/components/mind-map/MindMap.tsx`
- [Feed and recommendations](https://github.com/k1m-june9/public_insight/blob/main/front_web/src/app/feed/%5Bid%5D/page.tsx): `front_web/src/app/feed/[id]/page.tsx`
- [Search interface](https://github.com/k1m-june9/public_insight/blob/main/front_web/src/app/search/page.tsx): `front_web/src/app/search/page.tsx`
- [Admin console](https://github.com/k1m-june9/public_insight/tree/main/front_web/src/app/admin): `front_web/src/app/admin`

### Application API

- [HTTP API](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F1_routers/v1/api.py): `backend/app/F1_routers/v1/api.py`
- [Content services](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/feed.py): `backend/app/F2_services/feed.py`
- [Authentication](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/auth.py): `backend/app/F2_services/auth.py`
- [Graph service](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F2_services/graph.py): `backend/app/F2_services/graph.py`
- [Search API](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F11_search/ES8_search_service.py): `backend/app/F11_search/ES8_search_service.py`
- [Recommendation service](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F13_recommendations/service.py): `backend/app/F13_recommendations/service.py`

### Discovery and intelligence

- [Knowledge graph ETL](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F14_knowledge_graph/pipeline.py): `backend/app/F14_knowledge_graph/pipeline.py`
- [Graph ML prediction](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F14_knowledge_graph/graph_ml.py): `backend/app/F14_knowledge_graph/graph_ml.py`
- [Document summarization](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F4_utils/summarizer.py): `backend/app/F4_utils/summarizer.py`
- [Recommendation engine](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F13_recommendations/engine.py): `backend/app/F13_recommendations/engine.py`

### Data and storage

- [MySQL data](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F8_database/connection.py): `backend/app/F8_database/connection.py`
- [Neo4j graph](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F8_database/graph_db.py): `backend/app/F8_database/graph_db.py`
- [Elasticsearch](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F11_search/ES1_client.py): `backend/app/F11_search/ES1_client.py`
- [Feed and user models](https://github.com/k1m-june9/public_insight/blob/main/backend/app/F7_models/feeds.py): `backend/app/F7_models/feeds.py`

### Other components

- **Reader**
- **Administrator**

## Connections

- Reader → Web application: browses (evidence: `README.md`)
- Administrator → Admin console: manages content (evidence: `README.md`)
- Web application → HTTP API: requests data
- Search interface → Search API: submits searches
- Search API → Elasticsearch: searches (evidence: `backend/app/F11_search/ES8_search_service.py`)
- Feed and recommendations → Recommendation service: requests recommendations
- Recommendation service → Recommendation engine: scores feeds (evidence: `backend/app/F13_recommendations/service.py`)
- Recommendation engine → Feed and user models: uses feed data (evidence: `backend/app/F13_recommendations/engine.py`)
- Mind map → Graph service: explores graph (evidence: `README.md`)
- Graph service → Neo4j graph: queries graph
- Knowledge graph ETL → MySQL data: extracts records (evidence: `README.md`)
- Knowledge graph ETL → Elasticsearch: extracts logs (evidence: `README.md`)
- Knowledge graph ETL → Neo4j graph: loads graph (evidence: `backend/app/F14_knowledge_graph/pipeline.py`)
- Knowledge graph ETL → Graph ML prediction: invokes prediction (evidence: `backend/app/F14_knowledge_graph/pipeline.py`)
- Document summarization → Feed and user models: summarizes documents (evidence: `README.md`)
- Authentication → Feed and user models: uses account data
- Content services → Feed and user models: manages content
