Wiki source code of Data Model

Last modified by Robert Schaub on 2025/12/24 20:30

Hide last authors
Robert Schaub 1.1 1 = Data Model =
2
Robert Schaub 2.1 3 This page describes the current data model for FactHarbor 0.9.25.
Robert Schaub 1.1 4
5 == 1. Versioning Strategy ==
6
7 Every entity in FactHarbor has a full immutable version history. This ensures:
8 * Complete auditability
9 * Ability to reconstruct historical state
10 * Federation-compatible lineage tracking
11 * Transparent evolution of claims, scenarios, and verdicts
12
13 === 1.1 Core Versioning Principles ===
14
15 **Immutability**:
16 * Each version is stored independently
17 * Versions cannot be deleted, only superseded
18 * Historical versions remain accessible
19
20 **Lineage**:
21 * Each version links to its parent via `ParentVersionID`
22 * Forms directed acyclic graph (DAG) of changes
23 * Supports branching in federated environments
24
25 **Provenance**:
26 * Every version timestamped (`CreatedAt`)
27 * Author type recorded (`AuthorType`: Human, AI, ExternalNode)
28 * Justification captured (`JustificationText`)
29 * Digital signatures for integrity (`SignatureHash` in Release 1.0)
30
31 **Federation Support**:
32 * Versions can originate from remote nodes
33 * Conflict detection via lineage comparison
34 * Parallel version trees for branching scenarios
35 * Cross-node version synchronization
36
37 === 1.2 Common Version Fields ===
38
39 All versioned entities include:
40
41 * **VersionID**: Unique identifier for this specific version
42 * **ParentVersionID**: Link to previous version (null for first version)
43 * **CreatedAt**: Timestamp (ISO 8601, UTC)
44 * **AuthorType**: Human | AI | ExternalNode
45 * **CreatedBy**: Foreign key to User or TechnicalUser
46 * **JustificationText**: Brief explanation of changes
47 * **PublicationMode**: Mode1 (draft) | Mode2 (AI-published) | Mode3 (human-reviewed)
48 * **ReviewStatus**: Workflow state (draft|in_review|approved|rejected)
49 * **NodeOrigin**: Node ID where version was created (for federation)
50 * **SignatureHash**: Cryptographic signature (Release 1.0)
51
52
53 === 1.3 Versioning Architecture Diagram ===
54
55 {{include reference="FactHarbor.Specification.Diagrams.Versioning Architecture.WebHome"/}}
56
57
58 == 2. Core Entity Definitions ==
59
60 === 2.1 User Entities ===
61
62 **USER** (base user table):
63 * ``UserID`` (PK)
64 * ``UserType`` (Reader|Contributor|Reviewer|Auditor|Expert|Moderator|Maintainer)
65 * ``DisplayName``
66 * ``Email`` (for Contributors and above)
67 * ``RegisteredAt``
68 * ``LastActive``
69 * ``Status`` (active|suspended|banned)
70
71 **TECHNICAL_USER** (system processes):
72 * ``SystemID`` (PK)
73 * ``SystemName``
74 * ``Purpose`` (AKEL|FederationSync|BackupService|Monitor|Audit)
75 * ``CreatedBy`` (FK to Maintainer who created this system user)
76 * ``CreatedAt``
77 * ``Status`` (active|paused|deprecated)
78 * ``ApiKey`` (encrypted)
79 * ``Permissions`` (JSON - authorized operations)
80
81 **Examples of Technical Users**:
82 * AKEL instances (AI processing)
83 * Federation sync bots
84 * Scheduled audit tasks
85 * Backup services
86 * Monitoring systems
87 * External API integrations
88
89
90 === 2.2 Content Entities ===
91
92 The system relies on the following versioned core entities:
93
94 **CLAIM_CLUSTER**:
95 * ``ClusterID`` (PK)
96 * ``EmbeddingVectorRef``
97 * ``Theme``
98 * Groups related claims into topical clusters
99 * One Cluster has many Claims
100 * A Claim belongs to exactly one primary cluster
101
102 **CLAIM / CLAIM_VERSION**:
103 * ``CLAIM`` is the long-lived anchor for a real-world claim
104 * ``CLAIM_VERSION`` is an immutable snapshot that includes:
Robert Schaub 2.1 105 * ``VersionID`` (PK)
106 * ``ClaimID`` (FK to CLAIM)
107 * ``ParentVersionID`` (FK to prior version, nullable)
108 * ``Text``
109 * ``Domain``
110 * ``ClaimType`` (literal|metaphorical|rhetorical|supernatural)
111 * ``Evaluability`` (empirical|subjective|non-falsifiable)
112 * ``RiskTier`` (A|B|C) - replaced SafetyCategory for consistency
113 * ``PublicationMode`` (Mode1|Mode2|Mode3)
114 * ``ReviewStatus`` (draft|in_review|approved|rejected)
115 * ``CreatedAt``, ``AuthorType``, ``CreatedBy``, ``JustificationText``
116 * ``NodeOrigin``, ``SignatureHash``
117 * ``Status`` (active|superseded|merged)
Robert Schaub 1.1 118
119 **SCENARIO / SCENARIO_VERSION**:
120 * ``SCENARIO`` is the anchor for a scenario across time
121 * ``SCENARIO_VERSION`` is an immutable snapshot:
Robert Schaub 2.1 122 * ``VersionID`` (PK)
123 * ``ScenarioID`` (FK to SCENARIO)
124 * ``ParentVersionID``
125 * ``ClaimID`` (FK to CLAIM)
126 * ``Definitions`` (JSON)
127 * ``Boundaries`` (JSON)
128 * ``Assumptions`` (JSON)
129 * ``Context`` (text)
130 * ``EvaluationMethod`` (text)
131 * ``PublicationMode`` (Mode1|Mode2|Mode3)
132 * ``ReviewStatus`` (draft|in_review|approved|rejected)
133 * ``CreatedAt``, ``AuthorType``, ``CreatedBy``, ``JustificationText``
134 * ``NodeOrigin``, ``SignatureHash``
135 * ``Status`` (active|superseded|deprecated)
Robert Schaub 1.1 136
137 **Note**: SafetyClass removed from Scenario - risk tier is at claim level
138
139 **EVIDENCE / EVIDENCE_VERSION**:
140 * ``EVIDENCE`` is the anchor
141 * ``EVIDENCE_VERSION`` is the versioned snapshot:
Robert Schaub 2.1 142 * ``VersionID`` (PK)
143 * ``EvidenceID`` (FK to EVIDENCE)
144 * ``ParentVersionID``
145 * ``Type`` (paper|dataset|report|transcript|expert|media)
146 * ``Category`` (empirical|historical|rhetorical|dataset|meta-analysis)
147 * ``Reliability`` (low|medium|high)
148 * ``Provenance`` (URL, DOI, source metadata)
149 * ``ExtractionMethod`` (manual|OCR|API|AKEL)
150 * ``ContentHash`` (SHA256 of evidence content)
151 * ``PublicationMode`` (Mode1|Mode2|Mode3)
152 * ``ReviewStatus`` (draft|verified|disputed|retracted)
153 * ``CreatedAt``, ``AuthorType``, ``CreatedBy``, ``JustificationText``
154 * ``NodeOrigin``, ``SignatureHash``
155 * ``Status`` (active|superseded)
Robert Schaub 1.1 156
157 **VERDICT / VERDICT_VERSION**:
158 * ``VERDICT`` is the anchor
159 * ``VERDICT_VERSION`` is the snapshot:
Robert Schaub 2.1 160 * ``VersionID`` (PK)
161 * ``VerdictID`` (FK to VERDICT)
162 * ``ParentVersionID``
163 * ``ClaimID`` (FK to CLAIM)
164 * ``ScenarioVersionID`` (FK to specific SCENARIO_VERSION)
165 * ``EvidenceVersionSet`` (JSON array of Evidence VersionIDs used)
166 * ``LikelihoodRange`` (0–1, with uncertainty bounds)
167 * ``ExplanationChain`` (JSON)
168 * ``UncertaintyFactors`` (JSON)
169 * ``PublicationMode`` (Mode1|Mode2|Mode3)
170 * ``ReviewStatus`` (draft|in_review|approved|retracted)
171 * ``CreatedAt``, ``AuthorType``, ``CreatedBy``, ``JustificationText``
172 * ``NodeOrigin``, ``SignatureHash``
173 * ``Status`` (current|outdated|superseded|retracted)
Robert Schaub 1.1 174
175
176 == 3. Many-to-Many Linking Tables ==
177
178 **ScenarioEvidenceLink**:
179 * Links scenario versions to evidence versions with relevance scoring
180 * ``ScenarioID``, ``ScenarioVersionID``
181 * ``EvidenceID``, ``EvidenceVersionID``
182 * ``RelevanceScore`` (0–1) - How relevant this evidence is to this scenario
183 * ``LinkJustification`` - Brief explanation of relevance
184
185 **Purpose**:
186 * Evidence can be used by multiple scenarios
187 * Scenarios can draw from multiple pieces of evidence
188 * Relevance scoring helps prioritize evidence
189 * Version-specific linking preserves historical accuracy
190
191 **ClaimCluster**:
192 * Semantic clustering of similar claims
193 * ``ClusterID`` (PK)
194 * ``EmbeddingVector`` - Vector representation for semantic search
195 * ``MemberList`` - List of ClaimIDs in this cluster
196 * ``Theme`` - Human-readable theme description
197
198
Robert Schaub 2.1 199 == 4. Key Changes Since 0.9.1 ==
Robert Schaub 1.1 200
201 **Updated Field Names**:
Robert Schaub 2.1 202 * `SafetyCategory` → ``RiskTier`` (consistency with risk tier system A/B/C)
Robert Schaub 1.1 203 * `SafetyClass` removed from Scenario (redundant with claim-level RiskTier)
204
205 **Added Fields to All Version Entities**:
206 * `PublicationMode` - Track Mode 1/2/3 status
207 * `ReviewStatus` - Track workflow state
208 * `NodeOrigin` - Federation provenance
209 * `CreatedBy` - FK to User/TechnicalUser (clarified)
210
211 **New Entity**:
212 * `TECHNICAL_USER` - Separate system processes from human users
213
214 **Clarifications**:
215 * `ScenarioVersionID` in Verdict (not just ScenarioID) - links to specific version
216 * `ContentHash` in Evidence - SHA256 for integrity checking
217
218
219 == 5. Data Model Behavior ==
220
221 === 5.1 Late-Arriving Evidence ===
222
223 When new evidence versions appear:
224 1. Existing verdicts marked as **outdated**
225 2. Scenario relevance must be re-evaluated
226 3. Re-evaluation engine triggers verdict recomputation
227 4. New verdict versions created
228 5. Users notified of updates
229
230 === 5.2 Scenario Evolution ===
231
232 When a scenario's assumptions or definitions change:
233 * Creates new scenario version (not in-place update)
234 * All dependent verdicts must be recalculated
235 * Previous scenario versions remain accessible
236 * Version lineage preserved
237
238 === 5.3 Federated Nodes ===
239
240 Each node may share partial data:
241 * Claims and scenarios shared if relevant
242 * Evidence metadata shared, not always full files
243 * Version synchronization via NodeOrigin tracking
244 * Branching allowed for divergent interpretations
245
246
247 == 6. Visual Diagrams ==
248
249 The following diagrams provide visual representations of the data model structure and relationships.
250
251 === 6.1 Core Data Model ERD ===
252
253 {{include reference="FactHarbor.Specification.Diagrams.Core Data Model ERD.WebHome"/}}
254
255 === 6.2 User Roles Structure ===
256
257 {{include reference="FactHarbor.Specification.Diagrams.User Class Diagram.WebHome"/}}
258
259 === 6.3 Content Workflow ===
260
261 {{include reference="FactHarbor.Specification.Diagrams.Claim and Scenario Workflow.WebHome"/}}
262
263
264 == 7. Related Pages ==
265
266 * [[Federation & Decentralization>>FactHarbor.Specification.Federation & Decentralization.WebHome]]
267 * [[AKEL (AI Knowledge Extraction Layer)>>FactHarbor.Specification.AI Knowledge Extraction Layer (AKEL).WebHome]]
268 * [[Architecture>>FactHarbor.Specification.Architecture.WebHome]]
269