-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo
62 lines (43 loc) · 1.86 KB
/
todo
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
EFFICIENT UNIT MANAGEMENT
Make hook that fetches ALL units for a project, and stores them in indexedDB.
When the hook is mounted, first only get list of unit ids and hashes, to check whether indexedDB is still in sync
If not, update the unit ids that need updating.
RENAME units so that in the annotatorIndex the indices are jobSessionIndex and not unitIndex.
Reserve the name units exclusively for units in annotation jobs.
Make sub table for annotations in DB
composite primary key:
- id (as created by client)
- unitAnnotationId
- annotation
When posting annotations, just post the ones for current variable, as an upsert using the unique IDs.
The encrypted session token doesn't contain the validation data, but just a boolean for whether or not the variable should be validated. If so, fetch the validation data from the DB.
Include "done" field in annotation. Set this to true if the annotator confirmed submitting the variable (in case of multi code annotations).
Now always calculate the variablestatuses from scratch on update. Make it so that it stops if a variable is not yet answered (which can happen if codebook changed). Then recalculate once answered, so it should automatically skip over gaps.
Store annotations as an object, and we can in one query add and remove annotations.
This way we don't have to send redundant annotations, but just a AnnotationDictionary object to 'add',
and an array of 'rmIds'.
-- Create the table
CREATE TABLE my_table (
id serial PRIMARY KEY,
test text,
data jsonb NOT NULL
);
-- Insert example data
INSERT INTO my_table (test,data)
VALUES ('testdit', '{
"id1": "",
"id2": "",
"id3": "",
"id4": ""
}');
SELECT jsonb_pretty(data)
FROM my_table
WHERE id = 1;
UPDATE my_table
SET data = (data - ARRAY['id1', 'id2']) ||
'{"idnew1": "", "idnew2":""}'::jsonb,
test = 'jeej'
WHERE id=1;
SELECT jsonb_pretty(data), test
FROM my_table
WHERE id = 1;