Data Model
Conceptual Model
erDiagram
User ||--o{ Survey : "creates"
User ||--o{ Permission : "is granted"
Survey ||--o{ Permission : "is shared by"
Survey ||--o{ Version : "keeps as history"
Version ||--o{ Section : "contains"
Section ||--o{ Question : "contains"
Question ||--o{ Choice : "has"
Question ||--o{ BranchRule : "has"
Question ||--o{ VisibilityRule : "has"
BranchRule ||--o{ BranchCondition : "contains"
VisibilityRule ||--o{ VisibilityCondition : "contains"
VisibilityRule ||--o{ HideTarget : "specifies"
Survey ||--o{ LibraryItem : "registers on export"
ExternalSurvey ||--o{ ExternalQuestion : "contains"
ExternalSurvey ||--o{ LibraryItem : "registers on import"
Entities
| Entity |
Description |
| User |
A person using the system. Created automatically at authentication |
| Survey |
The container of a questionnaire. Holds the theme, status, and latest version number |
| Permission |
The role a user has on a survey (view / edit) |
| Version |
The unit of a snapshot of a survey's content. Added on every save |
| Section |
A major group of the questionnaire. Belongs to a version |
| Question |
A question inside a section. Identified uniquely by its question code |
| Choice |
An answer option. Matrix rows and columns and FA input fields share the same entity |
| BranchRule |
Defines where to move when a condition holds |
| BranchCondition |
A condition expressing "which question's answer, in which state" |
| VisibilityRule |
Hides choices when a condition holds |
| HideTarget |
The choice hidden by a visibility rule |
| LibraryItem |
A question accumulated for reuse. Internal or external in origin |
| ExternalSurvey / ExternalQuestion |
Questionnaires and questions imported from Creative Survey |
Business Rules
Surveys and Versions
- Questionnaire content is stored as snapshots belonging to a version, not to the survey
- Editing always targets the latest version; earlier versions are never modified
- Saving creates a new version copying the entire content of the latest one
- A rollback does not overwrite an earlier version; it creates a new version restoring that content
- Row IDs of sections and questions are re-assigned per version, but stable IDs are carried over
Questions and Choices
- Question codes are unique within a survey and serve as the reference key for branch conditions and destinations
- Duplicating a question assigns a new code, and branch references to the original question are re-pointed at it
- Choices are deleted and recreated on every question update, so their IDs are not stable
- Branch conditions and visibility rules therefore reference choices by label string
- Intro steps (
intro) have no answer field and cannot be used as a branch condition source
Branching and Visibility
- Rules are evaluated in order and the first one that holds is applied (first match wins)
- Conditions within one rule combine with AND or OR; nesting and mixing are not possible
- Destinations are later questions in the same section, or
SO / SC / SX / the question itself
- When the destination is the question itself, it becomes an exclusive setting that shows a message and blocks progress
- Visibility conditions have exactly the same structure as branch conditions; the output is "choices to hide" instead of a destination
not_includes and not_only also hold when unanswered (matching Creative Survey's semantics)
Permissions and Deletion
- The creator of a survey automatically receives edit permission
- Duplicating a survey carries over the source survey's permissions
- Survey deletion is a soft delete and can be performed only by the creator and administrators
- Deleting sections and questions is a hard delete against the latest version's snapshot (earlier versions keep them)
- Administrators can access every survey regardless of permission records
Question Library
- Exporting a survey registers its questions. Existing entries from the same survey are replaced
- Only the prompt text and choice structure are registered; branch rules and visibility logic are not included
- Reuse is possible even if the source survey was deleted, as long as the snapshot remains
- Past question data can be deleted by administrators only (not even the registrant can delete it otherwise)
External Data
- Re-importing the same external questionnaire (source + external ID) deletes the existing one and re-inserts it
- Because the Creative Survey API is undocumented, the raw imported JSON is kept as-is
- CS has no concept of sections, so questionnaires are split into section candidates at "intro step" questions