-
-
Notifications
You must be signed in to change notification settings - Fork 107
各種イベント管理サービスのAPIで統計情報を集計したい #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
TIPS: ナラさんが2015年頃、似たようなイベント情報収集機能をRailsで実装していた 😮 Push notification of events - GitHub |
ナラさんが当時、実装していて気づいたこと:
|
memo: connpassのAPI ref: https://connpass.com/about/api/ CoderDojo浜松の例
results_availableは12で過去分を含めた全てのイベントは12件存在している ただし、series_idを引っ張ってくるためには一度apiを叩く必要があり、なにかしらのkey, valueが必要。
CoderDojo浜松のデータを取るためのキーワードがなさそうなので、 ちなみに、下北沢の場合は以下のようなデータで、
dojosテーブルのurlがconnpassのサブドメインなのだが、 |
memo: doorkeeperのapi ref: https://www.doorkeeperhq.com/developer/api connpassと同様にgroupというキーが使えそう。 |
現状、 |
これなんですが、
という理由からイベントリストを束ねるseries_id(doorkeeperではgroup)を引くという観点からはあまり有効なcolumnになれなさそうなんですよね。 |
なるほど、手運用でも良さそうですね! その場合は yaml ではなく Dojo モデルに更新をかけるような形が良いかなと思いました! (yaml は各道場運営者に編集してもらうためのファイルで、なるべく簡潔で分かりやすい状態の方がよいので💦) |
なるほど、貴重な情報ありがとうございます😁
そうですね、coderdojo管理者がなんか良しなにやる方法にします。 |
ご参考になったようで何よりです! 😸 何か気になる箇所などあれば、お気軽にご連絡くださ〜い ;) |
Implementation to aggregate statistical information #12
@nalabjp PRありがとうございました! 😸 先ほどPRをマージしましたが、こちらの Issue については、トップページ ( https://coderdojo.jp/ ) に
といった文言を追加するところまでやろうかなと考えています 🤔 (インパクトの高い統計情報だと思うので、ぜひ載せたい) なので上記の文言をトップページに表示できるようになったら、本 Issue を完了という形にさせていただけると嬉しいです! 🙏 |
#164 をマージしたあとのTODO
|
.oO(イベント統計情報、どう呼び出すのが正しいんだろう...? 聞くの忘れていました ><) |
むむ、、、冪等ではないのかな...?
```
rails aborted!
ActiveModel::RangeError: 542546935853207 is out of range for ActiveModel::Type::Integer with limit 4 bytes
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.4/lib/active_model/type/integer.rb:51:in `ensure_in_range'
/app/vendor/bundle/ruby/2.4.0/gems/activemodel-5.1.4/lib/active_model/type/integer.rb:27:in `serialize'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/attribute.rb:51:in `value_for_database'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/relation/query_attribute.rb:11:in `value_for_database'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/quoting.rb:166:in `block in type_casted_binds'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/quoting.rb:166:in `map'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/quoting.rb:166:in `type_casted_binds'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:611:in `exec_no_cache'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:601:in `execute_and_clear'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:79:in `exec_query'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:102:in `exec_insert'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:113:in `exec_insert'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:133:in `insert'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/query_cache.rb:17:in `insert'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/relation.rb:61:in `insert'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:589:in `_create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/counter_cache.rb:178:in `_create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/locking/optimistic.rb:76:in `_create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:296:in `_create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:340:in `block in _create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:131:in `run_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:827:in `_run_create_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:340:in `_create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/timestamp.rb:95:in `_create_record'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:563:in `create_or_update'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:336:in `block in create_or_update'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:131:in `run_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/callbacks.rb:336:in `create_or_update'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/persistence.rb:162:in `save!'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/validations.rb:50:in `save!'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/attribute_methods/dirty.rb:43:in `save!'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:313:in `block in save!'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:313:in `save!'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.4/lib/active_record/suppressor.rb:46:in `save!'
/app/lib/tasks/dojo_event_services.rake:31:in `block (3 levels) in '
/app/lib/tasks/dojo_event_services.rake:9:in `each'
/app/lib/tasks/dojo_event_services.rake:9:in `block (2 levels) in '
/app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke'
/app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `'
/app/bin/rails:4:in `require'
/app/bin/rails:4:in `'
Tasks: TOP => dojo_event_services:upsert
```
|
|
integer to stringに変更したmigrationが実行されてなさそうな気がします! |
@nalabjp おぉ、失念してました 💦 コメントありがとうございます! 😸 |
herokuへのdeploy時ってmigration走らないんでしたっけ?🤔 |
あれ、でも
```
▸ heroku-cli: update available from 6.13.13 to 6.14.36-15f8a25
Running rails db:migrate on ⬢ coderdojo-japan... up, run.3368 (Hobby)
D, [2017-11-03T15:17:37.436091 #4] DEBUG -- : (1.0ms) SELECT pg_try_advisory_lock(2721298366456587855)
D, [2017-11-03T15:17:37.449559 #4] DEBUG -- : (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
I, [2017-11-03T15:17:37.450654 #4] INFO -- : Migrating to ChangeColumnTypeDojoEventServices (20170820090605)
D, [2017-11-03T15:17:37.453089 #4] DEBUG -- : (1.0ms) BEGIN
== 20170820090605 ChangeColumnTypeDojoEventServices: migrating ================
-- change_column(:dojo_event_services, :name, :integer, {:null=>false})
D, [2017-11-03T15:17:37.455033 #4] DEBUG -- : (1.6ms) ALTER TABLE "dojo_event_services" ALTER COLUMN "name" TYPE integer
D, [2017-11-03T15:17:37.456232 #4] DEBUG -- : (1.0ms) ROLLBACK
D, [2017-11-03T15:17:37.457506 #4] DEBUG -- : (1.1ms) SELECT pg_advisory_unlock(2721298366456587855)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DatatypeMismatch: ERROR: column "name" cannot be cast automatically to type integer Caused by: Caused by: Tasks: TOP => db:migrate (See full trace by running task with --trace)
|
@nalabjp 最近全くマイグレーションやって気にしてなかったので、確かに走らせてない可能性がありますね 😅 |
むむっ、postgresさん、カラムのタイプ変更がちょっと一手間必要そう? |
なるほど🤔 事前に気づけてよかったです! 😸 もし運用開始が間に合わなくても、スクリプトで取得した統計データさえ教えてもらえればとりあえず数字を表示することはできるので、最悪それで見せてしまうこともできそうです ;) 👍 ✨ (ポイントは運用が始まることではなく、スクリプトで取得した統計データ情報なので、それを見せられればとりあえずは問題なさそう 📈✨) |
https://stackoverflow.com/a/36899371 rails wayだとこんな感じだと書かれてますね。 |
CoderDojo 柏周辺は自前のイベント管理サービスを使っていて、その合計をさっき直接伺ったのでこちらにメモしておきますね ;)
=> 129回 |
柏はfacebookイベントから計測済みでした〜 |
- Stats of 69/109 dojos using Facebook/Doorkeeper/connpass (1,466) - Manually add the number of 柏の葉, 南柏, 柏湘南, and 小平 - This stats will be dynamically updated in the near future
やりたいこと
数字の根拠を明確にし、かつ、その集計方法が誰でも検証可能である状況にしたい 📈 👀
数字の使用例
子ども向けプログラミング道場を推進する一般社団法人 CoderDojo Japanを さくらインターネットが支援、「さくらのクラウド」を無料提供
https://www.sakura.ad.jp/press/2017/0720_cloud-coderjapan/
少なくとも2,000~3,000回ぐらいは達成していそうだったが、今回は主要な道場のみを指先確認して1,000以上あることを確認した。しかし、より正確な根拠があれば、もっと正確な数字が伝えられる。CoderDojo の参加者数についても同様で、計測方法が確立すれば、より正確な数字が伝えられる。
cf. 日本の CoderDojo (zen登録済) - Google Spreadsheet
https://docs.google.com/spreadsheets/d/17-M-qv5c0MdE_ZIFk566I2CGCIDHFkQwXWiunDXCGVw/edit#gid=354377216
欲しい情報
対応する必要のあるイベント管理サービス
Peatix(今は考えない) ※ 利用例@会津Facebook Event API(今は考えない)CoderDojo Zen(今は考えない)あとでやる (今はやらない)
The text was updated successfully, but these errors were encountered: