Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding pdq db creation and data ingestion features #100

Merged
merged 12 commits into from
May 12, 2024
Prev Previous commit
Next Next commit
feat: create_and_append_db.sh script to create a db with all datapoin…
…ts uptodate
kopardev committed May 12, 2024
commit 203655878de084b46265a9081344f3c6dfca063e
40 changes: 40 additions & 0 deletions extras/create_and_append_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
# This script:
# 1. creates a sqlite3 database using `spacesavers2_pdq_create_db`
# 2. updates the database for "CCBR" mount related datapoints
# 3. updates the database for "CCBR_Pipeliner" mount related datapoints

module load ccbrpipeliner/6
BIN="/data/CCBR_Pipeliner/Tools/spacesavers2/pdq_db/bin"
DB="/data/CCBR_Pipeliner/userdata/spacesavers2_pdq/pdq.db"

if [[ "1" == "0" ]];then
# Step 1.
${BIN}/spacesavers2_pdq_create_db -f $DB
fi

# Step 2.
for f in `ls /data/CCBR_Pipeliner/userdata/spacesavers2_pdq/_data_CCBR.*.tsv*`
do
bn=$(basename $f)
echo $bn
dt=$(echo $bn|awk -F"." '{print $2}')
dm="CCBR"
${BIN}/spacesavers2_pdq_update_db \
--tsv $f \
--database $DB \
--datamount $dm --date $dt
done

# Step 3.
for f in `ls /data/CCBR_Pipeliner/userdata/spacesavers2_pdq/_data_CCBR_Pipeliner.*.tsv*`
do
bn=$(basename $f)
echo $bn
dt=$(echo $bn|awk -F"." '{print $2}')
dm="CCBR_Pipeliner"
${BIN}/spacesavers2_pdq_update_db \
--tsv $f \
--database $DB \
--datamount $dm --date $dt
done