diff --git a/README.md b/README.md index 10ee5d9..a2a22f8 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,11 @@ pip install -r requirements.txt ## Cara Menjalankan Aplikasi +### Aktifkan venv +```bash +source /home/pacs/pydicom-migrasi-clarity/venv/bin/activate +``` + ### Contoh Penggunaan Umum Untuk migrasi data harian baru: ```bash @@ -94,17 +99,21 @@ Program ini mendukung beberapa mode operasi: python main.py process --start-date 20250501 --end-date 20250502 ``` -2. **Find-Studies** - Hanya mencari studi berdasarkan rentang tanggal: +2. **Process-Study** - Menjalankan alur kerja lengkap untuk studi tertentu: + ```bash + python main.py process-study --study-uid 1.2.826.1.3680043.9.5282.150415.30338.202504010001 + ``` +3. **Find-Studies** - Hanya mencari studi berdasarkan rentang tanggal: ```bash python main.py find-studies --start-date 20250501 --end-date 20250502 ``` -3. **Get-Study** - Mengambil studi tertentu berdasarkan StudyInstanceUID: +4. **Get-Study** - Mengambil studi tertentu berdasarkan StudyInstanceUID: ```bash python main.py get-study --study-uid 1.2.826.1.3680043.9.5282.150415.30338.202504010001 ``` -4. **Send-Study** - Mengirim studi tertentu ke PACS tujuan: +5. **Send-Study** - Mengirim studi tertentu ke PACS tujuan: ```bash python main.py send-study --study-uid 1.2.826.1.3680043.9.5282.150415.30338.202504010001 ``` diff --git a/config/settings.py b/config/settings.py index a8ca53f..a877af7 100644 --- a/config/settings.py +++ b/config/settings.py @@ -8,14 +8,14 @@ SOURCE_PORT = 8888 # Our port # Source PACS Configuration (where to query/get data from) SOURCE_PACS = { - "host": "192.168.22.3", + "host": "192.168.2.30", "port": 11112, - "aet": "ABPACS" + "aet": "FREEDOM" } # Destination PACS Configuration (where to send data to) DESTINATION_PACS = { - "host": "152.42.173.210", + "host": "192.168.1.29", "port": 11112, "aet": "ABPACS" } @@ -40,5 +40,5 @@ JSON_OUTPUT_DIR = "output/json" DICOM_STORE_DIR = "output/dicom" # HIS Configuration -HIS_HOST = "localhost:8787" -HIS_URL = "/result_series" \ No newline at end of file +HIS_HOST = "192.168.1.1:80" +HIS_URL = "/poapi/api_migrasiclarity.php?name=migrasi_data_pacs" diff --git a/main.py b/main.py index e3cad8f..7ba1120 100644 --- a/main.py +++ b/main.py @@ -485,7 +485,16 @@ def process_workflow(args): # STEP 5: Send study_log to HIS API his_url = f"http://{settings.HIS_HOST}{settings.HIS_URL}" try: - response = requests.post(his_url, json=study_log) + # Header tembak API HIS + headers = { + 'id': 'Vmtaa2MySnRUblJTYWtKb1ZucHNNVlZVU2pSaFIwNTBZa1JDYkZaV1NtOWFSV1JIVmxkSmQxSnJUbFpTVlZwRlZsaGpPVkJSUFQwPQ==', + 'Content-Type': 'application/json' + } + response = requests.post(his_url, json=study_log, headers=headers) + + # Gunakan ini untuk development + # response = requests.post(his_url, json=study_log) + if response.status_code == 200 and response.json().get('OK') == "1": his_log.append(study_log) logger.info(f"Successfully sent JSON {accession_number} to HIS API") @@ -595,7 +604,16 @@ def process_workflow_by_study(args): # STEP 4: Send study_log to HIS API his_url = f"http://{settings.HIS_HOST}{settings.HIS_URL}" try: - response = requests.post(his_url, json=study_log) + # Header tembak API HIS + headers = { + 'id': 'Vmtaa2MySnRUblJTYWtKb1ZucHNNVlZVU2pSaFIwNTBZa1JDYkZaV1NtOWFSV1JIVmxkSmQxSnJUbFpTVlZwRlZsaGpPVkJSUFQwPQ==', + 'Content-Type': 'application/json' + } + response = requests.post(his_url, json=study_log, headers=headers) + + # Pakai ini untuk Development + # response = requests.post(his_url, json=study_log) + if response.status_code == 200 and response.json().get('OK') == "1": logger.info(f"Successfully sent JSON {accession_number} to HIS API") # Save successful log