# bansugyeong/crime-alert-service architecture

> Architecture diagram of the GitHub repository bansugyeong/crime-alert-service, 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/bansugyeong/crime-alert-service
- Repository: https://github.com/bansugyeong/crime-alert-service

## Overview

This repository combines a Seoul-crime information website with exploratory crime-rate analysis and forecasting work. The user-facing flow is browsing crime information on a map, with account features for posting and saving districts; the server handles those requests and queries MySQL. The analysis work combines crime and contextual data, then explores forecasting and regression. README statements support the broad analysis stages and planned capabilities; source excerpts verify selected web routes and calls, but do not establish how analysis outputs are deployed to the website.

Main entry points: [`front/web/server.js`](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/server.js) (Web API server), [`front/web/public/index.html`](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/index.html) (Crime website), [`machine learning/analyze/crime_analysis_script.py`](https://github.com/bansugyeong/crime-alert-service/blob/master/machine%20learning/analyze/crime_analysis_script.py) (Crime model analysis), [`analysis/preprocessing/pre_crime.ipynb`](https://github.com/bansugyeong/crime-alert-service/blob/master/analysis/preprocessing/pre_crime.ipynb) (Data preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Crime information website"]
  node_webui["Crime website<br/>[index.html]"]
  node_crime_map["Interactive map<br/>[mapInit.js]"]
  node_news["Crime news<br/>[newsList.js]"]
  node_resource_links["Prevention links<br/>[범죄관련사이트URL.txt]"]
end

subgraph group_accounts["Accounts and community"]
  node_server["Web API server<br/>[server.js]"]
  node_auth_ui["Login and signup<br/>[log.js]"]
  node_board_ui["Community board<br/>[board.js]"]
  node_favorites_ui["District favorites<br/>[mapInit.js]"]
  node_admin_ui["Admin console<br/>[admin.js]"]
  node_db_module["MySQL connection<br/>[db.js]"]
  node_mysql[("Crime database")]
end

subgraph group_analysis["Crime analysis and prediction"]
  node_preprocess["Data preparation<br/>[pre_crime.ipynb]"]
  node_analysis_script["Crime model analysis"]
  node_regression["Regression analysis"]
  node_forecasting["Time-series forecasts"]
  node_map_outputs["Crime rate maps<br/>[map_seoul.ipynb]"]
end

subgraph group_data["Crime and context data"]
  node_crime_data["Crime records"]
  node_context_data["Population weather buildings"]
end

node_visitor(("Website visitor"))

node_visitor -->|"browses"| node_webui
node_webui -->|"shows map"| node_crime_map
node_webui -->|"shows articles"| node_news
node_webui -->|"offers links"| node_resource_links
node_board_ui -->|"requests posts"| node_server
node_auth_ui -->|"handles login"| node_server
node_favorites_ui -->|"requests favorites"| node_server
node_admin_ui -->|"requests admin data"| node_server
node_server -->|"queries database"| node_db_module
node_db_module -->|"connects to"| node_mysql
node_crime_data -.->|"informs analysis"| node_preprocess
node_context_data -.->|"joins context"| node_preprocess
node_preprocess -.->|"prepares features"| node_analysis_script
node_analysis_script -.->|"compares models"| node_regression
node_analysis_script -.->|"explores forecasts"| node_forecasting
node_crime_data -.->|"visualizes crime"| node_map_outputs

click node_webui "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/index.html"
click node_crime_map "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/mapInit.js"
click node_news "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/newsList.js"
click node_resource_links "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/crimelink/%EB%B2%94%EC%A3%84%EA%B4%80%EB%A0%A8%EC%82%AC%EC%9D%B4%ED%8A%B8URL.txt"
click node_server "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/server.js"
click node_auth_ui "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/log.js"
click node_board_ui "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/board.js"
click node_favorites_ui "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/mapInit.js"
click node_admin_ui "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/admin.js"
click node_db_module "https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/db.js"
click node_preprocess "https://github.com/bansugyeong/crime-alert-service/blob/master/analysis/preprocessing/pre_crime.ipynb"
click node_analysis_script "https://github.com/bansugyeong/crime-alert-service/blob/master/machine%20learning/analyze/crime_analysis_script.py"
click node_regression "https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning/analyze/regression"
click node_forecasting "https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning/analyze/time_series"
click node_map_outputs "https://github.com/bansugyeong/crime-alert-service/blob/master/machine%20learning/crime/map_seoul.ipynb"
click node_crime_data "https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning/crime"
click node_context_data "https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning"

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_webui,node_crime_map,node_news,node_resource_links toneBlue
class node_server,node_auth_ui,node_board_ui,node_favorites_ui,node_admin_ui,node_db_module,node_mysql toneAmber
class node_preprocess,node_analysis_script,node_regression,node_forecasting,node_map_outputs toneMint
class node_crime_data,node_context_data toneRose
class node_visitor toneIndigo
```

## Components

### Crime information website

- [Crime website](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/index.html): `front/web/public/index.html`
- [Interactive map](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/mapInit.js): `front/web/public/js/mapInit.js`
- [Crime news](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/newsList.js): `front/web/public/js/newsList.js`
- [Prevention links](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/crimelink/%EB%B2%94%EC%A3%84%EA%B4%80%EB%A0%A8%EC%82%AC%EC%9D%B4%ED%8A%B8URL.txt): `front/web/public/crimelink/범죄관련사이트URL.txt`

### Accounts and community

- [Web API server](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/server.js): `front/web/server.js`
- [Login and signup](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/log.js): `front/web/public/js/log.js`
- [Community board](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/board.js): `front/web/public/js/board.js`
- [District favorites](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/mapInit.js): `front/web/public/js/mapInit.js`
- [Admin console](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/admin.js): `front/web/public/js/admin.js`
- [MySQL connection](https://github.com/bansugyeong/crime-alert-service/blob/master/front/web/public/js/db.js): `front/web/public/js/db.js`
- **Crime database**

### Crime analysis and prediction

- [Data preparation](https://github.com/bansugyeong/crime-alert-service/blob/master/analysis/preprocessing/pre_crime.ipynb): `analysis/preprocessing/pre_crime.ipynb`
- [Crime model analysis](https://github.com/bansugyeong/crime-alert-service/blob/master/machine%20learning/analyze/crime_analysis_script.py): `machine learning/analyze/crime_analysis_script.py`
- [Regression analysis](https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning/analyze/regression): `machine learning/analyze/regression`
- [Time-series forecasts](https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning/analyze/time_series): `machine learning/analyze/time_series`
- [Crime rate maps](https://github.com/bansugyeong/crime-alert-service/blob/master/machine%20learning/crime/map_seoul.ipynb): `machine learning/crime/map_seoul.ipynb`

### Crime and context data

- [Crime records](https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning/crime): `machine learning/crime`
- [Population weather buildings](https://github.com/bansugyeong/crime-alert-service/tree/master/machine%20learning): `machine learning`

### Other components

- **Website visitor**

## Connections

- Website visitor → Crime website: browses (evidence: `README.md`)
- Crime website → Interactive map: shows map (evidence: `README.md`)
- Crime website → Crime news: shows articles (evidence: `README.md`)
- Crime website → Prevention links: offers links (evidence: `README.md`)
- Community board → Web API server: requests posts (evidence: `front/web/public/js/board.js`)
- Login and signup → Web API server: handles login (evidence: `front/web/server.js`)
- District favorites → Web API server: requests favorites (evidence: `front/web/public/js/mapInit.js`)
- Admin console → Web API server: requests admin data (evidence: `front/web/public/js/admin.js`)
- Web API server → MySQL connection: queries database (evidence: `front/web/server.js`)
- MySQL connection → Crime database: connects to (evidence: `front/web/public/js/db.js`)
- Crime records → Data preparation: informs analysis (evidence: `README.md`)
- Population weather buildings → Data preparation: joins context (evidence: `README.md`)
- Data preparation → Crime model analysis: prepares features (evidence: `README.md`)
- Crime model analysis → Regression analysis: compares models (evidence: `README.md`)
- Crime model analysis → Time-series forecasts: explores forecasts (evidence: `README.md`)
- Crime records → Crime rate maps: visualizes crime (evidence: `README.md`)
