-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDocumentation.txt
228 lines (162 loc) · 8.38 KB
/
Documentation.txt
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
################################################################
IMPORTANTE!!!! LIBRERIA DE ANUNCIOS DE FACEBOOK!!!!
INVESTIGAR ESTO!
https://www.facebook.com/ads/library/?active_status=all&ad_type=all&country=ALL&view_all_page_id=100288322951708&sort_data[direction]=desc&sort_data[mode]=relevancy_monthly_grouped&search_type=page&media_type=all
################################################################
rails g model Site name:string:uniq url:string:uniq
rails g migration AddFilterToSite filter:string
rails g migration AddNegativeFilterToSite filter:string
rails g migration AddDateFilterToSite date_filter:string
rails g migration AddStatsToSite reaction_count:integer comment_count:integer share_count:integer comment_plugin_count:integer total_count:integer
rails g migration AddContentFilterToSite content_filter:string
rails generate active_admin:resource Site
rails g model Entry url:string:uniq title:string enabled:boolean
rails f migration AddSiteToEntry site_id:integer:index
rails g migration AddDescriptionToEntry description:text content:text
rails g migration AddPublishedToEntry published_at:timestamp
rails g migration AddImageUrlToEntry image_url:text
rails g migration AddStatsToEntry reaction_count:integer comment_count:integer share_count:integer comment_plugin_count:integer total_count:integer
rails g migration AddTwToEntry tw_fav:integer tw_rt:integer tw_total:integer
rails g migration AddPublishedDateToEntry published_date:date:index
rails g migration AddContentToEntry content:text
rails generate migration AddPolarityToEntries polarity:integer delta:integer
rails g migration AddAltsToTag variations:string
rails g migration AddInteractionsToTag fb_total_stats:string
rails g model Topic name:string
rails g model Page uid:string name:string username:string picture:text followers:integer category:string description:text website:string website:string
rails g model Post uid:string:index posted_at:timestamp picture:text shares:integer comments:integer message:text title:text page:references reactions_like:integer reactions_love:integer reactions_wow:integer reactions_haha:integer reactions_sad:integer reactions_angry:integer reactions_thankful:integer total_count:integer post_type:string description:text url:text clean_url:text
rails g model Comment uid:string created_time:datetime message:text entry_id:integer:index
IMPORTANTE HAY QUE PARCHAR EL ANEMONE O NO FUNCIONA
Linea 165 de page.rb
# remove anchor
link = link.to_s.gsub(/#.*$/,'')
if Gem::Requirement.new('< 2.5').satisfied_by?(Gem::Version.new(RUBY_VERSION))
link = URI.encode(URI.decode(link))
end
REGEX DE NOMBRES - alternativas
\b[A-Z][a-zØ-öø-ÿ]*\s[A-Z][a-zØ-öø-ÿ]*\b
EDITOR="code --wait" rails credentials:edit
EDITOR="mcedit" rails credentials:edit
EDITOR="less" rails credentials:edit
RAILS_ENV=production rails c -- --noautocomplete
RAILS_ENV=production rake crawler
RAILS_ENV=production rake update_stats
RAILS_ENV=production rake update_dates_test
RAILS_ENV=production rake facebook:fanpage_crawler
RAILS_ENV=production rake facebook:comment_crawler
RAILS_ENV=production rake facebook:update_fanpages
RAILS_ENV=production rake ai:set_polarity
RAILS_ENV=production rake ai:generate_ai_reports
RAILS_ENV=production rake ai:set_topic_polarity
RAILS_ENV=production rake clean_site_content
nohup rake telegram_bot RAILS_ENV=production &
git reset --hard origin/main
PARA ARGENTINA
RAILS_ENV=production_ar rails db:create
ALTER TABLE entries CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE entries CHANGE title VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
------------------------------------------------------------------------------------------------
resolver problema de encoding:
https://sebhastian.com/mysql-incorrect-string-value/
si ya esta creado hay que dropear el index que causa prolemas i crear uno de nuevo mas corto:
CREATE INDEX prefix_index_on_url ON entries(url(191));
------------------------------------------------------------------------------------------------
EXPORTAR SQLite
sqlite> .headers on
sqlite> .mode csv
sqlite> .output selected_data.csv
sqlite> SELECT book_id,
...> title,
...> authors,
...> year
...> FROM books;
sqlite> .quit
LOAD CONTENIDO MYSQL
load data infile "/home/morfeo/db/sites.csv" into table sites fields terminated by "," enclosed by '"' lines terminated by "\n";
# Login / Users / Topics
rails generate devise User
rails generate devise:views users
rails generate model UserTopic user:references topic:references
rails generate devise:controllers users
# Fusion
rails g migration AddStatusToTopics status:boolean
rails g model TopicStatDaily entry_count:integer total_count:integer average:integer topic_date:date topic:references
# OTRA FORMA DE HACER LOS GRAFICOS DEL FRONT
@interacciones_ultimo_dia_topico = topics.map do |topic|
{
name: topic.name,
data: topic.topic_stat_dailies.where(created_at: 1.day.ago..).joins(:topic).group('topics.name').order(total_count: :desc).sum(:total_count)
}
end
# Nube de palabras reemplazado
@tags_cloud = topics_entries.tag_counts_on(:tags).order(count: :desc)
<% tag_cloud(@tags_cloud, %w(css1 css2 css3 css4)) do |tag, css_class| %>
<span class="<%=css_class%>"><%= tag.name %></span>
<% end %>
# Newspaper
rails g model Newspaper date:date site:references
rails g model NewspaperText title:string description:text newspaper:references
rails generate active_admin:resource Newspaper
bin/importmap pin @stimulus-components/lightbox
rails g migration AddPolaritiesToTopicStatDailies positive_quantity:integer negative_quantity:integer neutral_quantity:integer positive_interaction:integer negative_interaction:integer neutral_interaction:integer
rails g migration AddStatusToSites status:boolean
#-- Notas Repetidas
rails g migration ChangeDefaultValueForEnabled
Entry.update_all(enabled: true)
rails g migration AddRepeatedToEntries repeated:boolean
rails g migration change_data_type_for_repeated
rails g migration AddIsJsToSites is_js:boolean
<div class='outside'
data-controller='entries-chart'
data-entries-chart-id-value='entryQuantitiesChart'
data-entries-chart-url-value='<%= entries_data_topics_path %>'>
<div class='card mt-2'>
<div class='card-body'>
<%= line_chart @entry_quantities, xtitle: "Fecha", ytitle: "Cant. Notas", thousands: ".", curve: false, library: {
plotOptions: {
series: {
dataLabels: {
enabled: true
}
}
} }, adapter: 'highcharts', id: 'entryQuantitiesChart' %>
</div>
</div>
<!-- Modal -->
<div id="entriesModal" class="fixed z-10 inset-0 overflow-y-auto hidden" aria-labelledby="modal-title" role="dialog" aria-modal="true">
<div class="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<!-- Modal panel -->
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div id='entries' data-entries-chart-target='entries'></div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm" data-action="click->entries-chart#closeModal">
Cerrar
</button>
</div>
</div>
</div>
</div>
</div>
SELECT * FROM pages
INTO OUTFILE '/tmp/pages.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
SELECT * FROM sites
INTO OUTFILE '/tmp/sites.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
# Title
rails g model TitleTopicStatDaily entry_quantity:integer entry_interaction:integer average:integer topic_date:date topic:references
rails generate active_admin:resource TitleTopicStatDaily
## REPORTES
rails g model report_detail title:string sumary:text date:date
rails g model Report title:string sumary:text topic:references report_detail:references
rails g migration AddFieldsToReports title:string sumary:text date:date
rails g controller Reports index show