chore: bootstrap repository with governance docs
Initialize git, add Apache-2.0 LICENSE, .gitattributes (LF line endings), AGENTS.md (entry points, stack, discovery order, baseline checks), RUNBOOK.md (dev boot, prod deploy with overlay, ingestion, failures, rollback, scaling notes), .env.prod.example with rotated credential placeholders, and dev-only warnings on .env.example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
42
app/storage/local_paths.py
Normal file
42
app/storage/local_paths.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Storage key conventions for MinIO and local working paths."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
from app.config import settings
|
||||
|
||||
|
||||
def work_dir_for(document_id: uuid.UUID | str) -> Path:
|
||||
p = Path(settings.app_work_dir) / str(document_id)
|
||||
p.mkdir(parents=True, exist_ok=True)
|
||||
return p
|
||||
|
||||
|
||||
def key_original_pdf(document_id: uuid.UUID | str, sha256: str) -> str:
|
||||
return f"docs/{document_id}/original/{sha256}.pdf"
|
||||
|
||||
|
||||
def key_ocr_pdf(document_id: uuid.UUID | str) -> str:
|
||||
return f"docs/{document_id}/ocr/ocr.pdf"
|
||||
|
||||
|
||||
def key_docling_json(document_id: uuid.UUID | str) -> str:
|
||||
return f"docs/{document_id}/docling/document.json"
|
||||
|
||||
|
||||
def key_markdown(document_id: uuid.UUID | str) -> str:
|
||||
return f"docs/{document_id}/docling/document.md"
|
||||
|
||||
|
||||
def key_page_image(document_id: uuid.UUID | str, page_number: int) -> str:
|
||||
return f"docs/{document_id}/pages/p{page_number:05d}.png"
|
||||
|
||||
|
||||
def key_figure_crop(document_id: uuid.UUID | str, page_number: int, figure_index: int) -> str:
|
||||
return f"docs/{document_id}/figures/p{page_number:05d}_f{figure_index:03d}.png"
|
||||
|
||||
|
||||
def key_table_json(document_id: uuid.UUID | str, table_index: int) -> str:
|
||||
return f"docs/{document_id}/tables/t{table_index:04d}.json"
|
||||
Reference in New Issue
Block a user