-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dc1d64
commit 9fa7cf6
Showing
3 changed files
with
67 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,22 @@ | |
|
||
# jap_5ThOJ14yf7z1EPEUpAoZYMWoETZcmJk305719 | ||
|
||
def get_met(): | ||
tease = os.getenv['TEASE'] | ||
def parse_cmd(): | ||
#parse command line for TEASE var | ||
import argparse | ||
parser = argparse.ArgumentParser(description='API File to Pull Subject Data from Jatos') | ||
parser.add_argument('-t', type=str, help='TEASE') | ||
parser.add_argument('-a', type=str, help="toke") | ||
return parser.parse_args() | ||
|
||
|
||
|
||
def get_met(tease): | ||
|
||
|
||
proxies = { | ||
'http': f'http:zjgilliam:{tease}//proxy.divms.uiowa.edu:8888', | ||
'https': f'https://zjgilliam:{tease}proxy.divms.uiowa.edu:8888', | ||
'http': f'http:zjgilliam:{tease}@proxy.divms.uiowa.edu:8888', | ||
'https': f'http://zjgilliam:{tease}@proxy.divms.uiowa.edu:8888', | ||
} | ||
|
||
|
||
|
@@ -62,13 +72,14 @@ def get_met(): | |
|
||
return study_result_ids | ||
|
||
def get_data(study_result_ids): | ||
def get_data(study_result_ids, tease): | ||
|
||
|
||
tease = os.getenv['TEASE'] | ||
|
||
|
||
proxies = { | ||
'http': f'http:zjgilliam:{tease}//proxy.divms.uiowa.edu:8888', | ||
'https': f'https://zjgilliam:{tease}proxy.divms.uiowa.edu:8888', | ||
'http': f'http:zjgilliam:{tease}@proxy.divms.uiowa.edu:8888', | ||
'https': f'http://zjgilliam:{tease}@proxy.divms.uiowa.edu:8888', | ||
} | ||
|
||
|
||
|
@@ -184,7 +195,6 @@ def convert_beh(): | |
|
||
return paths | ||
|
||
|
||
def move_txt(txt_files): | ||
dic = {} | ||
for file_path in txt_files: | ||
|
@@ -200,43 +210,50 @@ def move_txt(txt_files): | |
print(sub) | ||
target_dir = f'./data/{sub}/raw' | ||
os.makedirs(target_dir, exist_ok=True) | ||
# Save the DataFrame to a CSV file in the target directory | ||
# Save the DataFrame to a text file in the target directory | ||
output_file = os.path.join(target_dir, os.path.basename(file_path)) | ||
# save df as a txt file to target dir | ||
with open(output_file, 'w') as f: | ||
f.write(df.to_string(index=False)) | ||
print(f"Saved {output_file} to {target_dir}") | ||
os.remove(file_path) | ||
print(f"Removed {file_path}") | ||
# remove any dirs in data/raw | ||
for root, dirs, files in os.walk('./data/raw'): | ||
for d in dirs: | ||
shutil.rmtree(os.path.join(root, d)) | ||
|
||
return None | ||
# Move the directory removal outside the loop | ||
for root, dirs, files in os.walk('./data/raw'): | ||
for d in dirs: | ||
shutil.rmtree(os.path.join(root, d)) | ||
# Optionally, remove the raw directory itself | ||
os.rmdir('./data/raw') | ||
|
||
return None | ||
|
||
|
||
|
||
def push(): | ||
subprocess.run(["git","remote", "set-url", "https://github.com/HBClab/boost-beh-AF.git"]) | ||
subprocess.run(["git", "add", "-A"]) | ||
subprocess.run(["git", "commit", "-m", "auto commit -> added subject task data"]) | ||
subprocess.run(["git", "push"]) | ||
def push(toke): | ||
#use the folder name as task | ||
task = os.path.basename(os.getcwd()) | ||
|
||
subprocess.run(['git', 'config', 'user.email', '[email protected]']) | ||
subprocess.run(['git', 'remote', 'set-url', 'origin', f'https://miloswrath:{toke}@github.com/HBClab/{task}']) | ||
subprocess.run(['git', 'config', 'user.name', 'miloswrath']) | ||
subprocess.run(['git', 'add', '.']) | ||
subprocess.run(['git', 'commit', '-m', 'Automated Commit -> New Data']) | ||
subprocess.run(['git', 'push', 'origin', 'main']) | ||
|
||
def main(): | ||
study_result_ids = get_met() | ||
get_data(study_result_ids) | ||
args = parse_cmd() | ||
tease = args.t | ||
toke = args.a | ||
study_result_ids = get_met(tease) | ||
get_data(study_result_ids, tease) | ||
convert_beh() | ||
txt_files = [] | ||
for root, dirs, files in os.walk('./data/raw'): | ||
for file in files: | ||
if file.endswith(".txt"): | ||
txt_files.append(os.path.join(root, file)) | ||
move_txt(txt_files) | ||
push() | ||
|
||
push(toke) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
contourpy==1.2.1 | ||
cycler==0.12.1 | ||
fonttools==4.53.1 | ||
fuzzywuzzy==0.18.0 | ||
kiwisolver==1.4.5 | ||
matplotlib==3.9.2 | ||
numpy==2.0.1 | ||
packaging==24.1 | ||
pandas==2.2.2 | ||
pillow==10.4.0 | ||
pyparsing==3.1.2 | ||
python-dateutil==2.9.0.post0 | ||
pytz==2024.1 | ||
seaborn==0.13.2 | ||
six==1.16.0 | ||
tzdata==2024.1 |