Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Release 2020-05-10 01:14:59 +0900 #212

Merged
merged 75 commits into from
May 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
c2766c5
add auto_merge label
koogawa Apr 8, 2020
c9c6d32
Merge branch 'development' of github.com:koogawa/covid19 into develop…
koogawa Apr 12, 2020
3d6ac30
get diff
koogawa Apr 12, 2020
675244c
Create scraping_data
koogawa Apr 12, 2020
c5d665d
puts uls[i].text
koogawa Apr 12, 2020
001911c
Update driver
koogawa Apr 12, 2020
416db4e
Use match
koogawa Apr 12, 2020
7d9982c
Use multi match
koogawa Apr 12, 2020
a4d311f
Get 年齢
koogawa Apr 12, 2020
8aa87f4
Update regex
koogawa Apr 12, 2020
6e02234
Update regex
koogawa Apr 12, 2020
b2106c5
Update regex
koogawa Apr 12, 2020
18687f5
Update regex
koogawa Apr 12, 2020
b37c8ff
Update regex
koogawa Apr 12, 2020
e4e1644
Update regex
koogawa Apr 12, 2020
bfd5aa2
Update regex
koogawa Apr 12, 2020
aac9c4e
Update regex
koogawa Apr 12, 2020
5abb352
Push datas
koogawa Apr 12, 2020
3ce461b
require 'date'
koogawa Apr 12, 2020
2149f5e
Fix typo
koogawa Apr 12, 2020
df098bb
Open json file
koogawa Apr 12, 2020
5875b3c
data.json を更新
koogawa Apr 12, 2020
26457e7
Define data_hash
koogawa Apr 12, 2020
5088a7a
Write files
koogawa Apr 12, 2020
dd25ab4
Change hash key
koogawa Apr 12, 2020
85acfc5
Use concat instead of push
koogawa Apr 12, 2020
2b411c7
ソースコードを整形
koogawa Apr 12, 2020
07a8adf
Update cron schedule
koogawa Apr 12, 2020
c6ef80c
Merge pull request #23 from koogawa/get-diff
koogawa Apr 12, 2020
19310cb
Merge branch 'development' of github.com:covid19-miyazaki/covid19 int…
koogawa Apr 12, 2020
d08d729
json をレビューしやすいよう整形する
koogawa Apr 12, 2020
b86e27e
Merge branch 'development' of github.com:koogawa/covid19 into develop…
koogawa Apr 12, 2020
468c2fc
Check outputs
koogawa Apr 12, 2020
d857405
お知らせに差分があったかどうか判定する方法を変えた
koogawa Apr 12, 2020
814dba7
インデント数を調整
koogawa Apr 12, 2020
f9d8951
Change cron schedule
koogawa Apr 12, 2020
1156484
Update cron schedule
koogawa Apr 13, 2020
3c7d78c
Update cron schedule
koogawa Apr 13, 2020
04cf344
Merge branch 'development' of github.com:covid19-miyazaki/covid19 int…
koogawa Apr 13, 2020
c0675d5
各種 json を最新の状態に更新
koogawa Apr 13, 2020
bb92d61
不要な文字を修正
koogawa Apr 22, 2020
5036a25
一時的に外したコメントアウトをもとに戻す
koogawa Apr 22, 2020
94c0597
データを最新に
koogawa Apr 28, 2020
9bdd21e
データを最新に
koogawa Apr 28, 2020
167e494
news.json も最新に
koogawa Apr 28, 2020
40582cc
Merge branch 'miyazaki/development' into development
Morichan Apr 28, 2020
0fa54f6
Merge branch 'development' into development
koogawa Apr 28, 2020
bc32985
:bug: fix(ruby): WhiteSpaceの置換設定除去
Morichan Apr 28, 2020
89711c8
退院者の更新
koogawa Apr 29, 2020
3094177
検査陽性者の更新
koogawa Apr 29, 2020
74b4260
Merge pull request #191 from covid19-miyazaki/koogawa-patch-20200430
korosuke613 Apr 30, 2020
2add95c
Merge branch 'development' into development
koogawa Apr 30, 2020
909ccaf
:sparkles: feat(v-data-table): テーブルヘッダーにTI18nコンポーネント適用
Morichan Apr 30, 2020
871eb18
:sparkles: feat(age): 陽性患者の属性テーブルにおける年齢幅上限の追加
Morichan May 1, 2020
957adc3
Merge pull request #178 from koogawa/development
korosuke613 May 1, 2020
9220d32
:bug: fix(v-data-table): 振り仮名表記できなかった居住地カラムの修正
Morichan May 2, 2020
f10b5cc
:sparkles: feat(easy Japanese): やさしい日本語ページの文言変更
Morichan May 2, 2020
cb561ab
:sparkles: feat(english ruby): 英単語におけるルビ振り機能の追加
Morichan May 2, 2020
b47ce27
:cake: chore(yarn.lock): yarn.lockの自動更新
Morichan May 2, 2020
efd9fcd
:sparkles: feat(easy Japanese): 変更漏れの変更
Morichan May 3, 2020
e98fcbf
Merge branch 'development' into ticket-184
korosuke613 May 4, 2020
5c33225
Merge pull request #196 from Morichan/ticket-184
korosuke613 May 4, 2020
3327af0
カンマを除去するようにした
korosuke613 May 4, 2020
1beea2b
Merge branch 'development' into ticket-199
korosuke613 May 4, 2020
1b2ae72
Merge pull request #200 from covid19-miyazaki/ticket-199
korosuke613 May 4, 2020
8aed31d
お知らせ更新のプルリク発行をbotがするように設定
korosuke613 May 4, 2020
d5aa1f5
要請患者数更新のプルリク発行をbotがするように設定
korosuke613 May 4, 2020
e128b55
検査者数のプルリク発行をbotがするように設定
korosuke613 May 4, 2020
a56ed7d
スクレイピングの頻度を6時間おきにした
korosuke613 May 4, 2020
b3894c0
Merge pull request #201 from covid19-miyazaki/ticket-194
korosuke613 May 4, 2020
e121a97
Update scraping.yml
korosuke613 May 5, 2020
f62093e
20200509_検査陽性者の状況を更新
koogawa May 9, 2020
1b39e64
Merge pull request #211 from covid19-miyazaki/update-20200509
korosuke613 May 9, 2020
4aaa3c8
Merge branch 'development' into staging
korosuke613 May 9, 2020
30e3874
Merge branch 'master' into staging
korosuke613 May 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .github/workflows/news_scraping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ jobs:
- /dev/shm:/dev/shm
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.5'
- name: execute
- name: Scraping News
env:
URL: "https://www.pref.miyazaki.lg.jp/kenko/hoken/kansensho/covid19/hassei.html"
SELENIUM_HOST: localhost
Expand All @@ -30,6 +28,7 @@ jobs:
bundle install
ruby scraping.rb
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v2
with:
commit-message: 'Update news.json'
Expand All @@ -39,3 +38,27 @@ jobs:
branch-suffix: timestamp
title: '最新のお知らせ更新'
body: '公式サイトのお知らせが更新されました。差分を確認してマージしてください。'
token: ${{ secrets.BOT_TOKEN }}
# ここから下はお知らせに差分があった場合のみ実行する
- uses: actions/checkout@v2
if: steps.cpr.outputs.pr_number != 0
- name: Scraping Data
env:
URL: "https://www.pref.miyazaki.lg.jp/kenko/hoken/kansensho/covid19/hassei.html"
SELENIUM_HOST: localhost
TZ: Asia/Tokyo
run: |
ruby scraping_data.rb
if: steps.cpr.outputs.pr_number != 0
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
commit-message: 'Update data.json'
branch: data
base: master
# labels: auto_merge
branch-suffix: timestamp
title: '陽性患者数更新'
body: '公式サイトの情報が更新されました。差分を確認してマージしてください。'
token: ${{ secrets.BOT_TOKEN }}
if: steps.cpr.outputs.pr_number != 0
4 changes: 2 additions & 2 deletions .github/workflows/scraping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ env:
TZ: 'Asia/Tokyo'
on:
schedule:
- cron: '0 */12 * * *'
- cron: '0 */6 * * *'
jobs:
scraping:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -49,9 +49,9 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: コロナ情報の更新
commit-message: コロナ情報を更新しました.
branch: auto_update_covid19
labels: auto_merge
base: master
token: ${{ secrets.BOT_TOKEN }}
2 changes: 1 addition & 1 deletion assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"日南市": "Nichinan",
"串間市": "Kushima",
"高千穂町": "Takachiho",
"{age}代": " {age}s",
"{ageHead}歳〜{ageTail}歳": " {ageHead}s",
"10歳未満": "Under 10 years old",
"男性": "Male",
"女性": "Female",
Expand Down
460 changes: 218 additions & 242 deletions assets/locales/ja-Hira.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"埼玉県": "埼玉県",
"湖南省長沙市": "湖南省長沙市",
"湖北省武漢市": "湖北省武漢市",
"{age}代": "{age}代",
"{ageHead}歳〜{ageTail}歳": "{ageHead}代",
"10歳未満": "10歳未満",
"男性": "男性",
"女性": "女性",
Expand Down
15 changes: 15 additions & 0 deletions components/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
:mobile-breakpoint="0"
class="cardTable"
>
<template v-slot:header.公表日="{ header }">
<t-i18n>{{ header.text }}</t-i18n>
</template>
<template v-slot:header.居住地="{ header }">
<t-i18n>{{ header.text }}</t-i18n>
</template>
<template v-slot:header.年代="{ header }">
<t-i18n>{{ header.text }}</t-i18n>
</template>
<template v-slot:header.性別="{ header }">
<t-i18n>{{ header.text }}</t-i18n>
</template>
<template v-slot:header.退院="{ header }">
<t-i18n>{{ header.text }}</t-i18n>
</template>
<template v-slot:body="{ items }">
<tbody>
<tr v-for="item in items" :key="item.text">
Expand Down
5 changes: 3 additions & 2 deletions components/cards/ConfirmedCasesAttributesCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export default {
} else if (row['年代'] === '不明') {
row['年代'] = this.$t('不明')
} else {
const age = row['年代'].substring(0, 2)
row['年代'] = this.$t('{age}代', { age })
const ageHead = row['年代'].substring(0, 2)
const ageTail = String(Number(ageHead) + 9)
row['年代'] = this.$t('{ageHead}歳〜{ageTail}歳', { ageHead, ageTail })
}
}

Expand Down
18 changes: 9 additions & 9 deletions data/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
"居住地": "宮崎市",
"年代": "40代",
"性別": "男性",
"退院": "入院中",
"date": "2020-04-06"
"退院": "退院",
"date": "2020-04-29"
},
{
"リリース日": "2020-04-07T08:00:00.000Z",
Expand All @@ -104,8 +104,8 @@
"居住地": "日南市",
"年代": "30代",
"性別": "女性",
"退院": "入院中",
"date": "2020-04-08"
"退院": "退院",
"date": "2020-04-29"
},
{
"リリース日": "2020-04-08T08:00:00.000Z",
Expand Down Expand Up @@ -136,8 +136,8 @@
"居住地": "宮崎市",
"年代": "50代",
"性別": "女性",
"退院": "入院中",
"date": "2020-04-11"
"退院": "退院",
"date": "2020-05-09"
}
]
},
Expand All @@ -151,11 +151,11 @@
"children": [
{
"attr": "入院中",
"value": 8,
"value": 5,
"children": [
{
"attr": "軽症・中等症",
"value": 8
"value": 5
},
{
"attr": "重症",
Expand All @@ -165,7 +165,7 @@
},
{
"attr": "退院",
"value": 9
"value": 12
},
{
"attr": "死亡",
Expand Down
2 changes: 1 addition & 1 deletion data/news.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
"text": "新型コロナウイルス感染症患者(2例目、3例目)の発生について(続報)"
}
]
}
}
7 changes: 4 additions & 3 deletions scraping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
puts news

# JSON出力
File.open("data/news.json", 'w') do |file|
str = JSON.dump(news, file)
end
news_json = JSON.pretty_generate(news, {:indent => " "})
File.open("data/news.json", mode = "w") { |f|
f.write(news_json)
}

exit

2 changes: 1 addition & 1 deletion scrapingSource/Scraping.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def set_parse_table_data_to_json(self):
"""
self.json["lastUpdate"] = self.get_time()
self.json["patients"]["date"] = self.get_time()
self.json["main_summary"]["value"] = int(self.covid_data[0])
self.json["main_summary"]["value"] = int(self.covid_data[0].replace(',', ''))
self.json["main_summary"]["children"][0]["value"] = int(self.covid_data[1])
json.dump(self.json, open(self.json_path, 'w'), indent=4, ensure_ascii=False)

Expand Down
67 changes: 67 additions & 0 deletions scraping_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
require 'selenium-webdriver'
require 'date'

today = Date.today.strftime("%Y/%m/%d")
driver = Selenium::WebDriver.for :remote, desired_capabilities: :chrome, url: "http://#{ENV['SELENIUM_HOST']}:4444/wd/hub"

# 最新ニュースのURL取得
driver.navigate.to(ENV['URL'])
list_table = driver.find_element(:class => "list_table")
urls = list_table.find_elements(:tag_name => "a")
url = urls[0].attribute("href")

# 最新ニュースをスクレイピング
driver.navigate.to(url)
uls = driver.find_elements(:class => "noicon")
count = uls.length - 1
datas = []
for i in 0..count do
data = { "リリース日" => today, "退院" => "入院中", "date" => today }
ul = uls[i]

address = ul.text.match(/居住地(.+)/)
if address
data["居住地"] = address[1]
else
next
end

age = ul.text.match(/年齢(.+)/)
if age
data["年代"] = age[1]
else
next
end

gender = ul.text.match(/性別(.+)/)
if gender
data["性別"] = gender[1]
else
next
end

datas.push(data)
end

data_count = datas.length

data_hash = {}
File.open("data/data.json") do |file|
data_hash = JSON.load(file)
end

# data.json を更新
data_hash["lastUpdate"] = today
data_hash["patients"]["date"] = today
data_hash["patients"]["data"].concat(datas)
data_hash["main_summary"]["children"][0]["value"] = data_hash["main_summary"]["children"][0]["value"] + data_count
data_hash["main_summary"]["children"][0]["children"][0]["value"] = data_hash["main_summary"]["children"][0]["children"][0]["value"] + data_count
data_hash["main_summary"]["children"][0]["children"][0]["children"][0]["value"] = data_hash["main_summary"]["children"][0]["children"][0]["children"][0]["value"] + data_count
data_hash["patients_summary"]["data"].push({ "日付" => today, "小計" => data_count })

data_json = JSON.pretty_generate(data_hash, {:indent => " "})
File.open("data/data.json", mode = "w") { |f|
f.write(data_json)
}

exit
2 changes: 1 addition & 1 deletion utils/ruby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const createRubyObject = (text: string) => {
let lastText: string
let pos = 0
const texts: RubyText[] = []
const regp = /([\p{sc=Han}|\s|・]+?)(([\p{sc=Hiragana}|\s|・]+?))/gu
const regp = /([\p{sc=Han}|・|A-z]+?)(([\p{sc=Hiragana}|\p{sc=Katakana}|ー|・]+?))/gu

// ふりがなを含んだ文字列をパースしてオブジェクトを生成
while ((match = XRegExp.exec(text, regp, pos))) {
Expand Down
Loading