Skip to content

Commit

Permalink
Merge branch 'main' into dutch_translations
Browse files Browse the repository at this point in the history
  • Loading branch information
matentzn committed Jan 10, 2025
2 parents 926f29e + 3ba10e3 commit 611fd91
Showing 24 changed files with 80,861 additions and 60,063 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/qc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Basic ODK workflow

name: QC

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
qc:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5.4

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Install dependencies
run: make install
- name: Run ontology QC checks
env:
DEFAULT_BRANCH: main
run: make qc

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@
all_translations.zip
crowdin_data/
/site
tmp/
43 changes: 37 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
##### Process translations
BABELON_FILES := $(wildcard babelon/hp-*.babelon.tsv)

install:
pip install -U babelon
# Extract the variable part (e.g., pt)
TRANSLATIONS := $(patsubst babelon/hp-%.babelon.tsv, %, $(BABELON_FILES))

list-translations:
@echo $(TRANSLATIONS)

##### Process translations

sort-%: babelon/hp-%.babelon.tsv babelon/hp-%.synonyms.tsv
mkdir -p tmp
{ head -n 1 babelon/hp-$*.synonyms.tsv && tail -n +2 babelon/hp-$*.synonyms.tsv | sort; } > tmp/$*_synonyms_sorted.tsv
{ head -n 2 babelon/hp-$*.synonyms.tsv && tail -n +3 babelon/hp-$*.synonyms.tsv | sort; } > tmp/$*_synonyms_sorted.tsv
{ head -n 1 babelon/hp-$*.babelon.tsv && tail -n +2 babelon/hp-$*.babelon.tsv | sort; } > tmp/$*_babelon_sorted.tsv
mv tmp/$*_babelon_sorted.tsv babelon/hp-$*.babelon.tsv
mv tmp/$*_synonyms_sorted.tsv babelon/hp-$*.synonyms.tsv
@@ -22,8 +26,32 @@ sort-all:
$(MAKE) sort-pt sort-de sort-fr sort-pt sort-zh

validate-%: babelon/hp-%.babelon.tsv babelon/hp-%.synonyms.tsv
tsvalid babelon/hp-$*.babelon.tsv --skip "W1"
tsvalid babelon/hp-$*.synonyms.tsv --skip "W1"
@output=$$(tsvalid babelon/hp-$*.synonyms.tsv --skip "W1"); \
if echo "$$output" | grep -Eq 'E[0-9]+:[ ]'; then \
echo "Error detected in hp-$*.synonyms.tsv: $$output"; \
exit 1; \
fi
@output=$$(tsvalid babelon/hp-$*.babelon.tsv --skip "W1"); \
if echo "$$output" | grep -Eq 'E[0-9]+:[ ]'; then \
echo "Error detected in hp-$*.babelon.tsv: $$output"; \
exit 1; \
fi
babelon convert babelon/hp-$*.babelon.tsv --output-format owl -o tmp/$*-babelon.owl
robot template --template babelon/hp-$*.synonyms.tsv --output tmp/$*-synonyms.owl

validate-all:
$(MAKE) $(foreach lang, $(TRANSLATIONS), validate-$(lang))

qc: validate-all
@echo "All translations are valid"

update: babelon/hp-ja.babelon.tsv
$(MAKE) sort-all
$(MAKE) clean-all
$(MAKE) validate-all

install:
pip install -U babelon==0.3.4 --break-system-packages

###
prepare_data:
@@ -34,6 +62,9 @@ babelon/hp-%.babelon.tsv:
mkdir -p babelon/
babelon parse crowdin_data/$*/hpo_notes.xliff -o $@

babelon/hp-ja.babelon.tsv:
wget "https://raw.githubusercontent.com/ogishima/HPO-Japanese/master/HPO-japanese.alpha.21Jul2023.tsv" -O $@

LANGUAGES=cs nl tr
HP_TRANSLATIONS=$(patsubst %, babelon/hp-%.babelon.tsv, $(LANGUAGES))

2 changes: 1 addition & 1 deletion babelon/hp-ar.synonyms.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
subject_id translation_value comment
ID AL oboInOwl:hasExactSynonym@ar
ID AL oboInOwl:hasExactSynonym@ar
Loading

0 comments on commit 611fd91

Please sign in to comment.