-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathERD.puml
More file actions
348 lines (305 loc) · 7.21 KB
/
ERD.puml
File metadata and controls
348 lines (305 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
@startuml "HypercertERD"
' None of these support arrows originating from individual fields
'!pragma layout smetana
'!pragma layout elk
'!pragma layout vizjs
title "Hypercert ERD"
' Configuration variables
!ifndef SHOW_FIELDS
!define SHOW_FIELDS false
!endif
!if (SHOW_FIELDS == "false")
hide empty fields
!endif
hide empty methods
hide stereotypes
!define REVIEW_COLOR #FFFACD
!define ARROW_COLOR #666666
<style>
document {
title {
FontSize 24
FontStyle bold
}
}
classDiagram {
arrow {
LineColor ARROW_COLOR
FontColor ARROW_COLOR
FontSize 10
}
.largeBold {
header {
FontSize 20
FontStyle bold
}
}
}
</style>
' Contributors are represented by DIDs or human-readable strings
' therefore do not require modelling via a lexicon.
entity "contributor (DID/profile)" as contributorEntity #FFD4A3 {
!if (SHOW_FIELDS == "true")
DID or social profile URI
!endif
}
' org.hypercerts.claim.activity - this is the main record
' representing a hypercert.
dataclass activity <<largeBold>> #B4E5D0 {
!if (SHOW_FIELDS == "true")
title
shortDescription
description?
image?
workScope?
startDate?
endDate?
contributions[]?
locations[]?
rights?
createdAt
!endif
}
' org.hypercerts.claim.evidence
dataclass evidence {
!if (SHOW_FIELDS == "true")
subject?
content
title
shortDescription?
description?
relationType?
createdAt
!endif
}
' org.hypercerts.claim.measurement
dataclass measurement {
!if (SHOW_FIELDS == "true")
subject?
measurers[]
metric
value
methodType?
methodURI?
evidenceURI[]?
location?
createdAt
!endif
}
' org.hypercerts.claim.evaluation
dataclass evaluation {
!if (SHOW_FIELDS == "true")
subject?
summary
evaluators[]
content[]?
measurements[]?
score
location?
createdAt
!endif
}
' org.hypercerts.claim.contributor
dataclass contributor {
!if (SHOW_FIELDS == "true")
identifier?
displayName?
image?
role?
contributionDescription?
startDate?
endDate?
createdAt
!endif
}
' app.certified.location
dataclass location {
!if (SHOW_FIELDS == "true")
lpVersion
srs
locationType
location
name?
description?
createdAt
!endif
}
' Certified badges (data class + award + response)
dataclass badgeDefinition {
!if (SHOW_FIELDS == "true")
badgeType
title
icon
description?
allowedIssuers[]?
createdAt
!endif
}
dataclass badgeAward {
!if (SHOW_FIELDS == "true")
badge
subject
note?
createdAt
!endif
}
dataclass badgeResponse {
!if (SHOW_FIELDS == "true")
badgeAward
response
weight?
createdAt
!endif
}
' org.hypercerts.claim.rights
dataclass rights {
!if (SHOW_FIELDS == "true")
rightsName
rightsType
rightsDescription
attachment?
createdAt
!endif
}
' org.hypercerts.claim.collection
' Note: Collections can use app.certified.location as a sidecar
' by creating a location record with the same TID
dataclass collection {
!if (SHOW_FIELDS == "true")
type?
title
shortDescription?
description? (Leaflet ref)
items[]
createdAt
!endif
}
' org.hypercerts.acknowledgement
dataclass acknowledgement {
!if (SHOW_FIELDS == "true")
subjects[]
context
given
comment?
createdAt
!endif
}
' org.hypercerts.claim.collection.project (sidecar)
dataclass collectionProject {
!if (SHOW_FIELDS == "true")
projectTitle?
shortProjectDescription?
projectDescription (Leaflet ref)
avatar?
coverPhoto?
createdAt
!endif
}
'together {
' Funders are represented by DIDs or human-readable strings
' therefore do not require modelling via a lexicon.
entity funder #FFD4A3 {
!if (SHOW_FIELDS == "true")
DID or name/pseudonym
!endif
}
' org.hypercerts.funding.receipt
dataclass fundingReceipt {
!if (SHOW_FIELDS == "true")
to
from
for?
amount
currency
paymentRail?
paymentNetwork?
transactionId?
notes?
occurredAt?
createdAt
!endif
}
'} ' end together
' NOTE: this is NOT a lexicon, but instead reflects an onchain
' tokenization of an activity record. So it does not need
' a lexicon definition.
protocol token <<largeBold>> #FFB6C1 {
!if (SHOW_FIELDS == "true")
(on-chain only)
!endif
}
' layout hints
'evaluation --d[hidden]-> evidence
'evaluation --d[hidden]-> measurement
'measurement -d[hidden]-> activity
'evidence -r[hidden]-> measurement
activity -l[hidden]-> token
'evidence -d[hidden]-> activity
'collection -d[hidden]-> activity
'activity -u[hidden]-> contributor
'activity -u[hidden]-> location
'activity -d[hidden]-> rights
'contribution -r[hidden]-> contributor
'fundingReceipt -[hidden]-> contributor
evaluation::subject --> evidence
evaluation::measurements --> measurement
evaluation::subject --> activity
' Impossible to get this one on without screwing up the layout
'evaluation::location --[norank]-> location
' so instead make a dangling arrow using a hidden class
skinparam class {
BackgroundColor<<Ghost>> Transparent
BorderColor<<Ghost>> Transparent
EntityColor<<Ghost>> Transparent
}
class " " as hiddenLocation1 <<Ghost>>
hide hiddenLocation1 circle
evaluation::location --> hiddenLocation1
!if (SHOW_FIELDS == "true")
' Also ensure the hidden class is somewhere "en route" to location
hiddenLocation1 -[hidden]-> activity
!else
' Also Impossible to get this one on without screwing up the layout
'evaluation -d[norank]--> location
!endif
evidence::subject --> activity
measurement::subject --> activity
' Somewhat similarly for measurement --> location
!if (SHOW_FIELDS == "true")
class " " as hiddenLocation2 <<Ghost>>
hide hiddenLocation2 circle
measurement::location --> hiddenLocation2
' Also ensure the hidden class is somewhere "en route" to location
hiddenLocation2 -[hidden]-> location
!else
measurement --> location
!endif
collection::items --> activity
collection::items --> collection : "recursive\nnesting"
collection ..|> collectionProject : "sidecar\n(same TID)"
acknowledgement::subjects --> activity : "(subject)"
acknowledgement::context --> collection : "(context)"
note bottom of acknowledgement : "Subjects and context can reference\nany AT Protocol record type."
activity::contributions -l--> contributor
activity::rights --> rights
activity::locations --> location
contributor::identifier --> contributorEntity : made by
' These ones are not described by any lexicon, but are added to
' the diagram for clarity
token ..> activity : tokenizes
funder ..> activity : funds
contributor ..> rights : has
' These two are strings which will reference the counterparty's
' DID or human-readable name (if they're not on ATProto).
' However we still deliberately use solid arrows because they are
' explicitly described within the fundingReceipt lexicon.
fundingReceipt::from --> funder
fundingReceipt::to --> contributorEntity
fundingReceipt::for --> activity : funds
badgeAward::badge --> badgeDefinition
badgeResponse::badgeAward --> badgeAward
badgeAward::subject --> contributor
badgeAward::subject --> activity
' This screws up the layout
'badgeAward::subject --[norank]-> collection
@enduml