Skip to content

Data Update

Data Update #1009

Workflow file for this run

name: Data Update
on: workflow_dispatch
jobs:
patients_data:
name: Patients Data
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=patients_data -L -o patients.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py patients'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/patients.json
test_people:
name: Tested people
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=tested_people -L -o test_people.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json_test_people.py'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/test_people.json
mutant_test_people:
name: Mutant Tested people
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=mutant_tested_people -L -o mutant_test_people.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py mutant_test_people'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/mutant_test_people.json
call_center:
name: Call Center
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=call_center -L -o call_center.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py call_center'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/call_center.json
positive_number:
name: Positive Number
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=positive_number -L -o positive_number.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py positive_number'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/positive_number.json
mutant_positive:
name: Mutant virus Positive Number
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=mutant_positive_number -L -o mutant_positive.json'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/mutant_positive.json
recovered_number:
name: Recovered Number
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=recovered_number -L -o recovered_number.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py recovered_number'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/recovered_number.json
death_number:
name: Death Number
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=death_number -L -o death_number.csv'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py death_number'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/death_number.json
inspections_summary:
name: Inspections Summary
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=inspections_summary -L -o inspections_summary.json'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/inspections_summary.json
main_summary:
name: Main Summary
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=main_summary -L -o main_summary.json'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/main_summary.json
corona_next:
name: Corona Next
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=corona_next -L -o corona_next.json'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/corona_next.json
news_json:
name: news.json
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=news_json -L -o news.json'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/news.json
last_update:
name: Last Update Time
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: 'curl ${DATA_UPDATE_URL}?data=last_update -L -o last_update.json'
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/last_update.json
otherpref:
name: Otherpref
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: curl ${DATA_UPDATE_URL}?data=forked_sites -L -o otherpref.csv
working-directory: dist/data
env:
DATA_UPDATE_URL: ${{ secrets.DATA_UPDATE_URL }}
- name: Convert to JSON
run: 'python ../../generate_datajson/csv2json.py otherpref'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/otherpref.json
vaccine_data:
name: Vaccine Data
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Download File
run: curl --compressed https://data.vrs.digital.go.jp/vaccination/opendata/latest/prefecture.ndjson -L -o vaccine_data.ndjson
working-directory: dist/data
- name: Convert to Ibaraki Pref only JSON
run: 'python ../../generate_datajson/vaccine_data.py'
working-directory: dist/data
- name: Save
uses: actions/upload-artifact@v3
with:
name: opendata_artifact
path: dist/data/vaccine_data.json
push_dev:
name: Generate data.json
runs-on: ubuntu-22.04
needs:
[
patients_data,
test_people,
mutant_test_people,
call_center,
positive_number,
mutant_positive,
recovered_number,
death_number,
inspections_summary,
main_summary,
corona_next,
news_json,
last_update,
otherpref,
vaccine_data,
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: generate_datajson
- name: Restore
uses: actions/download-artifact@v3
with:
path: dist/data
- name: Move restored files
run: 'mv ./dist/data/opendata_artifact/*.* ./dist/data/'
- name: Generate data.json
run: 'python ../../generate_datajson/main.py'
working-directory: dist/data
- name: Move data.json, news.json, otherpref.json
run: |
mv data/*.json ../../data/ -f
working-directory: dist/data
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update Data" -a
- name: Temporary disable branch protection
uses: Hatzelencio/[email protected]
with:
path: .github/config/branch_unlock_dev.yml
env:
GITHUB_TOKEN: ${{secrets.GHAC_TOKEN}}
- name: Push to development
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: development
- name: Enable branch protection
uses: Hatzelencio/[email protected]
with:
path: .github/config/branch_protect_dev.yml
env:
GITHUB_TOKEN: ${{secrets.GHAC_TOKEN}}
- name: Run Deploy & i18n_generator
run: |
echo "::group::Development Deploy"
curl https://api.github.com/repos/a01sa01to/covid19-ibaraki/actions/workflows/39093765/dispatches -X POST -H "Accept: application.vnd.github.v3+json" -H "Authorization: token ${WORKFLOW_DISPATCH_TOKEN}" -d '{"ref":"development"}'
echo "::endgroup::"
echo "::group::i18n generator"
curl https://api.github.com/repos/a01sa01to/covid19-ibaraki/actions/workflows/10549046/dispatches -X POST -H "Accept: application.vnd.github.v3+json" -H "Authorization: token ${WORKFLOW_DISPATCH_TOKEN}" -d '{"ref":"development"}'
echo "::endgroup::"
env:
WORKFLOW_DISPATCH_TOKEN: ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}
push_production:
name: Push to production branch
runs-on: ubuntu-22.04
needs: push_dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: development
fetch-depth: 0
- uses: actions/checkout@v4
with:
ref: production
fetch-depth: 0
- name: Merge
run: git merge origin/development --ff
- name: Temporary disable branch protection
uses: Hatzelencio/[email protected]
with:
path: .github/config/branch_unlock_prod.yml
env:
GITHUB_TOKEN: ${{secrets.GHAC_TOKEN}}
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: production
- name: Enable branch protection
uses: Hatzelencio/[email protected]
with:
path: .github/config/branch_protect_prod.yml
env:
GITHUB_TOKEN: ${{secrets.GHAC_TOKEN}}
- name: Run Deploy
run: |
curl https://api.github.com/repos/a01sa01to/covid19-ibaraki/actions/workflows/39093766/dispatches -X POST -H "Accept: application.vnd.github.v3+json" -H "Authorization: token ${WORKFLOW_DISPATCH_TOKEN}" -d '{"ref":"production"}'
env:
WORKFLOW_DISPATCH_TOKEN: ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}