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

Places where consent date is parsed #131

Open
tashrifbillah opened this issue Sep 24, 2024 · 1 comment
Open

Places where consent date is parsed #131

tashrifbillah opened this issue Sep 24, 2024 · 1 comment

Comments

@tashrifbillah
Copy link
Contributor

tashrifbillah commented Sep 24, 2024

yp= group1[group1['version']=='YP']
yp_sorted= yp.sort_values('interview_date',
key=lambda dates: [datetime.strptime(x,'%m/%d/%Y') for x in dates])
chr_hc= yp_sorted.iloc[-1]['group']

(The focus of this partition, PSYCHS FU forms, won't reach until after two months of screening. If a subject does not provide chrcrit_part in two months, there is no need to consider that subject!)


utility/rpms_to_redcap.py

Lines 175 to 183 in e9ebd8c

def sort_consent_dates(df):
# extract Young Patient's rows only, we do not need Guardian's rows
# to account for re-consent scenario, consider only the latest row
yp= df[df['version']=='YP']
yp_sorted= yp.sort_values('interview_date',
key=lambda dates: [datetime.strptime(x,'%m/%d/%Y') for x in dates])
return yp_sorted

utility/rpms_to_redcap.py

Lines 221 to 223 in e9ebd8c

# skip Parent/Guardian consent if YP consent is present
if 'version' in visit and visit['version']=='Parent/Guardian' and 'YP' in data['version'].unique():
continue

utility/rpms_to_redcap.py

Lines 325 to 329 in e9ebd8c

if form=='informed_consent_run_sheet':
if data['interview_date'].unique().shape[0]>1:
yp_sorted=sort_consent_dates(data)
orig_consent=yp_sorted.iloc[0]['interview_date']
data_form['chric_consent_date']= _date(orig_consent).strftime('%Y-%m-%d')

utility/clean_old_arm.py

Lines 50 to 61 in 683fb3b

yp= pd.read_csv(inform_consent)
# yp can contain Young Patient's and/or Guardian's rows
# to account for re-consent scenario, consider only the latest row
yp_sorted= yp.sort_values('interview_date',
key=lambda dates: [datetime.strptime(x,'%m/%d/%Y') for x in dates])
chr_hc= yp_sorted.iloc[-1]['group']
if yp_sorted['group'].unique().shape[0]==1:
if (datetime.today()-datetime.strptime(yp_sorted.iloc[-1]['interview_date'],'%m/%d/%Y')).days>21:
# this subject cannot have duplicate arm
continue

@tashrifbillah
Copy link
Contributor Author

Fixed by 8c081af

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant