Skip to content

Commit

Permalink
PICA: general changes #163
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed May 24, 2023
1 parent abc2e72 commit 46ec665
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 60 deletions.
7 changes: 1 addition & 6 deletions common-script
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ do_completeness_sqlite() {

untrace
HAS_GROUP_PARAM=$(echo ${TYPE_PARAMS} | grep -c -P -e '--groupBy [^-]' || true)

if [[ "${HAS_GROUP_PARAM}" == "1" ]]; then
bash scripts/sqlite/completeness-grouped.sqlite.sh ${OUTPUT_DIR}
else
bash scripts/sqlite/completeness.sqlite.sh ${OUTPUT_DIR}
fi
bash scripts/sqlite/completeness.sqlite.sh ${OUTPUT_DIR} ${HAS_GROUP_PARAM}
}

do_classifications() {
Expand Down
53 changes: 0 additions & 53 deletions scripts/sqlite/completeness-grouped.sqlite.sh

This file was deleted.

12 changes: 11 additions & 1 deletion scripts/sqlite/completeness.sqlite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ log() {
}

OUTPUT_DIR=$1
HAS_GROUP_PARAM=$2

log "OUTPUT_DIR: ${OUTPUT_DIR}"
log "HAS_GROUP_PARAM: ${HAS_GROUP_PARAM}"

log "create table marc_elements"
sqlite3 ${OUTPUT_DIR}/qa_catalogue.sqlite << EOF
DROP TABLE IF EXISTS "marc_elements";
CREATE TABLE IF NOT EXISTS "marc_elements" (
"groupId" INTEGER,
"documenttype" TEXT,
"path" TEXT,
"packageid" INTEGER,
Expand All @@ -40,7 +46,11 @@ DELETE FROM marc_elements;
EOF

log "create headless CSV"
tail -n +2 ${OUTPUT_DIR}/marc-elements.csv > ${OUTPUT_DIR}/marc-elements-noheader.csv
if [[ "${HAS_GROUP_PARAM}" == "1" ]]; then
tail -n +2 ${OUTPUT_DIR}/completeness-grouped-marc-elements.csv > ${OUTPUT_DIR}/marc-elements-noheader.csv
else
tail -n +2 ${OUTPUT_DIR}/marc-elements.csv | sed 's;^;0,;' > ${OUTPUT_DIR}/marc-elements-noheader.csv
fi

log "import marc elements"
sqlite3 ${OUTPUT_DIR}/qa_catalogue.sqlite << EOF
Expand Down

0 comments on commit 46ec665

Please sign in to comment.