-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_sample_data.js
executable file
·106 lines (100 loc) · 2.67 KB
/
load_sample_data.js
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
#!/usr/local/bin/node
var carto = require('./');
var async = require('async');
var protests;
var law;
var protests_cause_law;
var casserole;
var law_causes_casserole;
async.series([
function(cb){
protests = new carto.models.Situation();
protests.create(cb);
},
function(cb){
protests.title('Québec Student Protests', cb);
},
function(cb){
protests.alias('quebec-student-protests', cb);
},
function(cb){
protests.location('Montréal, QC', cb);
},
function(cb){
protests.period('Summer 2012', cb);
},
function(cb){
protests.tag('Maple Spring', cb);
},
function(cb){
protests.mark('controversial', cb);
},
function(cb){
law = new carto.models.Situation();
law.create(cb);
},
function(cb){
law.title('National Assembly of Quebec Passes Bill 78', cb);
},
function(cb){
law.alias('national-assembly-of-quebec-passes-bill-78', cb);
},
function(cb){
law.period('May 18th, 2012', cb);
},
function(cb){
law.location('Québec', cb);
},
function(cb){
protests_cause_law = new carto.models.Relationship();
protests_cause_law.create({
cause: { _id: protests.id },
effect: { _id: law.id }
}, cb);
},
function(cb){
protests_cause_law.strengthen(cb);
},
function(cb){
protests_cause_law.description('The law restricts protest or picketing on or near university grounds. The law further requires that organizers of a protest, consisting of 50 or more people in a public venue anywhere in Quebec, submit their proposed venue and/or route to the relevant police for approval.', cb)
},
function(cb){
casserole = new carto.models.Situation();
casserole.create(cb);
},
function(cb){
casserole.title('Casserole Protests', cb);
},
function(cb){
casserole.alias('casserole-protests', {reason: 'catchy name'}, cb);
},
function(cb){
casserole.location('Montreal, QC', cb);
},
function(cb){
casserole.tag('Maple Spring', cb);
},
function(cb){
casserole.description('Montreal residents banged on pots and pans in an act of defiance against the recently passed Law 78.', cb);
},
function(cb){
law_causes_casserole = new carto.models.Relationship();
law_causes_casserole.create({
cause: {
_id: law.id
},
effect: {
_id: casserole.id
}
}, cb);
},
function(cb){
law_causes_casserole.description("Casserole protests started just after the law was passed. Signs condemning law 78 could be seen.", cb);
},
function(cb){
law_causes_casserole.weaken(cb);
}
], function(async_err, async_result){
if (async_err){ return console.error(async_err) }
console.log('Sample data loaded.');
});