Spaces:
Sleeping
Sleeping
File size: 801 Bytes
6960b79 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 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)
|