# pokemon1742000-commits/pu architecture

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

- Interactive diagram: https://gitdiagram.com/pokemon1742000-commits/pu
- Repository: https://github.com/pokemon1742000-commits/pu

## Overview

Đây là ứng dụng Electron cho Windows để nhập dữ liệu mua hàng, quét mã, nhập kho và gia công; đối chiếu theo dự án, xử lý xác nhận thủ công và xuất báo cáo Excel. Người dùng chọn file và sheet trong giao diện, dữ liệu được phân tích rồi lưu hoặc dùng cho đối chiếu; kết quả có thể kiểm tra và xuất theo các mẫu báo cáo. README cũng nêu quản lý đổi mã PR, Job Code, kiểm toán dữ liệu, backup/khôi phục và cập nhật. Một số chức năng chỉ được mô tả trong README; các liên kết triển khai chưa xác nhận được để trống.

Main entry points: [`main.js`](https://github.com/pokemon1742000-commits/pu/blob/main/main.js) (Electron main), [`src/export-worker.js`](https://github.com/pokemon1742000-commits/pu/blob/main/src/export-worker.js) (Export worker), [`renderer/app.js`](https://github.com/pokemon1742000-commits/pu/blob/main/renderer/app.js) (Application UI), [`src/storage.js`](https://github.com/pokemon1742000-commits/pu/blob/main/src/storage.js) (SQLite storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_renderer["Application UI<br/>[app.js]"]
  node_bridge["IPC bridge<br/>[preload.js]"]
  node_main["Electron main<br/>[main.js]"]
end

subgraph group_ingestion["Import and storage"]
  node_file_runner["File runner<br/>[file-runner.js]"]
  node_file_worker["File worker<br/>[file-worker.js]"]
  node_processor["Workbook processor<br/>[processor.js]"]
  node_inspector["XLSX inspector<br/>[xlsx-inspector.js]"]
  node_finalizer["Import finalizer"]
  node_finalizer_worker["Finalizer worker"]
  node_storage[("SQLite storage<br/>[storage.js]")]
  node_database_worker["Raw import worker"]
end

subgraph group_reconciliation["Reconciliation"]
  node_matching["Code matching<br/>[processor.js]"]
  node_review["Match review<br/>[app.js]"]
  node_replacements["PR replacements<br/>[processor.js]"]
end

subgraph group_reporting["Reports and maintenance"]
  node_audit["Data audit<br/>[data-audit.js]"]
  node_job_codes["Job Code reference"]
  node_export_worker["Export worker<br/>[export-worker.js]"]
  node_exporter["Excel exporter<br/>[exporter.js]"]
  node_updates["Release updates<br/>[update-release.js]"]
  node_version_data["Version data<br/>[version-data.js]"]
end

node_user(("Operator"))
node_workbooks["Excel sources"]

node_user -->|"operates"| node_renderer
node_workbooks -->|"selects files"| node_renderer
node_renderer -->|"invokes IPC"| node_bridge
node_bridge -->|"dispatches IPC"| node_main
node_main -->|"starts parsing"| node_file_runner
node_file_runner -->|"spawns"| node_file_worker
node_file_worker -->|"parses workbooks"| node_processor
node_processor -->|"inspects sheets"| node_inspector
node_main -->|"starts finalization"| node_finalizer_worker
node_finalizer_worker -->|"runs"| node_finalizer
node_main -->|"reads and writes"| node_storage
node_database_worker -->|"calls import methods"| node_storage
node_main -->|"runs comparison"| node_matching
node_renderer -->|"resolves candidates"| node_review
node_main -->|"runs audit"| node_audit
node_main -->|"starts export"| node_export_worker
node_export_worker -->|"builds workbook"| node_exporter
node_export_worker -->|"reads large datasets"| node_storage
node_export_worker -->|"uses comparison logic"| node_matching
node_main -->|"manages updates"| node_updates
node_updates -->|"reads version data"| node_version_data

click node_renderer "https://github.com/pokemon1742000-commits/pu/blob/main/renderer/app.js"
click node_bridge "https://github.com/pokemon1742000-commits/pu/blob/main/preload.js"
click node_main "https://github.com/pokemon1742000-commits/pu/blob/main/main.js"
click node_file_runner "https://github.com/pokemon1742000-commits/pu/blob/main/src/file-runner.js"
click node_file_worker "https://github.com/pokemon1742000-commits/pu/blob/main/src/file-worker.js"
click node_processor "https://github.com/pokemon1742000-commits/pu/blob/main/src/processor.js"
click node_inspector "https://github.com/pokemon1742000-commits/pu/blob/main/src/xlsx-inspector.js"
click node_finalizer "https://github.com/pokemon1742000-commits/pu/blob/main/src/import-finalizer.js"
click node_finalizer_worker "https://github.com/pokemon1742000-commits/pu/blob/main/src/import-finalizer-worker.js"
click node_storage "https://github.com/pokemon1742000-commits/pu/blob/main/src/storage.js"
click node_database_worker "https://github.com/pokemon1742000-commits/pu/blob/main/src/raw-import-worker.js"
click node_matching "https://github.com/pokemon1742000-commits/pu/blob/main/src/processor.js"
click node_review "https://github.com/pokemon1742000-commits/pu/blob/main/renderer/app.js"
click node_replacements "https://github.com/pokemon1742000-commits/pu/blob/main/src/processor.js"
click node_audit "https://github.com/pokemon1742000-commits/pu/blob/main/src/data-audit.js"
click node_job_codes "https://github.com/pokemon1742000-commits/pu/blob/main/assets/MKAC%20Monthly%20Timesheet.xlsx"
click node_export_worker "https://github.com/pokemon1742000-commits/pu/blob/main/src/export-worker.js"
click node_exporter "https://github.com/pokemon1742000-commits/pu/blob/main/src/exporter.js"
click node_updates "https://github.com/pokemon1742000-commits/pu/blob/main/src/update-release.js"
click node_version_data "https://github.com/pokemon1742000-commits/pu/blob/main/src/version-data.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_renderer,node_bridge,node_main toneBlue
class node_file_runner,node_file_worker,node_processor,node_inspector,node_finalizer,node_finalizer_worker,node_storage,node_database_worker toneAmber
class node_matching,node_review,node_replacements toneMint
class node_audit,node_job_codes,node_export_worker,node_exporter,node_updates,node_version_data toneRose
class node_user,node_workbooks toneIndigo
```

## Components

### Desktop interface

- [Application UI](https://github.com/pokemon1742000-commits/pu/blob/main/renderer/app.js): `renderer/app.js`
- [IPC bridge](https://github.com/pokemon1742000-commits/pu/blob/main/preload.js): `preload.js`
- [Electron main](https://github.com/pokemon1742000-commits/pu/blob/main/main.js): `main.js`

### Import and storage

- [File runner](https://github.com/pokemon1742000-commits/pu/blob/main/src/file-runner.js): `src/file-runner.js`
- [File worker](https://github.com/pokemon1742000-commits/pu/blob/main/src/file-worker.js): `src/file-worker.js`
- [Workbook processor](https://github.com/pokemon1742000-commits/pu/blob/main/src/processor.js): `src/processor.js`
- [XLSX inspector](https://github.com/pokemon1742000-commits/pu/blob/main/src/xlsx-inspector.js): `src/xlsx-inspector.js`
- [Import finalizer](https://github.com/pokemon1742000-commits/pu/blob/main/src/import-finalizer.js): `src/import-finalizer.js`
- [Finalizer worker](https://github.com/pokemon1742000-commits/pu/blob/main/src/import-finalizer-worker.js): `src/import-finalizer-worker.js`
- [SQLite storage](https://github.com/pokemon1742000-commits/pu/blob/main/src/storage.js): `src/storage.js`
- [Raw import worker](https://github.com/pokemon1742000-commits/pu/blob/main/src/raw-import-worker.js): `src/raw-import-worker.js`

### Reconciliation

- [Code matching](https://github.com/pokemon1742000-commits/pu/blob/main/src/processor.js): `src/processor.js`
- [Match review](https://github.com/pokemon1742000-commits/pu/blob/main/renderer/app.js): `renderer/app.js`
- [PR replacements](https://github.com/pokemon1742000-commits/pu/blob/main/src/processor.js): `src/processor.js`

### Reports and maintenance

- [Data audit](https://github.com/pokemon1742000-commits/pu/blob/main/src/data-audit.js): `src/data-audit.js`
- [Job Code reference](https://github.com/pokemon1742000-commits/pu/blob/main/assets/MKAC%20Monthly%20Timesheet.xlsx): `assets/MKAC Monthly Timesheet.xlsx`
- [Export worker](https://github.com/pokemon1742000-commits/pu/blob/main/src/export-worker.js): `src/export-worker.js`
- [Excel exporter](https://github.com/pokemon1742000-commits/pu/blob/main/src/exporter.js): `src/exporter.js`
- [Release updates](https://github.com/pokemon1742000-commits/pu/blob/main/src/update-release.js): `src/update-release.js`
- [Version data](https://github.com/pokemon1742000-commits/pu/blob/main/src/version-data.js): `src/version-data.js`

### Other components

- **Operator**
- **Excel sources**

## Connections

- Operator → Application UI: operates
- Excel sources → Application UI: selects files
- Application UI → IPC bridge: invokes IPC
- IPC bridge → Electron main: dispatches IPC
- Electron main → File runner: starts parsing
- File runner → File worker: spawns
- File worker → Workbook processor: parses workbooks
- Workbook processor → XLSX inspector: inspects sheets
- Electron main → Finalizer worker: starts finalization
- Finalizer worker → Import finalizer: runs
- Electron main → SQLite storage: reads and writes
- Raw import worker → SQLite storage: calls import methods
- Electron main → Code matching: runs comparison
- Application UI → Match review: resolves candidates
- Electron main → Data audit: runs audit
- Electron main → Export worker: starts export
- Export worker → Excel exporter: builds workbook
- Export worker → SQLite storage: reads large datasets
- Export worker → Code matching: uses comparison logic
- Electron main → Release updates: manages updates
- Release updates → Version data: reads version data
