Files
semprini-domain-digital-dat…/data_model/entities/account.md
T
paulandClaude Opus 5 aeba56e5f2 Add the Digital Core domain model from semprini-blog-dataproducts
The MD-DDL model (domain, entities, enums, the Canonical Party product
declaration) moves into its own repository, owned by the domain's modelling
team. Engineering teams consume its product declarations and generate products
from semprini-data-product-templates.

Adds the MD-DDL agent wrappers (md-ddl init), pyproject with md-ddl, and
README/CLAUDE.md describing the team split and the handoff interface.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 22:51:50 +12:00

4.3 KiB

Digital Core

Entities

Account

An Account is the running record of what a Customer holds and owes. Balances live here and transactions move them.

Account is where a lot of businesses accidentally encode their product catalogue into a status column. Keeping the account generic and pushing the specifics onto Product and Agreement is what lets a new offering launch without a schema change.

---
config:
  layout: elk
---
classDiagram
  class Account{
    * Account Identifier : string
    Account Number : string
    Account Type : enum~AccountType~
    Account Status : enum~AccountStatus~
    Opened Date : date
    Closed Date : date
  }

  Customer "0..*" --> "0..*" Account : holds
  Account "0..*" --> "1" Product : instance of
  Account "0..*" --> "1" Currency : denominated in
  ServiceLocation "1" --> "0..*" Account : serves

  class AccountType["<a href='../enums.md#account-type'>Account Type</a>"]{<<enumeration>>}
  class AccountStatus["<a href='../enums.md#account-status'>Account Status</a>"]{<<enumeration>>}

  class Customer["<a href='./customer.md'>Customer</a>"]
  class Product["<a href='./product.md'>Product</a>"]
  class Currency["<a href='./currency.md'>Currency</a>"]
  class ServiceLocation["<a href='./service-location.md'>Service Location</a>"]
existence: independent
mutability: slowly_changing
temporal:
  tracking: valid_time
  description: >
    Account status moves back and forth — Active to Suspended and back again — and the
    dates of those moves matter. Valid time tracking supports questions like "was this
    account suspended when that charge was applied?". Opened Date and Closed Date are the
    outer boundaries of the account's life.
attributes:
  Account Identifier:
    type: string
    identifier: primary
    description: >
      Globally unique identifier for this account. Immutable once assigned.

  Account Number:
    type: string
    description: >
      The account number as shown to the customer. Distinct from the identifier: this one
      appears on statements and can change if the account is renumbered during a migration.

  Account Type:
    type: enum:Account Type
    description: >
      What the account is for — billing, subscription, prepaid, wallet and so on. Different
      types behave differently: a prepaid account cannot go negative, a credit account can.

  Account Status:
    type: enum:Account Status
    description: >
      Current operational state. Suspension and closure are recorded with their effective
      dates so that history can be reconstructed.

  Opened Date:
    type: date
    description: >
      Date the account was opened. Starts the account's valid time period and feeds
      dormancy and tenure calculations.

  Closed Date:
    type: date
    description: >
      Date the account was permanently closed. Null means still open. Accounts are closed,
      never deleted — a deleted account orphans every transaction that referenced it.
constraints:
  Closed Account Requires Closed Date:
    check: >
      Account Status != 'Closed'
      OR Closed Date IS NOT NULL
    description: >
      An account with status Closed must record when it closed.

  Closed Date After Opened Date:
    check: "Closed Date IS NULL OR Closed Date > Opened Date"
    description: >
      An account's closure date must be later than its opening date.
governance:
  pii: false
  classification: Confidential
  retention: 7 years
  retention_basis: Domain default
  description: >
    An account is not personal data in itself, but balances and holdings are commercially
    sensitive and readily identify a customer through the holder relationship. Retained
    for seven years after closure to cover billing disputes and tax records.
  access_role:
    - CUSTOMER_SERVICE
    - DATA_ANALYST

Relationships

Account Holds Product

An Account is an instance of one Product definition.

source: Account
type: references
target: Product
cardinality: many-to-one
granularity: atomic
ownership: Account

Account Denominated In Currency

An Account is denominated in exactly one Currency. All balances and amounts on the account are expressed in it.

source: Account
type: references
target: Currency
cardinality: many-to-one
granularity: atomic
ownership: Account