generated from john/python-template
V4.4 Complete
This commit is contained in:
+23
-7
@@ -8,6 +8,7 @@ This document defines the relational schema for the document transcription syste
|
||||
erDiagram
|
||||
DOCUMENT_TYPE {
|
||||
UUID id PK
|
||||
TEXT semantic_key UK
|
||||
TEXT label
|
||||
TEXT normalized_label
|
||||
BOOLEAN is_active
|
||||
@@ -17,8 +18,9 @@ TIMESTAMPTZ updated_at
|
||||
|
||||
PERSON_ROLE {
|
||||
UUID id PK
|
||||
TEXT code
|
||||
TEXT semantic_key UK
|
||||
TEXT label
|
||||
TEXT normalized_label
|
||||
BOOLEAN is_active
|
||||
TIMESTAMPTZ created_at
|
||||
TIMESTAMPTZ updated_at
|
||||
@@ -196,17 +198,29 @@ EXECUTION_ATTEMPT ||--o{ PROCESSING_ARTIFACT : produces
|
||||
- `SOURCE.raw_transcription` remains immutable machine output.
|
||||
- `SOURCE.revised_text` stores human edits and is the preferred display value when present.
|
||||
|
||||
### Semantic Registry Governance
|
||||
|
||||
- `DOCUMENT_TYPE.id` and `PERSON_ROLE.id` are the only relationship and public API identities.
|
||||
- Nullable unique `semantic_key` values identify application-defined built-ins and are immutable after creation.
|
||||
- Semantic keys are internal and are never accepted from Settings or public relationship APIs.
|
||||
- A non-null semantic key marks a protected built-in; built-ins may be relabeled or disabled but not deleted.
|
||||
- Custom entries have null semantic keys and may be deleted only when unreferenced.
|
||||
- Labels are mutable display text and are unique after trimming and case normalization.
|
||||
- Inactive entries remain valid for historical rows but are excluded from new-assignment selectors.
|
||||
|
||||
### Document-Person Role Governance
|
||||
|
||||
- Documents support zero, one, or many people per relationship role.
|
||||
- Documents support zero or one relationship for each Person.
|
||||
- Relationship roles are defined by `PERSON_ROLE` rather than hardcoded columns.
|
||||
- `DOCUMENT_PERSON` must be unique for `(document_id, person_id, role_id)`.
|
||||
- Relationship writes must be deterministic and use explicit add/remove link intent.
|
||||
- `DOCUMENT_PERSON.role_id` is required.
|
||||
- `DOCUMENT_PERSON` must be unique for `(document_id, person_id)`.
|
||||
- Complete link sets and Document fields are validated and persisted in one atomic transaction.
|
||||
- Existing inactive roles may remain unchanged; new or changed assignments require active roles.
|
||||
|
||||
### Document Type Governance
|
||||
|
||||
- Every document type is defined by `DOCUMENT_TYPE`.
|
||||
- `DOCUMENT_TYPE.id` is the sole machine identity.
|
||||
- `DOCUMENT_TYPE.id` is the relationship identity; hidden semantic keys identify protected built-in meaning.
|
||||
- `DOCUMENT_TYPE.label` is mutable display text and is unique after trimming and case normalization.
|
||||
- `DOCUMENT_TYPE.normalized_label` stores the normalized uniqueness key.
|
||||
- Inactive types remain valid for historical rows but should be excluded from default selection UIs.
|
||||
@@ -214,8 +228,10 @@ EXECUTION_ATTEMPT ||--o{ PROCESSING_ARTIFACT : produces
|
||||
## Constraint Summary
|
||||
|
||||
- `DOCUMENT_TYPE.normalized_label` is unique.
|
||||
- `PERSON_ROLE.code` is unique.
|
||||
- `DOCUMENT_PERSON(document_id, person_id, role_id)` is unique.
|
||||
- `DOCUMENT_TYPE.semantic_key` is nullable and unique.
|
||||
- `PERSON_ROLE.normalized_label` is unique.
|
||||
- `PERSON_ROLE.semantic_key` is nullable and unique.
|
||||
- `DOCUMENT_PERSON(document_id, person_id)` is unique.
|
||||
|
||||
## Indexing Guidance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user