Skip to content

Commit 5b8de60

Browse files
add datamodel.md
1 parent 68d977a commit 5b8de60

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

datamodel.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# REST API Data Model
2+
3+
No formal definition, just some examples, to have some reference for discussion
4+
5+
The idea is that this is what the API will return, but it also serves as a
6+
guideline for variable naming in the code.
7+
8+
In general:
9+
10+
* All 'reputation' values are expressed as fractions of the total reputaiton of the system
11+
* Tokens are just absolute values (not fractions)
12+
13+
## User
14+
15+
A user has tokens and reputatation:
16+
17+
{
18+
'id': 123,
19+
'tokens': 11.3,
20+
'reputation': 0.03, /* the fraction of the user' rep
21+
wrt the total_repution */
22+
}
23+
24+
25+
## Contribution
26+
27+
{
28+
'id': 12345,
29+
'contributor' : {
30+
/* user structure */
31+
...
32+
},
33+
'score': 0.30,
34+
/* score = the sum of the reputation
35+
of the 'up votes' as a fraction of total_reputation (and in general sum(evalutor.reputation * evaluation.score)) */
36+
'engaged_reputation': 0.4,
37+
/* the sum of the reputation of all evaluators of this contribution */
38+
}
39+
40+
41+
* in the present API, 'score' is an absolute value, and 'scorePercentage' the
42+
fraction of the 'score' relative to total_repuation. I think this is confusing.
43+
* question, ore: why do you have 'score' and 'scorePercentage'?
44+
45+
46+
## Evaluation
47+
48+
{
49+
'id': 1234545,
50+
'value': 1.0,
51+
'evaluator' : {
52+
/* user structure */
53+
...
54+
}
55+
'contribution': {
56+
...
57+
},
58+
}

0 commit comments

Comments
 (0)