Flatten cases directory structure and unify paths

- Remove cases/new|in-progress|completed subdivision (status managed in DB)
- Rename documents/original → documents/originals (consistent plural)
- Move exports from global data/exports/ into cases/{num}/exports/
- Add documents/research/ for case law and analysis files
- Update all agents, scripts, config, web API endpoints, and DB paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-09 14:33:27 +00:00
parent 4d674bf475
commit 22e819363e
17 changed files with 1203 additions and 62 deletions

View File

@@ -53,28 +53,15 @@ GOOGLE_CLOUD_VISION_API_KEY = os.environ.get("GOOGLE_CLOUD_VISION_API_KEY", "")
# Data directory
DATA_DIR = Path(os.environ.get("DATA_DIR", str(Path.home() / "legal-ai" / "data")))
TRAINING_DIR = DATA_DIR / "training"
EXPORTS_DIR = DATA_DIR / "exports"
EXPORTS_DIR = DATA_DIR / "exports" # legacy exports only
# Cases directory — new structure: cases/{new,in-progress,completed}/{case_number}/
CASES_BASE = Path(os.environ.get("CASES_BASE", str(Path.home() / "legal-ai" / "cases")))
CASES_NEW = CASES_BASE / "new"
CASES_IN_PROGRESS = CASES_BASE / "in-progress"
CASES_COMPLETED = CASES_BASE / "completed"
CASES_DIR = CASES_NEW # backwards compatibility — new cases default here
_STATUS_DIRS = [CASES_NEW, CASES_IN_PROGRESS, CASES_COMPLETED]
# Cases directory — flat structure: data/cases/{case_number}/
CASES_DIR = DATA_DIR / "cases"
def find_case_dir(case_number: str) -> Path:
"""Find a case directory across all status folders.
Returns the existing directory, or defaults to CASES_NEW/{case_number}.
"""
for base in _STATUS_DIRS:
candidate = base / case_number
if candidate.exists():
return candidate
return CASES_NEW / case_number
"""Return the case directory for a given case number."""
return CASES_DIR / case_number
# Chunking parameters
CHUNK_SIZE_TOKENS = 600