Coder Social home page Coder Social logo

arakawatomonori / covid19-surveyor Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 18.0 14.8 MB

主要省庁と都道府県や自治体の経済支援制度をまとめる

Home Page: https://help.stopcovid19.jp/

License: Do What The F*ck You Want To Public License

Shell 68.83% Dockerfile 1.46% Makefile 3.65% HTML 1.56% Vue 10.54% JavaScript 1.22% Python 10.30% Jupyter Notebook 2.45%

covid19-surveyor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

covid19-surveyor's Issues

リリース時にCloudFrontのキャッシュを削除する

とりあえず CloudFront の Invalidate 権限を持つ IAM ユーザーを作りました。
今は deploy には CircleCI を使っているんですかね。
どのように deploy されているのかよくわからないのですが、どうするのが良いでしょうか。
aws CLI を CircleCI の VM から実行できれば、シェルスクリプト作って Makefile から実行すれば良さそうですが。

該当するキーワードが検索対象ファイルに存在しない場合 `grep.sh` が失敗する

make test で動作確認をしていたのですが、

$ make test
~~(wget の出力)~~
終了しました --2020-04-15 21:39:45--
経過時間: 19m 55s
ダウンロード完了: 8924 ファイル、3.2G バイトを 7m 45s で取得 (7.15 MB/s)
Makefile:36: recipe for target 'test' failed
make: *** [test] Error 123

と、途中でジョブが落ちました。

grep.sh が落ちているようで、grepは検索がマッチしなかった場合、終了コード1を返すので、スクリプトの失敗となりジョブが途中で落ちるようです。

以下は set -ex 付きの出力

$ make grep 
./crawler/grep.sh
++ cat
+ words='助成
補助
給付
収入
減額
支援
資金
税金
税制
納税
県税
融資
貸付
制度
相談
窓口
猶予
延長
学校
授業
労働
特例
措置
雇用
事業
休業
リモートワーク
テレワーク'
+ rm -f www-data/index.html
+ sed '/^.\{1,200\}$/!d'
+ sed 's/ //g'
+ grep -r コロナ '--include=*.html' ./www-data
+ sed s/ //g
+ sed 's/[ \t]*//g'
+ sed -e 's/<[^>]*>//g'
+ for word in ${words}
+ echo 助成
助成
+ grep 助成 ./tmp/grep_コロナ.txt.tmp
+ for word in ${words}
+ echo 補助
補助
+ grep 補助 ./tmp/grep_コロナ.txt.tmp
+ for word in ${words}
+ echo 給付
給付
+ grep 給付 ./tmp/grep_コロナ.txt.tmp
+ for word in ${words}
+ echo 収入
収入
+ grep 収入 ./tmp/grep_コロナ.txt.tmp
+ for word in ${words}
+ echo 減額
減額
+ grep 減額 ./tmp/grep_コロナ.txt.tmp
Makefile:45: recipe for target 'grep' failed
make: *** [grep] Error 1

xargs の並列数が不正

0 になってる。

$ ./wget.sh
xargs: max. processes must be >0
./wget.sh: line 10: ./grep.sh: No such file or directory
./index.sh: line 48: -1: substring expression < 0

実行時のみに実行されるべきコードがsourceの際に実行されないようにする

Python でいう if __name__ == '__main__' のような構文をを加えたい。

  • テストを実行する際に、テストする関数を読み込むために現在 . ./crawler/wget.sh などで読み込んでいる
    • この読み込みは関数以外も読み込んでしまう(実行がされる)
  • テストしたい関数以外も実行され、環境変数などが整備されないまま実行されてしまいエラーになる
    • 具体的には、現在の slack-bot/url-map.sh の下記のコードがテスト時にも実行されている
channels_id=`get_channels_id`
members_list=`get_members_list $channels_id`

echo members num ${#members_list[@]}

for member in $members_list; do
	member_id=${member:1:-1}
	send_message $member_id
done

これを

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
    # ... 実行コマンド
fi

などとすればスクリプトとして実行されたときのみ実行され、source されたときには実行されない。はず。(未確認)

参考: https://stackoverflow.com/questions/29966449/what-is-the-bash-equivalent-to-pythons-if-name-main

make wget 等でディスク容量を使いすぎる問題に対応

Slack #covid19-surveyor-dev

chrome 1:13 PM, 2020-04-18
make wget、50GBくらい容量食うと聞いてましたが、150GB以上空いてたSSDがいっぱいになって止まっちゃいましたね…
内容見ると謎の画像キャッシュみたいなので数GB食ってたりするので
wget で画像をダウンロードしないとか、拡張子を制限すれば少し減りますかね

ライセンスの指定

全く急ぎではないですが、現在ライセンスの指定がないので何か決めたほうが良いと思います。

urls.txtを人力MapReduceできるようにする

やりたいこと

  • urls.txtの各URLをKeyとしてRedisにつっこむ
  • SlackのbotがDMでランダムに未回答のURLを取り出してランダムな人に「これは都道府県/市区町村独自の個人向けの経済支援制度ですか?」とYes/Noで答えられる質問をする
  • 解答されたら結果をRedisに保存し、ランダムに次の未回答のURLを取り出してまたその人に質問する

arakawatomonori/covid19-surveyor の 権限をもらう

  • Fork だと動作確認がしにくいということで invite してもらった
  • 新規参加者はまず最初のいくつかは Fork して PR 出すでよさそう
  • Invitation を Accpet しないと権限つかない

before

🧸 sarabi-mastiff.lan:covid19-surveyor
$ git push
remote: Permission to arakawatomonori/covid19-surveyor.git denied to tamakiii.
fatal: unable to access 'https://github.com/arakawatomonori/covid19-surveyor.git/': The requested URL returned error: 403

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.