fix: product_id 충돌 해결 (임의 생성 5종 → MASTER-017~021)
This commit is contained in:
29
fix_ids.py
Normal file
29
fix_ids.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import os
|
||||
|
||||
master_dir = r'C:\Users\청춘약국\source\animal-medication-api\data\master'
|
||||
|
||||
# 충돌 ID 수정 매핑
|
||||
id_map = {
|
||||
'apoquel.json': 'MASTER-017',
|
||||
'bravecto.json': 'MASTER-018',
|
||||
'simparica.json': 'MASTER-019',
|
||||
'gabapentin.json': 'MASTER-020',
|
||||
'metronidazole.json': 'MASTER-021'
|
||||
}
|
||||
|
||||
for filename, new_id in id_map.items():
|
||||
filepath = os.path.join(master_dir, filename)
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
old_id = data['product_id']
|
||||
data['product_id'] = new_id
|
||||
|
||||
with open(filepath, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
|
||||
print(f'{filename}: {old_id} -> {new_id}')
|
||||
|
||||
print('Done')
|
||||
Reference in New Issue
Block a user