# rachdaubuirerach-commits/chamcong architecture

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

- Interactive diagram: https://gitdiagram.com/rachdaubuirerach-commits/chamcong
- Repository: https://github.com/rachdaubuirerach-commits/chamcong

## Overview

TimeTracker is a browser-based attendance and salary tracker. Users configure work settings, record or review attendance, and see calendar, hours, and pay summaries; optional workflows compare HR spreadsheets via OCR and export attendance as images. Lunar-calendar and Vietnamese-holiday logic enrich dates, while local storage persists app data. The main controller is a large single script; its detailed internal call structure is only partly evidenced in the excerpts, so the graph avoids inferring those calls. The README is empty, and some UI, export, and offline relationships are not shown in sampled source.

Main entry points: [`script.js`](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js) (Tracker UI and logic), [`ocr-compare.js`](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/ocr-compare.js) (OCR and comparison), [`sw.js`](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/sw.js) (Offline service worker), [`holiday-resolver.js`](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/holiday-resolver.js) (Holiday resolver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_attendance["Attendance and pay"]
  node_app["Tracker UI and logic<br/>[script.js]"]
  node_settings["Work settings<br/>[script.js]"]
  node_attendance_data["Attendance, absence, notes<br/>[script.js]"]
  node_summaries["Hours and salary views<br/>[script.js]"]
end

subgraph group_calendar["Calendar rules"]
  node_lunar_engine["Lunar date engine<br/>[lunar-engine.js]"]
  node_holiday_data["Vietnamese holiday data<br/>[holiday-data.js]"]
  node_holiday_resolver["Holiday resolver"]
end

subgraph group_verification["Import and export"]
  node_ocr["OCR and comparison<br/>[ocr-compare.js]"]
  node_tesseract["Tesseract OCR runtime"]
  node_langdata["Vietnamese and Chinese models"]
  node_image_export["Attendance PNG export<br/>[image-export.js]"]
  node_canvas["html2canvas"]
end

subgraph group_runtime["Browser runtime"]
  node_local_storage[("Browser local storage")]
  node_effects["Interaction effects<br/>[effects.js]"]
  node_service_worker["Offline service worker<br/>[sw.js]"]
  node_cache[("Browser cache")]
end

node_person(("User"))

node_person -->|"uses"| node_app
node_app -->|"manages"| node_settings
node_app -->|"records"| node_attendance_data
node_app -->|"presents"| node_summaries
node_settings -->|"reads and writes"| node_local_storage
node_attendance_data -->|"reads and writes"| node_local_storage
node_app -->|"looks up holidays"| node_holiday_resolver
node_holiday_resolver -->|"reads"| node_holiday_data
node_holiday_resolver -->|"converts dates"| node_lunar_engine
node_app -.->|"uses lunar dates"| node_lunar_engine
node_person -->|"submits HR image"| node_ocr
node_ocr -->|"creates worker"| node_tesseract
node_ocr -->|"loads languages"| node_langdata
node_ocr -.->|"compares logs"| node_attendance_data
node_ocr -->|"renders report"| node_canvas
node_person -->|"requests PNG"| node_image_export
node_image_export -->|"renders image"| node_canvas
node_person -->|"interacts"| node_effects
node_service_worker -->|"stores responses"| node_cache
node_service_worker -->|"caches app assets"| node_app
node_service_worker -->|"caches OCR assets"| node_tesseract
node_service_worker -->|"caches models"| node_langdata

click node_app "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js"
click node_settings "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js"
click node_attendance_data "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js"
click node_summaries "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js"
click node_lunar_engine "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/lunar-engine.js"
click node_holiday_data "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/holiday-data.js"
click node_holiday_resolver "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/holiday-resolver.js"
click node_ocr "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/ocr-compare.js"
click node_tesseract "https://github.com/rachdaubuirerach-commits/chamcong/tree/main/tesseract"
click node_langdata "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/tesseract/lang-data/chi_sim.traineddata.gz"
click node_image_export "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/image-export.js"
click node_effects "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/effects.js"
click node_service_worker "https://github.com/rachdaubuirerach-commits/chamcong/blob/main/sw.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_app,node_settings,node_attendance_data,node_summaries,node_person toneBlue
class node_lunar_engine,node_holiday_data,node_holiday_resolver toneAmber
class node_ocr,node_tesseract,node_langdata,node_image_export,node_canvas toneMint
class node_local_storage,node_effects,node_service_worker,node_cache toneRose
```

## Components

### Attendance and pay

- [Tracker UI and logic](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js): `script.js`
- [Work settings](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js): `script.js`
- [Attendance, absence, notes](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js): `script.js`
- [Hours and salary views](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/script.js): `script.js`

### Calendar rules

- [Lunar date engine](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/lunar-engine.js): `lunar-engine.js`
- [Vietnamese holiday data](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/holiday-data.js): `holiday-data.js`
- [Holiday resolver](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/holiday-resolver.js): `holiday-resolver.js`

### Import and export

- [OCR and comparison](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/ocr-compare.js): `ocr-compare.js`
- [Tesseract OCR runtime](https://github.com/rachdaubuirerach-commits/chamcong/tree/main/tesseract): `tesseract`
- [Vietnamese and Chinese models](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/tesseract/lang-data/chi_sim.traineddata.gz): `tesseract/lang-data/chi_sim.traineddata.gz`
- [Attendance PNG export](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/image-export.js): `image-export.js`
- **html2canvas**

### Browser runtime

- **Browser local storage**
- [Interaction effects](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/effects.js): `effects.js`
- [Offline service worker](https://github.com/rachdaubuirerach-commits/chamcong/blob/main/sw.js): `sw.js`
- **Browser cache**

### Other components

- **User**

## Connections

- User → Tracker UI and logic: uses
- Tracker UI and logic → Work settings: manages (evidence: `script.js`)
- Tracker UI and logic → Attendance, absence, notes: records (evidence: `script.js`)
- Tracker UI and logic → Hours and salary views: presents (evidence: `script.js`)
- Work settings → Browser local storage: reads and writes (evidence: `script.js`)
- Attendance, absence, notes → Browser local storage: reads and writes (evidence: `script.js`)
- Tracker UI and logic → Holiday resolver: looks up holidays (evidence: `script.js`)
- Holiday resolver → Vietnamese holiday data: reads (evidence: `holiday-resolver.js`)
- Holiday resolver → Lunar date engine: converts dates (evidence: `holiday-resolver.js`)
- Tracker UI and logic → Lunar date engine: uses lunar dates
- User → OCR and comparison: submits HR image
- OCR and comparison → Tesseract OCR runtime: creates worker (evidence: `ocr-compare.js`)
- OCR and comparison → Vietnamese and Chinese models: loads languages (evidence: `ocr-compare.js`)
- OCR and comparison → Attendance, absence, notes: compares logs
- OCR and comparison → html2canvas: renders report (evidence: `ocr-compare.js`)
- User → Attendance PNG export: requests PNG
- Attendance PNG export → html2canvas: renders image (evidence: `image-export.js`)
- User → Interaction effects: interacts
- Offline service worker → Browser cache: stores responses (evidence: `sw.js`)
- Offline service worker → Tracker UI and logic: caches app assets (evidence: `sw.js`)
- Offline service worker → Tesseract OCR runtime: caches OCR assets (evidence: `sw.js`)
- Offline service worker → Vietnamese and Chinese models: caches models (evidence: `sw.js`)
