-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathschema.dbml
251 lines (216 loc) · 6.47 KB
/
schema.dbml
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
enum iso_639_codes {
en
es
pa
}
table iso_639_strings {
id int [primary key]
code iso_639_codes [primary key]
value string
Note: 'Strings for a given iso-639 code. E.g. en, es, pa, etc'
}
enum iso_15924_codes {
Latn
Aran
Guru
}
table iso_15924_strings {
id int [primary key]
code iso_15924_codes [primary key]
value string
Note: 'Strings for a given iso-15924 code. E.g. Latn, Aran, Guru, etc'
}
enum line_kind {
refrain
heading
line
invocation
orphan
}
enum language {
"iso-639"
}
enum line_data_type {
recitable [note: 'Recitable Gurbani']
panthic [note: 'Non-singable panthic text E.g. suraj prakash']
translations
// We should decide if we need this
transliteration
}
Table line_groups {
id string [primary key]
bookmark_id string [ref: > bookmarks.id]
line_id string [ref: > lines.id]
author string [ref: - authors.id]
// related_assets string [ref: <> assets.id, note: 'Related, useful assets to the line group. E.g. Kirtan, Katha, etc.']
order_id int
Note: 'A line group is a grouped, ordered portion of lines. E.g. a shabad.'
}
Table lines {
id string [primary key]
kind line_kind
// Standardised ordering for conceptual
line_number int
page int
related_assets string [ref: <> assets.id, note: 'Related, useful assets to the line. E.g. katha, kirtan, podcasts, notes, etc.']
// Could be on line_group instead?
source_id string [ref: - sources.id]
Note: '''
A fundamental, abstract unit of content, backed by a consistent id.
Whilst a line represents a single unit of content abstractly, it can have multiple representations, depending on the asset selected.
E.g. a line may have the same identifier, but the assets may have different translations.
'''
}
Table recommended_line_assets {
asset_id string [ref: - assets.id]
language int [ref: - iso_639_strings.id]
type line_data_type
priority int
Note: 'Our recommendation of which asset to read from for a line. Used to prioritise what to display from line_data.'
}
Table line_data {
line_id string [ref: < lines.id]
asset_id int [ref: - assets.id]
type line_data_type [note: 'The type of line data. E.g. primary, translation, etc.']
language int [ref: - iso_639_strings.id]
data string
Note: '''
Whilst a line represents a single unit of content, abstractly, it can have multiple representations.
E.g. a line may have a variation depending on the publisher, or have multiple translations.
line_data is a table of all representations of a line according to different assets.
'''
}
Table authors {
id string
name int [ref: - iso_15924_strings.id]
Note: 'The composer of a line group within a source. e.g. Guru Nanak Dev Ji, etc.'
}
// Banis also have to be able to include / augment from other material sources
// TO discuss
table bookmark_folders {
// id = 0 is root folder
id int [primary key]
bookmark_id string [ref: - bookmarks.id]
bookmarks bookmarks [ref: <> bookmarks.id]
Note: '''
A folder is a collection of bookmarks.
The root folder will have id = 0
'''
}
enum bookmark_type {
line_group
bani
source
}
table bookmarks {
id int [primary key]
name string
type bookmark_type
Note: '''
A bookmark is an organisational unit for a collection of lines, line groups, banis, etc.
The root bookmark will have id = 0 and type = folder
'''
}
// A published collection of lines
table banis {
id string
bookmark_id string [ref: - bookmarks.id]
name i18string
lines string [ref: <> lines.id]
related_assets string [ref: <> assets.id, note: 'Related, useful assets to the bani. E.g. katha, kirtan, podcasts, notes, etc.']
}
// Composition e.g. SGGS
table sources {
id string
bookmark_id string [ref: - bookmarks.id]
name int [ref: - iso_15924_strings.id]
Note: '''
Represents a composition containing lines. E.g. SGGS, Sarbloh Granth.
'''
}
// Amrit Keertan will be an asset (for research reasons)
// But a bookmark for browsing reasons
// Mahan Kosh -> word level
table dictionaries {
id string
asset_id string [ref: - assets.id]
}
table words {
id string
}
// future can have recommended dicitionaries
// for now, return all defintiions but ordered
table word_definitions {
word_id string [ref: - words.id]
dictionary_id string [ref: - dictionaries.id]
language language
definition string
}
// generated from word_representations
table words_search {
query string [primary key]
word_id string [ref: > words.id]
// unique per query <> word_id pair
priority int
}
table word_representations {
dictionary_id string [ref: - dictionaries.id]
word_id string [ref: - words.id]
language language
script script
// primary key (dict_id, word_id, lang, script)
word string
alternative_spellings string[]
}
Table asset_authors {
id string [primary key]
first_name string
last_name string
}
Table asset_groups {
id string [primary key]
name string
assets string [ref: > assets.id]
Note: '''
A group of assets that are related to each other.
Examples:
- Bundled Content: To group related assets that form a complete work (e.g., a multi-part katha series or a collection of kirtan recordings that belong together)
- Different Formats: To link different formats of the same content (e.g., a video recording and its audio-only version, or PDF transcripts of the same content)
- Versioning/Editions: To group different versions or editions of the same content while maintaining them as separate assets
- Playlists/Collections: To allow user-created or curated collections of related assets
'''
}
enum asset_type {
audio
video
pdf
}
Table assets {
id string [primary key]
name string
authors string [ref: > asset_authors.id]
publisher string
published_date Date
type asset_type
Note:
'''
A digitised source of content. e.g. a PDF, audio, video, etc.'
Assets have 2 fundamental purposes:
- To be a source of primary content for lines, exposed in line_data. E.g. line ABCD can have multiple line_data entries, each with a different asset_id, corresponding to different translations, or different variations of the same content.
- To provide a related content for a user to browse, e.g. a PDF, audio, video, etc.
Examples of related assets:
- Kirtan of line groups / banis
- Katha / Podcasts of lines, line groups, banis
- Notes / compositions (pictures) of line groups, banis
- PDFs, books of line groups
'''
}
Table audio {
asset_id string [ref: > assets.id]
}
Table video {
asset_id string [ref: > assets.id]
}
Table pdf {
asset_id string [ref: > assets.id]
}