# jam9973/opensource_project architecture

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

- Interactive diagram: https://gitdiagram.com/jam9973/opensource_project
- Repository: https://github.com/jam9973/opensource_project

## Overview

이 저장소는 식당 테이블 영상에서 좌석 영역을 설정하고, 사람 추적 결과를 테이블별·시간대별 통계로 제공하는 분석 제품입니다. 주 흐름은 영상 업로드 → 영역 프로필 생성·수정 → 분석 요청과 진행 조회 → 결과 선택·시각화입니다. 백엔드에는 영역 제안, 카메라 정합, 추적·집계가 있고 웹에는 분석 제출과 시간대별·테이블 이용 화면이 있습니다. 관계는 발췌 소스와 README로 확인되는 것만 표시했으며, 미발췌 구현의 호출 관계는 추정하지 않았습니다.

Main entry points: [`backend/main.py`](https://github.com/jam9973/opensource_project/blob/main/backend/main.py) (분석 API), [`web/src/features/time-series/TimeSeriesPage.jsx`](https://github.com/jam9973/opensource_project/blob/main/web/src/features/time-series/TimeSeriesPage.jsx) (시간대별 분석 화면), [`web/src/features/table-usage/TableUsagePage.jsx`](https://github.com/jam9973/opensource_project/blob/main/web/src/features/table-usage/TableUsagePage.jsx) (테이블 이용 화면), [`web/src/features/new-analysis/AnalysisJobContext.jsx`](https://github.com/jam9973/opensource_project/blob/main/web/src/features/new-analysis/AnalysisJobContext.jsx) (분석 작업 상태)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["백엔드 분석"]
  node_cli["분석 CLI<br/>[cli.py]"]
  node_api["분석 API<br/>[main.py]"]
  node_tracker["사람 추적·집계<br/>[analysis.py]"]
  node_camera["카메라 정합<br/>[camera.py]"]
end

subgraph group_setup["영역 설정"]
  node_editor["영역 편집기<br/>[region_editor.py]"]
  node_layout["영역 후보 생성·프로필<br/>[layout.py]"]
end

subgraph group_webflow["웹 분석 흐름"]
  node_webapp["웹 화면 라우팅<br/>[App.jsx]"]
  node_job["분석 작업 상태"]
  node_newpage["새 분석 화면"]
  node_httpclient["분석 API 클라이언트<br/>[api.js]"]
end

subgraph group_results["결과 조회·표시"]
  node_analysisstate["분석 선택·상태"]
  node_selector["분석 선택기"]
  node_timeseries["시간대별 분석 화면<br/>[TimeSeriesPage.jsx]"]
  node_timeseriesdata["시간대별 변환·요약<br/>[timeSeries.js]"]
  node_tablepage["테이블 이용 화면<br/>[TableUsagePage.jsx]"]
  node_tabledata["세션·요약 변환<br/>[tableUsage.js]"]
  node_charts["차트 렌더링<br/>[ChartCanvas.jsx]"]
  node_format["시간·수치 포맷<br/>[format.js]"]
end

subgraph group_persistence["결과 저장"]
  node_supabase[("Supabase 분석 저장소<br/>[schema.sql]")]
  node_local[("로컬 결과 JSON<br/>[main.py]")]
  node_supaclient["브라우저 Supabase 연결<br/>[supabase.js]"]
end

node_operator(("분석 담당자"))
node_browser(("브라우저 사용자"))
node_video["영상 파일"]

node_operator -->|"실행"| node_cli
node_cli -->|"분석 호출"| node_tracker
node_operator -->|"영역 설정"| node_editor
node_editor -->|"후보 생성·재사용"| node_layout
node_layout -->|"프레임 정합"| node_camera
node_operator -->|"영상 제공"| node_video
node_video -->|"영역 제안 입력"| node_editor
node_video -->|"분석 업로드"| node_api
node_api -->|"영역 요청 처리"| node_layout
node_api -->|"분석 작업 실행"| node_tracker
node_tracker -->|"좌표 정합"| node_camera
node_api -->|"결과 보관"| node_local
node_api -->|"결과 upsert"| node_supabase
node_browser -->|"화면 사용"| node_webapp
node_webapp -->|"선택기 표시"| node_selector
node_browser -->|"분석 제출"| node_newpage
node_newpage -->|"작업 요청"| node_job
node_job -->|"요청·상태 조회"| node_httpclient
node_httpclient -->|"HTTP 요청"| node_api
node_job -->|"완료 결과 전달"| node_analysisstate
node_analysisstate -->|"저장 결과 조회"| node_supaclient
node_supaclient -->|"공개 결과 조회"| node_supabase
node_selector -->|"목록·선택 사용"| node_analysisstate
node_timeseries -->|"데이터 변환"| node_timeseriesdata
node_timeseries -->|"차트 표시"| node_charts
node_timeseries -->|"값 포맷"| node_format
node_tablepage -->|"세션·요약 변환"| node_tabledata
node_tablepage -->|"차트 표시"| node_charts
node_tablepage -->|"값 포맷"| node_format

click node_cli "https://github.com/jam9973/opensource_project/blob/main/backend/cli.py"
click node_api "https://github.com/jam9973/opensource_project/blob/main/backend/main.py"
click node_tracker "https://github.com/jam9973/opensource_project/blob/main/backend/analysis.py"
click node_camera "https://github.com/jam9973/opensource_project/blob/main/backend/camera.py"
click node_editor "https://github.com/jam9973/opensource_project/blob/main/backend/region_editor.py"
click node_layout "https://github.com/jam9973/opensource_project/blob/main/backend/layout.py"
click node_webapp "https://github.com/jam9973/opensource_project/blob/main/web/src/App.jsx"
click node_job "https://github.com/jam9973/opensource_project/blob/main/web/src/features/new-analysis/AnalysisJobContext.jsx"
click node_newpage "https://github.com/jam9973/opensource_project/blob/main/web/src/features/new-analysis/NewAnalysisPage.jsx"
click node_httpclient "https://github.com/jam9973/opensource_project/blob/main/web/src/lib/api.js"
click node_analysisstate "https://github.com/jam9973/opensource_project/blob/main/web/src/context/AnalysisContext.jsx"
click node_selector "https://github.com/jam9973/opensource_project/blob/main/web/src/components/AnalysisSelector.jsx"
click node_timeseries "https://github.com/jam9973/opensource_project/blob/main/web/src/features/time-series/TimeSeriesPage.jsx"
click node_timeseriesdata "https://github.com/jam9973/opensource_project/blob/main/web/src/features/time-series/timeSeries.js"
click node_tablepage "https://github.com/jam9973/opensource_project/blob/main/web/src/features/table-usage/TableUsagePage.jsx"
click node_tabledata "https://github.com/jam9973/opensource_project/blob/main/web/src/features/table-usage/tableUsage.js"
click node_charts "https://github.com/jam9973/opensource_project/blob/main/web/src/components/ChartCanvas.jsx"
click node_format "https://github.com/jam9973/opensource_project/blob/main/web/src/lib/format.js"
click node_supabase "https://github.com/jam9973/opensource_project/blob/main/supabase/schema.sql"
click node_local "https://github.com/jam9973/opensource_project/blob/main/backend/main.py"
click node_supaclient "https://github.com/jam9973/opensource_project/blob/main/web/src/lib/supabase.js"

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_cli,node_api,node_tracker,node_camera toneBlue
class node_editor,node_layout toneAmber
class node_webapp,node_job,node_newpage,node_httpclient toneMint
class node_analysisstate,node_selector,node_timeseries,node_timeseriesdata,node_tablepage,node_tabledata,node_charts,node_format toneRose
class node_supabase,node_local,node_supaclient,node_operator,node_browser,node_video toneIndigo
```

## Components

### 백엔드 분석

- [분석 CLI](https://github.com/jam9973/opensource_project/blob/main/backend/cli.py): `backend/cli.py`
- [분석 API](https://github.com/jam9973/opensource_project/blob/main/backend/main.py): `backend/main.py`
- [사람 추적·집계](https://github.com/jam9973/opensource_project/blob/main/backend/analysis.py): `backend/analysis.py`
- [카메라 정합](https://github.com/jam9973/opensource_project/blob/main/backend/camera.py): `backend/camera.py`

### 영역 설정

- [영역 편집기](https://github.com/jam9973/opensource_project/blob/main/backend/region_editor.py): `backend/region_editor.py`
- [영역 후보 생성·프로필](https://github.com/jam9973/opensource_project/blob/main/backend/layout.py): `backend/layout.py`

### 웹 분석 흐름

- [웹 화면 라우팅](https://github.com/jam9973/opensource_project/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [분석 작업 상태](https://github.com/jam9973/opensource_project/blob/main/web/src/features/new-analysis/AnalysisJobContext.jsx): `web/src/features/new-analysis/AnalysisJobContext.jsx`
- [새 분석 화면](https://github.com/jam9973/opensource_project/blob/main/web/src/features/new-analysis/NewAnalysisPage.jsx): `web/src/features/new-analysis/NewAnalysisPage.jsx`
- [분석 API 클라이언트](https://github.com/jam9973/opensource_project/blob/main/web/src/lib/api.js): `web/src/lib/api.js`

### 결과 조회·표시

- [분석 선택·상태](https://github.com/jam9973/opensource_project/blob/main/web/src/context/AnalysisContext.jsx): `web/src/context/AnalysisContext.jsx`
- [분석 선택기](https://github.com/jam9973/opensource_project/blob/main/web/src/components/AnalysisSelector.jsx): `web/src/components/AnalysisSelector.jsx`
- [시간대별 분석 화면](https://github.com/jam9973/opensource_project/blob/main/web/src/features/time-series/TimeSeriesPage.jsx): `web/src/features/time-series/TimeSeriesPage.jsx`
- [시간대별 변환·요약](https://github.com/jam9973/opensource_project/blob/main/web/src/features/time-series/timeSeries.js): `web/src/features/time-series/timeSeries.js`
- [테이블 이용 화면](https://github.com/jam9973/opensource_project/blob/main/web/src/features/table-usage/TableUsagePage.jsx): `web/src/features/table-usage/TableUsagePage.jsx`
- [세션·요약 변환](https://github.com/jam9973/opensource_project/blob/main/web/src/features/table-usage/tableUsage.js): `web/src/features/table-usage/tableUsage.js`
- [차트 렌더링](https://github.com/jam9973/opensource_project/blob/main/web/src/components/ChartCanvas.jsx): `web/src/components/ChartCanvas.jsx`
- [시간·수치 포맷](https://github.com/jam9973/opensource_project/blob/main/web/src/lib/format.js): `web/src/lib/format.js`

### 결과 저장

- [Supabase 분석 저장소](https://github.com/jam9973/opensource_project/blob/main/supabase/schema.sql): `supabase/schema.sql`
- [로컬 결과 JSON](https://github.com/jam9973/opensource_project/blob/main/backend/main.py): `backend/main.py`
- [브라우저 Supabase 연결](https://github.com/jam9973/opensource_project/blob/main/web/src/lib/supabase.js): `web/src/lib/supabase.js`

### Other components

- **분석 담당자**
- **브라우저 사용자**
- **영상 파일**

## Connections

- 분석 담당자 → 분석 CLI: 실행 (evidence: `README.md`)
- 분석 CLI → 사람 추적·집계: 분석 호출 (evidence: `backend/cli.py`)
- 분석 담당자 → 영역 편집기: 영역 설정 (evidence: `README.md`)
- 영역 편집기 → 영역 후보 생성·프로필: 후보 생성·재사용 (evidence: `backend/region_editor.py`)
- 영역 후보 생성·프로필 → 카메라 정합: 프레임 정합 (evidence: `backend/layout.py`)
- 분석 담당자 → 영상 파일: 영상 제공 (evidence: `README.md`)
- 영상 파일 → 영역 편집기: 영역 제안 입력 (evidence: `README.md`)
- 영상 파일 → 분석 API: 분석 업로드 (evidence: `README.md`)
- 분석 API → 영역 후보 생성·프로필: 영역 요청 처리 (evidence: `README.md`)
- 분석 API → 사람 추적·집계: 분석 작업 실행 (evidence: `README.md`)
- 사람 추적·집계 → 카메라 정합: 좌표 정합 (evidence: `backend/analysis.py`)
- 분석 API → 로컬 결과 JSON: 결과 보관 (evidence: `README.md`)
- 분석 API → Supabase 분석 저장소: 결과 upsert (evidence: `backend/main.py`)
- 브라우저 사용자 → 웹 화면 라우팅: 화면 사용 (evidence: `README.md`)
- 웹 화면 라우팅 → 분석 선택기: 선택기 표시 (evidence: `web/src/App.jsx`)
- 브라우저 사용자 → 새 분석 화면: 분석 제출 (evidence: `README.md`)
- 새 분석 화면 → 분석 작업 상태: 작업 요청 (evidence: `web/src/features/new-analysis/NewAnalysisPage.jsx`)
- 분석 작업 상태 → 분석 API 클라이언트: 요청·상태 조회 (evidence: `web/src/features/new-analysis/AnalysisJobContext.jsx`)
- 분석 API 클라이언트 → 분석 API: HTTP 요청 (evidence: `README.md`)
- 분석 작업 상태 → 분석 선택·상태: 완료 결과 전달 (evidence: `web/src/features/new-analysis/AnalysisJobContext.jsx`)
- 분석 선택·상태 → 브라우저 Supabase 연결: 저장 결과 조회 (evidence: `web/src/context/AnalysisContext.jsx`)
- 브라우저 Supabase 연결 → Supabase 분석 저장소: 공개 결과 조회 (evidence: `README.md`)
- 분석 선택기 → 분석 선택·상태: 목록·선택 사용 (evidence: `web/src/components/AnalysisSelector.jsx`)
- 시간대별 분석 화면 → 시간대별 변환·요약: 데이터 변환 (evidence: `web/src/features/time-series/TimeSeriesPage.jsx`)
- 시간대별 분석 화면 → 차트 렌더링: 차트 표시 (evidence: `web/src/features/time-series/TimeSeriesPage.jsx`)
- 시간대별 분석 화면 → 시간·수치 포맷: 값 포맷 (evidence: `web/src/features/time-series/TimeSeriesPage.jsx`)
- 테이블 이용 화면 → 세션·요약 변환: 세션·요약 변환 (evidence: `web/src/features/table-usage/TableUsagePage.jsx`)
- 테이블 이용 화면 → 차트 렌더링: 차트 표시 (evidence: `web/src/features/table-usage/TableUsagePage.jsx`)
- 테이블 이용 화면 → 시간·수치 포맷: 값 포맷 (evidence: `web/src/features/table-usage/TableUsagePage.jsx`)
