Baseleg Docs
Domain · Lite contexts / Compliance · Baseleg Docs
v1 lite

Compliance

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 people 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 Person meets a specific recurring compliance requirement.

Key attributes:

  • id — unique identifier
  • personId — the person this record applies to (PersonId)
  • 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
  • personId — the person the alert concerns (PersonId)
  • requirementType — the requirement type that triggered the alert
  • alertTypeapproaching-expiry | lapsed
  • triggeredAt — when the alert was generated
  • acknowledged — whether the person/staff has acknowledged the alert
  • acknowledgedAt — timestamp of acknowledgement

Document expiry record

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

Key attributes:

  • id — unique identifier
  • subjectIdPersonId or AircraftId
  • subjectTypeperson | 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 Person 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 Person.
  • checkPersonCurrency — return the current compliance status for a Person 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 person.
  • recordDocumentExpiry — register an expiry date for a document.

Cross-context relationships

ContextUsage
PeopleReferences PersonId for the Person 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 Person and operations staff