Skip to content

Compliance Engine ​

The Compliance Engine decides whether a proposed journey, match or booking satisfies the currently approved operating rules.

It can ALLOW, BLOCK, REVIEW, SUSPEND or ESCALATE.

What it does not do ​

The engine never asserts that an activity is legally compliant because an internal rule passed.

It applies the policy configuration supplied by the approved operating and regulatory framework. That framework is external and versioned; the engine is only its mechanical interpreter. If the policy is wrong, the decision is wrong in a consistent and inspectable way.

Separation from matching ​

text
Matching Engine
      │
      │  "These journeys are geographically compatible."
      ▼
Candidate Match
      │
      ▼
Compliance Engine
      │
      │  "Is this permitted under the currently approved rules?"
      ▼
   ┌────┴─────┐
   ▼          ▼
 ALLOW   BLOCK / REVIEW

A match can be geographically excellent and still require review or blocking. This is the most important structural decision in the platform: it lets the operating model change without rebuilding the matching system, and it is the reason RTA can approve a different framework than the initial assumptions without invalidating the matching work.

Policy configuration ​

Rules are configuration, never code. The active policy is a versioned document.

json
{
  "policyVersion": "PILOT-0.1",
  "identity": {
    "driverVerificationRequired": true,
    "passengerVerificationRequired": true
  },
  "vehicle": {
    "verificationRequired": true
  },
  "journey": {
    "existingJourneyRequired": true
  },
  "relationship": {
    "enabled": true,
    "approvedTypes": []
  },
  "contribution": {
    "enabled": false,
    "approvedModes": []
  },
  "matching": {
    "maxDetourMeters": null,
    "maxDetourSeconds": null
  }
}

An empty array or a null value means the value must be supplied by an approved policy. It never means "no limit" and it never means "not applicable". A policy that leaves maxDetourMeters unset does not permit unlimited detour; it is incomplete and evaluation returns REVIEW.

Decision states ​

DecisionMeaning
ALLOWEvery mandatory configured requirement is satisfied.
REVIEWThe system cannot determine automatically whether the activity should proceed. A human decides.
BLOCKA mandatory configured condition has failed.
SUSPENDAn account-level control is applied, taking the subject out of service pending review.
ESCALATEThe matter is handed to the regulatory workflow.

REVIEW and BLOCK are different in kind: BLOCK is a known failure, REVIEW is indeterminacy. Collapsing them would hide operational problems behind a clean failure, and would stop distinguishing "we know this is not allowed" from "we cannot tell yet".

HOLD is a fifth action available to the administrative workflow — it is a temporary control applied while a review is open, not an engine output.

json
{ "status": "ALLOW", "reasonCodes": [] }
json
{
  "status": "REVIEW",
  "reasonCodes": ["RELATIONSHIP_REQUIRES_REVIEW"]
}
json
{
  "status": "BLOCK",
  "reasonCodes": ["DRIVER_NOT_VERIFIED"]
}

Compliance domains ​

The engine evaluates fourteen domains.

#DomainRule prefix
1IdentityIDENTITY-
2DriverDRIVER-
3VehicleVEHICLE-
4JourneyJOURNEY-
5PassengerPASSENGER-
6Relationship / eligibilityRELATIONSHIP-
7Route behaviourROUTE-
8Frequency / activityACTIVITY-
9ContributionCONTRIBUTION-
10SafetySAFETY-
11ComplaintsCOMPLAINT-
12Account historyACCOUNT-
13Geographic restrictionsGEO-
14Regulatory policyPOLICY-

Identity ​

CodeConditionDefault action
IDENTITY-001Driver identity not verifiedBLOCK
IDENTITY-002Passenger identity not verifiedBLOCK
IDENTITY-003Identity verification expiredREVIEW or BLOCK

The exact treatment is configurable. What is not configurable is treating an expired verification as a valid one.

Driver ​

CodeConditionDefault action
DRIVER-001Driver profile incompleteBLOCK
DRIVER-002Driving licence verification failedBLOCK
DRIVER-003Driver account suspendedBLOCK
DRIVER-004Driver verification expiredREVIEW

A user must never be able to bypass verification by creating a second driver profile. The uniqueness of driver_profiles.user_id is what makes this enforceable.

Vehicle ​

CodeConditionDefault action
VEHICLE-001Vehicle not verifiedBLOCK
VEHICLE-002Vehicle verification expiredREVIEW
VEHICLE-003Vehicle unavailableBLOCK
VEHICLE-004Seating capacity exceededBLOCK

Journey ​

CodeConditionDefault action
JOURNEY-001Journey is cancelledBLOCK
JOURNEY-002Journey is already completedBLOCK
JOURNEY-003Journey has no available seatsBLOCK
JOURNEY-004Driver creates repeated passenger-specific journeysREVIEW

JOURNEY-004 is a risk signal, not a legal determination. See Risk Signals.

The existing-journey rule ​

The most important control in the platform is a structural one, not a rule.

The permitted flow:

text
Driver creates journey
        ↓
Journey published
        ↓
Passengers request compatible seats

The prohibited flow:

text
Passenger requests trip
        ↓
System creates a driver journey
        ↓
Driver transports passenger

The second pattern makes the product behave like an on-demand passenger transport marketplace regardless of what the rest of the system says. It is prevented by construction — a journey always belongs to a driver and a vehicle, and a ride request can only attach to an existing journey.

Relationship rules ​

The system supports relationship information where the approved operating model requires it.

Application-level values: FRIEND, RELATIVE, CO_WORKER, SAME_EMPLOYER, SAME_SCHOOL, SAME_COMMUNITY, OTHER.

These are application data categories. They are not an independent legal determination and must not be presented as one. Which categories qualify is set by relationship.approvedTypes in the active policy.

Verification state of a declared relationship: UNVERIFIED, SELF_DECLARED, INVITED, VERIFIED, REJECTED, REVIEW.

A self-declared relationship is data. It does not by itself satisfy an eligibility rule, and the policy decides whether that is acceptable.

Risk levels ​

LevelTypical action
LOWAllow
MEDIUMMonitor / review
HIGHHold / manual review
CRITICALBlock / suspend / escalate

These are system classifications, not legal classifications. Thresholds are configurable per policy version.

Rule evaluation result ​

Every rule returns the same shape, pass or fail.

json
{
  "ruleCode": "DRIVER-001",
  "policyVersion": "PILOT-0.1",
  "result": "PASS",
  "severity": "LOW",
  "action": "ALLOW",
  "evidence": { "driverVerified": true }
}
json
{
  "ruleCode": "VEHICLE-001",
  "policyVersion": "PILOT-0.1",
  "result": "FAIL",
  "severity": "HIGH",
  "action": "BLOCK",
  "evidence": { "vehicleVerified": false }
}

ruleCode is required, not optional. A decision that cannot name the rules that produced it cannot be explained or reviewed later.

Compliance decision object ​

json
{
  "decisionId": "uuid",
  "subject": {
    "journeyId": "uuid",
    "matchId": "uuid",
    "bookingId": "uuid"
  },
  "policy": {
    "policyId": "uuid",
    "version": "PILOT-0.1"
  },
  "decision": "ALLOW",
  "risk": { "level": "LOW" },
  "rules": [
    { "code": "IDENTITY-001", "result": "PASS" },
    { "code": "VEHICLE-001", "result": "PASS" }
  ],
  "createdAt": "2026-09-30T07:20:00Z"
}

Explainability ​

Every decision carries reason codes:

json
{
  "decision": "REVIEW",
  "reasonCodes": ["ACTIVITY-004", "CONTRIBUTION-002"]
}

An administrator must be able to see, for any decision:

  • the decision
  • the policy version
  • the rules evaluated
  • the rules passed
  • the rules failed
  • the evidence for each
  • the timestamp
  • the actor or system
  • the algorithm version
  • previous decisions on the same subject

Without the pass/fail split, a reviewer sees a verdict with no way to check it.

Policy versioning ​

Every decision references a policy version.

text
PILOT-0.1
PILOT-0.2
RTA-APPROVED-1.0
RTA-APPROVED-1.1

This exists to answer one question: which rules were active when this journey was approved?

When the approved operating framework changes, a new ruleset is activated. Rules are versioned so no application rewrite is needed.

Audit trail ​

Compliance decisions are append-only. See Compliance Audit.

A decision that changes does not overwrite its predecessor:

text
Decision #1
    │
    ▼
Decision #2
    │
    ▼
Decision #3

The complete history stays available.

Emergency override ​

Emergency handling runs on a separate pathway and must not depend on ordinary matching or compliance logic. A failing or degraded compliance dependency must never be the reason an emergency alert fails to propagate.

Normal path:

text
Compliance  ->  Booking  ->  Journey

Emergency path:

text
Emergency detected
        ↓
Safety workflow
        ├── Emergency contact notification
        ├── Live location sharing
        ├── Incident creation
        ├── Platform safety team
        └── Regulatory escalation where applicable

Administrative workflow ​

text
SYSTEM DETECTS EVENT
        ↓
COMPLIANCE EVENT
        ↓
AUTOMATIC RULE ACTION
        ├── ALLOW
        ├── HOLD
        ├── BLOCK
        └── ESCALATE
        ↓
HUMAN REVIEW
        ↓
RESOLUTION

Fail-safe behaviour ​

If a mandatory compliance dependency becomes unavailable:

text
Verification unavailable
        ↓
Do NOT assume PASS
        ↓
PENDING / REVIEW

The system must never interpret "unable to verify" as "verified".

This is the single most consequential invariant in the engine. An outage in an identity provider must degrade to REVIEW, never to ALLOW. Failing closed on availability is the price of a decision that means anything.

Evaluation contract ​

text
evaluate(passenger, driver, vehicle, journey, request, match, policy)

Returns:

  • a decision — ALLOW, REVIEW or BLOCK
  • reasonCodes
  • riskLevel
  • policyVersion
  • ruleResults
  • evidence

Combined matching and compliance pipeline ​

text
            PASSENGER
                │
                ▼
         Ride Request
                │
                ▼
Candidate Discovery
                │
                ▼
      Route compatibility
                │
                ▼
          Time matching
                │
                ▼
        Seat Eligibility
                │
                ▼
        COMPLIANCE ENGINE
                │
      ┌─────────┼─────────┐
      ▼         ▼         ▼
    BLOCK     REVIEW     ALLOW
                │         │
                ▼         ▼
          Human Review  Ranking
                            │
                            ▼
                       Match Offer
                            │
                            ▼
                          Booking
                            │
                            ▼
                          Journey
                            │
                            ▼
                  Compliance Monitoring

Compliance runs before ranking. An ALLOW match is ranked; a REVIEW match is queued for a person; a BLOCK match is never surfaced.

Privacy ​

Compliance does not mean unrestricted access to personal data.

Apply data minimisation, purpose limitation, role-based access, encryption, hashing where appropriate, audit logging, retention policies, restricted location visibility and secure deletion.

Sensitive identifiers are not stored in plaintext:

text
plate_hash
identity_reference_hash
device_reference_hash

KHAWI — same route, go together.