Baseleg Docs

Compliance

Status: v1 lite — scaffolded, not a primary v1 delivery focus
Packages: packages/domain/compliance, packages/application/compliance

Purpose

The Compliance context monitors time-sensitive requirements for members and aircraft. It tracks whether individuals and fleet assets are current for the requirements relevant to their activities, and raises alerts when requirements are approaching expiry or have lapsed.

In v1, Compliance covers basic currency records and alert generation. Automated rule evaluation, complex dependency chains between requirements, and integration with external certification bodies come later.

Key entities

Currency record (aggregate root)

A record of whether a Member meets a specific recurring compliance requirement.

Key attributes:

  • id — unique identifier
  • memberId — the member this record applies to (MemberId)
  • requirementType — the type of requirement (e.g. flight-review, medical-class-2, bfr)
  • validFrom — date from which this currency is valid
  • expiresAt — date after which the currency lapses
  • statuscurrent | lapsed | pending
  • evidenceRef — optional reference to the document or event that established currency (e.g. a Lesson ID or external document ID)

Compliance alert

A notification record raised when a currency requirement is approaching expiry or has already lapsed.

Key attributes:

  • id — unique identifier
  • memberId — the member the alert concerns (MemberId)
  • requirementType — the requirement type that triggered the alert
  • alertTypeapproaching-expiry | lapsed
  • triggeredAt — when the alert was generated
  • acknowledged — whether the member/staff has acknowledged the alert
  • acknowledgedAt — timestamp of acknowledgement

Document expiry record

Tracks an expiry date for a specific document associated with a Member or Aircraft.

Key attributes:

  • id — unique identifier
  • subjectIdMemberId or AircraftId
  • subjectTypemember | aircraft
  • documentType — e.g. c-of-a, annual, pilot-licence
  • expiresAt — document expiry date

Domain rules

  1. A currency requirement becomes lapsed on the day expiresAt passes.
  2. An approaching-expiry alert is raised when expiresAt is within the configured warning window (default: 30 days).
  3. A Member with a lapsed critical currency requirement should not be assigned as Instructor on a Booking (enforcement: v2+).
  4. Alerts are not cleared by acknowledgement — they are cleared when the underlying currency is renewed.

Key use cases

  • recordCurrency — record or renew a currency requirement for a Member.
  • checkMemberCurrency — return the current compliance status for a Member across all tracked requirements.
  • generateAlerts — evaluate all currency records and produce alerts for any approaching or lapsed items.
  • acknowledgeAlert — mark an alert as seen by staff or the member.
  • recordDocumentExpiry — register an expiry date for a document.

Cross-context relationships

ContextUsage
PeopleReferences MemberId for the Member whose compliance is tracked
AircraftReferences AircraftId for airworthiness and C of A tracking
TrainingTraining Endorsements may satisfy or update currency records (v2+)
NotificationsCompliance alerts trigger notifications to the affected Member and operations staff