AURASHIELDV3 / data /data_loader.py
ANJU DEVI
AuraShield V3 Docker deployment
6960b79
Raw
History Blame Contribute Delete
801 Bytes
import json
import os
import pandas as pd
def load_mock_data(filepath):
"""
Loads mock vulnerability dataset from a JSON file.
"""
if not os.path.exists(filepath):
raise FileNotFoundError(f"File not found: {filepath}")
with open(filepath, 'r') as f:
data = json.load(f)
return data
def load_enriched_data(filepath):
"""
Loads the enriched dataset from a JSON file.
"""
if not os.path.exists(filepath):
# Default fallback to current dir
filepath = os.path.join(os.path.dirname(__file__), "enriched_data.json")
with open(filepath, 'r') as f:
data = json.load(f)
return data
def to_dataframe(data):
"""
Converts list of dicts to pandas DataFrame.
"""
return pd.DataFrame(data)