18 lines
568 B
Python
18 lines
568 B
Python
import sys
|
|
import json
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
from import_to_sqlite import import_abnormal_report_data
|
|
from config import OUTPUT_DIR
|
|
|
|
latest_file = OUTPUT_DIR / "report_abnormal_20260611_120355.json"
|
|
print(f"Importing from {latest_file}")
|
|
with open(latest_file, 'r', encoding='utf-8') as f:
|
|
data = json.load(f)
|
|
items = data.get('result', {}).get('items', [])
|
|
if items:
|
|
count = import_abnormal_report_data(items)
|
|
print(f"Imported {count} items.")
|
|
else:
|
|
print("No items in json.")
|