Files
OCR-SPRIN-SERVICE/Makefile
Devin AI ca0c0a0428 Phase 1 MVP: synchronous OCR + regex header extraction
Implements the foundation of the OCR Sprint service:
- FastAPI app with /api/v1/health and /api/v1/documents (sync upload)
- Pydantic v2 schemas for documents, extraction result, personnel
- Pipeline: PDF/image ingest (PyMuPDF), preprocessing (resize, deskew,
  denoise, optional adaptive threshold), PaddleOCR wrapper, regex-based
  header extraction (nomor sprint, tanggal, satuan, perihal, dasar),
  signatory NRP, master-pangkat validation, confidence scoring + routing.
- Tests: 61 unit tests covering regex rules, validators, preprocess,
  ingest, confidence, and API contract (PaddleOCR mocked).
- Tooling: pyproject (setuptools), ruff, mypy strict, pytest, pre-commit,
  Dockerfile, docker-compose, Makefile.
- Docs: README + docs/architecture.md (full hybrid stack rationale and
  6-phase roadmap).

Co-authored-by: adrian kuman firmansah <adriancuman@gmail.com>
2026-04-25 14:58:50 +00:00

53 lines
1.2 KiB
Makefile

.PHONY: help install dev fmt lint typecheck test test-cov run docker-build docker-up docker-down clean
help:
@echo "Targets:"
@echo " install - install runtime + dev deps in current env"
@echo " dev - run FastAPI app with autoreload"
@echo " fmt - format code with ruff"
@echo " lint - lint with ruff"
@echo " typecheck - run mypy"
@echo " test - run pytest"
@echo " test-cov - run pytest with coverage"
@echo " docker-build - build api image"
@echo " docker-up - start docker-compose stack"
@echo " docker-down - stop docker-compose stack"
install:
python -m pip install --upgrade pip
pip install -e ".[dev]"
pre-commit install || true
dev:
uvicorn ocr_sprint.main:app --reload --host 0.0.0.0 --port 8000
fmt:
ruff format src tests
ruff check --fix src tests
lint:
ruff check src tests
ruff format --check src tests
typecheck:
mypy src
test:
pytest
test-cov:
pytest --cov --cov-report=term-missing
docker-build:
docker compose build
docker-up:
docker compose up -d
docker-down:
docker compose down
clean:
rm -rf .pytest_cache .mypy_cache .ruff_cache .coverage htmlcov build dist *.egg-info
find . -type d -name __pycache__ -exec rm -rf {} +