Skip to content

Commit 668041a

Browse files
committed
add clean-tsv workflow
1 parent 627bfd3 commit 668041a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/clean-tsv.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tab correcting and sorting on manually maintained tsv files
2+
3+
on:
4+
push:
5+
branches:
6+
- clean-metadata
7+
tags-ignore:
8+
- '**'
9+
paths:
10+
- source-data/location_hierarchy.tsv
11+
- source-data/gisaid_annotations.tsv
12+
13+
jobs:
14+
clean-metadata:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.x'
22+
- name: Install dependencies
23+
run: |
24+
PATH="$HOME/.local/bin:$PATH"
25+
python3 -m pip install --upgrade pip setuptools
26+
python3 -m pip install pipenv
27+
- name: clean location hierarchies
28+
run: |
29+
pipenv sync
30+
pipenv run ./bin/clean-tsv-metadata --metadata source-data/location_hierarchy.tsv --header
31+
- name: clean annotations
32+
run: |
33+
pipenv sync
34+
grep -v "paper\|title" source-data/gisaid_annotations.tsv > nonpaper_annotations.tsv
35+
pipenv run ./bin/clean-tsv-metadata --metadata nonpaper_annotations.tsv --n-cols 4
36+
grep "paper\|title" source-data/gisaid_annotations.tsv > paper_annotations.tsv
37+
pipenv run ./bin/clean-tsv-metadata --metadata paper_annotations.tsv --n-cols 4 --sort-col 1
38+
cat nonpaper_annotations.tsv > source-data/gisaid_annotations.tsv
39+
cat paper_annotations.tsv >> source-data/gisaid_annotations.tsv
40+
- name: commit cleaned tsvs
41+
run: |
42+
git config --global user.name "${{ github.actor }}"
43+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
44+
git diff --quiet || git commit -am "Automated commit: clean manually maintained tsvs"
45+
git push

0 commit comments

Comments
 (0)