Skip to content

Commit

Permalink
(#4): data/who-icd-crosswalk.tm.hxl.csv draft
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Sep 4, 2022
1 parent f49ad13 commit e0ea6b8
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ jobs:
- run: pip install -r .github/requirements.txt
continue-on-error: true

- run: pip list
continue-on-error: true

# #### Java Setup __________________________________________________________
# # @see https://github.com/marketplace/actions/setup-java-jdk
# - uses: actions/setup-java@v3
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ __pycache__
node_modules
package.json
yarn.lock
temp/
temp/


# https://github.com/EticaAI/lexicographi-sine-finibus is cloned here
# Reasoning: use some scripts related to Wikidata data pull
scripts/lexicographi-sine-finibus
11 changes: 11 additions & 0 deletions data/who-icd-crosswalk.tm.hxl.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#item+conceptum+codicem,#item+rem+i_qcc+is_zxxx+ix_wikiq,#item+rem+i_qcc+is_zxxx+ix_wdatap493,#item+rem+i_qcc+is_zxxx+ix_wdatap494,#item+rem+i_qcc+is_zxxx+ix_wdatap7329,#item+rem+i_qcc+is_zxxx+ix_wdatap7807
5,Q5,,,XE653,301526589
58,Q58,,,XA7QV2,435785772
144,Q144,,,XE33Q,687129994
146,Q146,,,XE4V0,1951749770
152,Q152,,,XE71F,1977658261
198,Q198,,,XE324,364444100
497,Q497,,,XA0D34,1211030054
499,Q499,,,XA17J1,1494375321
553,Q553,,,XA6CZ2,1492238572
728,Q728,,,XE4BU,1656506786
5 changes: 5 additions & 0 deletions i18n/zxx/who-icd.wikidata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# - Using:
# - https://github.com/EticaAI/lexicographi-sine-finibus
# - /workspace/git/EticaAI/lexicographi-sine-finibus/officina

# printf "P7329\n" | ./999999999/0/1603_3_12.py --actionem-sparql --de=P --query --ex-interlinguis --cum-interlinguis=P493,P494,P7329,P7807 | ./999999999/0/1603_3_12.py --actionem-sparql --csv --hxltm > 999999/0/P7329~P493+P494+P7329+P7807.tm.hxl.csv
84 changes: 76 additions & 8 deletions scripts/common.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ BUILDTEMPDIR="${BUILDTEMPDIR:-$__BUILDTEMPDIR}"
#### Configurable variables - - - - - - - - - - - - - - - - - - - - - - - - - -
# from https://apps.who.int/whocc/Search.aspx
WHO_REGIONS=("AFRO" "AMRO" "EMRO" "EURO" "SEARO" "WPRO")
# WHO_CSVFIELDS=(
# "textbox105|code" # SOA-5 [AFRO]
# "textbox106|status" # Active,Pending
# "textbox113|name" # Active,Pending
# "textbox20|region" # Active,Pending
# "textbox19|country" # Active,Pending
# "textbox127|website" # Active,Pending
# )
LSF_REMOTE_GIT="https://github.com/EticaAI/lexicographi-sine-finibus.git"
LSF_LOCAL_CLONED="$ROOTDIR/scripts/lexicographi-sine-finibus"
LSF_OFFICINA="$LSF_LOCAL_CLONED/officina"
#NUMERORDINATIO_BASIM="$LSF_OFFICINA"

#### Fancy colors constants - - - - - - - - - - - - - - - - - - - - - - - - - -
# shellcheck disable=SC2034
Expand Down Expand Up @@ -139,6 +135,78 @@ crawler_who_cc_fech_region() {
printf "\t%40s\n" "${tty_green}${FUNCNAME[0]} FINISHED OKAY ${tty_normal}"
}

#######################################
# Build local copy of crosswalk
#
# Globals:
# ROOTDIR
# BUILDTEMPDIR
# Arguments:
# repo Repository to fetch the data
# savepath (optional) Path to store the metadata
# Returns
# None
#######################################
crawler_wikidata_who_icd() {
# whoccregion="$1"
# output="$2"
printf "\n\t%40s\n" "${tty_blue}${FUNCNAME[0]} STARTED ${tty_normal}"
echo "TODO"

temporarium_hxltm="$BUILDTEMPDIR/P7329~P493+P494+P7329+P7807.tm.hxl.csv"
temporarium_hxltm_data="$ROOTDIR/data/who-icd-crosswalk.tm.hxl.csv"
set -x
# node "$ROOTDIR/scripts/etc/whocc-downloader.js" \
# --who-region "$whoccregion" \
# --output "$output"
printf "P7329\n" |
NUMERORDINATIO_BASIM="${LSF_OFFICINA}" "${LSF_OFFICINA}/999999999/0/1603_3_12.py" \
--actionem-sparql \
--de=P \
--query \
--ex-interlinguis \
--identitas-ex-wikiq \
--cum-interlinguis=P493,P494,P7329,P7807 |
NUMERORDINATIO_BASIM="${LSF_OFFICINA}" "${LSF_OFFICINA}/999999999/0/1603_3_12.py" \
--actionem-sparql \
--identitas-ex-wikiq \
--csv --hxltm \
>"$temporarium_hxltm"

frictionless validate "$temporarium_hxltm"

head -n 11 "$temporarium_hxltm" > "$temporarium_hxltm_data"

set +x
printf "\t%40s\n" "${tty_green}${FUNCNAME[0]} FINISHED OKAY ${tty_normal}"
}

#######################################
# Clone remote LSF git to local path (for additional heavy build process)
#
# Globals:
# ROOTDIR
# LSF_REMOTE_GIT
# LSF_LOCAL_CLONED
# Arguments:
#
# Returns
# None
#######################################
gh_clone_lsf_to_scripts() {
remote_git="$LSF_REMOTE_GIT"
local_dir="$LSF_LOCAL_CLONED"

if [ -f "${local_dir}" ]; then
echo "Already cached [${local_dir}]. Skiping"
return 0
fi

set -x
git clone "$remote_git" "$local_dir"
set +x
}

#######################################
# Fetch repo statistics of one repository
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/manual.sh → scripts/etc/manual.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# FILE: manual.sh
#
# USAGE: ./scripts/manual.sh
# USAGE: ./scripts/etc/manual.sh
#
# DESCRIPTION: Generic non automated commands.
#
Expand Down
12 changes: 12 additions & 0 deletions scripts/via-github-action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,17 @@ if [ "$OPERATION" = "crawler_who_cc" ]; then
crawler_who_cc
fi

# OPERATION=gh_clone_lsf_to_scripts ./scripts/via-github-action.sh
if [ "$OPERATION" = "gh_clone_lsf_to_scripts" ]; then
gh_clone_lsf_to_scripts
exit 0
fi

# OPERATION=crawler_wikidata_who_icd ./scripts/via-github-action.sh
if [ "$OPERATION" = "crawler_wikidata_who_icd" ]; then
crawler_wikidata_who_icd
exit 0
fi

echo "unknow operation [$OPERATION]"
exit 1

0 comments on commit e0ea6b8

Please sign in to comment.