Files
semprini-domain-digital-dat…/data_model/entities/party_role.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

5.3 KiB

Digital Core

Entities

Party Role

A Party Role is the capacity in which a Party acts. It separates who someone is from what they are doing — the single most useful distinction in the whole model.

The same person may be a Customer on a subscription, the Payer on a family member's bill, and a Service Agent employed by the business, all at the same time. Model those as three roles against one Party and the business can answer "how many customers do we have" and "is this the same human being" as separate questions, which they are.

Party Role is abstract and is never instantiated directly. Every role is one of its specialisations: Customer, Merchant, Payer, Payee, Service Agent, Payment Initiator.

---
config:
  layout: elk
---
classDiagram
  class PartyRole{
    <<abstract>>
    * Role Identifier : string
    Role Status : enum~PartyRoleStatus~
    Role Start Date : date
    Role End Date : date
  }

  class Customer
  class Merchant
  class Payee
  class Payer
  class ServiceAgent
  class PaymentInitiator

  Customer --|> PartyRole
  Merchant --|> PartyRole
  Payee --|> PartyRole
  Payer --|> PartyRole
  ServiceAgent --|> PartyRole
  PaymentInitiator --|> PartyRole

  PartyRole "1" <-- "0..*" Party : assumes
  PartyRole "0..*" --> "0..*" ContactAddress : uses
  PartyRole "0..*" --> "0..1" Agreement : governed by

  class PartyRoleStatus["<a href='../enums.md#party-role-status'>Party Role Status</a>"]{<<enumeration>>}

  class Customer["<a href='./customer.md'>Customer</a>"]
  class Merchant["<a href='./merchant.md'>Merchant</a>"]
  class Payee["<a href='./payee.md'>Payee</a>"]
  class Payer["<a href='./payer.md'>Payer</a>"]
  class ServiceAgent["<a href='./service-agent.md'>Service Agent</a>"]
  class PaymentInitiator["<a href='./payment_initiator.md'>Payment Initiator</a>"]

  class Party["<a href='./party.md'>Party</a>"]
  class ContactAddress["<a href='./contact_address.md'>Contact Address</a>"]
  class Agreement["<a href='./agreement.md'>Agreement</a>"]
existence: independent
mutability: slowly_changing
temporal:
  tracking: bitemporal
  description: >
    Bitemporal tracking captures both when the role was actually in effect (valid time, via Role Start Date and Role End Date) and when the business knew about it (transaction time). This supports point-in-time questions such as "was this party a customer when that order was placed?" while still allowing corrections that arrive late to be recorded without rewriting history.
attributes:
  Role Identifier:
    type: string
    identifier: primary
    description: >
      Globally unique identifier for this role instance. Distinct from the Party Identifier — one party holding two roles has two Role Identifiers.

  Role Status:
    type: enum:Party Role Status
    description: >
      The current lifecycle status of this role. Controls whether the role confers its business permissions.

  Role Start Date:
    type: date
    description: >
      The date this role became effective.

  Role End Date:
    type: date
    description: >
      The date this role ceased to be effective. Null means the role is still open. Roles are closed rather than deleted, so that history stays intact.
constraints:
  Role End After Start:
    check: "Role End Date IS NULL OR Role End Date > Role Start Date"
    description: >
      A role's end date must be later than its start date. A null end date indicates the role is currently open.

  Closed Role Requires End Date:
    check: >
      Role Status != 'Closed'
      OR Role End Date IS NOT NULL
    description: >
      A role with a status of Closed must have a Role End Date recorded, so the valid time period is always closed correctly.
governance:
  pii: false
  classification: Internal
  retention: 7 years
  retention_basis: Domain default
  description: >
    Role records carry no personal data themselves — they point at a Party, which does. Roles must never be deleted; closing them with an end date is the only permitted termination, because a deleted role silently rewrites what the business was entitled to do at a past moment.
  access_role:
    - CUSTOMER_SERVICE
    - DATA_ANALYST

Relationships

Party Role Uses Contact Addresses

A Party Role may use one or more Contact Addresses owned by the underlying Party. The Party owns its addresses; a role picks which of them applies in its context.

source: Party Role
type: associates_with
target: Contact Address
cardinality: many-to-many
granularity: atomic
ownership: Party Role

Party Role Governed By Agreement

A Party Role may be governed by a specific Agreement that sets out its obligations and permissions.

source: Party Role
type: references
target: Agreement
cardinality: many-to-one
granularity: atomic
ownership: Party Role

Party Role At Point In Time

Captures the state of a Party Role as it stood on a given date. Reporting usually needs the state as at the end of a period rather than the state right now — how many active customers did we have on 30 June, not how many do we have today.

Party Role is declared bitemporal; this period-granularity relationship makes the snapshot pattern explicit so that generated physical models can materialise it.

source: Party Role
type: snapshots
target: Party Role
cardinality: one-to-one
granularity: period
ownership: Party Role
self_referential: true