From 297c9a6a013cf0deb474cd0d90ec47844b4a0c80 Mon Sep 17 00:00:00 2001 From: mario Date: Mon, 28 Apr 2025 15:37:02 +0700 Subject: [PATCH] add readme.md --- README.md | 145 ++++++++++++++++++++++++++++++++++++++++++++ test/http/test.http | 7 ++- 2 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3281398 --- /dev/null +++ b/README.md @@ -0,0 +1,145 @@ +# GO-OHIF-Proxy + +## 1. Gambaran Umum + +### Tujuan + +App ini dibuat untuk menyalurkan **dicomWeb** request dari OHIF ke Google Healthcare. Proxy berperan hanya sebagai authenticator ke Google dengan `service-account.json`, **tanpa merubah / menambah request** + +Berikut adalah cara clone project ini: + + +## 2. Alur Kerja Aplikasi + +``` ++----------------+ +----------------+ +----------------------+ +| | | | | | +| OHIF Viewer |----->| GO-OHIF-Proxy |----->| Google Healthcare | +| (Web Client) |<-----| |<-----| DICOM API | +| | | | | | ++----------------+ +----------------+ +----------------------+ +``` + +1. **Permintaan Klien**: OHIF Viewer mengirimkan permintaan DICOMweb (misalnya, untuk mengambil studi). +2. **Pemrosesan Proxy**: + - Proxy mencegat permintaan. + - Menambahkan header autentikasi yang sesuai. + - Meneruskan permintaan ke Google Cloud Healthcare API. +3. **Pemrosesan Google Cloud**: Healthcare API memproses permintaan DICOM. +4. **Penanganan Respons**: Proxy meneruskan respons kembali ke klien. + +## 3. Instalasi dan Penggunaan + +### Prasyarat + +- Go versi 1.19 atau lebih tinggi. +- Akun Google Cloud dengan Healthcare API diaktifkan. +- Kredensial akun layanan dengan akses ke DICOM store. + +### Clone dan Setup + +```bash +# Clone repositori +git clone https://devone.aplikasi.web.id/gitea/mario/go-ohif-proxy.git +cd go-ohif-proxy + +# Install dependencies +go mod download +``` + +### Konfigurasi + +1. Salin file konfigurasi contoh: + ```bash + cp config/config.yaml.example config/config.yaml + ``` + +2. Edit `config/config.yaml` sesuai kebutuhan: + ```yaml + server: + port: 5555 + read_timeout_seconds: 30 + write_timeout_seconds: 30 + idle_timeout_seconds: 60 + + log_level: "info" # debug, info, warn, error + + google: + project_id: "id-proyek-gcp-anda" + location: "lokasi-anda" + dataset: "nama-dataset-anda" + dicom_store: "nama-dicom-store-anda" + credentials_path: "./credentials/service-account.json" + + allowed_origins: + - "http://localhost:3000" # URL OHIF Viewer + ``` + +3. Letakkan kredensial akun layanan Google Cloud Anda di `credentials/service-account.json`. + +### Menjalankan Aplikasi + +#### Build dan Jalankan Secara Langsung + +```bash +# Build aplikasi +go build -o ohif-proxy ./cmd/server + +# Jalankan aplikasi +./ohif-proxy +``` + +#### Menggunakan Docker + +```bash +# Build image Docker +docker build -t go-ohif-proxy . + +# Jalankan dengan Docker +docker run -p 5555:5555 -v $(pwd)/config:/app/config -v $(pwd)/credentials:/app/credentials go-ohif-proxy +``` + +#### Menggunakan Docker Compose + +```bash +docker-compose up +``` + +### Run Aplikasi Tanpa Build + +1. Transfer `./ohif-proxy` ke server tujuan. Contoh: + ```sh + scp ohif-proxy pacs@152.42.173.210:/home/pacs/google-ohif-proxy + ``` +2. Pastikan server tujuan terinstall **go versi >1.19**. Cek dengan: +3. Buat direktori: + ```sh + mkdir -p ~/google-ohif-proxy + mkdir -p ~/google-ohif-proxy/config + mkdir -p ~/google-ohif-proxy/credentials + ``` +4. Tambahkan `config.go` dan `config.yaml`. + ```sh + scp -r config/* pacs@152.42.173.210:/home/pacs/google-ohif-proxy/config/ + ``` +5. Tambahkan credential `/credentials/service-account.json` + ``` + nano credentials/service-account.json + # atau + # scp dari local + ``` + + +### Pengujian + +Aplikasi ini menyertakan permintaan HTTP uji di direktori `test/http` yang dapat digunakan dengan klien REST seperti ekstensi REST Client di VSCode. + +```bash +# Jalankan pengujian yang disertakan +make test +``` + +--- + +Untuk informasi lebih lanjut tentang OHIF: [https://ohif.org/](https://ohif.org/) +Untuk informasi lebih lanjut tentang Google Cloud Healthcare API: [https://cloud.google.com/healthcare](https://cloud.google.com/healthcare) \ No newline at end of file diff --git a/test/http/test.http b/test/http/test.http index f82275f..b79ca37 100644 --- a/test/http/test.http +++ b/test/http/test.http @@ -1,5 +1,8 @@ ### Local OHIF Proxy Test File -@baseUrl = http://localhost:5555 +# @baseUrl = http://localhost:5555 +# @baseUrl = http://devone.aplikasi.web.id:5555 +@baseUrl = http://152.42.173.210:5555 + ### 1. Health Check # Verifies that the proxy server is running @@ -18,7 +21,7 @@ Accept: application/dicom+json ### 4. QIDO-RS: Search for Studies with Date Range # Returns studies within a date range -GET {{baseUrl}}/dicomWeb/studies?StudyDate=20200101-20230101 +GET {{baseUrl}}/dicomWeb/studies?StudyDate=20250301-20250415 Accept: application/dicom+json ### 5. QIDO-RS: Search for Series in a Study