Skip to content

Commit 58d08c8

Browse files
committed
Copied from dc-v5 branch
1 parent 104cf63 commit 58d08c8

File tree

363 files changed

+207209
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+207209
-6
lines changed

‎crime/canada_map.svg‎

Lines changed: 460 additions & 0 deletions
Loading

‎crime/crime.csv‎

Lines changed: 1261 additions & 0 deletions
Large diffs are not rendered by default.

‎crime/filter_stats.rb‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env ruby
2+
3+
city_names=[
4+
'Toronto, Ontario',
5+
'Ottawa-Gatineau, Ontario/Quebec',
6+
'Vancouver, British Columbia',
7+
'Montreal, Quebec',
8+
'Edmonton, Alberta',
9+
'Winnipeg, Manitoba',
10+
'Saskatoon, Saskatchewan',
11+
'Calgary, Alberta',
12+
'Quebec, Quebec',
13+
'Halifax, Nova Scotia',
14+
'St. John\'s, Newfoundland and Labrador',
15+
'Saint John, New Brunswick',
16+
'Yukon',
17+
'Northwest Territories',
18+
'Nunavut'
19+
]
20+
21+
crime_types=[
22+
'"Total, all violations",Actual incidents',
23+
'"Total, all violations","Rate per 100,000 population"',
24+
'Total violent Criminal Code violations,Actual incidents',
25+
'Total violent Criminal Code violations,"Rate per 100,000 population"',
26+
'Homicide,Actual incidents',
27+
'Homicide,"Rate per 100,000 population"'
28+
]
29+
30+
subs=[
31+
['Toronto, Ontario','Toronto'],
32+
['Ottawa-Gatineau, Ontario/Quebec','Ottawa'],
33+
['Vancouver, British Columbia','Vancouver'],
34+
['Montreal, Quebec','Montreal'],
35+
['Edmonton, Alberta','Edmonton'],
36+
['Winnipeg, Manitoba','Winnipeg'],
37+
['Saskatoon, Saskatchewan','Saskatoon'],
38+
['Calgary, Alberta','Calgary'],
39+
['Quebec, Quebec','Quebec'],
40+
['Halifax, Nova Scotia','Halifax'],
41+
['St. John\'s, Newfoundland and Labrador','St. John\'s'],
42+
['Saint John, New Brunswick','Saint John']
43+
]
44+
45+
puts"year,city,type,sub_type,number"
46+
47+
File.open(ARGV[0],"r:ISO8859-1"){ |file|
48+
file.each_line(){ |line|
49+
begin
50+
catch:linedo
51+
city_names.each{ |city|
52+
if(line =~ /.*#{city}.*/)
53+
crime_types.each{ |crime|
54+
if(line =~ /.*#{crime}.*/)
55+
subs.each{|sub_pair|
56+
line=line.gsub(sub_pair[0],sub_pair[1])
57+
}
58+
putsline
59+
throw:line
60+
end
61+
}
62+
end
63+
}
64+
end
65+
rescueArgumentError
66+
# do nothing
67+
end
68+
}
69+
}

‎crime/index.html‎

Lines changed: 710 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
(0)