cloudfactory 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.gitignore +11 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +10 -0
  4. data/README.md +44 -0
  5. data/Rakefile +40 -0
  6. data/bin/cf +8 -0
  7. data/cf.gemspec +76 -0
  8. data/example/google_translate_app/Gemfile +12 -0
  9. data/example/google_translate_app/config.ru +7 -0
  10. data/example/google_translate_app/google_translate_input.csv +4 -0
  11. data/example/google_translate_app/google_translator_app.rb +53 -0
  12. data/example/google_translate_app/views/index.haml +2 -0
  13. data/example/google_translate_app/views/layout.haml +7 -0
  14. data/example/google_translate_app/views/run.haml +4 -0
  15. data/example/google_translate_app/views/style.sass +2 -0
  16. data/example/human_worker_app/Gemfile +12 -0
  17. data/example/human_worker_app/config.ru +7 -0
  18. data/example/human_worker_app/human_worker_app.rb +55 -0
  19. data/example/human_worker_app/human_worker_input.csv +5 -0
  20. data/example/human_worker_app/public/app.js +12 -0
  21. data/example/human_worker_app/temp.csv +3 -0
  22. data/example/human_worker_app/views/index.haml +15 -0
  23. data/example/human_worker_app/views/layout.haml +10 -0
  24. data/example/human_worker_app/views/result.haml +18 -0
  25. data/example/human_worker_app/views/run.haml +12 -0
  26. data/example/human_worker_app/views/style.sass +25 -0
  27. data/example/sample_yaml_files/concept_tagging_robot.yaml +18 -0
  28. data/example/sample_yaml_files/content_scraping_robot.yaml +19 -0
  29. data/example/sample_yaml_files/entity_extraction_robot.yaml +18 -0
  30. data/example/sample_yaml_files/google_translate_robot.yaml +20 -0
  31. data/example/sample_yaml_files/image_processing_robot.yaml +20 -0
  32. data/example/sample_yaml_files/keyword_matching_and_text_extraction_robot.yaml +26 -0
  33. data/example/sample_yaml_files/mailer_robot.yaml +21 -0
  34. data/example/sample_yaml_files/media_converter_robot.yaml +21 -0
  35. data/example/sample_yaml_files/media_splitting_robot.yaml +20 -0
  36. data/example/sample_yaml_files/multiple_skill_badge.yaml +75 -0
  37. data/example/sample_yaml_files/sentiment_robot.yaml +19 -0
  38. data/example/sample_yaml_files/skill_badge.yaml +56 -0
  39. data/example/sample_yaml_files/stat_badge.yaml +40 -0
  40. data/example/sample_yaml_files/term_extraction_robot.yaml +20 -0
  41. data/example/sample_yaml_files/tournament_station_and_form_fields.yaml +40 -0
  42. data/features/form_generation.feature +46 -0
  43. data/features/form_preview.feature +98 -0
  44. data/features/line_creation.feature +99 -0
  45. data/features/line_deletion.feature +50 -0
  46. data/features/line_generation.feature +57 -0
  47. data/features/run.feature +141 -0
  48. data/features/support/cli_steps.rb +16 -0
  49. data/features/support/env.rb +23 -0
  50. data/features/target_url.feature +82 -0
  51. data/fixtures/api_credentials_example.yml +4 -0
  52. data/fixtures/input_data/media_converter_robot.csv +2 -0
  53. data/fixtures/input_data/test.csv +2 -0
  54. data/lib/cf.rb +94 -0
  55. data/lib/cf/account.rb +32 -0
  56. data/lib/cf/cli.rb +52 -0
  57. data/lib/cf/cli/config.rb +87 -0
  58. data/lib/cf/cli/form.rb +82 -0
  59. data/lib/cf/cli/line.rb +237 -0
  60. data/lib/cf/cli/production.rb +62 -0
  61. data/lib/cf/cli/templates/css_file.css.erb +22 -0
  62. data/lib/cf/cli/templates/form_preview.html.erb +17 -0
  63. data/lib/cf/cli/templates/html_file.html.erb +21 -0
  64. data/lib/cf/cli/templates/js_file.js.erb +18 -0
  65. data/lib/cf/cli/templates/line.tt +55 -0
  66. data/lib/cf/cli/templates/sample-line/form.css +27 -0
  67. data/lib/cf/cli/templates/sample-line/form.html +26 -0
  68. data/lib/cf/cli/templates/sample-line/form.js +7 -0
  69. data/lib/cf/cli/templates/sample-line/line.yml.erb +67 -0
  70. data/lib/cf/cli/templates/sample-line/sample-line.csv +3 -0
  71. data/lib/cf/client.rb +56 -0
  72. data/lib/cf/custom_task_form.rb +136 -0
  73. data/lib/cf/department.rb +24 -0
  74. data/lib/cf/final_output.rb +20 -0
  75. data/lib/cf/form_field.rb +62 -0
  76. data/lib/cf/human_worker.rb +67 -0
  77. data/lib/cf/input_format.rb +134 -0
  78. data/lib/cf/line.rb +231 -0
  79. data/lib/cf/robot_worker.rb +31 -0
  80. data/lib/cf/run.rb +158 -0
  81. data/lib/cf/station.rb +340 -0
  82. data/lib/cf/task_form.rb +147 -0
  83. data/lib/cf/version.rb +3 -0
  84. data/lib/generators/cf/form/form_generator.rb +55 -0
  85. data/lib/generators/cf/form/templates/cf_form.html.erb +11 -0
  86. data/lib/generators/cf/install/install_generator.rb +22 -0
  87. data/lib/generators/cf/install/templates/README +13 -0
  88. data/lib/generators/cf/install/templates/cloud_factory.rb +7 -0
  89. data/spec/account_spec.rb +11 -0
  90. data/spec/badge_spec.rb +88 -0
  91. data/spec/concept_tagging_robot_spec.rb +54 -0
  92. data/spec/config_spec.rb +20 -0
  93. data/spec/content_scraping_robot_spec.rb +58 -0
  94. data/spec/custom_task_form_spec.rb +190 -0
  95. data/spec/department_spec.rb +14 -0
  96. data/spec/entity_extraction_robot_spec.rb +56 -0
  97. data/spec/form_field_spec.rb +126 -0
  98. data/spec/generators/form_generator_spec.rb +60 -0
  99. data/spec/generators/install_generator_spec.rb +35 -0
  100. data/spec/google_translate_robot_spec.rb +64 -0
  101. data/spec/human_worker_spec.rb +118 -0
  102. data/spec/image_processing_robot_spec.rb +56 -0
  103. data/spec/input_format_spec.rb +113 -0
  104. data/spec/keyword_matching_and_text_extraction_robot_spec.rb +73 -0
  105. data/spec/line_spec.rb +338 -0
  106. data/spec/mailer_robot_spec.rb +62 -0
  107. data/spec/media_converter_robot_spec.rb +72 -0
  108. data/spec/media_splitting_robot_spec.rb +62 -0
  109. data/spec/run_spec.rb +298 -0
  110. data/spec/sentiment_robot_spec.rb +56 -0
  111. data/spec/spec_helper.rb +39 -0
  112. data/spec/station_spec.rb +256 -0
  113. data/spec/task_form_spec.rb +96 -0
  114. data/spec/term_extraction_robot_spec.rb +58 -0
  115. data/spec/text_appending_robot_spec.rb +86 -0
  116. metadata +472 -0
@@ -0,0 +1,237 @@
1
+ # encoding: utf-8
2
+ require 'thor/group'
3
+
4
+ module Cf
5
+ class Newline < Thor::Group
6
+ include Thor::Actions
7
+ include Cf::Config
8
+ source_root File.expand_path('../templates/', __FILE__)
9
+ argument :title, :type => :string, :desc => "The line title"
10
+ argument :yaml_destination, :type => :string, :required => true
11
+
12
+ def generate_line_template
13
+ arr = yaml_destination.split("/")
14
+ arr.pop
15
+ line_destination = arr.join("/")
16
+ template("sample-line/line.yml.erb", yaml_destination)
17
+ copy_file("sample-line/form.css", "#{line_destination}/station_2/form.css")
18
+ copy_file("sample-line/form.html", "#{line_destination}/station_2/form.html")
19
+ copy_file("sample-line/form.js", "#{line_destination}/station_2/form.js")
20
+ copy_file("sample-line/sample-line.csv", "#{line_destination}/input/#{title.underscore.dasherize}.csv")
21
+ FileUtils.mkdir("#{line_destination}/output")
22
+ end
23
+ end
24
+ end
25
+
26
+
27
+ module Cf
28
+ class Line < Thor
29
+ include Cf::Config
30
+ desc "line generate LINE-TITLE", "generates a line template at <line-title>/line.yml"
31
+ method_option :force, :type => :boolean, :default => false, :aliases => "-f", :desc => "force to overwrite the files if the line already exists, default is false"
32
+ # method_option :with_custom_form, :type => :boolean, :default => false, :aliases => "-wcf", :desc => "generate the template with custom task form and the sample files, default is true"
33
+
34
+ def generate(title=nil)
35
+ if title.present?
36
+ line_destination = "#{title.underscore.dasherize}"
37
+ yaml_destination = "#{line_destination}/line.yml"
38
+ FileUtils.rm_rf(line_destination, :verbose => true) if options.force? && File.exist?(line_destination)
39
+ if File.exist?(line_destination)
40
+ say "Skipping #{yaml_destination} because it already exists.\nUse the -f flag to force it to overwrite or check and delete it manually.", :red
41
+ else
42
+ say "Generating #{yaml_destination}", :green
43
+ Cf::Newline.start([title, yaml_destination])
44
+ say "A new line named #{line_destination} generated.", :green
45
+ say "Modify the #{yaml_destination} file and you can create this line with: cf line create", :yellow
46
+ end
47
+ else
48
+ say "Title for the line is required.", :red
49
+ end
50
+ end
51
+
52
+ desc "line delete", "delete the line at http://cloudfactory.com"
53
+ def delete
54
+ line_source = Dir.pwd
55
+ yaml_source = "#{line_source}/line.yml"
56
+
57
+ unless File.exist?(yaml_source)
58
+ say("The line.yml file does not exist in this directory", :red) and return
59
+ end
60
+
61
+ set_target_uri(false)
62
+ if set_api_key(yaml_source)
63
+ CF.account_name = CF::Account.info.name
64
+ line_dump = YAML::load(File.open(yaml_source))
65
+ line_title = line_dump['title']
66
+
67
+ CF::Line.destroy(line_title)
68
+ say("The line #{line_title} was deleted successfully!", :yellow)
69
+ else
70
+ say("The api_key is missing in the line.yml file", :red)
71
+ end
72
+ end
73
+
74
+ desc "line create", "takes the yaml file at line.yml and creates a new line at http://cloudfactory.com"
75
+ def create
76
+ line_source = Dir.pwd
77
+ yaml_source = "#{line_source}/line.yml"
78
+
79
+ unless File.exist?(yaml_source)
80
+ say "The line.yml file does not exist in this directory", :red
81
+ return
82
+ end
83
+
84
+ set_target_uri(false)
85
+ if set_api_key(yaml_source)
86
+
87
+ CF.account_name = CF::Account.info.name
88
+
89
+ line_dump = YAML::load(File.open(yaml_source))
90
+ line_title = line_dump['title'].parameterize
91
+ line_description = line_dump['description']
92
+ line_department = line_dump['department']
93
+ line = CF::Line.new(line_title, line_department, :description => line_description)
94
+
95
+ unless line.errors.blank?
96
+ say("#{line.errors.message}", :red) and return
97
+ end
98
+
99
+ say "Creating new assembly line: #{line.title}", :green
100
+ say "Adding InputFormats", :green
101
+
102
+ # Creation of InputFormat from yaml file
103
+ input_formats = line_dump['input_formats']
104
+ input_formats.each do |input_format|
105
+ attrs = {
106
+ :name => input_format['name'],
107
+ :required => input_format['required'],
108
+ :valid_type => input_format['valid_type']
109
+ }
110
+ input_format_for_line = CF::InputFormat.new(attrs)
111
+ line.input_formats input_format_for_line
112
+ say_status "input", "#{attrs[:name]}"
113
+ end
114
+
115
+ # Creation of Station
116
+ stations = line_dump['stations']
117
+ stations.each do |station_file|
118
+ type = station_file['station']['station_type']
119
+ index = station_file['station']['station_index']
120
+ input_formats_for_station = station_file['station']['input_formats']
121
+ if type == "tournament"
122
+ jury_worker = station_file['station']['jury_worker']
123
+ auto_judge = station_file['station']['auto_judge']
124
+ station_params = {:line => line, :type => type, :jury_worker => jury_worker, :auto_judge => auto_judge, :input_formats => input_formats_for_station}
125
+ else
126
+ station_params = {:line => line, :type => type, :input_formats => input_formats_for_station}
127
+ end
128
+ station = CF::Station.create(station_params) do |s|
129
+ #say "New Station has been created of type => #{s.type}", :green
130
+ say "Adding Station #{index}: #{s.type}", :green
131
+ # For Worker
132
+ worker = station_file['station']['worker']
133
+ number = worker['num_workers']
134
+ reward = worker['reward']
135
+ worker_type = worker['worker_type']
136
+ if worker_type == "human"
137
+ skill_badges = worker['skill_badges']
138
+ stat_badge = worker['stat_badge']
139
+ if stat_badge.nil?
140
+ human_worker = CF::HumanWorker.new({:station => s, :number => number, :reward => reward})
141
+ else
142
+ human_worker = CF::HumanWorker.new({:station => s, :number => number, :reward => reward, :stat_badge => stat_badge})
143
+ end
144
+ if worker['skill_badges'].present?
145
+ skill_badges.each do |badge|
146
+ human_worker.badge = badge
147
+ end
148
+ end
149
+ #say "New Worker has been created of type => #{worker_type}, Number => #{number} and Reward => #{reward}", :green
150
+ say_status "worker", "#{number} Cloud #{pluralize(number, "Worker")} with reward of #{reward} #{pluralize(reward, "cent")}"
151
+ else
152
+ settings = worker['settings']
153
+ robot_worker = CF::RobotWorker.create({:station => s, :type => worker_type, :settings => settings})
154
+
155
+ #say "New Worker has been created of type => #{worker_type} and settings => #{worker['settings']}", :green
156
+ say_status "robot", "Robot worker: #{worker_type}"
157
+ end
158
+
159
+ # Creation of Form
160
+ # Creation of TaskForm
161
+ if station_file['station']['task_form'].present?
162
+ title = station_file['station']['task_form']['form_title']
163
+ instruction = station_file['station']['task_form']['instruction']
164
+ form = CF::TaskForm.create({:station => s, :title => title, :instruction => instruction}) do |f|
165
+ # Creation of FormFields
166
+ station_file['station']['task_form']['form_fields'].each do |form_field|
167
+ form_field_params = form_field.merge(:form => f)
168
+ field = CF::FormField.new(form_field_params.symbolize_keys)
169
+ end
170
+ say_status "form", "TaskForm '#{f.title}'"
171
+ end
172
+
173
+ elsif station_file['station']['custom_task_form'].present?
174
+ # Creation of CustomTaskForm
175
+ title = station_file['station']['custom_task_form']['form_title']
176
+ instruction = station_file['station']['custom_task_form']['instruction']
177
+
178
+ html_file = station_file['station']['custom_task_form']['html']
179
+ html = File.read("#{line_source}/station_#{station_file['station']['station_index']}/#{html_file}")
180
+ css_file = station_file['station']['custom_task_form']['css']
181
+ css = File.read("#{line_source}/station_#{station_file['station']['station_index']}/#{css_file}")
182
+ js_file = station_file['station']['custom_task_form']['js']
183
+ js = File.read("#{line_source}/station_#{station_file['station']['station_index']}/#{js_file}")
184
+ form = CF::CustomTaskForm.create({:station => s, :title => title, :instruction => instruction, :raw_html => html, :raw_css => css, :raw_javascript => js})
185
+
186
+ say_status "form", "CustomTaskForm '#{form.title}'"
187
+ end
188
+
189
+ end
190
+ end
191
+ say " ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁", :white
192
+ say "Line was successfully created.", :green
193
+ say "View your line at http://#{CF.account_name}.#{CF.api_url.split("/")[-2]}/lines/#{CF.account_name}/#{line.title}", :yellow
194
+ say "\nNow you can do production runs with: cf production start <your_run_title>", :green
195
+ say "Note: Make sure your-run-title.csv file is in the input directory.", :green
196
+ else
197
+ say "The api_key is missing in the line.yml file", :red
198
+ end
199
+ end
200
+
201
+ desc "line list", "List your lines"
202
+ def list
203
+ line_source = Dir.pwd
204
+ yaml_source = "#{line_source}/line.yml"
205
+
206
+ unless File.exist?(yaml_source)
207
+ say("The line.yml file does not exist in this directory", :red) and return
208
+ end
209
+
210
+ set_target_uri(false)
211
+ if set_api_key(yaml_source)
212
+ CF.account_name = CF::Account.info.name
213
+ lines = CF::Line.all
214
+ lines.sort! {|a, b| a[:name] <=> b[:name] }
215
+ say "\n"
216
+ say("No Lines", :yellow) if lines.blank?
217
+
218
+ lines_table = table do |t|
219
+ t.headings = ["Line Title", 'URL']
220
+ lines.each do |line|
221
+ t << [line.title, "http://#{CF.account_name}.cloudfactory.com/lines/#{CF.account_name}/#{line.title.parameterize}"]
222
+ end
223
+ end
224
+ say(lines_table)
225
+ else
226
+ say("The api_key is missing in the line.yml file", :red)
227
+ end
228
+ end
229
+
230
+ # helper function like in Rails
231
+ def pluralize(number, text)
232
+ return text.pluralize if number != 1
233
+ text
234
+ end
235
+
236
+ end
237
+ end
@@ -0,0 +1,62 @@
1
+ require 'thor/group'
2
+
3
+ module Cf
4
+ class Production < Thor
5
+ include Cf::Config
6
+
7
+ desc "production start <run-title>", "creates a production run with input data file at input/<run-title>.csv"
8
+ method_option :input_data, :type => :string, :aliases => "-i", :desc => "the name of the input data file"
9
+ method_option :live, :type => :boolean, :default => false, :aliases => "-l", :desc => "force the host to set to live mturk environment"
10
+ def start(title=nil)
11
+
12
+ if title.nil?
13
+ say("The run title is required to start the production.", :red) and return
14
+ end
15
+
16
+ run_title = title.parameterize
17
+ line_destination = Dir.pwd
18
+ yaml_source = "#{line_destination}/line.yml"
19
+
20
+ unless File.exist?("#{yaml_source}")
21
+ say("The current directory is not a valid line directory.", :red) and return
22
+ end
23
+
24
+ line_yaml_dump = YAML::load(File.open(yaml_source))
25
+ line_title = line_yaml_dump['title'].parameterize
26
+
27
+ if !options[:input_data].nil?
28
+ input_data = "input/#{options[:input_data]}"
29
+ else
30
+ input_data = "input/#{run_title}.csv"
31
+ end
32
+
33
+ unless File.exist?(input_data)
34
+ say("The input data csv file named #{input_data} is missing.", :red) and return
35
+ end
36
+
37
+ set_target_uri(options[:live])
38
+ # before starting the run creation process, we need to make sure whether the line exists or not
39
+ # if not, then we got to first create the line and then do the production run
40
+ # else we just simply do the production run
41
+ if set_api_key(yaml_source)
42
+ CF.account_name = CF::Account.info.name
43
+ line = CF::Line.info(line_title)
44
+ input_data_path = "#{Dir.pwd}/#{input_data}"
45
+ if line.error.blank?
46
+ say "Creating a production run with title #{run_title}", :green
47
+ run = CF::Run.create(line, run_title, input_data_path)
48
+ say "A run with title #{run.title} created successfully."
49
+ else
50
+ # first create line
51
+ say "Creating the line: #{line_title}", :green
52
+ Cf::Line.new.create
53
+ # Now create a production run with the title run_title
54
+ run = CF::Run.create(CF::Line.info(line_title), run_title, input_data_path)
55
+ say "A run with title #{run.title} using the line #{line_title} was successfully created."
56
+ end
57
+ else
58
+ say "The api_key is missing in the line.yml file", :red
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,22 @@
1
+ body {background:red;}
2
+
3
+ #instructions{
4
+ text-align:center;
5
+ }
6
+
7
+ #image-field-wrapper{
8
+ min-width:1050px;
9
+ overflow:hidden;
10
+ }
11
+
12
+ #field-panel{
13
+ float:left;
14
+ padding: 10px 10px 0 10px;
15
+ min-width:512px;
16
+ overflow:hidden;
17
+ }
18
+
19
+ .input-field{
20
+ width:150px;
21
+ margin:4px;
22
+ }
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Form Preview</title>
5
+ <link href="form.css" media="screen, projection" rel="stylesheet" type="text/css" />
6
+ <script src="form.js" type="text/javascript"></script>
7
+ </head>
8
+ <!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
9
+ <!--[if IE 7 ]> <body class="ie7"> <![endif]-->
10
+ <!--[if IE 8 ]> <body class="ie8"> <![endif]-->
11
+ <!--[if IE 9 ]> <body class="ie9"> <![endif]-->
12
+ <!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->
13
+ <div id="container">
14
+ <%= form_content %>
15
+ </div>
16
+ </body>
17
+ </html>
@@ -0,0 +1,21 @@
1
+ <div id="station_<%= station %>_instructions" class="station_<%= station %> cf_form_instruction">
2
+ <ul>
3
+ <li>Sample bullet list of instruction</li>
4
+ <li>Sample bullet list of instruction</li>
5
+ <li>Sample bullet list of instruction</li>
6
+ </ul>
7
+ </div>
8
+
9
+ <div id="station_<%= station %>_form" class="station_<%= station %> cf_form_content">
10
+ <%- labels.split(",").each do |label| -%>
11
+ <label>{{<%= label %>}}</label>
12
+ <%- end unless labels.nil? -%>
13
+
14
+ <div id = "field-panel">
15
+ <%-
16
+ fields.each_pair do |field_name, field_type|
17
+ -%>
18
+ <p><label><%= field_name %></label><input id="<%= field_name.downcase %>" type="text" name="output[<%= field_name.downcase %>]" data-valid-type="<%= field_type.downcase %>" /></p>
19
+ <%- end unless fields.blank? -%>
20
+ </div>
21
+ </div>
@@ -0,0 +1,18 @@
1
+ <script src="http://code.jquery.com/jquery-latest.js"></script>
2
+ <script type="text/javascript" src="http://www.bizcardarmy.com/javascripts/jquery.autocomplete-min.js"></script>
3
+ <script type="text/javascript">
4
+ $(document).ready(function(){
5
+ autocomplete_fields = ["first_name", "middle_name", "last_name", "company", "job_title", "city", "state", "zip"];
6
+
7
+ $.each(autocomplete_fields, function(index, value){
8
+ var inputField = "input." + value;
9
+ $(inputField).autocomplete({
10
+ serviceUrl: "http://www.bizcardarmy.com/cards/return_data_for_autocompletion.json",
11
+ maxHeight: 400,
12
+ width: 300,
13
+ zIndex: 9999,
14
+ params: { field: value }
15
+ });
16
+ });
17
+ });
18
+ </script>
@@ -0,0 +1,55 @@
1
+ # ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
2
+ # See docs at http://developers.cloudfactory.com/lines/yaml.html
3
+ # See examples at http://developers.cloudfactory.com/lines/examples.html
4
+ #
5
+ # Fill in your API key below (see http://cloudfactory.com/account#settings)
6
+ # ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁ ☁
7
+
8
+ # Line settings (see http://cloudfactory.com/lines/yaml.html#line-settings)
9
+ api_key: fill_in_your_api_key
10
+ title: <%= title.underscore.dasherize %>
11
+ description: Describe the line what its purpose is and what it does. You got the idea, right?
12
+ department: Survey
13
+
14
+
15
+ # Line Input Formats (see http://cloudfactory.com/lines/yaml.html#line-input-formats)
16
+ # input_formats:
17
+ # - name: company
18
+ # required: true
19
+ # valid_type: general # general, url, date, email, ...
20
+
21
+ # Stations (see http://cloudfactory.com/lines/yaml.html#stations)
22
+ stations:
23
+ - station:
24
+ station_index: 1
25
+ station_type: work
26
+ # Worker (see http://cloudfactory.com/lines/yaml.html#workers)
27
+ worker:
28
+ worker_type: human # human, impr
29
+ num_workers: 2
30
+ reward: 5
31
+ # Task Form (see http://cloudfactory.com/lines/yaml.html#task-forms)
32
+ task_form:
33
+ form_title: Enter text from a business card image for TASKFORM
34
+ instruction: Read the business card image and the fill the fields for TASKFORM
35
+ form_fields:
36
+ - label: CEO Name
37
+ field_type: short_answer
38
+ required: true
39
+ - label: CEO Email
40
+ field_type: email
41
+ required: true
42
+ - station:
43
+ station_index: 2
44
+ station_type: work
45
+ worker:
46
+ worker_type: human
47
+ num_workers: 1
48
+ reward: 3
49
+ # Custom Task Form (see http://cloudfactory.com/lines/yaml.html#custom-task-form)
50
+ custom_task_form:
51
+ form_title: Enter text from a business card image for CUSTOMTASKFORM
52
+ instruction: Read the business card image and the fill the fields for CUSTOMTASKFORM
53
+ html: form.html
54
+ css: form.css
55
+ js: form.js
@@ -0,0 +1,27 @@
1
+ body {background: grey;}
2
+
3
+ #instructions{
4
+ text-align:center;
5
+ }
6
+
7
+ #image-field-wrapper{
8
+ min-width:1050px;
9
+ overflow:hidden;
10
+ }
11
+
12
+ #field-panel{
13
+ float:left;
14
+ padding: 10px 10px 0 10px;
15
+ min-width:512px;
16
+ overflow:hidden;
17
+ }
18
+
19
+ .input-field{
20
+ width:150px;
21
+ margin:4px;
22
+ }
23
+
24
+ .appended_para {
25
+ font-size: 1.5em;
26
+ font-family: Verdana, Arial;
27
+ }