Spaces:
Sleeping
Sleeping
File size: 458 Bytes
6f94597 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import json
from typing import List, Dict, Any
def load_documents(path: str) -> Dict[str, Any]:
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
return data
def validate_document(data: Dict[str, Any]) -> bool:
required = ["doc_name", "structure"]
for field in required:
if field not in data:
return False
if not isinstance(data.get("structure"), list):
return False
return True
|