dodil/erp-brick-hr

src/brick_hr/domain/__init__.py

"""The hr domain: rules in plain Python. No SQLAlchemy, FastAPI, MCP or identity here.

THE UBIQUITOUS LANGUAGE (modules/hr domain_model). These words are used, exactly, in names below this package,
in the use cases, the tables and the scenarios. If a word changes, it changes everywhere.

  person            a natural person we employ or engage. One per human, however many times they come back.
                    Key person_id (PersonId, derived from the PersonKey).
  engagement        one period of working for us under one worker type. A rehire is a new engagement; so is
                    a conversion. Key person_id|n (EngagementRef).
  worker_type       what the engagement is (a row): employee, freelancer (sole trader), freelancer (via a
                    company), intern… It decides the playbook, whether payroll applies, the partner roles.
  assignment        where an engagement sits on a date: org unit, job, optional position, location, work
                    schedule, employment %, cost centre. Sliced.
  org_unit          a team or department in the org tree. Sliced, so a reorganisation is dated.
  position          one seat in an org unit that describes a job. Optional, except the chief position.
  chief_position    the position that manages an org unit.
  manager           DERIVED: the holder of the chief position of the assignment's unit, walking up the tree.
                    Never stored (ManagerOf). A manager override on the assignment is the rare exception.
  job               a catalogue entry (Motion Designer).
  slice             one dated version of a record, valid_from to valid_to (open = 9999-12-31).
  delimit           to end the previous slice the day before a new one starts. Nothing is overwritten.
  correction        a new slice with the SAME valid_from that supersedes the old one (superseded_by).
  personnel_event   something that happened to an engagement on an effective date: Hired, Transferred,
                    PayChanged, ContractExtended, Left, Rehired, Converted. It writes slices; it may start a run.
  reason            why a personnel event happened (a row per event type).
  infogroup         the records one event type captures (a row set).
  playbook          the customer's checklist for one kind of run, versioned.
  run               a playbook expanded for one person and one personnel event. Its id is derived.
  step              one item of a run: task | action | document | draft | intake | approval.
  responsible_group WHO a step goes to (manager, IT, finance, buddy, HR, the starter), resolved when due.
  capability        a named thing a provider can do in the outside world (identity.provision_user).
  manual_task       the first-class path when no provider is wired: the capability, the exact input, the plan.
  sensitive_data    NI/tax id, bank, home address, date of birth, emergency contact, right-to-work evidence.
                    Its own aggregate (Sensitive), HR and finance only.
  localisation_pack a country's legal fields, document types, steps and checks (gb first).

Aggregates (one per transaction): Person, Org, Sensitive, Configuration, Playbook, Run, Intake, PayrollExtract,
PrivacyRequest. Their invariants are enforced HERE, never by the database.
"""