Skip to content

Commit

Permalink
* remove default dates
Browse files Browse the repository at this point in the history
* use python engine
* render average table based on simpler logic
  • Loading branch information
tashrifbillah committed Jul 15, 2022
1 parent 44b1b65 commit b618b53
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ def set_dates(click):
end=datetime.now().strftime("%Y/%m/%d")

# qcimg dropdown menu
df= pd.read_csv(pjoin(ROOTDIR,'eeg_qc_images.csv'))
df= pd.read_csv(pjoin(ROOTDIR,'eeg_qc_images.csv'),on_bad_lines='skip',engine='python')
options=df['img'].values
value=df[df['default']==1]['img'].values

return start,end,options,value
# return start,end,options,value
return '','',options,value

raise PreventUpdate

Expand Down Expand Up @@ -296,7 +297,7 @@ def render_table(start, end, site, qcimg, score, tech, order, click):
eeg_tech=''
for r in sheets:
print('reading', basename(r))
run_sheet_df= pd.read_csv(r, on_bad_lines='skip')
run_sheet_df= pd.read_csv(r, on_bad_lines='skip', engine='python')

if run_sheet_df.shape[0]>1:
# ProNET
Expand Down Expand Up @@ -336,7 +337,7 @@ def render_table(start, end, site, qcimg, score, tech, order, click):
with open(props_file,'rb') as f:
props= pickle.load(f)


headers= ['Index','Subject','Session','QC Score']+ qcimg
head= [html.Tr([html.Th(h) for h in headers])]
body=[]
Expand Down Expand Up @@ -468,15 +469,16 @@ def save_data(click,scores,comments,ids,props):
Input('global-filter', 'n_clicks')])
def render_avg_table(site, qcimg, click):

changed = [p['prop_id'] for p in callback_context.triggered][0]
# trigger initial callback but condition future callbacks
if changed=='.':
pass
elif (site or qcimg) and ('global-filter' not in changed):
raise PreventUpdate
elif not qcimg:
# trigger initial callback but condition future callbacks on click
with open(click_record) as f:
old_click= int(f.read())

# print(f'click {click} , old_click {old_click}')

if click==old_click:
raise PreventUpdate


# if we do not glob, finding dirs would be difficult
# because of Pronet/Prescient ramification
dirs= glob(ROOTDIR+'/**/Figures', recursive=True)
Expand Down

0 comments on commit b618b53

Please sign in to comment.