edit: clear readme, pdu, query level
This commit is contained in:
64
README.md
64
README.md
@@ -1,3 +1,65 @@
|
||||
# pydicom-uploader
|
||||
|
||||
Gateway untuk retrieve order di BISONE yang perlu di upload ke Google Healthcare
|
||||
## Overview
|
||||
pydicom-uploader adalah sebuah gateway untuk mengambil order dari BISONE yang perlu diunggah ke Google Healthcare. Proyek ini dirancang untuk mempermudah proses pengambilan dan pengunggahan file DICOM dari PACS ke Google Healthcare API melalui Go OHIF Proxy.
|
||||
|
||||
### Fitur Utama
|
||||
- Mengambil daftar order yang perlu diproses dari API BISONE.
|
||||
- Mengambil file DICOM dari PACS menggunakan protokol DICOM C-GET.
|
||||
- Mengunggah file DICOM ke Google Healthcare API.
|
||||
- Memperbarui status order di API BISONE setelah proses selesai.
|
||||
- Logging yang terstruktur untuk memantau proses.
|
||||
|
||||
## Alur Kerja Sederhana
|
||||
1. Aplikasi mengambil daftar order yang perlu diproses dari API BISONE.
|
||||
```
|
||||
# Contoh GET Request
|
||||
GET https://devone.aplikasi.web.id/one-api/mockup/godicomupreq/godicomupreq/get_uprequests?startDate=2025-04-22&endDate=2025-04-22&status=0
|
||||
```
|
||||
2. Untuk setiap order:
|
||||
- Mengambil file DICOM dari PACS berdasarkan StudyInstanceUID.
|
||||
- Mengunggah file DICOM ke Google Healthcare API melalui Go OHIF Proxy.
|
||||
- Memperbarui status order di API BISONE.
|
||||
|
||||
3. Membersihkan file sementara setelah proses selesai.
|
||||
|
||||
## Development
|
||||
|
||||
### Prasyarat
|
||||
- Python 3.9 atau lebih baru.
|
||||
- Virtual environment (opsional, tetapi disarankan).
|
||||
|
||||
### Langkah-langkah
|
||||
1. Clone repository ini:
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd pydicom-google-uploader
|
||||
```
|
||||
|
||||
2. Buat virtual environment dan aktifkan:
|
||||
```bash
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate # Untuk Linux/Mac
|
||||
venv\Scripts\activate # Untuk Windows
|
||||
```
|
||||
|
||||
3. Install dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
4. Konfigurasi file `config.py` sesuai dengan kebutuhan Anda, seperti:
|
||||
- `PACS_HOST`, `PACS_PORT`, `PACS_AE_TITLE`, dan `LOCAL_AE_TITLE` untuk konfigurasi PACS.
|
||||
- `PROXY_URL` untuk URL Go OHIF Proxy.
|
||||
- `API_URL` untuk endpoint API BISONE.
|
||||
|
||||
5. Jalankan aplikasi:
|
||||
```bash
|
||||
python main.py
|
||||
```
|
||||
|
||||
6. Untuk pengembangan, Anda dapat menggunakan file `test.http` untuk menguji endpoint HTTP.
|
||||
|
||||
### Catatan
|
||||
- Pastikan Anda memiliki akses ke PACS dan API BISONE yang dikonfigurasi.
|
||||
- Gunakan log file (`server.log`) untuk memantau proses dan debugging jika terjadi kesalahan.
|
||||
39
main.py
39
main.py
@@ -102,6 +102,8 @@ class DicomUploader:
|
||||
"""
|
||||
ae = AE(ae_title=self.local_ae_title)
|
||||
ae.add_requested_context(PatientRootQueryRetrieveInformationModelGet)
|
||||
|
||||
# ae.maximum_pdu_size = 130816 # * Kalau ingin set maximum PDU size to 128kB. Harus set di sisi DCM4CHEE juga
|
||||
|
||||
storage_uids = [
|
||||
'1.2.840.10008.5.1.4.1.1.1', # CR Storage
|
||||
@@ -151,22 +153,33 @@ class DicomUploader:
|
||||
|
||||
if assoc.is_established:
|
||||
ds = Dataset()
|
||||
|
||||
if sop_instance_uid:
|
||||
ds.QueryRetrieveLevel = 'IMAGE'
|
||||
ds.StudyInstanceUID = study_instance_uid
|
||||
ds.SeriesInstanceUID = series_instance_uid
|
||||
ds.SOPInstanceUID = sop_instance_uid
|
||||
elif series_instance_uid:
|
||||
ds.QueryRetrieveLevel = 'SERIES'
|
||||
ds.StudyInstanceUID = study_instance_uid
|
||||
ds.SeriesInstanceUID = series_instance_uid
|
||||
else:
|
||||
ds.QueryRetrieveLevel = 'STUDY'
|
||||
ds.StudyInstanceUID = study_instance_uid
|
||||
|
||||
# * Kalau level image nanti cuma 1 image aja yang digetscu
|
||||
# if sop_instance_uid:
|
||||
# ds.QueryRetrieveLevel = 'IMAGE'
|
||||
# ds.StudyInstanceUID = study_instance_uid
|
||||
# ds.SeriesInstanceUID = series_instance_uid
|
||||
# ds.SOPInstanceUID = sop_instance_uid
|
||||
|
||||
# * Kalau level series nanti cget semua image dalam 1 series id itu
|
||||
# elif series_instance_uid:
|
||||
# ds.QueryRetrieveLevel = 'SERIES'
|
||||
# ds.StudyInstanceUID = study_instance_uid
|
||||
# ds.SeriesInstanceUID = series_instance_uid
|
||||
|
||||
# * Kalau level study nanti cget semua image dalam 1 study id itu
|
||||
# else:
|
||||
# ds.QueryRetrieveLevel = 'STUDY'
|
||||
# ds.StudyInstanceUID = study_instance_uid
|
||||
|
||||
# * Default: Study level. Sampai ada kasus yang membutuhkan level lain
|
||||
ds.QueryRetrieveLevel = 'STUDY'
|
||||
ds.StudyInstanceUID = study_instance_uid
|
||||
|
||||
# Send C-GET request and collect responses
|
||||
responses = assoc.send_c_get(ds, PatientRootQueryRetrieveInformationModelGet)
|
||||
|
||||
logger.info(f"Query Retrieval Level: {ds.QueryRetrieveLevel}")
|
||||
|
||||
for status, identifier in responses:
|
||||
if status:
|
||||
|
||||
Reference in New Issue
Block a user