KYC / KYB — engineering¶
Runtime shape¶
Single FastAPI process (src/app.py) with many POST handlers. Heavy ML (face, NLP) and Prembly HTTP calls run inside request handlers / model modules.
Layout¶
kyc-kyb-ai-backend/
src/app.py
src/models/ # prembly_*, face_*, adverse_media/, anti_spoof/
src/report/ # AI report agent + aml_goaml/
src/application/ # Pydantic models
src/config/appconfig.py
tests/
Route ownership¶
All HTTP routes are declared in src/app.py (see Integrate / OpenAPI). Keep routers thin when refactoring: move logic into src/models/ and src/report/.
goAML module¶
src/report/aml_goaml/ — Excel → validated JSON → goAML 5.0.2 XML (NFIU CTR/STR). PARTIAL: library + scripts; not registered on FastAPI. Status: offline pipeline until a job/HTTP entrypoint exists.
Local¶
cd kyc-kyb-ai-backend
poetry install
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json
poetry run uvicorn src.app:app --reload
Tests: poetry run pytest tests/ (Prembly/GCP mocked in tests/conftest.py).
OpenAPI sync¶
After route changes, refresh platform-docs/docs/openapi/kyc-kyb.openapi.json via platform-docs/scripts/export_kyc_openapi.py or curl from a running process.
Auth gap¶
No JWT dependencies on routes. CORS is wide open in app code. Document gateway requirements per environment before exposing.