Switch to cases/{new,in-progress,completed}/ directory structure

Replace single CASES_DIR with find_case_dir() that searches across
all status directories. New cases created in cases/new/{number}/.

Config: CASES_BASE, CASES_NEW, CASES_IN_PROGRESS, CASES_COMPLETED
Docker: added -v /home/chaim/legal-ai/cases:/cases volume mount

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 10:45:47 +00:00
parent dc6026100c
commit 5fc52ce530
6 changed files with 32 additions and 12 deletions

View File

@@ -52,9 +52,29 @@ ANTHROPIC_API_KEY = os.environ.get("ANTHROPIC_API_KEY", "")
# Data directory
DATA_DIR = Path(os.environ.get("DATA_DIR", str(Path.home() / "legal-ai" / "data")))
CASES_DIR = DATA_DIR / "cases"
TRAINING_DIR = DATA_DIR / "training"
# 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]
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
# Chunking parameters
CHUNK_SIZE_TOKENS = 600
CHUNK_OVERLAP_TOKENS = 100