Purpose
This demo shows an end‑to‑end compliance workflow in which an Organisation requests background checks for an Individual, who then submits the required data, and an Admin (Verification Officer) reviews and finalises the result. The FastAPI back‑end, Python SDK, and OAuth 2.0 auth flow are all exercised.
- Actors & Permissions
- Authentication & Authorisation
- End‑to‑End Workflow
- API Surface
- State Diagram
- Running the Demo Locally
- Assumptions & Limitations
| Role / Entity | Typical User | Permissions |
|---|---|---|
| Organisation | HRIS / ATS integration, corporate client | • Create Verification Requests • Poll status • Receive webhook notifications |
| Individual | Employee / Contractor | • View required checks • Submit personal data & documents |
| Admin | Verification Officer (VO) | • View all requests & data • Mark result Completed / Failed • Download audit trail |
Each role authenticates with its own client_id / client_secret pair issued via the Admin Portal.
- Protocol: OAuth 2.0 (Client‑Credentials)
- Token endpoint:
POST /oauth2/token - Scopes:
org.verify– create & view own requestsuser.submit– view & submit assigned checksadmin.review– full read/write
Tokens are JWTs signed by the API; the SDK refreshes them automatically.
curl -X POST https://api.demo.local/oauth2/token \
-d 'grant_type=client_credentials&client_id=ORG_123&client_secret=•••&scope=org.verify'- Organisation ➜ API
POST /verificationswith employee identifiers + list of checks.
Status →PENDING_ORG - System ➜ Individual
Email/SMS invites the individual to log in to the Applicant Portal (out‑of‑scope for this demo – assumed). - Individual ➜ API
PUT /verifications/{id}/datasends required PII and documents.
Status →PENDING_ADMIN - Admin ➜ API (Back‑office UI)
GET /admin/verifications/{id}shows all submitted data.
Admin reviews external evidence (AHPRA, Bankruptcy, WWC, etc.). - Admin ➜ API
PATCH /admin/verifications/{id}with{ "status": "COMPLETED", "outcome": "PASS" }or{ "status": "FAILED", "reason": "Expired registration" }. - API ➜ Organisation
WebhookPOST https://client.example.com/webhookswith final result ‑or‑ Organisation pollsGET /verifications/{id}.
Workflow ends.
sequenceDiagram
participant Org as Organisation (client)
participant API as Verification API
participant Ind as Individual
participant Adm as Admin/VO
Org->>API: POST /verifications (employee, requestedChecks)
API-->>Org: 201 Created (id)
API-->>Ind: Invitation with link & token
Ind->>API: PUT /verifications/{id}/data
API-->>Adm: New submission notification
Adm->>API: GET /admin/verifications/{id}
Adm-->>API: PATCH /admin/verifications/{id} (COMPLETED / FAILED)
API-->>Org: Webhook or poll result
Only business‑logic‑relevant paths are shown; auth, health, and pagination parameters omitted for brevity.
| Method | Path | Auth Scope | Purpose |
|---|---|---|---|
POST |
/verifications |
org.verify |
Create a new verification request |
GET |
/verifications/{id} |
org.verify |
Get consolidated status/outcome |
PUT |
/verifications/{id}/data |
user.submit |
Individual submits required data |
PATCH |
/admin/verifications/{id} |
admin.review |
Admin marks result Completed/Failed |
GET |
/admin/verifications?status=… |
admin.review |
List & filter all requests |
POST |
/webhooks/verify/{id} |
— | (System → Organisation) push result |
PENDING_ORG → PENDING_ADMIN → COMPLETED | FAILED
^ |
| ↓
+----------- FAILED ------------
graph TD
PENDING_ORG --> PENDING_ADMIN
PENDING_ADMIN --> COMPLETED
PENDING_ADMIN --> FAILED
PENDING_ORG --> FAILED
# 1. Clone & start the FastAPI server
$ git clone https://github.com/your-org/regtech-demo.git
$ cd regtech-demo
$ poetry install
$ uvicorn app.main:app --reload
# 2. (Optional) seed demo data
$ python scripts/seed_demo_clients.py
# 3. Try the flow
$ http POST :8000/oauth2/token client_id==ORG_123 client_secret==secret grant_type==client_credentials scope==org.verify
$ http POST :8000/verifications Authorization:"Bearer <token>" < sample_create.jsonSwagger UI available at http://localhost:8000/docs when running in dev mode.
- External check integrations are stubbed → response is mock PASS after 3 s.
- No email front‑end – invitation link is logged to console.
- Data persists in SQLite (
/tmp/demo.db) and is wiped on restart. - RBAC is simplified: scopes map 1‑to‑1 with actor roles. In production, you may need finer‑grained claim sets.
- Add asynchronous queue (Celery, SQS) for long‑running checks.
- Encrypt PII columns at rest with AWS KMS.
- Capture per‑field audit events for regulator export.