Files
cpone_dashboard/docs/superpowers/specs/2026-04-27-mcu-dashboard-design.md
2026-04-30 14:27:01 +07:00

108 lines
3.3 KiB
Markdown

# MCU Dashboard (cpone-dashboard) — Design Spec
Date: 2026-04-27
## Overview
Dashboard live monitoring MCU (Medical Check-Up) untuk laboratorium klinik CpOne. Menampilkan data real-time dari kegiatan MCU korporat: KPI harian, TAT, status station, arrival tracking, progress pemeriksaan, abnormal monitoring, dan laporan hasil.
## Data Architecture
```
cpone (main DB, Server A)
↓ inject/ETL (proyek terpisah)
cpone_dashboard (Server A)
↓ MySQL replication (otomatis)
cpone_dashboard (Server B — production)
↓ dibaca oleh
Go Dashboard App (Server B)
```
Dashboard app **hanya** konek ke `cpone_dashboard` lokal. Zero dependency ke `cpone`.
## Tech Stack
- **Backend**: Go 1.21, framework Chi (router lightweight)
- **Frontend**: Go HTML templates (embed ke binary), HTMX via CDN, ECharts via CDN, Tailwind via CDN
- **Database**: MySQL 8.0, single connection ke `cpone_dashboard`
- **Build**: Cross-compile di Mac (`GOOS=linux GOARCH=amd64`), deploy binary ke server
- **Primary color**: `#3b50a0`
## Pages
1. **Login** — autentikasi user
2. **Dashboard** — KPI cards, TAT harian, station status table, arrival list, trend chart (HTMX polling tiap 10s)
3. **Arrival Tracking** — daftar peserta check-in
4. **Observation Progress** — progress per station pemeriksaan
5. **Abnormal Monitoring** — hasil pemeriksaan dengan flag abnormal
6. **Result Reports** — laporan hasil konsolidasi per peserta
## Folder Structure
```
cpone-dashboard/
├── main.go
├── go.mod
├── go.sum
├── .env ← DB DSN, port, dll
├── .env.example
├── Makefile ← make build, make deploy
├── config/
│ └── config.go
├── db/
│ └── db.go ← single connection ke cpone_dashboard
├── menu/
│ ├── dashboard/
│ │ ├── handler.go
│ │ ├── query.go
│ │ └── route.go
│ ├── arrival/
│ │ ├── handler.go
│ │ ├── query.go
│ │ └── route.go
│ ├── progress/
│ │ ├── handler.go
│ │ ├── query.go
│ │ └── route.go
│ ├── abnormal/
│ │ ├── handler.go
│ │ ├── query.go
│ │ └── route.go
│ └── result/
│ ├── handler.go
│ ├── query.go
│ └── route.go
├── templates/
│ ├── layout/
│ │ └── base.html
│ ├── dashboard/
│ │ ├── index.html
│ │ └── partials/
│ │ ├── kpi.html
│ │ ├── stations.html
│ │ └── arrivals.html
│ ├── arrival/
│ │ └── index.html
│ ├── progress/
│ │ └── index.html
│ ├── abnormal/
│ │ └── index.html
│ └── result/
│ └── index.html
└── static/
└── css/
└── custom.css
```
## Deploy Flow
```bash
make deploy
# = GOOS=linux GOARCH=amd64 go build -o cpone-dashboard .
# + scp cpone-dashboard one@devcpone.aplikasi.web.id:/home/one/project/cpone-dashboard/
# + ssh ... restart process
```
## Out of Scope
- Inject/ETL dari `cpone` ke `cpone_dashboard` (proyek terpisah)
- MySQL replication setup
- Multi-tenancy / multi-server config