Architecture, Domain Model, and Workflows
Architecture overview#
UPH is implemented as a Frappe app (uph) with these primary layers:
- Domain layer (
party_master, role child tables, party analytic accounting). - Controller layer (
party.py,queries.py,mdm.py,field.py). - Settings and schema orchestration (
party_master_settings.py). - Caching and boot helpers (
uph.__init__,party.boot). - Reporting layer (party account statement/balances, chronological ledger, health report).
Domain model (inferred from doctype modules)#
Primary Doctypes#
Party Master
- Tree/nested-set behavior, hierarchical numbering, lifecycle hooks.
- Child tables include roles and linked parties.
Party Master Role
- Defines allowed roles (
party_type_role) for a Party Master.
- Defines allowed roles (
Party Master Parties
- Links Party Master to concrete party documents with
party_type,party,party_name,currency.
- Links Party Master to concrete party documents with
Party Master Settings
- Governs target doctypes, mapping rules, required/allowed policies, and auto-creation of
party_masterfields.
- Governs target doctypes, mapping rules, required/allowed policies, and auto-creation of
Data Quality Rule / Data Quality Rule Condition
- Configures duplicate matching criteria (exact/fuzzy/date range), weights, similarity, and filter expressions.
Party Analytic Accounting
- Assigns analytics to Party Master/parties with allow/restrict company controls and effective date windows.
Key relationships#
- One Party Master can map to many party records across multiple roles.
- A party record maps to one Party Master (enforced/validated by rules).
- Transactional doctypes can carry an auto-managed
party_masterfield.
Business workflows#
1) Party Master lifecycle#
- Create Party Master with hierarchical constraints.
- Validate role consistency.
- Auto-generate numbering and maintain linked-party counters.
- Create primary contact/address helpers.
2) Rule-based party linking#
validate_party_master_on_target_party_typeenforces required/allowed logic.validate_party_master_on_document_typessets or validatesparty_masteron mapped documents.- Duplicate checks prevent conflicting party-to-master assignments.
3) Transactional synchronization#
When a party’s master changes, UPH can:
- scan configured doctypes,
- count/update historical rows,
- optionally run queued/background update flows,
- leave audit comments on Party Master.
4) Duplicate governance workflow#
mdm.validate_document_quality loads active quality rules and:
- evaluates optional filter conditions,
- detects potential duplicates by weighted criteria,
- triggers configured action (warn/block) with scored records.
5) Reporting workflow#
Reports aggregate by Party Master and linked parties to produce:
- chronological movement,
- account balances,
- statement with opening/current logic,
- health metrics (linked vs unlinked records).