Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/argosDataDumper_v1.0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import getpass
import json
import os
import requests

basename = "https://hive3.biochemistry.gwu.edu/"

def apiLogin():
global cookies

user = input("\nEnter your username on HIVE3 (email address): ")
password = getpass.getpass()
loginParams = {'api': '0', 'cmdr': 'login', 'login': user, 'pswd': password}
response = requests.get(basename, params=loginParams)
if response.text != '':
print(response.text)
apiLogin() # Try again
else:
cookies = response.cookies

apiLogin()




24 changes: 24 additions & 0 deletions lib/argosPuller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

if [ "$#" -eq 0 ]
then
echo "No arguments supplied"
exit 1
fi

for FILE in /software/argosdb/dataset-maker/recipes/*.json;
do
query=$(printf "%s\n" "${FILE##*/}" | sed -r 's/(.*[0-9]{6})_.*/\1/' | tr '[:lower:]' '[:upper:]' $sample);
echo $query;
if [[ ! -e ~/api/data/$query.json ]]; then
touch ~/api/data/"$query".json;
fi;
curl -X 'POST' \
'https://api.argosdb.org/dataset/detail' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"bcoid": "'"$query"'",
"dataversion": "'"$1"'"
}' > ~/api/data/"$query".json;
done
15 changes: 15 additions & 0 deletions lib/numberOfSanityErrors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Redirect the output of Robel's dataset-maker/check-dataset-sanity.py to a file and run this script on it to get a count of how many errors there are by table.

import json

with open ("dataset-sanity-log-10.24.2024", "r") as inFile:
myObj = json.load(inFile)

myList = []

for key in myObj:
values = myObj[key]
for value in values:
myList.append(value)
print (key + ", Number of errors: " + str(len(myList)))

3 changes: 3 additions & 0 deletions lib/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"my_first_key" : "my_first_value"
}
39 changes: 39 additions & 0 deletions lib/shell/argosPuller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

if [ "$#" -eq 0 ]
then
echo "No version supplied; usage: ./argosPuller.sh <version>"
exit 1
fi

for FILE in /software/argosdb/dataset-maker/recipes/*.json;
do
query=$(printf "%s\n" "${FILE##*/}" | sed -r 's/(.*[0-9]{6})_.*/\1/' | tr '[:lower:]' '[:upper:]' $sample);
echo $query;
if [[ ! -e ~/api/data/$query.json ]]; then
touch ~/api/data/"$query".json;
fi;
curl -X 'POST' \
'https://api.argosdb.org/dataset/detail' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"bcoid": "'"$query"'",
"dataversion": "'"$1"'"
}' > ~/api/data/"$query".json;
done

echo "Finished downlaoding data from ARGOS API. Attempting to push data sets to HIVE 3..."
read -p "Enter your login for HIVE 3: " user
read -sp "Enter your password" pass
#This needs a check to make sure it logged in properly and retry input if not.
curl -k -c ~/hive3.cookie "https://hive3.biochemistry.gwu.edu/dna.cgi?cmdr=login&login=${user}&pswd=${pass}"

for DATASET in ~/api/data/*.json;
do
curl -v -b ~/hive3.cookie -X POST -F "content=@${DATASET}" -F 'cmd=objSetFile' -F 'raw=1' -F 'bin=0' -F 'type=u-file' -F 'filename=_.json' -F 'name=ArgosDataSetFile' -F 'ext=json' 'https://hive3.biochemistry.gwu.edu/dna.cgi';
done




20 changes: 20 additions & 0 deletions lib/shell/hive3pushTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

echo "Finished downlaoding data from ARGOS API. Attempting to push data sets to HIVE 3...\n"
read -p "Enter your login for HIVE 3: " user
read -p "Enter your password" pass
curl -k -c ~/hive3.cookie "https://hive3.biochemistry.gwu.edu/dna.cgi?cmdr=login&login=${user}&pswd=${pass}"

# Log into HIVE 3:
# curl -k -c ~/hive3.cookie 'https://hive3.biochemistry.gwu.edu/dna.cgi?cmdr=login&login=argos@argos.org&pswd=qQ123123'
# Remember to get input from user for login/pass!!!

for DATASET in ~/scripts/*.json;
#for DATASET in ~/api/data/*.json;
do
curl -v -b ~/hive3.cookie -X POST -F "content=@${DATASET}" -F 'cmd=objSetFile' -F 'raw=1' -F 'bin=0' -F 'type=u-file' -F 'filename=_.json' -F 'name=apiTestFile' -F 'ext=json' 'https://hive3.biochemistry.gwu.edu/dna.cgi';
done
# curl -v -b ~/hive3.cookie -X POST -F 'content=@/home/vboxuser/scripts/test.json' -F 'cmd=objSetFile' -F 'raw=1' -F 'bin=0' -F 'type=u-file' -F 'filename=_.json' -F 'name=apiTestFile' -F 'ext=json' 'https://hive3.biochemistry.gwu.edu/dna.cgi';

# The @content tag is where you specify the file.