memaker / ttv4

Tweet analysis tool version 4, implementing graphical dashboard
0 stars 2 forks source link

h1. Ttv4

This application was generated with the "rails_apps_composer":https://github.com/RailsApps/rails_apps_composer gem provided by the "RailsApps Project":http://railsapps.github.io/.

h2. Diagnostics

This application was built with recipes that are NOT known to work together.

This application was built with preferences that are NOT known to work together.

If the application doesn't work as expected, please "report an issue":https://github.com/RailsApps/rails_apps_composer/issues and include these diagnostics:

We'd also like to know if you've found combinations of recipes or preferences that do work together.

Recipes: ["apps4", "controllers", "core", "email", "extras", "frontend", "gems", "git", "init", "models", "prelaunch", "railsapps", "readme", "routes", "saas", "setup", "testing", "views"]

Preferences: {:git=>true, :railsapps=>"none", :dev_webserver=>"webrick", :prod_webserver=>"same", :database=>"mongodb", :orm=>"mongoid", :templates=>"erb", :unit_test=>"rspec", :integration=>"cucumber", :continuous_testing=>"none", :fixtures=>"factory_girl", :frontend=>"bootstrap", :bootstrap=>"less", :email=>"gmail", :authentication=>"devise", :devise_modules=>"default", :authorization=>"cancan", :form_builder=>"simple_form", :starter_app=>"admin_app", :rvmrc=>true, :quiet_assets=>true, :local_env_file=>true, :better_errors=>true, :ban_spiders=>true, :jsruntime=>true, :github=>true}

h2. Ruby on Rails

This application requires:

Learn more about "Installing Rails":http://railsapps.github.io/installing-rails.html.

h2. Database

This application uses MongoDB with the Mongoid ORM.

h2. Development

h2. Email

The application is configured to send email using a Gmail account.

h2. Getting Started

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

h2. Documentation and Support

This is the only documentation.

h4. Issues

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

h2. Contributing

If you make improvements to this application, please share with others.

If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work.

h2. Credits

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

h2. License

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

h2. Heroku

$ heroku logs
$ heroku logs --tail
$ heroku apps:destroy still-plains-4287
$ heroku config
$ heroku config:set GITHUB_USERNAME=joesmith
$ heroku config:get GITHUB_USERNAME
$ heroku config:unset GITHUB_USERNAME

h2. Mongo

$ mongo

use ttv4

Delete a collection

show collections db.corpus_anews.drop()

Upload data and generate the scaffold $ mongoimport -h ds049157.mongolab.com:49157 -d twittermometro -c corpus_positive -u twitteruser -p demopass --file corpus_positive.csv --type csv --headerline $ rails generate scaffold CorpusPositive sentence:text

Upload data to mongolab $ mongoimport -h ds049157.mongolab.com:49157 -d twittermometro -c corpus_anews -u twitteruser -p demopass --file ANEW-Appendix.csv --type csv --headerline

Upload data to development $ mongoimport -h localhost:27017 -d twittermometro_development -c corpus_anews --file ANEW-Appendix.csv --type csv --headerline

For the 'tab separated values' use: --type tsv $ mongoimport -h localhost:27017 -d ttv4_development -c corpus_leads --file mycorpustsv.csv --type tsv --headerline

For the last version (from Diego) $ mongoimport -h ds047458.mongolab.com:47458 -d ttv4 -c corpus_leads -u twitteruser -p demopass --file 4-corpus_leads.csv --type tsv --headerline

Export data $ mongoexport -h localhost:27017 -d ttv4_development -c filters --out /home/roberto/tmp/filters

h2. Git

$ git status
$ git branch (inform about the branch)
$ git branch feature1 (create the branch)
$ git checkout feature1 (make this branch the operational one)
(you modify the files and commit to the branch
$ git add .
$ git commit -m 'This is your message'
$ git checkout master
$ git merge feature1
$ git branch -d feature1 # delete the branch

Branching model
http://nvie.com/posts/a-successful-git-branching-model/

Discard changes and go back to a commit
$ git reset --hard c56d8a3b164d9315b15af6f99527cbe620a7ad38

Twitter bootstrap pagination https://github.com/markbates/jquery-bootstrap-pagination

Firs implementation of Classifier https://github.com/cardmagic/classifier, add to Gemfile gem "classifier" gem "stemmer" gem "madeleine" $ bundle install

Implementation of Bayes Motel gem "bayes_motel" $ bundle install

Start the collector $ cd twittermometro/script $ ./tweet_collector.rb zara01_mongolab

using Rake

rake RAILS_ENV=production cron

ejecutar rake en Heroku

cd twittermometro heroku run bundle exec rake RAILS_ENV=production twitterv3:tweet_collector mass_media

'ruby/twittermometro' is called http://murmuring-cliffs-8661.herokuapp.com/ on heroku

see https://devcenter.heroku.com/articles/getting-started-with-rails3

to set up environmental variables on Heroku

$ heroku config:set TWITTER_OAUTH_TOKEN=241596263-34CuJsLeexQOZlWMPkwJXjEEU0Ij9Z4ALUN9gRqG $ heroku config

Scaffolding para Filter $ rails g scaffold Filter key:string value:string type:string $ rails g scaffold Anew val-mn-all:double val-sd-all:double aro-mn-all:double aro-sd-all:double dom-mn-all:double dom-sd-all:double val-mn-fem:double val-sd-fem:double aro-mn-fem:double aro-sd-fem:double dom-mn-fem:double dom-sd-fem:double val-mn-mal:double val-sd-mal:double aro-mn-mal:double aro-sd-mal:double dom-mn-mal:double dom-sd-mal:double invoke mongoid create app/models/anew.rb invoke rspec create spec/models/anew_spec.rb invoke factory_girl create spec/factories/anews.rb invoke resource_route route resources :anews invoke scaffold_controller create app/controllers/anews_controller.rb invoke erb create app/views/anews create app/views/anews/index.html.erb create app/views/anews/edit.html.erb create app/views/anews/show.html.erb create app/views/anews/new.html.erb create app/views/anews/_form.html.erb invoke rspec create spec/controllers/anews_controller_spec.rb create spec/routing/anews_routing_spec.rb invoke rspec create spec/requests/anews_spec.rb invoke helper create app/helpers/anews_helper.rb invoke rspec invoke assets invoke coffee create app/assets/javascripts/anews.js.coffee invoke scss create app/assets/stylesheets/anews.css.scss invoke scss identical app/assets/stylesheets/scaffolds.css.scss

$ rails destroy scaffold Anew

$ rails g scaffold CorpusAnew Val-Mn-All:double Val-Sd-All:double Aro-Mn-All:double Aro-Sd-All:double Dom-Mn-All:double Dom-Sd-All:double Val-Mn-Fem:double Val-Sd-Fem:double Aro-Mn-Fem:double Aro-Sd-Fem:double Dom-Mn-Fem:double Dom-Sd-Fem:double Val-Mn-Mal:double Val-Sd-Mal:double Aro-Mn-Mal:double Aro-Sd-Mal:double Dom-Mn-Mal:double Dom-Sd-Mal:double $ rails g scaffold CorpusAnew valmnall:double valsdall:double aromnall:double arosdall:double dommnall:double domsdall:double valmnfem:double valsdfem:double aromnfem:double arosdfem:double dommnfem:double domsdfem:double valmnmal:double valsdmal:double aromnmal:double arosdmal:double dommnmal:double domsdmal:double $ rails g scaffold CorpusAnew valmnall:decimal valsdall:decimal aromnall:decimal arosdall:decimal dommnall:decimal domsdall:decimal valmnfem:decimal valsdfem:decimal aromnfem:decimal arosdfem:decimal dommnfem:decimal domsdfem:decimal valmnmal:decimal valsdmal:decimal aromnmal:decimal arosdmal:decimal dommnmal:decimal domsdmal:decimal $ rails g scaffold CorpusAnew sword:string valmnall:decimal $ rails g scaffold CorpusLead tweet:string leadorno:string

Console with IRB $ rails console

How to execute scripts on the Rails environment

rails r app/workers/runner_twitter_search.rb

The API http://0.0.0.0:3000/api/v1/leads?id=532a2067a5e05ab62700000e