Skip to content

Instantly share code, notes, and snippets.

@tashrifbillah
Created July 30, 2024 16:05
Show Gist options
  • Save tashrifbillah/a32d0776bc1cdfc71e5c3a1aa39aa402 to your computer and use it in GitHub Desktop.
Save tashrifbillah/a32d0776bc1cdfc71e5c3a1aa39aa402 to your computer and use it in GitHub Desktop.
Explore new Penn CNB data structure to identify problems
from glob import glob
import json
dict1={'1':'SPLLT-A','2':'SPLLT-B','3':'SPLLT-C','4':'SPLLT-D','5':'PLLT-A','6':'PLLT-B','':'_______'}
files=glob('Pr*/PHOENIX/PROTECTED/Pr*/raw/???????/surveys/*.UPENN_nda.json')
# odd number of sessions and not provided cnb_pllt_test
for file in files:
with open(file) as f:
data=json.load(f)
id=data[0]['src_subject_id']
# for even number of sessions, change this to len(data)%2==0
if len(data)%2:
print(len(data), id)
dict2=[]
for d in data:
dict2.append((d['interview_date'],dict1[d['cnb_pllt_test']]))
for d in sorted(dict2):
print('\t',d)
print('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment