# codergogh/seoul-ev-data-platform architecture

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

- Interactive diagram: https://gitdiagram.com/codergogh/seoul-ev-data-platform
- Repository: https://github.com/codergogh/seoul-ev-data-platform

## Overview

서울 전동화 입지 인사이트 플랫폼은 서울 3개 구의 도로·차량등록·충전기 데이터를 수집해 품질을 검증하고, 충전소 우선 검토 지역을 산출해 웹에 공개합니다. 운영 DAG는 재처리, 품질 모니터링, SLA 감시, 보존 정리와 백업을 지원합니다. 웹은 분석 결과와 운영 화면을 제공하며 OAuth 로그인과 역할별 접근을 적용합니다. DAG 간 주요 흐름은 README를 근거로 표시했고, 일부 DAG와 웹 기능은 구현을 읽지 않아 관계를 문서 근거로만 그렸습니다.

Main entry points: [`dags/ev03_mart_integration.py`](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev03_mart_integration.py) (지표·품질 관문), [`dags/ev02_registration_monthly.py`](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev02_registration_monthly.py) (등록 수집), [`plugins/common/db.py`](https://github.com/codergogh/seoul-ev-data-platform/blob/main/plugins/common/db.py) (SQL·트랜잭션 접근), [`web/src/App.tsx`](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/App.tsx) (웹 앱 라우팅)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["수집·분석"]
  node_road["도로 수집"]
  node_registration["등록 수집"]
  node_chargers["충전기 수집"]
  node_aux["수요 보조"]
  node_master["도로-동 매핑"]
  node_mart["지표·품질 관문"]
end

subgraph group_ops["운영·품질"]
  node_runlog["실행·품질 기록<br/>[ops.py]"]
  node_reprocess["재처리 진입점<br/>[ev11_reprocess.py]"]
  node_monitor["품질 모니터"]
  node_retention["보존 정리"]
  node_sla["SLA 감시<br/>[ev15_sla_watch.py]"]
  node_backup["DB 백업<br/>[ev16_db_backup.py]"]
end

subgraph group_publish["게시·저장"]
  node_db[("분석 데이터베이스")]
  node_dbaccess["SQL·트랜잭션 접근<br/>[db.py]"]
  node_webpublish["웹 데이터 게시"]
end

subgraph group_web["분석 웹"]
  node_webdata["웹 데이터 로더<br/>[data.ts]"]
  node_app["웹 앱 라우팅<br/>[App.tsx]"]
  node_analysis["분석 화면"]
  node_operations["운영 화면<br/>[Pipeline.tsx]"]
  node_regionmap["지역 지도<br/>[RegionMap.tsx]"]
end

subgraph group_identity["인증·권한"]
  node_auth["세션·프로필<br/>[AuthContext.tsx]"]
  node_roles["역할 판정<br/>[roles.ts]"]
  node_supabase["Supabase 인증<br/>[supabase.ts]"]
end

node_user(("분석 사용자"))
node_sources{{"공공 데이터 API"}}
node_vercel{{"Vercel 웹"}}
node_slack{{"Slack"}}

node_sources -.->|"도로 관측 제공"| node_road
node_sources -.->|"등록 자료 제공"| node_registration
node_sources -.->|"충전소 자료 제공"| node_chargers
node_road -.->|"수집 적재"| node_db
node_registration -.->|"월 스냅샷 적재"| node_db
node_chargers -.->|"일 스냅샷 적재"| node_db
node_aux -.->|"주간 스냅샷 적재"| node_db
node_master -.->|"매핑 버전 적재"| node_db
node_db -.->|"입력 조회"| node_mart
node_registration -.->|"Asset 알림"| node_mart
node_master -.->|"Asset 알림"| node_mart
node_mart -.->|"마트 교체"| node_db
node_mart -.->|"게시 Asset"| node_webpublish
node_chargers -.->|"공급 Asset"| node_webpublish
node_webpublish -.->|"데이터 게시"| node_vercel
node_road -.->|"DB 접근"| node_dbaccess
node_registration -->|"DB 접근"| node_dbaccess
node_registration -->|"실행 기록"| node_runlog
node_aux -->|"DB 접근"| node_dbaccess
node_aux -->|"품질 기록"| node_runlog
node_mart -->|"SQL 실행"| node_dbaccess
node_mart -.->|"실행·품질 기록"| node_runlog
node_dbaccess -->|"트랜잭션 읽기·쓰기"| node_db
node_runlog -->|"기록 저장"| node_dbaccess
node_reprocess -.->|"재실행 요청"| node_registration
node_reprocess -.->|"재실행 요청"| node_mart
node_monitor -.->|"품질 리포트"| node_slack
node_sla -.->|"기한 알림"| node_slack
node_retention -.->|"조건부 삭제"| node_db
node_backup -.->|"백업·복원"| node_db
node_user -.->|"결과 조회"| node_app
node_app -->|"데이터 로드"| node_webdata
node_webdata -.->|"결과 데이터 제공"| node_analysis
node_app -.->|"화면 분기"| node_operations
node_analysis -.->|"지도 표시"| node_regionmap
node_analysis -.->|"지역 데이터 조회"| node_webdata
node_app -->|"인증 상태 조회"| node_auth
node_auth -->|"인증·프로필 조회"| node_supabase
node_auth -->|"역할 타입 사용"| node_roles
node_app -->|"화면 접근 판정"| node_roles

click node_road "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev01_traffic_collect.py"
click node_registration "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev02_registration_monthly.py"
click node_chargers "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev04_charger_daily.py"
click node_aux "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev05_demand_aux_weekly.py"
click node_master "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev10_master_refresh.py"
click node_mart "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev03_mart_integration.py"
click node_dbaccess "https://github.com/codergogh/seoul-ev-data-platform/blob/main/plugins/common/db.py"
click node_runlog "https://github.com/codergogh/seoul-ev-data-platform/blob/main/plugins/common/ops.py"
click node_reprocess "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev11_reprocess.py"
click node_monitor "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev12_quality_monitor.py"
click node_retention "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev13_retention_cleanup.py"
click node_sla "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev15_sla_watch.py"
click node_backup "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev16_db_backup.py"
click node_webpublish "https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev14_web_publish.py"
click node_webdata "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/data.ts"
click node_app "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/App.tsx"
click node_analysis "https://github.com/codergogh/seoul-ev-data-platform/tree/main/web/src/pages"
click node_operations "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/pages/Pipeline.tsx"
click node_regionmap "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/components/RegionMap.tsx"
click node_auth "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/auth/AuthContext.tsx"
click node_roles "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/auth/roles.ts"
click node_supabase "https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/auth/supabase.ts"

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_road,node_registration,node_chargers,node_aux,node_master,node_mart toneBlue
class node_runlog,node_reprocess,node_monitor,node_retention,node_sla,node_backup toneAmber
class node_db,node_dbaccess,node_webpublish,node_sources toneMint
class node_webdata,node_app,node_analysis,node_operations,node_regionmap toneRose
class node_auth,node_roles,node_supabase,node_user,node_vercel,node_slack toneIndigo
```

## Components

### 수집·분석

- [도로 수집](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev01_traffic_collect.py): `dags/ev01_traffic_collect.py`
- [등록 수집](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev02_registration_monthly.py): `dags/ev02_registration_monthly.py`
- [충전기 수집](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev04_charger_daily.py): `dags/ev04_charger_daily.py`
- [수요 보조](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev05_demand_aux_weekly.py): `dags/ev05_demand_aux_weekly.py`
- [도로-동 매핑](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev10_master_refresh.py): `dags/ev10_master_refresh.py`
- [지표·품질 관문](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev03_mart_integration.py): `dags/ev03_mart_integration.py`

### 운영·품질

- [실행·품질 기록](https://github.com/codergogh/seoul-ev-data-platform/blob/main/plugins/common/ops.py): `plugins/common/ops.py`
- [재처리 진입점](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev11_reprocess.py): `dags/ev11_reprocess.py`
- [품질 모니터](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev12_quality_monitor.py): `dags/ev12_quality_monitor.py`
- [보존 정리](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev13_retention_cleanup.py): `dags/ev13_retention_cleanup.py`
- [SLA 감시](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev15_sla_watch.py): `dags/ev15_sla_watch.py`
- [DB 백업](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev16_db_backup.py): `dags/ev16_db_backup.py`

### 게시·저장

- **분석 데이터베이스**
- [SQL·트랜잭션 접근](https://github.com/codergogh/seoul-ev-data-platform/blob/main/plugins/common/db.py): `plugins/common/db.py`
- [웹 데이터 게시](https://github.com/codergogh/seoul-ev-data-platform/blob/main/dags/ev14_web_publish.py): `dags/ev14_web_publish.py`

### 분석 웹

- [웹 데이터 로더](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/data.ts): `web/src/data.ts`
- [웹 앱 라우팅](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [분석 화면](https://github.com/codergogh/seoul-ev-data-platform/tree/main/web/src/pages): `web/src/pages`
- [운영 화면](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/pages/Pipeline.tsx): `web/src/pages/Pipeline.tsx`
- [지역 지도](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/components/RegionMap.tsx): `web/src/components/RegionMap.tsx`

### 인증·권한

- [세션·프로필](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/auth/AuthContext.tsx): `web/src/auth/AuthContext.tsx`
- [역할 판정](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/auth/roles.ts): `web/src/auth/roles.ts`
- [Supabase 인증](https://github.com/codergogh/seoul-ev-data-platform/blob/main/web/src/auth/supabase.ts): `web/src/auth/supabase.ts`

### Other components

- **분석 사용자**
- **공공 데이터 API**
- **Vercel 웹**
- **Slack**

## Connections

- 공공 데이터 API → 도로 수집: 도로 관측 제공
- 공공 데이터 API → 등록 수집: 등록 자료 제공
- 공공 데이터 API → 충전기 수집: 충전소 자료 제공
- 도로 수집 → 분석 데이터베이스: 수집 적재
- 등록 수집 → 분석 데이터베이스: 월 스냅샷 적재
- 충전기 수집 → 분석 데이터베이스: 일 스냅샷 적재
- 수요 보조 → 분석 데이터베이스: 주간 스냅샷 적재
- 도로-동 매핑 → 분석 데이터베이스: 매핑 버전 적재
- 분석 데이터베이스 → 지표·품질 관문: 입력 조회
- 등록 수집 → 지표·품질 관문: Asset 알림
- 도로-동 매핑 → 지표·품질 관문: Asset 알림
- 지표·품질 관문 → 분석 데이터베이스: 마트 교체
- 지표·품질 관문 → 웹 데이터 게시: 게시 Asset
- 충전기 수집 → 웹 데이터 게시: 공급 Asset
- 웹 데이터 게시 → Vercel 웹: 데이터 게시
- 도로 수집 → SQL·트랜잭션 접근: DB 접근
- 등록 수집 → SQL·트랜잭션 접근: DB 접근 (evidence: `dags/ev02_registration_monthly.py`)
- 등록 수집 → 실행·품질 기록: 실행 기록 (evidence: `dags/ev02_registration_monthly.py`)
- 수요 보조 → SQL·트랜잭션 접근: DB 접근 (evidence: `dags/ev05_demand_aux_weekly.py`)
- 수요 보조 → 실행·품질 기록: 품질 기록 (evidence: `dags/ev05_demand_aux_weekly.py`)
- 지표·품질 관문 → SQL·트랜잭션 접근: SQL 실행 (evidence: `dags/ev03_mart_integration.py`)
- 지표·품질 관문 → 실행·품질 기록: 실행·품질 기록 (evidence: `dags/ev03_mart_integration.py`)
- SQL·트랜잭션 접근 → 분석 데이터베이스: 트랜잭션 읽기·쓰기 (evidence: `plugins/common/db.py`)
- 실행·품질 기록 → SQL·트랜잭션 접근: 기록 저장 (evidence: `plugins/common/ops.py`)
- 재처리 진입점 → 등록 수집: 재실행 요청
- 재처리 진입점 → 지표·품질 관문: 재실행 요청
- 품질 모니터 → Slack: 품질 리포트
- SLA 감시 → Slack: 기한 알림
- 보존 정리 → 분석 데이터베이스: 조건부 삭제
- DB 백업 → 분석 데이터베이스: 백업·복원
- 분석 사용자 → 웹 앱 라우팅: 결과 조회
- 웹 앱 라우팅 → 웹 데이터 로더: 데이터 로드 (evidence: `web/src/App.tsx`)
- 웹 데이터 로더 → 분석 화면: 결과 데이터 제공 (evidence: `web/src/data.ts`)
- 웹 앱 라우팅 → 운영 화면: 화면 분기 (evidence: `web/src/App.tsx`)
- 분석 화면 → 지역 지도: 지도 표시 (evidence: `web/src/pages/RegionDetail.tsx`)
- 분석 화면 → 웹 데이터 로더: 지역 데이터 조회 (evidence: `web/src/pages/RegionDetail.tsx`)
- 웹 앱 라우팅 → 세션·프로필: 인증 상태 조회 (evidence: `web/src/App.tsx`)
- 세션·프로필 → Supabase 인증: 인증·프로필 조회 (evidence: `web/src/auth/AuthContext.tsx`)
- 세션·프로필 → 역할 판정: 역할 타입 사용 (evidence: `web/src/auth/AuthContext.tsx`)
- 웹 앱 라우팅 → 역할 판정: 화면 접근 판정 (evidence: `web/src/App.tsx`)
