Skip to content

Klamm Data Model

Spencer Rose edited this page Jun 12, 2025 · 13 revisions

Revised Data Model (Version 1)

erDiagram
    Form ||--o{ FormVersion : "has many"
    FormVersion ||--o{ Element : "has many"
    FormVersion ||--o{ FormStyleSheet : "has many"
    FormVersion ||--o{ FormDeploymentDetail : "has many"
    FormVersion }o--o{ FormDataSource : "has many"
    Element ||--o{ Container : "implements"
    Element ||--o{ Field : "implements"
    FieldTemplate ||--o{ Field : "has many"
    FieldTemplate ||--o{ FieldValidation : "has many"
    FieldTemplate ||--o{ FieldValue : "has one"
    FieldTemplate ||--o{ FieldDateFormat : "has one"
    FieldTemplate ||--o{ SelectOption : "has many"
    Container ||--o{ Element : "contains"
    Element ||--o{ ElementValidation : "has many"
    Element ||--o{ ElementConditional : "has many"
    Field ||--o{ ElementValue : "has one"
    Field ||--o{ ElementDateFormat : "has one"
    Field ||--o{ SelectOptionInstance : "has many"
    Form {
        int id PK
        string form_id "unique"
        string form_title
        int ministry_id FK
        string form_purpose
        string notes
        boolean active "renamed from decommissioned"
        int form_frequency_id FK
        int form_reach_id FK
        string print_reason
        string retention_needs
        boolean icm_non_interactive
        string footer_fragment_path "workbench_footer_fragment_path"
        string dcv_material_number
        string orbeon_functions
        boolean icm_generated
    }
    FormVersion {
        int id PK
        int form_id FK
        string uuid "new field"
        int version_number
        string status
        int form_developer_id FK
        string footer
    }
    FormDeploymentDetail {
        int id PK
        int form_version_id FK
        string environment "test|dev|prod"
        datetime deployed_at
    }
    FieldTemplate["FieldTemplate [Abstract]"] {
        int id PK
        string name "unique, camel_case"
        string label
        string help_text
        int data_type_id FK "check if used"
        string description
        string data_binding_path
        string data_binding
        string mask
    }
    Element["Element [Abstract]"] {
        int id PK
        int form_version_id FK
        int parent_element_id FK "nullable"
        string uuid
        int order
        string custom_label
        boolean hide_label "renamed from customize_label"
        string custom_data_binding_path
        string custom_data_binding
        string custom_help_text
        boolean visible_web "new field"
        boolean visible_pdf "new field"
    }
    Container["Container [Element Implementation]"] {
        int id PK
        int element_id FK "references Element"
        boolean has_repeater
        boolean has_clear_button
        string repeater_item_label
    }
    Field["Field [Element Implementation]"] {
        int id PK
        int element_id FK "references Element"
        int field_template_id FK
        string custom_mask
    }
    FormStyleSheet {
        int id PK
        int form_version_id FK
        string path "uuid"
        string name
        string type "web|pdf"
        string description
        int order
    }
Loading

Revised Data Model (Version 2)

erDiagram
    %% Main entities with vertical layout
    Form ||--o{ FormVersion : "has many"
    %% FormVersion relationships
    FormVersion ||--o{ Element : "has many"
    FormVersion ||--o{ FormStyleSheet : "has many"
    FormVersion ||--o{ FormDeploymentDetail : "has many"
    FormVersion }o--o{ FormDataSource : "has many"
    %% Element types (using labels to indicate inheritance)
    Element ||--o{ Container : "implements"
    Element ||--o{ Field : "implements"
    %% BaseFieldType relationships (previously FieldTemplate)
    BaseFieldType ||--o{ Field : "has many"
    %% Element relationships
    Container ||--o{ Element : "contains"
    Element ||--o{ ElementValidation : "has many"
    Element ||--o{ ElementConditional : "has many"
    Field ||--o{ ElementValue : "has one"
    Field ||--o{ ElementDateFormat : "has one"
    Field ||--o{ SelectOptionInstance : "has many"
    %% Entity definitions
    Form {
        int id PK
        string form_id "unique"
        string form_title
        int ministry_id FK
        string form_purpose
        string notes
        boolean active "renamed from decommissioned"
        int form_frequency_id FK
        int form_reach_id FK
        string print_reason
        string retention_needs
        boolean icm_non_interactive
        string footer_fragment_path "workbench_footer_fragment_path"
        string dcv_material_number
        string orbeon_functions
        boolean icm_generated
    }
    FormVersion {
        int id PK
        int form_id FK
        string uuid "new field"
        int version_number
        string status
        int form_developer_id FK
        string footer
    }
    FormDeploymentDetail {
        int id PK
        int form_version_id FK
        string environment "test|dev|prod"
        datetime deployed_at
    }
    %% Renamed from FieldTemplate
    BaseFieldType["BaseFieldType [Abstract]"] { 
        int id PK
        string name "unique, camel_case"
        int data_type_id FK "check if used"
        string description
    }
    Element["Element [Abstract]"] {
        int id PK
        int form_version_id FK
        int parent_element_id FK "nullable"
        string uuid
        int order
        string label "renamed from custom_label"
        boolean hide_label "renamed from customize_label"
        string data_binding_path "renamed from custom_data_binding_path"
        string data_binding "renamed from custom_data_binding"
        string help_text "renamed from custom_help_text"
        boolean visible_web "new field"
        boolean visible_pdf "new field"
    }
    Container["Container [Element Implementation]"] {
        int id PK
        int element_id FK "references Element"
        boolean has_repeater
        boolean has_clear_button
        string repeater_item_label
    }
    Field["Field [Element Implementation]"] {
        int id PK
        int element_id FK "references Element"
        int base_field_type_id FK "renamed from field_template_id"
        string mask "renamed from custom_mask"
    }
    FormStyleSheet {
        int id PK
        int form_version_id FK
        string path "uuid"
        string name
        string type "web|pdf"
        string description
        int

Loading

Clone this wiki locally