Skip to content

Repository files navigation

BPJS Healthkaton

Platform komprehensif untuk deteksi fraud dan monitoring klaim BPJS kesehatan yang terintegrasi dengan berbagai sistem seperti P-Care, V-Claim, dan Mobile JKN.

πŸ“‹ Daftar Isi


πŸ—οΈ Arsitektur Sistem

Project ini terdiri dari beberapa service yang saling terintegrasi:

Service Teknologi Port Deskripsi
Brain FastAPI (Python) 20501 AI engine untuk fraud detection dan judge analysis
Dashboard Next.js (TypeScript) 20502 Command center dashboard untuk monitoring real-time
Docs Astro 20503 Dokumentasi project
P-Care Next.js 20504 Interface untuk sistem P-Care BPJS
V-Claim Next.js 20505 Interface untuk sistem V-Claim BPJS
Mobile JKN Flutter - Aplikasi mobile untuk pasien
Notification Service Go 8080 Service untuk push notification via FCM

βš™οΈ Prasyarat

Pastikan sistem Anda telah menginstall tools berikut:

Wajib untuk Development:

  • Node.js >= 18.x (Download)
  • npm atau yarn atau pnpm
  • Python >= 3.9 (Download)
  • pip (biasanya sudah terinstall dengan Python)
  • Docker & Docker Compose (Download)
  • Git (Download)

Opsional (untuk development tertentu):

  • Go >= 1.20 (untuk notification service) (Download)
  • Flutter >= 3.x (untuk mobile app) (Download)
  • Supabase CLI (opsional, untuk database management) (Docs)

Akun & Kredensial:

  • Supabase Account (untuk database & realtime features)
  • Firebase Account (untuk push notifications)
  • API Keys BPJS (P-Care & V-Claim)

πŸš€ Instalasi & Setup

1. Clone Repository

git clone https://github.com/rakit-digital/bpjs-healthkaton.git
cd bpjs-healthkaton

2. Setup Brain Service (AI Engine)

cd brain

# Install Python dependencies
pip install -r requirements.txt

# atau gunakan virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # di Windows: venv\Scripts\activate
pip install -r requirements.txt

# Copy environment template
cp .env.example .env

# Edit file .env dengan kredensial Supabase Anda
nano .env  # atau gunakan text editor favorit Anda

Isi file .env untuk Brain:

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-anon-key

3. Setup Dashboard Service

cd ../dashboard

# Install dependencies
npm install
# atau: yarn install
# atau: pnpm install

# Copy environment template
cp .env.local.example .env.local

# Edit file .env.local
nano .env.local

Isi file .env.local untuk Dashboard:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key

4. Setup P-Care Service

cd ../p-care

# Install dependencies
npm install

# Copy environment template
cp .env.local.example .env.local

# Edit file .env.local
nano .env.local

Isi file .env.local untuk P-Care:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
# Tambahkan API keys P-Care jika diperlukan
PCARE_API_KEY=your-pcare-api-key
PCARE_API_SECRET=your-pcare-api-secret

5. Setup V-Claim Service

cd ../vclaim

# Install dependencies
npm install

# Copy environment template
cp .env.local.example .env.local

# Edit file .env.local
nano .env.local

Isi file .env.local untuk V-Claim:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
# Tambahkan API keys V-Claim jika diperlukan
VCLAIM_API_KEY=your-vclaim-api-key
VCLAIM_API_SECRET=your-vclaim-api-secret

6. Setup Docs Service

cd ../docs

# Install dependencies
npm install

7. Setup Notification Service (Opsional)

cd ../notification-service

# Download service account JSON dari Firebase Console
# Simpan sebagai service-account.json di directory ini

# Test locally (opsional)
GOOGLE_APPLICATION_CREDENTIALS=./service-account.json go run .

8. Setup Mobile JKN (Opsional - untuk development mobile)

cd ../mobilejkn

# Install Flutter dependencies
flutter pub get

# Jalankan code generation jika diperlukan
flutter pub run build_runner build --delete-conflicting-outputs

# Setup database (lihat setup-database.md untuk detail)

πŸ—„οΈ Konfigurasi Environment Variables

Environment Variables Lengkap

Berikut adalah daftar lengkap environment variables yang digunakan:

Brain Service (brain/.env)

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-anon-key
MODEL_NAME=sentence-transformers/all-MiniLM-L6-v2

Dashboard Service (dashboard/.env.local)

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key

P-Care Service (p-care/.env.local)

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
PCARE_API_KEY=your-pcare-api-key
PCARE_API_SECRET=your-pcare-api-secret
PCARE_BASE_URL=https://api.pcare.bpjs-kesehatan.go.id

V-Claim Service (vclaim/.env.local)

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
VCLAIM_API_KEY=your-vclaim-api-key
VCLAIM_API_SECRET=your-vclaim-api-secret
VCLAIM_BASE_URL=https://api.vclaim.bpjs-kesehatan.go.id

Notification Service

GOOGLE_APPLICATION_CREDENTIALS=./service-account.json
PORT=8080

πŸƒ Menjalankan Aplikasi

Opsi 1: Development Mode (Manual - Recommended untuk Development)

Buka terminal terpisah untuk setiap service:

Terminal 1 - Brain Service

cd brain
source venv/bin/activate  # jika menggunakan virtual environment
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Terminal 2 - Dashboard

cd dashboard
npm run dev

Terminal 3 - P-Care

cd p-care
npm run dev -- --port 3001

Terminal 4 - V-Claim

cd vclaim
npm run dev -- --port 3002

Terminal 5 - Docs (Opsional)

cd docs
npm run dev

Terminal 6 - Notification Service (Opsional)

cd notification-service
GOOGLE_APPLICATION_CREDENTIALS=./service-account.json go run .

Opsi 2: Production Mode dengan Docker Compose (Recommended untuk Production)

# Build semua services
docker-compose build

# Jalankan semua services
docker-compose up

# Atau jalankan di background
docker-compose up -d

# Untuk melihat logs
docker-compose logs -f

# Untuk stop semua services
docker-compose down

Opsi 3: Jalankan Service Tertentu dengan Docker

# Jalankan hanya dashboard
docker-compose up dashboard

# Jalankan brain dan dashboard
docker-compose up brain dashboard

# Rebuild dan jalankan service tertentu
docker-compose up --build dashboard

🌐 Mengakses Aplikasi

Setelah semua service berjalan, Anda dapat mengakses:

Service URL Development URL Docker Deskripsi
Brain API http://localhost:8000 http://localhost:20501 API endpoints & docs di /docs
Dashboard http://localhost:3000 http://localhost:20502 Command Center Dashboard
P-Care http://localhost:3001 http://localhost:20504 P-Care Interface
V-Claim http://localhost:3002 http://localhost:20505 V-Claim Interface
Docs http://localhost:4321 http://localhost:20503 Dokumentasi
Notification http://localhost:8080 - FCM Push Notification Service

API Documentation:


πŸ“ Struktur Project

bpjs-healthkaton/
β”œβ”€β”€ brain/                  # AI Engine (FastAPI + ML models)
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ fraud_detection/    # Fraud detection logic
β”‚   β”‚   └── judge_analysis/     # Judge analysis logic
β”‚   β”œβ”€β”€ migrations/         # Database migrations
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ dashboard/              # Command Center (Next.js)
β”‚   β”œβ”€β”€ app/               # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ command-center/    # Command center pages
β”‚   β”‚   β”œβ”€β”€ fraud-flags/       # Fraud flags management
β”‚   β”‚   └── api/               # API routes
β”‚   β”œβ”€β”€ components/        # React components
β”‚   β”œβ”€β”€ lib/              # Utilities & helpers
β”‚   β”‚   β”œβ”€β”€ supabase-browser.ts
β”‚   β”‚   β”œβ”€β”€ supabase-server.ts
β”‚   β”‚   └── types/
β”‚   └── migrations/       # SQL migrations
β”‚
β”œβ”€β”€ p-care/                # P-Care Interface (Next.js)
β”‚   β”œβ”€β”€ app/              # Application pages
β”‚   β”œβ”€β”€ components/       # React components
β”‚   └── lib/             # Supabase clients
β”‚
β”œβ”€β”€ vclaim/               # V-Claim Interface (Next.js)
β”‚   β”œβ”€β”€ app/             # Application pages
β”‚   β”œβ”€β”€ components/      # React components
β”‚   └── types/          # TypeScript types
β”‚
β”œβ”€β”€ mobilejkn/            # Mobile App (Flutter)
β”‚   β”œβ”€β”€ lib/             # Dart source code
β”‚   β”œβ”€β”€ android/         # Android specific
β”‚   └── ios/            # iOS specific
β”‚
β”œβ”€β”€ notification-service/  # Push Notification Service (Go)
β”‚   β”œβ”€β”€ main.go
β”‚   └── service-account.json
β”‚
β”œβ”€β”€ docs/                 # Documentation Site (Astro)
β”‚   └── src/
β”‚
β”œβ”€β”€ data/                # Data files & ingestion scripts
β”‚   β”œβ”€β”€ icd10.csv
β”‚   └── ingest.py
β”‚
β”œβ”€β”€ n8n/                 # n8n workflow definitions
β”‚
└── docker-compose.yml   # Docker orchestration

πŸ—„οΈ Setup Database (Supabase)

1. Buat Project Supabase

  1. Buka Supabase Dashboard
  2. Klik "New Project"
  3. Isi nama project, database password, dan pilih region
  4. Tunggu hingga project selesai dibuat

2. Dapatkan API Keys

  1. Di dashboard project, buka Settings β†’ API
  2. Copy Project URL dan anon/public key
  3. Simpan ke file .env dan .env.local sesuai service

3. Jalankan Migrations

Untuk Brain Service:

cd brain
# Pastikan SUPABASE_URL dan SUPABASE_KEY sudah diset
./apply_migration.sh
# atau manual:
# psql -h db.your-project.supabase.co -U postgres -d postgres -f migrations/001_enhance_claim_analysis_results.sql

Untuk Dashboard:

cd dashboard
# Jalankan migrations di Supabase SQL Editor atau via CLI
cat migrations/001_create_fraud_flag_master.sql | supabase db execute
cat migrations/002_sample_fraud_flags.sql | supabase db execute

4. Import Data (Opsional)

cd data
pip install -r requirements.txt
python ingest.py

πŸ”§ Troubleshooting

Problem: Port sudah digunakan

Solusi:

# Cek process yang menggunakan port
lsof -i :3000  # ganti dengan port yang bermasalah

# Kill process
kill -9 <PID>

# Atau gunakan port yang berbeda
npm run dev -- --port 3001

Problem: Environment variables tidak terbaca

Solusi:

  1. Pastikan file .env atau .env.local ada di directory yang benar
  2. Restart development server setelah mengubah environment variables
  3. Untuk Next.js, pastikan variables dimulai dengan NEXT_PUBLIC_ untuk client-side
  4. Jangan commit file .env ke git (sudah ada di .gitignore)

Problem: Python dependencies gagal install

Solusi:

# Upgrade pip
pip install --upgrade pip

# Install dengan flag spesifik jika error
pip install --no-cache-dir -r requirements.txt

# Atau gunakan conda
conda create -n bpjs python=3.9
conda activate bpjs
pip install -r requirements.txt

Problem: Docker build gagal

Solusi:

# Clear docker cache
docker system prune -a

# Build ulang tanpa cache
docker-compose build --no-cache

# Check logs untuk error spesifik
docker-compose logs <service-name>

Problem: Supabase connection error

Solusi:

  1. Verifikasi URL dan API key benar
  2. Pastikan Supabase project aktif (tidak paused)
  3. Check network/firewall settings
  4. Test connection di browser: https://your-project.supabase.co/rest/v1/

Problem: Module not found di Next.js

Solusi:

# Clear cache dan reinstall
rm -rf node_modules .next
npm install

# Atau rebuild
npm run build

Problem: Flutter dependencies error

Solusi:

# Clear cache
flutter clean

# Get dependencies
flutter pub get

# Jika masih error, upgrade Flutter
flutter upgrade

πŸ§ͺ Testing

Testing Brain Service

cd brain
pytest
# atau untuk coverage
pytest --cov=app tests/

Testing Next.js Services

cd dashboard  # atau p-care, vclaim
npm test
npm run test:watch  # watch mode

API Testing

# Import collection dari brain/api-tests.json ke Postman atau Thunder Client
# Atau gunakan curl:
curl http://localhost:8000/health

πŸ“š Resources & Links

Dokumentasi Resmi

Project Documentation

  • Lihat folder docs/ untuk dokumentasi detail
  • API endpoints: http://localhost:8000/docs (saat brain service running)
  • Setup database: mobilejkn/setup-database.md
  • API documentation: mobilejkn/API_DOCS.md

🀝 Contributing

Untuk berkontribusi:

  1. Fork repository ini
  2. Buat branch feature (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push ke branch (git push origin feature/AmazingFeature)
  5. Buat Pull Request

πŸ“„ License

Project ini menggunakan lisensi sesuai ketentuan BPJS Kesehatan dan Rakit Digital.


πŸ“ž Support

Untuk pertanyaan atau bantuan:


🎯 Quick Start Checklist

  • Clone repository
  • Install Node.js, Python, Docker
  • Buat Supabase project
  • Copy & isi semua file .env / .env.local
  • Install dependencies untuk setiap service
  • Jalankan migrations database
  • Start development servers
  • Akses dashboard di http://localhost:3000

Selamat coding! πŸš€

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages