Initial commit
This commit is contained in:
149
cpone-dashboard/scripts/README.md
Normal file
149
cpone-dashboard/scripts/README.md
Normal file
@@ -0,0 +1,149 @@
|
||||
# Demo Scripts — MCU PROJECT DEMO 2026
|
||||
|
||||
Script untuk generate dummy data dan simulasi live MCU berjalan, khusus keperluan demo ke client.
|
||||
|
||||
---
|
||||
|
||||
## Struktur
|
||||
|
||||
```
|
||||
scripts/
|
||||
├── demo_seed.py # Generate + jalankan dummy data (1500 pasien, historis + hari ini)
|
||||
├── demo_live.sh # Simulasi aktivitas MCU berjalan secara real-time
|
||||
├── demo_cleanup.sql # Hapus semua data demo
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Seed data awal (jalankan sekali sebelum demo)
|
||||
|
||||
```bash
|
||||
# Di laptop lokal
|
||||
python3 scripts/demo_seed.py > /tmp/demo_seed.sql
|
||||
|
||||
# Upload + jalankan di server
|
||||
scp /tmp/demo_seed.sql one@devcpone.aplikasi.web.id:/tmp/
|
||||
ssh one@devcpone.aplikasi.web.id "mysql -u admin -pSasone\!102938 cpone_dashboard < /tmp/demo_seed.sql"
|
||||
```
|
||||
|
||||
Alternatif one-liner:
|
||||
```bash
|
||||
python3 scripts/demo_seed.py | ssh one@devcpone.aplikasi.web.id "mysql -u admin -pSasone\!102938 cpone_dashboard"
|
||||
```
|
||||
|
||||
### 2. Jalankan live simulation
|
||||
|
||||
```bash
|
||||
ssh one@devcpone.aplikasi.web.id
|
||||
|
||||
# Kecepatan normal (8 detik per aksi)
|
||||
/home/one/demo_live.sh
|
||||
|
||||
# Lebih cepat untuk demo dinamis (3 detik per aksi)
|
||||
/home/one/demo_live.sh 3
|
||||
|
||||
# Lebih lambat (15 detik per aksi)
|
||||
/home/one/demo_live.sh 15
|
||||
|
||||
# Hentikan: Ctrl+C
|
||||
```
|
||||
|
||||
### 3. Reset data (setelah demo selesai)
|
||||
|
||||
```bash
|
||||
ssh one@devcpone.aplikasi.web.id "mysql -u admin -pSasone\!102938 cpone_dashboard < /tmp/demo_cleanup.sql"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Data yang Di-seed
|
||||
|
||||
| | Detail |
|
||||
|---|---|
|
||||
| **Project** | MCU PROJECT DEMO 2026 — PT DEMO CORPORATION |
|
||||
| **MCU ID** | 9999 |
|
||||
| **Periode** | 20 April 2026 – 10 Mei 2026 |
|
||||
| **Total pasien** | 1.500 (75/hari selama 20 hari) |
|
||||
| **Preregister ID range** | 900001 – 901500 |
|
||||
|
||||
### Distribusi skenario
|
||||
|
||||
| Tanggal | Pasien | Skenario |
|
||||
|---------|--------|----------|
|
||||
| 20 Apr – 28 Apr | 1 – 675 | Sudah selesai semua. Di antara ini, setiap kelipatan 15 (patient ke-15, 30, …) melakukan **2-day check-in**: sebagian station hari 1, sisa station hari 2. |
|
||||
| 29 Apr | 676 – 750 | Sudah check-in, nonlab station selesai, **lab station masih processing**. |
|
||||
| 30 Apr (hari ini) | 751 – 825 | 751–810: sudah check-in pagi, **partial station** (sedang berjalan). 811–825: **belum datang** — inilah yang akan di-trigger live script. |
|
||||
| 1 Mei – 9 Mei | 826 – 1.500 | Belum dijadwalkan. |
|
||||
|
||||
### Resume & hasil
|
||||
|
||||
| Kondisi | Pasien |
|
||||
|---------|--------|
|
||||
| Resume validated ✅ | Apr 20–27 (600 pasien) |
|
||||
| Resume published ✅ | Apr 20–25 (375 pasien) |
|
||||
| PDF tersedia (View PDF) | Pasien 1–80 (`2026/04/R26040001_*.pdf` dst.) |
|
||||
| Kelainan / abnormal | ~33% dari pasien validated (~186 rows), 6 grup |
|
||||
|
||||
---
|
||||
|
||||
## Apa yang Disimulasikan live_demo.sh
|
||||
|
||||
Script berjalan infinite loop, cycle 4 aksi secara berurutan:
|
||||
|
||||
| Aksi | Yang Terjadi |
|
||||
|------|-------------|
|
||||
| **A — Check-in** | Pasien baru dari kelompok "belum datang" (811–825) melakukan check-in dengan waktu saat ini |
|
||||
| **B — Station** | Pasien yang sudah check-in hari ini mendapatkan update station selesai (satu station per siklus) |
|
||||
| **C — Validasi** | Resume pasien kemarin (Apr 29) divalidasi dokter satu per satu |
|
||||
| **D — Publish PDF** | Pasien Apr 29 yang sudah divalidasi mendapat file PDF dan statusnya published |
|
||||
|
||||
Output di terminal:
|
||||
```
|
||||
╔══════════════════════════════════════════════════════════════╗
|
||||
║ CpOne — DEMO LIVE SIMULATION ║
|
||||
║ MCU PROJECT DEMO 2026 │ ID: 9999 │ Hari ini: 2026-04-30 ║
|
||||
╚══════════════════════════════════════════════════════════════╝
|
||||
|
||||
Aksi: A=Check-in B=Station C=Validasi D=Publish PDF
|
||||
Interval: 8s │ Press Ctrl+C untuk berhenti
|
||||
|
||||
[10:32:01] ✅ CHECK-IN │ Siti Santoso │ HR │ masuk pukul 10:32:01
|
||||
[10:32:09] 🏥 STATION │ Budi Wijaya │ Sample Station ECG │ selesai
|
||||
[10:32:17] ✔ VALIDASI │ Rina Pratama │ resume divalidasi dokter
|
||||
[10:32:25] 📄 PUBLISH │ Agus Kurnia │ PDF → 2026/04/R2604D76_resume_individu.pdf
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Tips Demo
|
||||
|
||||
**Halaman yang menarik untuk ditunjukkan:**
|
||||
|
||||
1. **Dashboard** — pilih tanggal hari ini (30/04/2026) untuk lihat aktivitas real-time
|
||||
2. **Arrival** — scroll ke bawah, pasien baru akan muncul setiap siklus
|
||||
3. **Progress** — counter "Validated" dan "Published" naik setiap kali aksi C/D dijalankan
|
||||
4. **Abnormal** — sudah ada data kelainan dari pasien Apr 20–27
|
||||
5. **Result** — tombol "View PDF" aktif untuk pasien 1–80 + pasien yang baru di-publish
|
||||
|
||||
**Saat demo:**
|
||||
- Buka dashboard di browser, biarkan live script jalan di background terminal
|
||||
- Tunjukkan pasien check-in datang satu per satu (Arrival page)
|
||||
- Tunjukkan station selesai bertahap (Dashboard → Station Status)
|
||||
- Tunjukkan counter validated/published naik (Progress page)
|
||||
- Tunjukkan PDF bisa dibuka (Result page → tombol View PDF)
|
||||
|
||||
---
|
||||
|
||||
## Re-seed Ulang
|
||||
|
||||
Kalau data ingin di-reset ke kondisi awal (misal setelah demo):
|
||||
|
||||
```bash
|
||||
# Dari laptop lokal, jalankan ulang seed
|
||||
python3 scripts/demo_seed.py | ssh one@devcpone.aplikasi.web.id "mysql -u admin -pSasone\!102938 cpone_dashboard"
|
||||
```
|
||||
|
||||
Script seed sudah idempotent — DELETE data lama dulu sebelum INSERT baru.
|
||||
Reference in New Issue
Block a user